Commit df6be5b9 authored by haiyoucuv's avatar haiyoucuv

GuideLayer

parent 4ff64cee
import { _decorator, Component, screen, ResolutionPolicy, Size, size, view, UITransform, Sprite, Canvas } from 'cc';
const { ccclass, property } = _decorator;
const CHECK_INTERVAL = 0.1;
@ccclass('FullScreenBgAutoFit')
export class FullScreenBgAutoFit extends Component {
@property(Canvas) canvasUITrans:UITransform;
private _oldSize:Size = size();
private _originalSize:Size;
private _uiTransform:UITransform;
private _sprite:Sprite;
start() {
this._uiTransform = this.getComponent(UITransform);
this._sprite = this.getComponent(Sprite);
if(!this._uiTransform || !this._sprite){
return;
}
this._originalSize = this._sprite.spriteFrame.originalSize;
this._sprite.sizeMode = Sprite.SizeMode.CUSTOM;
if(!this.canvasUITrans){
let parent = this.node.parent;
while(parent){
let canvas = parent.getComponent(Canvas);
if(canvas){
this.canvasUITrans = canvas.getComponent(UITransform);
break;
}
parent = parent.parent;
}
}
this.adjustResolutionPolicy();
}
private lastCheckTime = 0;
update(deltaTime: number) {
this.lastCheckTime+=deltaTime;
if(this.lastCheckTime < CHECK_INTERVAL){
return;
}
this.lastCheckTime = 0;
this.adjustResolutionPolicy();
}
adjustResolutionPolicy(){
let winSize = this.canvasUITrans.contentSize;
if(!this._oldSize.equals(winSize)){
let ratio = winSize.width / winSize.height;
let imgW2H = this._originalSize.width / this._originalSize.height;
if(ratio > imgW2H){
//wider than desgin.
this._uiTransform.width = winSize.width;
this._uiTransform.height = winSize.width / imgW2H;
}
else{
//higher than desgin.
this._uiTransform.width = winSize.height * imgW2H;
this._uiTransform.height = winSize.height;
}
this._oldSize.set(winSize);
}
}
}
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "31975f4f-3b2b-4d22-a2fb-8598998ce23c",
"files": [],
"subMetas": {},
"userData": {}
}
import Panel from "../../Module/Panel";
import {_decorator, Button, Node} from "cc";
import {changeScene} from "db://assets/Module/UIFast";
import {HomeScene} from "db://assets/Scripts/Scenes/HomeScene";
import { LOG_TYPE, sendLog } from "../Utils/WebNet/WebNet";
const {ccclass, property} = _decorator;
@ccclass('BackPanel')
export default class BackPanel extends Panel {
static skin = "BackPanel";
static group = "BackPanel";
@property(Node)
cancel: Node = null;
@property(Node)
ok: Node = null;
@property(Node)
close: Node = null;
async start() {
sendLog(LOG_TYPE.EXPOSURE, 6);
sendLog(LOG_TYPE.EXPOSURE, 7);
this.ok.on(Button.EventType.CLICK, this.clickOk, this);
this.cancel.on(Button.EventType.CLICK, this.clickCancel, this);
this.close.on(Button.EventType.CLICK, this.onClose, this);
}
clickOk() {
sendLog(LOG_TYPE.CLICK, 6);
this.hidePanel();
changeScene(HomeScene);
}
clickCancel() {
sendLog(LOG_TYPE.CLICK, 7);
this.hidePanel();
}
onClose() {
this.hidePanel();
}
}
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "ab79b766-839a-49fb-84b7-332a6266b2ee",
"files": [],
"subMetas": {},
"userData": {}
}
import Panel from "../../Module/Panel";
import { _decorator, Button, Label, Node, Sprite } from "cc";
import { changeScene } from "db://assets/Module/UIFast";
import { HomeScene } from "db://assets/Scripts/Scenes/HomeScene";
import { strFormat } from "../Utils/Utils";
import { PrizeScene } from "../Scenes/PrizeScene/PrizeScene";
import { LOG_TYPE, sendLog } from "../Utils/WebNet/WebNet";
const {ccclass, property} = _decorator;
@ccclass('FailPrizePanel')
export default class FailPrizePanel extends Panel {
static skin = "FailPrizePanel";
static group = "FailPrizePanel";
@property(Node)
close: Node = null!;
@property(Node)
get: Node = null!;
@property(Label)
prizeName: Label = null!;
@property(Sprite)
img: Sprite = null!;
async start() {
sendLog(LOG_TYPE.EXPOSURE, 4);
this.close.on(Button.EventType.CLICK, this.onClose, this);
this.get.on(Button.EventType.CLICK, this.clickGet, this);
const {optionName, optionImg} = this.data;
this.prizeName.string = strFormat(
optionName,
20
);
this.img.spriteFrame = optionImg;
}
clickGet = () => {
sendLog(LOG_TYPE.CLICK, 4);
this.hidePanel();
changeScene(PrizeScene);
}
/**
* 返回首页
*/
onClose = () => {
changeScene(HomeScene);
this.hidePanel();
}
}
{"ver":"4.0.24","importer":"typescript","imported":true,"uuid":"3678f62a-8704-4037-9796-ecde76bddfe4","files":[],"subMetas":{},"userData":{}}
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "c0928caf-d9af-4760-9077-3ec8a0ba7ec0",
"files": [],
"subMetas": {},
"userData": {}
}
import { _decorator, Component, Node } from 'cc';
const {ccclass, property} = _decorator;
@ccclass('PrizeItem')
export class PrizeItem extends Component {
data: any;
start() {
this.node.on(Node.EventType.TOUCH_END, this.onTouchEnd, this);
}
onTouchEnd() {
const {id, url} = this.data;
if (url) {
location.href = url
} else {
location.href = `/aaw/projectx/takePrize?projectOrderNo=${id}`
}
}
}
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "b496cad9-45c8-47d0-988d-bdb8907c1881",
"files": [],
"subMetas": {},
"userData": {}
}
import { _decorator, Button, Label, Node, randomRangeInt, Sprite, Color, Size } from 'cc';
import Scene from "db://assets/Module/Scene";
import { YXCollectionView, YXFlowLayout, YXIndexPath } from "db://assets/Component/YXList/lib";
import { sendWebNet, WebNetName } from "db://assets/Scripts/Utils/WebNet/WebNet";
import { changeScene } from "db://assets/Module/UIFast";
import { HomeScene } from "db://assets/Scripts/Scenes/HomeScene";
import { PrizeItem } from "./PrizeItem";
const {ccclass, property} = _decorator;
@ccclass('PrizeScene')
export class PrizeScene extends Scene {
static skin: string = "PrizeScene";
static group: string[] = ["PrizeScene"];
@property(Node)
backBtn: Node = null;
@property(YXCollectionView)
collectionView: YXCollectionView = null
prizeData: any[] = []
onLoad() {
this.backBtn.on(Button.EventType.CLICK, this.clickBtn, this);
}
async start() {
this.collectionView.numberOfItems = () => this.prizeData.length;
this.collectionView.onCellDisplay = this.onCellDisplay;
const layout = new YXFlowLayout();
layout.itemSize = new Size(676, 132);
layout.verticalSpacing = 16;
this.collectionView.layout = layout;
this.collectionView.reloadData();
this.updateRecords();
}
async updateRecords() {
const {success, data} = await sendWebNet(WebNetName.records);
if (!success) return;
this.prizeData = data;
this.collectionView.reloadData();
}
clickBtn() {
changeScene(HomeScene);
}
onCellDisplay = (cell: Node, indexPath: YXIndexPath, collectionView: YXCollectionView) => {
const ts = cell.getComponent(PrizeItem);
ts.data = this.prizeData[indexPath.item];
const {extra} = this.prizeData[indexPath.item];
const {name, icon} = extra;
cell.getChildByName(`img`).getComponent(Sprite).spriteFrame = icon;
cell.getChildByName(`name`).getComponent(Label).string = name;
}
}
{"ver":"4.0.24","importer":"typescript","imported":true,"uuid":"4e6ea92a-ee28-47fd-9566-e780867bd0e1","files":[],"subMetas":{},"userData":{}}
export enum HAND_TYPE {
CAT = "1",
DRAGON = "2",
HUMAN = "3",
}
export enum LOOP_TYPE {
CU = "1", // 铜
AG = "2", // 白银
AU = "3", // 黄金
JADEITE = "4", // 翡翠
GOD = "5", // 财神
}
export const LoopBuff = {
[LOOP_TYPE.CU]: 0,
[LOOP_TYPE.AG]: 0.1,
[LOOP_TYPE.AU]: 0.2,
[LOOP_TYPE.JADEITE]: 0.4,
[LOOP_TYPE.GOD]: 0.8,
}
/**
* 套中一个的基础分数
*/
export const BaseScore = 10;
/**
* 分享类型
*/
export enum SHARE_TYPE {
/** 邀请助力 */
INVITE = "1",
/** 送惊喜 */
SURPRISE = "2",
/** 炫耀 */
FLAUNT = "3",
}
\ No newline at end of file
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "0c75f4bb-25a6-493a-a2db-f93b8bd950ea",
"files": [],
"subMetas": {},
"userData": {}
}
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "6d648c1c-2698-475d-b3ab-7060187133e9",
"files": [],
"subMetas": {},
"userData": {}
}
This diff is collapsed.
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "7c6aed03-3df9-45df-a259-d0ead75958c3",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "BackPanel"
}
}
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "d0ef4e49-924f-4da8-b285-07ee1af57cb3",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "d0ef4e49-924f-4da8-b285-07ee1af57cb3@6c48a",
"displayName": "bg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "d0ef4e49-924f-4da8-b285-07ee1af57cb3",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "d0ef4e49-924f-4da8-b285-07ee1af57cb3@f9941",
"displayName": "bg",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 520,
"height": 400,
"rawWidth": 520,
"rawHeight": 400,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-260,
-200,
0,
260,
-200,
0,
-260,
200,
0,
260,
200,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
400,
520,
400,
0,
0,
520,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-260,
-200,
0
],
"maxPos": [
260,
200,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "d0ef4e49-924f-4da8-b285-07ee1af57cb3@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "d0ef4e49-924f-4da8-b285-07ee1af57cb3@6c48a"
}
}
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "1c0f877a-4088-4fc6-9641-98d9edcb4a42",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "1c0f877a-4088-4fc6-9641-98d9edcb4a42@6c48a",
"displayName": "确认退出",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "1c0f877a-4088-4fc6-9641-98d9edcb4a42",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "1c0f877a-4088-4fc6-9641-98d9edcb4a42@f9941",
"displayName": "确认退出",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 210,
"height": 85,
"rawWidth": 210,
"rawHeight": 85,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-105,
-42.5,
0,
105,
-42.5,
0,
-105,
42.5,
0,
105,
42.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
85,
210,
85,
0,
0,
210,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-105,
-42.5,
0
],
"maxPos": [
105,
42.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "1c0f877a-4088-4fc6-9641-98d9edcb4a42@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "1c0f877a-4088-4fc6-9641-98d9edcb4a42@6c48a"
}
}
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "4dcb4eb2-9ac4-490f-8720-91ccbff7a1f5",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "4dcb4eb2-9ac4-490f-8720-91ccbff7a1f5@6c48a",
"displayName": "继续游戏",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "4dcb4eb2-9ac4-490f-8720-91ccbff7a1f5",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "4dcb4eb2-9ac4-490f-8720-91ccbff7a1f5@f9941",
"displayName": "继续游戏",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 210,
"height": 85,
"rawWidth": 210,
"rawHeight": 85,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-105,
-42.5,
0,
105,
-42.5,
0,
-105,
42.5,
0,
105,
42.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
85,
210,
85,
0,
0,
210,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-105,
-42.5,
0
],
"maxPos": [
105,
42.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "4dcb4eb2-9ac4-490f-8720-91ccbff7a1f5@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "4dcb4eb2-9ac4-490f-8720-91ccbff7a1f5@6c48a"
}
}
{"ver":"1.2.0","importer":"directory","imported":true,"uuid":"a56f7ff5-f16a-4c7a-b50c-1cf562212b96","files":[],"subMetas":{},"userData":{}}
This diff is collapsed.
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "a4dc5224-00cb-4cdb-a01b-13d5aedcf38d",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "FailPrizePanel"
}
}
{"ver":"1.2.0","importer":"directory","imported":true,"uuid":"804474c6-dc76-42c0-9c72-c3eec67b7765","files":[],"subMetas":{},"userData":{}}
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "a86cce40-c91e-4b80-9180-f41806332c33",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "a86cce40-c91e-4b80-9180-f41806332c33@6c48a",
"displayName": "bg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "a86cce40-c91e-4b80-9180-f41806332c33",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "a86cce40-c91e-4b80-9180-f41806332c33@f9941",
"displayName": "bg",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 800,
"height": 939,
"rawWidth": 800,
"rawHeight": 939,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-400,
-469.5,
0,
400,
-469.5,
0,
-400,
469.5,
0,
400,
469.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
939,
800,
939,
0,
0,
800,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-400,
-469.5,
0
],
"maxPos": [
400,
469.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "a86cce40-c91e-4b80-9180-f41806332c33@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "a86cce40-c91e-4b80-9180-f41806332c33@6c48a"
}
}
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "69cde1a0-678c-49b2-bc68-f93109ce03a1",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "69cde1a0-678c-49b2-bc68-f93109ce03a1@6c48a",
"displayName": "开心收下",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "69cde1a0-678c-49b2-bc68-f93109ce03a1",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "69cde1a0-678c-49b2-bc68-f93109ce03a1@f9941",
"displayName": "开心收下",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 386,
"height": 85,
"rawWidth": 386,
"rawHeight": 85,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-193,
-42.5,
0,
193,
-42.5,
0,
-193,
42.5,
0,
193,
42.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
85,
386,
85,
0,
0,
386,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-193,
-42.5,
0
],
"maxPos": [
193,
42.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "69cde1a0-678c-49b2-bc68-f93109ce03a1@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "69cde1a0-678c-49b2-bc68-f93109ce03a1@6c48a"
}
}
......@@ -199,7 +199,7 @@
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
......@@ -374,7 +374,7 @@
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
......@@ -1453,7 +1453,7 @@
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
......@@ -1921,7 +1921,7 @@
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment