Browse Source

小游戏

master
cristianoxin 4 weeks ago
parent
commit
25dc383184
  1. 2
      .creator/asset-template/typescript/Custom Script Template Help Documentation.url
  2. 25504
      assets/60005/prefab/SubGame.prefab
  3. 3
      assets/60005/src/core/roll/RollBox60005.ts
  4. 10
      assets/60005/src/core/roll/RollCol60005.ts
  5. 4
      assets/60005/src/core/roll/RollManager60005.ts
  6. 96
      assets/60005/src/game/ui/SubGamePanelUI.ts
  7. 9
      assets/60005/src/game/ui/SubGamePanelUI.ts.meta
  8. 41
      assets/60005/src/game/ui/item/SubGamePanelItem.ts
  9. 9
      assets/60005/src/game/ui/item/SubGamePanelItem.ts.meta
  10. 2
      assets/test/mian.scene
  11. 22
      settings/v2/packages/cocos-service.json
  12. 8
      settings/v2/packages/project.json

2
.creator/asset-template/typescript/Custom Script Template Help Documentation.url

@ -0,0 +1,2 @@
[InternetShortcut]
URL=https://docs.cocos.com/creator/manual/en/scripting/setup.html#custom-script-template

25504
assets/60005/prefab/SubGame.prefab

File diff suppressed because it is too large

3
assets/60005/src/core/roll/RollBox60005.ts

@ -116,6 +116,9 @@ export class RollBox60005 extends Component{
this.stopEfct()
this.showMask(false)
}
clear(){
this.icon_sprite.spriteFrame = null
}
setData(val:any){
this.data=val
}

10
assets/60005/src/core/roll/RollCol60005.ts

@ -155,6 +155,16 @@ export class RollCol60005 extends Component{
}
}
clear(){
for(let i=0;i<this.items.length;i++){
this.items[i].clear()
let t_node: Node=this.items[i].node
t_node.position=this.startPosY[i].clone()
Tween.stopAllByTarget(t_node)
}
}

4
assets/60005/src/core/roll/RollManager60005.ts

@ -8,6 +8,7 @@ import { MinGameSpin60005 } from "../mrg/MinGameSpin60005";
import { GameEvent60005 } from "../../game/GameEvent60005";
import { ResultBox60005 } from "./ResultBox60005";
import { Game60005Tools } from "../../game/utils/Game60005Tools";
import { SubGamePanelUI } from "../../game/ui/SubGamePanelUI";
const { ccclass, property } = _decorator;
@ccclass('RollManager60005')
@ -157,6 +158,9 @@ export class RollManager60005 extends Component{
})
})
}
if(val.result.resultType != 0){
SubGamePanelUI.getInstance().freeGameResultList(val.result.FreeGameResultList)
}
}
showTotalWin(status:boolean){
if(this.totalWinLabel && this.totalWinLabel.isValid){

96
assets/60005/src/game/ui/SubGamePanelUI.ts

@ -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()
}
}

9
assets/60005/src/game/ui/SubGamePanelUI.ts.meta

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "631c920e-5e83-4aab-b078-d16fba531b02",
"files": [],
"subMetas": {},
"userData": {}
}

41
assets/60005/src/game/ui/item/SubGamePanelItem.ts

@ -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))
}
}
}

9
assets/60005/src/game/ui/item/SubGamePanelItem.ts.meta

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "7e23437e-d9be-42e6-b6bf-377d6742db80",
"files": [],
"subMetas": {},
"userData": {}
}

2
assets/test/mian.scene

@ -244,7 +244,7 @@
"_enabled": true,
"__prefab": null,
"ipAddress": "192.168.0.65",
"account": "911111111113",
"account": "911111111111",
"pwd": "111111",
"agentID": "1",
"PKG": "Q637767348",

22
settings/v2/packages/cocos-service.json

@ -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": []
}
]
}

8
settings/v2/packages/project.json

@ -0,0 +1,8 @@
{
"general": {
"designResolution": {
"width": 750,
"height": 1334
}
}
}
Loading…
Cancel
Save