12 changed files with 19753 additions and 5957 deletions
@ -0,0 +1,2 @@ |
|||||
|
[InternetShortcut] |
||||
|
URL=https://docs.cocos.com/creator/manual/en/scripting/setup.html#custom-script-template |
File diff suppressed because it is too large
@ -0,0 +1,96 @@ |
|||||
|
import { _decorator, Component, Node, tween, Tween, UITransform, v3 } from 'cc'; |
||||
|
import { SubGamePanelItem } from './item/SubGamePanelItem'; |
||||
|
import { ObjectPool } from '../../../sdk/API'; |
||||
|
const { ccclass, property } = _decorator; |
||||
|
|
||||
|
@ccclass('SubGamePanelUI') |
||||
|
export class SubGamePanelUI extends Component { |
||||
|
private static _ins:SubGamePanelUI; |
||||
|
public static getInstance():SubGamePanelUI{return SubGamePanelUI._ins} |
||||
|
protected __preload(): void { |
||||
|
if(SubGamePanelUI._ins)return |
||||
|
SubGamePanelUI._ins=this |
||||
|
} |
||||
|
|
||||
|
@property([Node]) |
||||
|
itemNode:Node[] = [] |
||||
|
@property([SubGamePanelItem]) |
||||
|
item:SubGamePanelItem[] = [] |
||||
|
@property([Node]) |
||||
|
payout:Node[] = [] |
||||
|
|
||||
|
/**当前免费游戏类型 */ |
||||
|
private currFreeType:number = -1; |
||||
|
/**当前免费游戏列表 */ |
||||
|
private freeList:any[] = []; |
||||
|
/**当前执行免费滚动的列表 */ |
||||
|
private executeFreeList:Node[] = []; |
||||
|
|
||||
|
start() { |
||||
|
for(let i=0;i<this.item.length;i++){ |
||||
|
this.item[i].node.active = false; |
||||
|
ObjectPool.getInstance().setObj(`SubGamePanelUI${i}`,this.item[i].node) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
protected onDestroy(): void { |
||||
|
SubGamePanelUI._ins=null |
||||
|
} |
||||
|
|
||||
|
public clear(){ |
||||
|
for(let i=0;i<this.itemNode.length;i++){ |
||||
|
this.itemNode[i].removeAllChildren(); |
||||
|
while(this.itemNode[i].children.length > 0){ |
||||
|
ObjectPool.getInstance().pushObj(this.itemNode[i].children[0]) |
||||
|
} |
||||
|
} |
||||
|
for(let i=0;i<this.payout.length;i++){ |
||||
|
const uitr:UITransform = this.payout[i].getComponent(UITransform); |
||||
|
this.payout[i].position = v3(this.payout[i].position.x,uitr.height+10); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public freeGameResultList(list:any[]){ |
||||
|
this.currFreeType = 0; |
||||
|
list = list.sort((a:any,b:any)=>{ |
||||
|
if(a.freeType - b.freeType > 0) return 1 |
||||
|
if(a.freeType - b.freeType < 0) return -1 |
||||
|
else return 0 |
||||
|
}) |
||||
|
this.freeList = list; |
||||
|
this.repeatAction(); |
||||
|
} |
||||
|
/**执行下一个免费 */ |
||||
|
private repeatAction(){ |
||||
|
this.clear(); |
||||
|
this.executeFreeList = []; |
||||
|
if(this.currFreeType >= this.freeList.length) return; |
||||
|
if(this.currFreeType < this.freeList.length && this.freeList[this.currFreeType]){ |
||||
|
const item:Node = ObjectPool.getInstance().getObj(`SubGamePanelUI${this.freeList[this.currFreeType].freeType}`); |
||||
|
//等待设置位置
|
||||
|
// item.position =
|
||||
|
this.itemNode[this.freeList[this.currFreeType].freeType].addChild(item); |
||||
|
this.executeFreeList.push(item); |
||||
|
this.showIndex(this.freeList[this.currFreeType]); |
||||
|
} |
||||
|
this.currFreeType++; |
||||
|
} |
||||
|
|
||||
|
public showIndex(freeData:any){ |
||||
|
let index = this.currFreeType; |
||||
|
let tw:Tween<Node> = tween(this.payout[index]) |
||||
|
.to(0.5,{position:v3(this.payout[index].position.x,0)}) |
||||
|
.call(()=>{ |
||||
|
tw.stop() |
||||
|
tw = null |
||||
|
}) |
||||
|
.start() |
||||
|
} |
||||
|
|
||||
|
public rollBox(){ |
||||
|
// this.item[index].roll()
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
@ -0,0 +1,9 @@ |
|||||
|
{ |
||||
|
"ver": "4.0.23", |
||||
|
"importer": "typescript", |
||||
|
"imported": true, |
||||
|
"uuid": "631c920e-5e83-4aab-b078-d16fba531b02", |
||||
|
"files": [], |
||||
|
"subMetas": {}, |
||||
|
"userData": {} |
||||
|
} |
@ -0,0 +1,41 @@ |
|||||
|
import { _decorator, Component, Label, Node } from 'cc'; |
||||
|
import { RollCol60005 } from '../../../core/roll/RollCol60005'; |
||||
|
const { ccclass, property } = _decorator; |
||||
|
|
||||
|
@ccclass('SubGamePanelItem') |
||||
|
export class SubGamePanelItem extends Component { |
||||
|
|
||||
|
@property([RollCol60005]) |
||||
|
colList:RollCol60005[]=[] |
||||
|
@property([Node]) |
||||
|
line:Node[]=[] |
||||
|
@property(Node) |
||||
|
icon:Node = null |
||||
|
@property(Node) |
||||
|
win:Node = null |
||||
|
@property(Label) |
||||
|
winLabel:Label = null |
||||
|
|
||||
|
start() { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
protected onDestroy(): void { |
||||
|
this.clear() |
||||
|
} |
||||
|
|
||||
|
public clear(){ |
||||
|
for(let i=0;i<this.colList.length;i++){ |
||||
|
this.colList[i].clear() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public roll(callBack?:()=>void){ |
||||
|
for(let i=0;i<this.colList.length;i++){ |
||||
|
this.colList[i].startSpin(2,callBack.bind(this)) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
@ -0,0 +1,9 @@ |
|||||
|
{ |
||||
|
"ver": "4.0.23", |
||||
|
"importer": "typescript", |
||||
|
"imported": true, |
||||
|
"uuid": "7e23437e-d9be-42e6-b6bf-377d6742db80", |
||||
|
"files": [], |
||||
|
"subMetas": {}, |
||||
|
"userData": {} |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
{ |
||||
|
"game": { |
||||
|
"name": "未知游戏", |
||||
|
"app_id": "UNKNOW", |
||||
|
"c_id": "0" |
||||
|
}, |
||||
|
"appConfigMaps": [ |
||||
|
{ |
||||
|
"app_id": "UNKNOW", |
||||
|
"config_id": "6f98b4" |
||||
|
} |
||||
|
], |
||||
|
"configs": [ |
||||
|
{ |
||||
|
"app_id": "UNKNOW", |
||||
|
"config_id": "6f98b4", |
||||
|
"config_name": "Default", |
||||
|
"config_remarks": "", |
||||
|
"services": [] |
||||
|
} |
||||
|
] |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
{ |
||||
|
"general": { |
||||
|
"designResolution": { |
||||
|
"width": 750, |
||||
|
"height": 1334 |
||||
|
} |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue