FirstStep
第一步讓全部盤面都轉起來。
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "230357b5-bfd3-4964-92ad-7a5acc92fa8f",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,539 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Column",
|
||||
"_objFlags": 0,
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 2
|
||||
},
|
||||
{
|
||||
"__id__": 5
|
||||
},
|
||||
{
|
||||
"__id__": 8
|
||||
},
|
||||
{
|
||||
"__id__": 11
|
||||
}
|
||||
],
|
||||
"_active": false,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 14
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 15
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 240,
|
||||
"height": 720
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
-517,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "item0",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 3
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 4
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 240,
|
||||
"height": 240
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
240,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "71078e62-f553-4cbc-954b-81fbacb59fe8"
|
||||
},
|
||||
"_type": 0,
|
||||
"_sizeMode": 0,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "61pJ7Q9iBAmIti9YpTJfys",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "item1",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 6
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 7
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 240,
|
||||
"height": 240
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "8cdb44ac-a3f6-449f-b354-7cd48cf84061"
|
||||
},
|
||||
"_type": 0,
|
||||
"_sizeMode": 0,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "47+vqQwhFMl6cAqj7v771l",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "item2",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 9
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 10
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 240,
|
||||
"height": 240
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
-240,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 8
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "8cdb44ac-a3f6-449f-b354-7cd48cf84061"
|
||||
},
|
||||
"_type": 0,
|
||||
"_sizeMode": 0,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "be2oQk/6ZOzpzQQCe/+lzE",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "item3",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 12
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 13
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 240,
|
||||
"height": 240
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
-480,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 11
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "8cdb44ac-a3f6-449f-b354-7cd48cf84061"
|
||||
},
|
||||
"_type": 0,
|
||||
"_sizeMode": 0,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "96iKSlkqtH8Z7zc0sOicnA",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "2bf4aLOHTJACJwI+ivNm27j",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"gameModule": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "",
|
||||
"sync": false
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "6893d156-7164-405e-9d78-612b1b0f4b03",
|
||||
"importer": "prefab",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
|
||||
import {gameMY} from './gameModule';
|
||||
|
||||
|
||||
// const eventTarget = new cc.EventTarget();
|
||||
|
||||
enum columnState {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ccclass
|
||||
export class columnControl extends cc.Component {
|
||||
|
||||
// @property({type: gameMY}) 這句不行
|
||||
// public gameModule: gameMY | null = null;
|
||||
|
||||
@property((cc.Node))
|
||||
gameModule: cc.Node;
|
||||
|
||||
private nowAction = null;
|
||||
private columnItem: Array<number> = [];
|
||||
private itemList:Array<number>;
|
||||
private gameModuleScript;
|
||||
|
||||
actionSet = {
|
||||
"stayPosition": cc.moveTo(0, new cc.Vec2(0, 240)),
|
||||
"rollingUp2Button": cc.sequence(cc.moveTo(0, new cc.Vec2(0, 240)), cc.moveBy(1.5, new cc.Vec2(0, -240))),
|
||||
};
|
||||
|
||||
|
||||
protected onLoad () {
|
||||
this.gameModuleScript = this.gameModule.getComponent('gameMY');
|
||||
}
|
||||
|
||||
protected start () {
|
||||
cc.log("this columnControl start");
|
||||
|
||||
this.itemList = Object.values(this.gameModuleScript.itemNameMapping);
|
||||
|
||||
for(let i=0;i<this.node.childrenCount;i++){
|
||||
let a = this.itemList[Math.floor(Math.random() * 12)];
|
||||
this.columnItem.unshift( a );
|
||||
this.node.children[i].getComponent(cc.Sprite).spriteFrame = this.gameModuleScript.item_spriteFrame[a]
|
||||
}
|
||||
|
||||
this.nowAction = this.node.runAction(this.actionSet["stayPosition"]);
|
||||
|
||||
}
|
||||
|
||||
protected update (dt) {
|
||||
if(this.nowAction.isDone() == true) {
|
||||
let a = this.itemList[Math.floor(Math.random() * 12)];
|
||||
this.columnItem.unshift( a );
|
||||
this.columnItem.pop();
|
||||
|
||||
//換圖
|
||||
for(let i=0;i<this.columnItem.length;i++){
|
||||
this.node.children[i].getComponent(cc.Sprite).spriteFrame = this.gameModuleScript.item_spriteFrame[this.columnItem[i]]
|
||||
}
|
||||
|
||||
//移動位置
|
||||
this.nowAction = this.node.runAction(this.actionSet["rollingUp2Button"]);
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 用 tween 做動畫
|
||||
// cc.tween(b)
|
||||
// .to(1, { position: cc.v2(100, 0), rotation: 360 })
|
||||
// .to(1, { position: cc.v2(0, 0), rotation: 0 })
|
||||
// // .to(1, { scale: 2 })
|
||||
// .start()
|
||||
|
||||
// 用 Action 做動畫
|
||||
// var seq = cc.sequence(cc.moveBy(1.5, cc.Vec2(100, 50)), cc.moveBy(1.5, cc.Vec2(-100, -50)));
|
||||
// b.runAction(this.seq)
|
||||
// c.runAction(this.seq) // 失敗 seq 不能一次賦予兩個物件一樣動作
|
||||
// this.bigFrameString.node.runAction(seq)
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "2bf4a2ce-1d32-4008-9c08-fa2bcd9b6ee3",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
|
||||
import {gameMY} from './gameModule';
|
||||
import {columnControl} from './columnControl';
|
||||
|
||||
|
||||
|
||||
|
||||
@ccclass
|
||||
export default class NewClass extends cc.Component {
|
||||
|
||||
|
||||
@property((cc.Node))
|
||||
gameModule: cc.Node = null;
|
||||
|
||||
@property((cc.Node))
|
||||
columnControl: cc.Node = null;
|
||||
|
||||
private secCounter: number;
|
||||
|
||||
private gameModuleScript;
|
||||
private columnControlScript;
|
||||
|
||||
protected onLoad () {
|
||||
cc.log("this is ee onLoad");
|
||||
// 呼叫其他 script 的方法或資源
|
||||
this.gameModuleScript = this.gameModule.getComponent('gameMY')
|
||||
this.columnControlScript = this.columnControl.getComponent('columnControl')
|
||||
}
|
||||
|
||||
protected onEnable(){
|
||||
cc.log("this is ee onEnable");
|
||||
}
|
||||
|
||||
protected start () {
|
||||
cc.log("this is ee start");
|
||||
this.secCounter = 0;
|
||||
}
|
||||
|
||||
tempValue = true
|
||||
|
||||
protected update (dt) {
|
||||
this.secCounter += dt;
|
||||
|
||||
// 測試 cc.resources.loadDir 載入時間 ==> 結論: 約需要 0.2~0.5秒
|
||||
if(this.tempValue){
|
||||
if(!(Object.keys(this.gameModuleScript.item_spriteFrame).length === 0)){
|
||||
cc.log(" empty to full : " + this.secCounter)
|
||||
this.tempValue = false
|
||||
}
|
||||
}
|
||||
|
||||
if(this.secCounter >= 5) {
|
||||
cc.log("engineer Function Update : " + this.secCounter)
|
||||
this.secCounter = 0
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected onDisable(): void {
|
||||
cc.log("this is ee onDisable")
|
||||
}
|
||||
|
||||
unitTest1():void {
|
||||
this.gameModule.emit('Bob', 'unitTest1 Success')
|
||||
}
|
||||
|
||||
disableColumn():void {
|
||||
// this.node.active = !this.node.active;
|
||||
this.columnControl.active = !this.columnControl.active;
|
||||
}
|
||||
|
||||
unitTest3():void {
|
||||
|
||||
// @ts-ignore
|
||||
this.itemList = Object.values(this.gameModuleScript.itemNameMapping)
|
||||
|
||||
for(let i=0;i<this.columnControl.childrenCount;i++){
|
||||
let a = this.itemList[Math.floor(Math.random() * 12)];
|
||||
this.columnControlScript.columnItem.push( a );
|
||||
let c = this.gameModuleScript.item_spriteFrame[a]
|
||||
this.columnControl.children[i].getComponent(cc.Sprite).spriteFrame = c
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "1edd79f4-2d40-469c-b8ed-d1112d2d4159",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -5,24 +5,136 @@
|
||||
// Learn life-cycle callbacks:
|
||||
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
|
||||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
const {ccclass, property, } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class NewClass extends cc.Component {
|
||||
|
||||
@property(cc.Label)
|
||||
label: cc.Label = null;
|
||||
|
||||
enum moduleState {
|
||||
"INIT",
|
||||
|
||||
};
|
||||
|
||||
@ccclass("gameMY")
|
||||
export class gameMY extends cc.Component {
|
||||
|
||||
@property
|
||||
text: string = 'hello';
|
||||
columnCount = 5;
|
||||
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
@property
|
||||
itemSize = 240;
|
||||
|
||||
// onLoad () {}
|
||||
@property(cc.Label)
|
||||
betString: cc.Label = null;
|
||||
|
||||
start () {
|
||||
@property(cc.Label)
|
||||
bigFrameString: cc.Label = null;
|
||||
|
||||
@property(cc.Label)
|
||||
balanceString: cc.Label = null;
|
||||
|
||||
|
||||
@property({type: cc.Prefab})
|
||||
columnPrefab: cc.Prefab | null = null;
|
||||
|
||||
@property(cc.Node)
|
||||
slotBoard: cc.Node = null;
|
||||
|
||||
|
||||
|
||||
|
||||
private betNumber: number;
|
||||
private balanceNumber: number;
|
||||
private bigFrameNumber: number;
|
||||
|
||||
// item 圖片資源存放區
|
||||
itemNameMapping = {
|
||||
'item_01':1, 'item_02':2, 'item_03':3, 'item_04':4, 'item_9':5,
|
||||
'item_10':6, 'item_j':7, 'item_k':8, 'item_q':9, 'item_a':10,
|
||||
'item_scatter':51, 'item_wild':52
|
||||
} as const;
|
||||
|
||||
item_spriteFrame = {};
|
||||
itemBlur_spriteFrame = {};
|
||||
|
||||
init_Complete:boolean = false
|
||||
|
||||
protected onLoad () {
|
||||
|
||||
|
||||
this.unitTestInit(); // for engineer use
|
||||
|
||||
// 讀取 item 圖片資源
|
||||
cc.resources.loadDir('item',cc.SpriteFrame, (err: any, sF) => {
|
||||
sF.forEach( (eachSpriteFrame)=>{
|
||||
this.item_spriteFrame[ this.itemNameMapping[eachSpriteFrame.name] ] = eachSpriteFrame
|
||||
})
|
||||
} );
|
||||
cc.resources.loadDir('item_blur',cc.SpriteFrame, (err: any, sF) => {
|
||||
sF.forEach( (eachSpriteFrame)=>{
|
||||
this.itemBlur_spriteFrame[ this.itemNameMapping[eachSpriteFrame.name] ] = eachSpriteFrame
|
||||
})
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
// update (dt) {}
|
||||
|
||||
|
||||
protected start () {
|
||||
this.betNumber = 50;
|
||||
|
||||
this.slotBoard.addChild( cc.instantiate(this.columnPrefab) )
|
||||
this.slotBoard.addChild( cc.instantiate(this.columnPrefab) )
|
||||
this.slotBoard.addChild( cc.instantiate(this.columnPrefab) )
|
||||
this.slotBoard.addChild( cc.instantiate(this.columnPrefab) )
|
||||
|
||||
}
|
||||
|
||||
protected update (dt) {
|
||||
|
||||
if(!this.init_Complete){
|
||||
// 完成圖片載入再啟動 column
|
||||
if((Object.keys(this.item_spriteFrame).length === 12)){
|
||||
for(let i=0;i<=5;i++){
|
||||
this.slotBoard.children[i].getComponent('columnControl').gameModule = this.node;
|
||||
this.slotBoard.children[i].active = true;
|
||||
this.init_Complete=true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onBetBtnClick(e: cc.Event.EventTouch): void {
|
||||
// let a = e.getCurrentTarget().name
|
||||
// cc.log(a)
|
||||
if(e.getCurrentTarget().name == 'btn_plus'){
|
||||
this.betNumber += 50;
|
||||
}
|
||||
else{
|
||||
this.betNumber -= 50;
|
||||
}
|
||||
this.betString.string = "" + this.betNumber
|
||||
}
|
||||
|
||||
|
||||
onSpinBtnClick():void {
|
||||
|
||||
|
||||
|
||||
|
||||
cc.log("nothing");
|
||||
|
||||
}
|
||||
|
||||
unitTestInit():void {
|
||||
// for unitTest 1
|
||||
this.node.on('Bob', (arg1)=>{
|
||||
cc.log("columnControl Recieve Bob say " + arg1)
|
||||
}, this)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "a2833e54-8f8c-4ff2-bf3d-79b159659738",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "b0b77d84-4360-4d7f-825f-47f491523771",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "1f49c310-e8ba-4faa-a998-1af948bb5b72",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
@@ -12,7 +12,7 @@
|
||||
"height": 240,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"item_01_blur": {
|
||||
"item_01": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "288cf246-a337-4e8f-9559-15ae9edc46be",
|
||||
"importer": "sprite-frame",
|
||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@@ -12,7 +12,7 @@
|
||||
"height": 240,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"item_02_blur": {
|
||||
"item_02": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "fa61f1cb-47e6-4adb-8630-bf2d87662adc",
|
||||
"importer": "sprite-frame",
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@@ -12,7 +12,7 @@
|
||||
"height": 240,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"item_03_blur": {
|
||||
"item_03": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "a9a3cbcd-cd68-4565-8616-eae5d8488e5d",
|
||||
"importer": "sprite-frame",
|
||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@@ -12,7 +12,7 @@
|
||||
"height": 240,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"item_04_blur": {
|
||||
"item_04": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "78729e82-3c30-4525-9376-40824dd55772",
|
||||
"importer": "sprite-frame",
|
||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
@@ -12,7 +12,7 @@
|
||||
"height": 240,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"item_10_blur": {
|
||||
"item_10": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "816aa32e-0046-4577-a000-15228576cdf5",
|
||||
"importer": "sprite-frame",
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@@ -12,7 +12,7 @@
|
||||
"height": 240,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"item_9_blur": {
|
||||
"item_9": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "c9d4dc67-1450-448f-858a-938596b58dff",
|
||||
"importer": "sprite-frame",
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@@ -12,7 +12,7 @@
|
||||
"height": 240,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"item_a_blur": {
|
||||
"item_a": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "67218748-6d3d-4090-a915-aea32b21442f",
|
||||
"importer": "sprite-frame",
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@@ -12,7 +12,7 @@
|
||||
"height": 240,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"item_j_blur": {
|
||||
"item_j": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "e01d2899-8497-489b-a896-ea04f558e0c7",
|
||||
"importer": "sprite-frame",
|
||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@@ -12,7 +12,7 @@
|
||||
"height": 240,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"item_k_blur": {
|
||||
"item_k": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "7713e6a6-19b6-4f9f-8878-5797856a476e",
|
||||
"importer": "sprite-frame",
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@@ -12,7 +12,7 @@
|
||||
"height": 240,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"item_q_blur": {
|
||||
"item_q": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "28e2997e-40d3-4e01-a212-699b1e06536b",
|
||||
"importer": "sprite-frame",
|
||||
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
@@ -12,7 +12,7 @@
|
||||
"height": 240,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"item_scatter_blur": {
|
||||
"item_scatter": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "96454c36-10c6-4c57-b856-c58eaebc73ab",
|
||||
"importer": "sprite-frame",
|
||||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
@@ -12,7 +12,7 @@
|
||||
"height": 240,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"item_wild_blur": {
|
||||
"item_wild": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "ac1e47f5-292c-43fa-b91a-ddda1b232dee",
|
||||
"importer": "sprite-frame",
|
||||