Commit 1c657840 authored by Tt's avatar Tt

基础效果完成

parent 3ed07c24
This source diff could not be displayed because it is too large. You can view the blob instead.
import { asyncDelay, onHomeworkFinish } from "../script/util"; import { asyncDelay, onHomeworkFinish } from "../script/util";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent"; import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
import pg from "./pg";
import map from "./map";
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
enum CELLTYPE {
SPEAK = 1,
MOVE_ADD = 2,
ROLL_AGAIN = 3,
DELAY_TIME = 4,
JUMP_ROLL = 5,
}
@ccclass @ccclass
export default class SceneComponent extends MyCocosSceneComponent { export default class SceneComponent extends MyCocosSceneComponent {
...@@ -25,7 +33,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -25,7 +33,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考 // TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData(); this.initData();
this.initView(); this.initView();
this.initListener(); this.initEvent();
} }
_cantouch = null; _cantouch = null;
...@@ -33,18 +41,14 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -33,18 +41,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 所有全局变量 默认都是null // 所有全局变量 默认都是null
this._cantouch = true; this._cantouch = true;
} }
//开发流程 //开发流程
//1.start状态 //1.start状态
//2.开局效果 //2.开局效果
//3.骰子动效,stop效果。 //3.骰子动效,stop效果。
//--骰子组件,输入点数,输出动画-最终结果。
//--
//4.星星位移。 //4.星星位移。
//--游戏开始就计算好后续的所有点数数组。 //--游戏开始就计算好后续的所有点数数组。
//--骰子及位移点数等添加到一个数组中,每次需要获取当前点和目标点时进行实时获取。 //--骰子及位移点数等添加到一个数组中,每次需要获取当前点和目标点时进行实时获取。
//--使用moveTo进行,for循环中间的节点来添加动画内容。【相机动画中有相关配置式代码】 //--出现错误反向退回。
//--最后一步走的所有的坐标记录下来。出现错误反向退回。
//--位移停止后触发目的地内容。 //--位移停止后触发目的地内容。
//5.触发目的地道具效果。 //5.触发目的地道具效果。
//--如各类道具,进行分类。统一调用一个方法输入,给予id //--如各类道具,进行分类。统一调用一个方法输入,给予id
...@@ -59,154 +63,200 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -59,154 +63,200 @@ export default class SceneComponent extends MyCocosSceneComponent {
//8.结算胜负 //8.结算胜负
//9.重新开始 //9.重新开始
initView() { initView() {
this.initBg(); this.initTouzi();
this.initPic(); this.initChess();
this.initBtn();
this.initIcon();
} }
initEvent() {
pg.event.on("game_start", () => { this.onGameStart() })
initBg() { pg.event.on("speak_success", () => { this.onSpeakScueess() });
const bgNode = cc.find('Canvas/bg'); pg.event.on("speak_fail", () => { this.onSpeakFail() });
bgNode.scale = this._mapScaleMax;
} }
//-----------------------------流程------------------------------
pic1 = null; private playerPoint: number;//
pic2 = null; private robotPoint: number;//
initPic() { private turnRobot: boolean;//当前是谁操作
const canvas = cc.find('Canvas'); onGameStart() {
const maxW = canvas.width * 0.7; this.playerPoint = 0;
this.robotPoint = 0;
this.getSprNodeByUrl(this.data.pic_url, (sprNode) => { this.turnRobot = false;
const picNode1 = sprNode; this.startTouzi();
picNode1.scale = maxW / picNode1.width;
picNode1.baseX = picNode1.x;
canvas.addChild(picNode1);
this.pic1 = picNode1;
const labelNode = new cc.Node();
labelNode.color = cc.Color.YELLOW;
const label = labelNode.addComponent(cc.Label);
label.string = this.data.text;
label.fontSize = 60;
label.lineHeight = 60;
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent('cc.Label').font;
picNode1.addChild(labelNode);
});
this.getSprNodeByUrl(this.data.pic_url_2, (sprNode) => {
const picNode2 = sprNode;
picNode2.scale = maxW / picNode2.width;
canvas.addChild(picNode2);
picNode2.x = canvas.width;
picNode2.baseX = picNode2.x;
this.pic2 = picNode2;
const labelNode = new cc.Node();
const label = labelNode.addComponent(cc.RichText);
const size = 60
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent(cc.Label).font;
label.string = `<outline color=#751e00 width=4><size=${size}><color=#ffffff>${this.data.text}</color></size></outline>`
label.lineHeight = size;
picNode2.addChild(labelNode);
});
} }
onSpeakScueess() {
initIcon() { //执行后续的动作。
const iconNode = this.getSprNode('icon'); this.turnNext();
iconNode.zIndex = 5;
iconNode.anchorX = 1;
iconNode.anchorY = 1;
iconNode.parent = cc.find('Canvas');
iconNode.x = iconNode.parent.width / 2 - 10;
iconNode.y = iconNode.parent.height / 2 - 10;
iconNode.on(cc.Node.EventType.TOUCH_START, () => {
this.playAudioByUrl(this.data.audio_url);
})
} }
onSpeakFail() {
curPage = null; //回退到最后一个位置
initBtn() { this.turnNext();
}
this.curPage = 0; turnNext() {
const bottomPart = cc.find('Canvas/bottomPart'); this.turnRobot = !this.turnRobot;
bottomPart.zIndex = 5; // 提高层级 this.startTouzi();
}
bottomPart.x = bottomPart.parent.width / 2; //-----------------------------CHESS-------------------------------
bottomPart.y = -bottomPart.parent.height / 2; private chessPlayer: cc.Node;
private chessRobot: cc.Node;
const leftBtnNode = bottomPart.getChildByName('btn_left'); initChess() {
//节点中添加了button组件 则可以添加click事件监听 //初始化棋子
leftBtnNode.on('click', () => { this.chessPlayer = pg.view.find(this, "chess/chess_player");
if (!this._cantouch) { this.chessRobot = pg.view.find(this, "chess/chess_robot");
return; }
getMovePoints(now, runNum) {
let points = [];
for (let i = now; i <= now + runNum; i++) {
let point = map[i];
if (!point) break;
points.push(point);
}
return points;
}
moveChess(runNum) {
return new Promise((resolve, reject) => {
this.runNum = runNum;
if (this.turnRobot) {
let points = this.getMovePoints(this.robotPoint, runNum);
console.log(points);
this.chessRobot.getComponent("chess").run(points).then(() => {
this.robotPoint += runNum;
resolve('');
})
} else {
let points = this.getMovePoints(this.playerPoint, runNum);
console.log(points);
this.chessPlayer.getComponent("chess").run(points).then(() => {
this.playerPoint += runNum;
resolve('');
})
} }
if (this.curPage == 0) { });
return; }
jumpChess(cell, jumpId) {
return new Promise((resolve, reject) => {
let jumpCell = map[jumpId - 1];
let points = [cell, jumpCell];
if (this.turnRobot) {
this.chessRobot.getComponent("chess").run(points).then(() => {
this.robotPoint = Number(jumpCell.id) - 1;
resolve('');
})
} else {
this.chessPlayer.getComponent("chess").run(points).then(() => {
this.playerPoint = Number(jumpCell.id) - 1;
resolve('');
})
} }
this.curPage = 0 });
this.leftMove(); }
private runNum: number;
this.playLocalAudio('btn'); checkCell() {
}) if (this.turnRobot) {
let cell = map[this.robotPoint];
const rightBtnNode = bottomPart.getChildByName('btn_right'); let val = cell.value;
//节点中添加了button组件 则可以添加click事件监听 let type = Number(cell.type);
rightBtnNode.on('click', () => { switch (type) {
if (!this._cantouch) { case CELLTYPE.MOVE_ADD:
return; this.moveChess(Number(val)).then(() => {
this.checkCell();
})
break;
case CELLTYPE.ROLL_AGAIN:
this.turnRobot = !this.turnRobot;
this.turnNext();
break;
case CELLTYPE.JUMP_ROLL:
this.jumpChess(cell, Number(val)).then(() => {
this.checkCell();
})
break;
default:
this.turnNext();
break;
} }
if (this.curPage == 1) { return
return; }
setTimeout(() => {
let cell = map[this.playerPoint];
let val = cell.value;
let type = Number(cell.type);
switch (type) {
case CELLTYPE.SPEAK:
pg.event.emit("speak_open")
break;
case CELLTYPE.DELAY_TIME:
setTimeout(() => {
this.turnNext();
}, 5000);
break;
case CELLTYPE.MOVE_ADD:
this.moveChess(Number(val)).then(() => {
this.checkCell();
})
break;
case CELLTYPE.ROLL_AGAIN:
this.turnRobot = !this.turnRobot;
this.turnNext();
break;
case CELLTYPE.JUMP_ROLL:
this.jumpChess(cell, Number(val)).then(() => {
this.checkCell();
})
break;
default:
this.turnNext();
break;
} }
}, 100);
this.curPage = 1
this.rightMove();
// 游戏结束时需要调用这个方法通知系统作业完成
onHomeworkFinish();
this.playLocalAudio('btn');
})
} }
//-----------------------------TOUZI-------------------------------
leftMove() { initTouzi() {
this._cantouch = false; let touzi_ani = pg.view.find(this, "touzi_ani");
const len = this.pic1.parent.width; let btn_stop = pg.view.find(touzi_ani, "btn_stop");
cc.tween(this.pic1) pg.view.touchOn(btn_stop, this.onTouchStop, this);
.to(1, { x: this.pic1.baseX }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
} }
onTouchStop() {
rightMove() { if (this.turnRobot) return;
this._cantouch = false; this.stopTouzi();
const len = this.pic1.parent.width; }
cc.tween(this.pic1) stopTouzi(runNum = 0) {
.to(1, { x: this.pic1.baseX - len }, { easing: 'cubicInOut' }) let touzi_ani = pg.view.find(this, "touzi_ani");
.start(); let icon = pg.view.find(touzi_ani, "icon");
let touzi = icon.getComponent("touzi");
cc.tween(this.pic2) let hand = pg.view.find(touzi_ani, "hand");
.to(1, { x: this.pic2.baseX - len }, { easing: 'cubicInOut' }) if (!runNum) {
.call(() => { runNum = 1 + Math.floor(Math.random() * 6);
this._cantouch = true; if (this.turnRobot) runNum = 1 + Math.floor(Math.random() * 5);
}
hand.active = false;
clearTimeout(this.stopHandTimer);
touzi.stopAni(runNum).then(() => {
touzi_ani.active = false;
pg.event.emit("player_point_update", { isRobot: this.turnRobot, num: runNum });
this.moveChess(runNum).then(() => {
this.checkCell();
}) })
.start(); })
} }
// update (dt) {}, private stopHandTimer: number;
startTouzi() {
let touzi_ani = pg.view.find(this, "touzi_ani");
initListener() { let icon = pg.view.find(touzi_ani, "icon");
let touzi = icon.getComponent("touzi");
let hand = pg.view.find(touzi_ani, "hand");
touzi_ani.active = true;
touzi.startAni();
if (this.turnRobot) {
setTimeout(() => {
this.stopTouzi();
}, 100);
} else {
this.stopHandTimer = setTimeout(() => {
hand.active = true;
}, 5000);
}
} }
//-----------------------------TOOL-------------------------------
// onHomeworkFinish最后需要添加作业完成
playLocalAudio(audioName) { playLocalAudio(audioName) {
const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource); const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
......
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const { ccclass, property } = cc._decorator;
import pg from "./pg";
@ccclass
export default class NewClass extends cc.Component {
@property(cc.Label)
label: cc.Label = null;
@property
text: string = 'hello';
// LIFE-CYCLE CALLBACKS:
private count = 0;
onLoad() {
this.count = 0;
}
start() {
}
update(dt) {
this.count++;
// if (this.count >= 30) this.count = 0;
this.updateItems();
}
updateItems() {
let cur = Math.floor(this.count / 30) % 4
for (let i = 0; i < 4; i++) {
let item = pg.view.find(this, "btn_audio" + i);
item.active = cur == i;
}
}
}
{
"ver": "1.0.8",
"uuid": "bed01784-8114-4d5e-bd26-36345307676c",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import movement from "./movements";
const { ccclass, property } = cc._decorator;
interface Point {
id: string;
blue_x: string;
blue_y: string;
yellow_x: string;
yellow_y: string;
}
@ccclass
export default class NewClass extends cc.Component {
@property
isRobot: boolean = false;
// LIFE-CYCLE CALLBACKS:
onLoad() {
}
private lastPoints: Array<Point>;
run(points: Array<Point>) {
return new Promise((resolve, reject) => {
this.lastPoints = points;
let posArray = this.getPos(points);
let point0 = posArray.shift();
this.node.x = point0.x;
this.node.y = point0.y;
let movementList = []
for (let i = 0; i < posArray.length; i++) {
let pos = posArray[i];
movementList.push({
id: i,
time: 0.2,
x: pos.x,
y: pos.y
})
}
movement.loadTween(this.node, movementList).then(() => {
resolve('');
})
});
}
getPos(points: Array<Point>) {
let posArray = points.map(li => {
let pos: any = {
x: this.isRobot ? li.blue_x : li.yellow_x,
y: this.isRobot ? li.blue_y : li.yellow_y
}
pos.x = Number(pos.x);
pos.y = Number(pos.y);
return pos;
});
return posArray;
}
start() {
}
// update (dt) {}
}
{
"ver": "1.0.8",
"uuid": "00040df5-e4c9-4c8d-9fea-65b709873399",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property(cc.Label)
label: cc.Label = null;
@property
text: string = 'hello';
// LIFE-CYCLE CALLBACKS:
onLoad() {
this.showAni();
}
showAni() {
this.node.x += 400;
this.node.y -= 200;
cc.tween(this.node).by(0.3, { x: -400, y: 200 }).start();
setTimeout(() => {
this.showAni();
}, 2000);
}
update(dt) {
}
}
{
"ver": "1.0.8",
"uuid": "df113ecd-ad74-4af4-8f8c-80c104abeefd",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
export default [{ "id": "1", "blue_x": "-360", "blue_y": "70", "yellow_x": "-455", "yellow_y": "70", "type": "0", "value": "0" }, { "id": "2", "blue_x": "-410", "blue_y": "163", "yellow_x": "-410", "yellow_y": "282", "type": "1", "value": "blackboard" }, { "id": "3", "blue_x": "-270", "blue_y": "147", "yellow_x": "-269", "yellow_y": "282", "type": "1", "value": "window" }, { "id": "4", "blue_x": "-129", "blue_y": "147", "yellow_x": "-130", "yellow_y": "282", "type": "1", "value": "door" }, { "id": "5", "blue_x": "7", "blue_y": "147", "yellow_x": "12", "yellow_y": "282", "type": "2", "value": "2" }, { "id": "6", "blue_x": "150", "blue_y": "147", "yellow_x": "150", "yellow_y": "282", "type": "1", "value": "window" }, { "id": "7", "blue_x": "293", "blue_y": "147", "yellow_x": "290", "yellow_y": "282", "type": "5", "value": "14" }, { "id": "8", "blue_x": "500", "blue_y": "211", "yellow_x": "433", "yellow_y": "282", "type": "1", "value": "door" }, { "id": "9", "blue_x": "338", "blue_y": "71", "yellow_x": "512", "yellow_y": "100", "type": "3", "value": "1" }, { "id": "10", "blue_x": "354", "blue_y": "-64", "yellow_x": "503", "yellow_y": "-66", "type": "1", "value": "door" }, { "id": "11", "blue_x": "516", "blue_y": "-204", "yellow_x": "503", "yellow_y": "-210", "type": "1", "value": "blackboard" }, { "id": "12", "blue_x": "291", "blue_y": "-126", "yellow_x": "292", "yellow_y": "-283", "type": "1", "value": "window" }, { "id": "13", "blue_x": "148", "blue_y": "-126", "yellow_x": "154", "yellow_y": "-283", "type": "2", "value": "3" }, { "id": "14", "blue_x": "9", "blue_y": "-126", "yellow_x": "12", "yellow_y": "-283", "type": "1", "value": "blackboard" }, { "id": "15", "blue_x": "-129", "blue_y": "-126", "yellow_x": "-127", "yellow_y": "-283", "type": "2", "value": "1" }, { "id": "16", "blue_x": "-270", "blue_y": "-126", "yellow_x": "-270", "yellow_y": "-283", "type": "1", "value": "window" }, { "id": "17", "blue_x": "-410", "blue_y": "-126", "yellow_x": "-410", "yellow_y": "-309", "type": "4", "value": "5" }, { "id": "18", "blue_x": "-548", "blue_y": "-126", "yellow_x": "-548", "yellow_y": "-288", "type": "1", "value": "door" }, { "id": "19", "blue_x": "-773", "blue_y": "-216", "yellow_x": "-692", "yellow_y": "-294", "type": "1", "value": "blackboard" }, { "id": "20", "blue_x": "-607", "blue_y": "-64", "yellow_x": "-764", "yellow_y": "-71", "type": "1", "value": "window" }, { "id": "21", "blue_x": "-607", "blue_y": "84", "yellow_x": "-780", "yellow_y": "73", "type": "4", "value": "5" }, { "id": "22", "blue_x": "-607", "blue_y": "220", "yellow_x": "-773", "yellow_y": "213", "type": "2", "value": "3" }, { "id": "23", "blue_x": "-607", "blue_y": "353", "yellow_x": "-764", "yellow_y": "353", "type": "1", "value": "door" }, { "id": "24", "blue_x": "-775", "blue_y": "487", "yellow_x": "-771", "yellow_y": "500", "type": "2", "value": "5" }, { "id": "25", "blue_x": "-550", "blue_y": "420", "yellow_x": "-550", "yellow_y": "548", "type": "1", "value": "window" }, { "id": "26", "blue_x": "-408", "blue_y": "394", "yellow_x": "-410", "yellow_y": "548", "type": "4", "value": "5" }, { "id": "27", "blue_x": "-270", "blue_y": "419", "yellow_x": "-268", "yellow_y": "562", "type": "2", "value": "2" }, { "id": "28", "blue_x": "-121", "blue_y": "419", "yellow_x": "-125", "yellow_y": "562", "type": "1", "value": "door" }, { "id": "29", "blue_x": "14", "blue_y": "419", "yellow_x": "15", "yellow_y": "562", "type": "1", "value": "blackboard" }, { "id": "30", "blue_x": "148", "blue_y": "388", "yellow_x": "152", "yellow_y": "562", "type": "3", "value": "1" }, { "id": "31", "blue_x": "286", "blue_y": "404", "yellow_x": "290", "yellow_y": "562", "type": "1", "value": "window" }, { "id": "32", "blue_x": "433", "blue_y": "404", "yellow_x": "431", "yellow_y": "562", "type": "2", "value": "1" }, { "id": "33", "blue_x": "574", "blue_y": "394", "yellow_x": "570", "yellow_y": "562", "type": "4", "value": "5" }, { "id": "34", "blue_x": "796", "blue_y": "490", "yellow_x": "714", "yellow_y": "562", "type": "1", "value": "blackboard" }, { "id": "35", "blue_x": "637", "blue_y": "354", "yellow_x": "784", "yellow_y": "351", "type": "1", "value": "door" }, { "id": "36", "blue_x": "624", "blue_y": "204", "yellow_x": "784", "yellow_y": "206", "type": "2", "value": "3" }, { "id": "37", "blue_x": "624", "blue_y": "66", "yellow_x": "784", "yellow_y": "68", "type": "5", "value": "43" }, { "id": "38", "blue_x": "624", "blue_y": "-60", "yellow_x": "798", "yellow_y": "-60", "type": "3", "value": "1" }, { "id": "39", "blue_x": "624", "blue_y": "-198", "yellow_x": "788", "yellow_y": "-207", "type": "1", "value": "window" }, { "id": "40", "blue_x": "624", "blue_y": "-343", "yellow_x": "788", "yellow_y": "-352", "type": "2", "value": "1" }, { "id": "41", "blue_x": "784", "blue_y": "-488", "yellow_x": "788", "yellow_y": "-484", "type": "1", "value": "blackboard" }, { "id": "42", "blue_x": "570", "blue_y": "-415", "yellow_x": "570", "yellow_y": "-551", "type": "1", "value": "window" }, { "id": "43", "blue_x": "429", "blue_y": "-415", "yellow_x": "424", "yellow_y": "-554", "type": "2", "value": "2" }, { "id": "44", "blue_x": "291", "blue_y": "-415", "yellow_x": "292", "yellow_y": "-554", "type": "1", "value": "door" }, { "id": "45", "blue_x": "146", "blue_y": "-415", "yellow_x": "148", "yellow_y": "-450", "type": "4", "value": "5" }, { "id": "46", "blue_x": "9", "blue_y": "-415", "yellow_x": "6", "yellow_y": "-554", "type": "1", "value": "blackboard" }, { "id": "47", "blue_x": "-132", "blue_y": "-415", "yellow_x": "-130", "yellow_y": "-554", "type": "1", "value": "window" }, { "id": "48", "blue_x": "-268", "blue_y": "-415", "yellow_x": "-268", "yellow_y": "-554", "type": "1", "value": "door" }, { "id": "49", "blue_x": "-410", "blue_y": "-415", "yellow_x": "-416", "yellow_y": "-554", "type": "2", "value": "2" }, { "id": "50", "blue_x": "-546", "blue_y": "-415", "yellow_x": "-550", "yellow_y": "-554", "type": "1", "value": "blackboard" }, { "id": "51", "blue_x": "-685", "blue_y": "-495", "yellow_x": "-685", "yellow_y": "-495", "type": "0", "value": "0" }]
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "7370c8bc-0e6d-4db0-84b1-3d09cb494848",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import pg from './pg'
// [
// {
// "id": 1,
// "time": 3,
// "delay": true
// },
// {
// "id": 2,
// "time": 3,
// "x": -445,
// "y": 193
// },
// {
// "id": 3,
// "time": 3,
// "delay": 0.2
// },
// {
// "id": 4,
// "time": 0,
// "aniname" : "normal"
// },
// {
// "id": 5,
// "time": 1,
// "delay": true
// },
// {
// "id": 6,
// "time": 0,
// "aniname" : "wrong"
// },
// {
// "id": 7,
// "time": 0,
// "audionode" : "sahua"
// }
// ]
class Movement {
loadTween(node, movementList) {
return new Promise((resolve, reject) => {
let tween = cc.tween(node);
movementList.forEach(moment => {
if (moment.delay) this.loadDelay(tween, moment.time);
// if (moment.aniname) this.loadDBArmature(tween, moment);
if (moment.audionode) this.loadAudio(node, tween, moment);
this.loadCCNode(tween, moment);
});
tween.call(() => {
setTimeout(() => {
resolve('');
}, 0);
})
tween.start();
});
}
//延迟处
private loadDelay(tween, time) {
tween.delay(time)
}
//拓展cc.node对应的属性处理
private loadCCNode(tween, moment) {
let obj: any = {};
if (moment.delay) return;//有等待不执行其他操作
if (moment.x && moment.x != "" && moment.y && moment.y != "") {
obj.position = cc.v2(moment.x, moment.y);
}
tween.to(moment.time, obj)
}
private loadDBArmature(tween, moment) {
// tween.delay(0)
// tween.call(() => {
// pg.animation.playDragonBone(this.node, moment.aniname);
// })
}
private loadAudio(node, tween, moment) {
tween.delay(0)
tween.call(() => {
let audioNode = node.getChildByName(moment.audionode);
let audioClip = audioNode.getComponent(cc.AudioSource).clip;
cc.audioEngine.play(audioClip, false, 1);
})
}
}
let movement = new Movement();
export default movement;
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "1bc25c74-7629-4b0d-86ce-d0dc86930dab",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
class Emitter {
static instance;
static getInstance() {
if (!Emitter.instance) {
Emitter.instance = new Emitter();
}
return Emitter.instance;
}
_name: any;
_callbacks: any;
constructor(name = "") {
this._name = name;
this._callbacks = {};
return this;
}
on(event, fn) {
(this._callbacks[event] = this._callbacks[event] || []).push(fn);
};
once(event, fn) {
function on() {
this.off(event, on);
fn.apply(this, arguments);
}
on.fn = fn;
this.on(event, on);
};
off(event, fn) {
// all
if (0 == arguments.length) {
this._callbacks = {};
return;
}
// specific event
let callbacks = this._callbacks[event];
if (!callbacks) return;
// remove all handlers
if (1 == arguments.length) {
delete this._callbacks[event];
return;
}
// remove specific handler
let cb;
for (let i = 0; i < callbacks.length; i++) {
cb = callbacks[i];
if (cb === fn || cb.fn === fn) {
callbacks.splice(i, 1);
break;
}
}
return;
}
emit(event, ...args) {
this._callbacks = this._callbacks || {};
// let args = [].slice.call(arguments, 1);
let callbacks = this._callbacks[event];
if (callbacks) {
callbacks = callbacks.slice(0);
for (let i = 0, len = callbacks.length; i < len; ++i) {
callbacks[i].apply(this, args);
}
}
}
listeners(event) {
this._callbacks = this._callbacks || {};
return this._callbacks[event] || [];
};
hasListeners(event) {
return !!this.listeners(event).length;
};
}
let pg = {
logger: {
d: function (str) {
cc.log(str);
return null;
},
i: function (str) {
cc.log(str);
return null;
},
w: function (str) {
cc.warn(str);
return null;
}
},
view: {
//---------------------节点管理------------------------------
//创建节点
createNode() {
let node = new cc.Node();
return node;
},
//添加节点
addChild(item, child, zIndex) {
if (!child) return console.log("addChild error ->请传入子节点");
if (!item) return console.log("addChild error ->请传入父节点");
let node = item.node ? item.node : item;
if (!node) return console.log("addChild error ->请传入父节点");
if (child.parent)
return pg.logger.w("此节点已经有父节点->" + child.name);
if (zIndex >= 0) {
node.addChild(child, zIndex)
} else {
node.addChild(child);
}
return true;
},
//删除子节点
removeChild(item, child) {
if (!item) return pg.logger.w("节点remove失败,传入了错误的item");
let node = item.node ? item.node : item;
if (child.parent && child.parent == node) {
node.removeChild(child);
child.destroy();
}
return true;
},
removeSelf(item) {
if (!item) return pg.logger.w("节点移除失败,传入了错误的item");
let node = item.node ? item.node : item;
node.removeFromParent();
node.destroy();
},
//删除所有子节点
removChildren(item) {
if (!item) return pg.logger.w("节点remove失败,传入了错误的item");
let node = item.node ? item.node : item;
if (!node.parent) return pg.logger.w("节点remove失败,传入了错误的item");
node.removeAllChildren();
return true;
},
//查找节点
find(item, childPath): cc.Node {
if (typeof item == "string") {
childPath = item;
item = null;
}
if (!childPath || childPath == '' || typeof childPath != 'string') return pg.logger.w("findChildByPath error->" + "请传入路径");
let child = null;
if (item) {
let node = item.node ? item.node : item;
if (!node.children || node.children.length == 0) return pg.logger.w("findChild error->" + "找不到此节点,请检查层级路径:" + childPath);
child = cc.find(childPath, node);
} else {
child = cc.find(childPath);
}
if (!child) return pg.logger.w("findChildByPath error->" + "找不到此节点,请检查层级路径:" + childPath);
return child;
},
//--------------------触控事件--------------------------------
//添加监听
touchOn(item, callback, target) {
if (!item) return pg.logger.w("添加按钮响应失败,传入了错误的item");
if (!callback || !target) return pg.logger.w("添加按钮响应失败,传入了空回调");
let node = item.node ? item.node : item;
node.on(cc.Node.EventType.TOUCH_END, callback, target);
return true;
},
//移除监听
touchOff(item, callback, target) {
if (!item) return pg.logger.w("移除按钮响应失败,传入了错误的item");
if (!callback || !target) return pg.logger.w("移除按钮响应失败,传入了空回调");
let node = item.node ? item.node : item;
if (!node || !node.parent) return pg.logger.w("节点已移除");
node.off(cc.Node.EventType.TOUCH_END, callback, target);
return true;
},
//是否允许点击
touchEnable(item, isEnable) {
if (!item) return pg.logger.w("设置按钮响应失败,传入了错误的item");
let node = item.node ? item.node : item;
if (!node) return pg.logger.w("设置按钮响应失败,传入了错误的item");
let btn = node.getComponent(cc.Button);
if (!btn) return pg.logger.w("当前节点没有添加button->" + node.name);
btn.interactable = isEnable;
return true;
},
//-------------------渲染相关---------------------------------
//显示隐藏
visible(item, isVisible) {
if (!item) return pg.logger.w("节点显示失败,传入了错误的item");
let node = item.node ? item.node : item;
if (!node || !node.parent) return pg.logger.w("节点已移除");
node.active = isVisible;
return true;
},
//更换图片
setImg(item, res) {
return new Promise((resolve, reject) => {
if (!item) return pg.logger.w("图片更换失败,传入了错误的item");
if (!res) return pg.logger.w("图片更换失败,传入了错误的res");
pg.load.loadImg(res).then((spriteFrame: cc.SpriteFrame) => {
if (!cc.isValid(item)) return pg.logger.i("节点已销毁");
let node = item.node ? item.node : item;
if (!cc.isValid(node)) return pg.logger.i("节点已销毁");
let component = node.getComponent(cc.Sprite);
let { width, height } = spriteFrame.getRect();
component.spriteFrame = spriteFrame;
resolve({ width, height });
})
})
},
setNetImg(item, res) {
return new Promise((resolve, reject) => {
if (!item) return pg.logger.w("图片更换失败,传入了错误的item");
let node = item.node ? item.node : item;
if (!res) {
node.active = false;
return pg.logger.w("图片更换失败,传入了错误的res");
}
if (!node) return pg.logger.w("图片更换失败,传入了错误的item");
if (node.net_url == res) return;
let w = node.width;
let h = node.height;
node.active = false;//
pg.load.loadNetImg(res).then((texture: cc.Texture2D) => {
if (!cc.isValid(node)) return pg.logger.i("节点已销毁");
let nw = node.width = texture.width;
let nh = node.height = texture.height;
let component = node.getComponent(cc.Sprite);
let spriteFrame = new cc.SpriteFrame(texture);
component.spriteFrame = spriteFrame;
node.net_url = res;
// setTimeout(() => {
if (!cc.isValid(node)) return pg.logger.i("节点已销毁");
if (!node) return pg.logger.w("节点已销毁");
node.width = w;
node.height = h;
node.active = true;
// }, 30);
resolve({ w: nw, h: nh });
})
})
},
switchMaterial(item, id0 = 0, id1 = 1) {
let material0 = item.getMaterial(id0);
let material1 = item.getMaterial(id1);
item.setMaterial(id0, material1);
item.setMaterial(id1, material0);
},
//更改文字
setString(item, text, count = 0) {
if (!item) return pg.logger.w("节点text失败,传入了错误的item");
if (count > 0) {
let parse_str = function (str, count) {
if (!str) return "";
var segmants = str.split('+');
str = segmants.join('');
var len = 0;
var idx = 0;
for (var i = 0; i < str.length; i++) {
var p = /[^x00-xff]/g;
var a = str.charAt(i);
if (p.test(a)) {
len += 2;
idx++;
}
else {
len += 1;
idx++;
}
if (len >= count * 2)
break;
}
return str.substr(0, idx);
}
text = parse_str(text, count);
}
let node = item.node ? item.node : item;
if (!node) return;
let component = node.getComponent(cc.Label);//组件功能 非node的功能
component.string = text;
return true;
},
//更变颜色
setColor(item, color, outlineWidth = -1) {
if (!item) return pg.logger.w("setColor warn->传入了错误的item");
let RGB = this.colorRgb(color);
if (!RGB || RGB.length == 0) return pg.logger.w("color ->传入了错误的color");
item.color = new cc.Color(RGB[0], RGB[1], RGB[2]);
if (outlineWidth < 0) return;
let LabelOutline = item.getComponent(cc.LabelOutline);
if (!LabelOutline) return pg.logger.w("LabelOutline warn->未添加描边");
LabelOutline.width = outlineWidth;
},
colorRgb(color) {
var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
var sColor = color;
if (sColor && reg.test(sColor)) {
if (sColor.length === 4) {
var sColorNew = "#";
for (var i = 1; i < 4; i += 1) {
sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
}
sColor = sColorNew;
}
//处理六位的颜色值
var sColorChange = [];
for (var i = 1; i < 7; i += 2) {
sColorChange.push(parseInt("0x" + sColor.slice(i, i + 2)));
}
return sColorChange;
} else {
return sColor;
}
},
//-------------------动画播放--------------------------------
playSpineAnimation(item, aniName, loop) {
if (!item || !cc.isValid(item)) return pg.logger.w("动画播放失败,传入了错误的item");
if (!aniName) return pg.logger.w("动画播放失败,传入了错误的aniName");
let node = item.node ? item.node : item;
if (!cc.isValid(node)) return pg.logger.w("节点已销毁");
let skl = node.getComponent(sp.Skeleton);
skl.setAnimation(0, aniName, loop);
return skl;
},
playDBAnimation(item, aniName, loop = -1) {
if (!item || !cc.isValid(item)) return pg.logger.w("动画播放失败,传入了错误的item");
if (!aniName) return pg.logger.w("动画播放失败,传入了错误的aniName");
let node = item.node ? item.node : item;
if (!cc.isValid(node)) return pg.logger.w("节点已销毁");
let skl: dragonBones.ArmatureDisplay = node.getComponent(dragonBones.ArmatureDisplay);
skl.playAnimation(aniName, loop);
return skl;
},
clone(node: cc.Node) {
return cc.instantiate(node)
}
},
load: {
//资源加载
// loadBundle: function (bundleName) {
// return new Promise((resolve, reject) => {
// // let hallBundle = cc.assetManager.getBundle(`hall`);
// // hallBundle.releaseAll();
// // cc.assetManager.removeBundle(hallBundle);
// let bundle = cc.assetManager.getBundle(bundleName);
// if (bundle) return resolve('');
// cc.assetManager.loadBundle(bundleName, (err, bundle) => {
// if (err) return cc.error(err);
// resolve(bundle);
// });
// });
// },
loadRes: function (res, type, bundleName) {
//此处需要二次封装,新的存在assetbundle
return new Promise((resolve, reject) => {
cc.loader.loadRes(res, type, (err, data) => {
if (err && !data) return resolve(pg.logger.d('loading loadRes error-> ' + res));
resolve(data);
});
})
},
loadImg: function (url) {
return new Promise((resolve, reject) => {
this.loadRes(url, cc.SpriteFrame).then((data) => {
if (!data || data.length == 0) return;
resolve(data);
})
})
},
loadPrefab: function (path = "") {
return new Promise((resolve, reject) => {
let url = "/prefabs/" + path;
this.loadRes(url, cc.Prefab).then((data) => {
if (!data || data.length == 0) return reject();
return resolve(cc.instantiate(data));
})
})
},
loadNetImg: function (url) {
return new Promise((resolve, reject) => {
cc.loader.load({ url }, (err, texture) => {
if (err && !texture) return resolve(pg.logger.w('loading loadRes warn-> ' + texture));
resolve(texture);
});
})
},
},
localStorage: {
//本地存储
setItem: function (key, val) {
cc.sys.localStorage.setItem(key, val);
},
getItem: function (key, defVal) {
return cc.sys.localStorage.getItem(key) || defVal;
}
},
http: {
//http访问
send: function (type, url, data, callback) {
return new Promise((resolve) => {
return setTimeout(() => {
return resolve({ status: 200 });
}, 100 + Math.random() * 300);
let xhr = cc.loader.getXMLHttpRequest();
xhr.timeout = 5000;
xhr.responseType = "text";
xhr.open(type, url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = () => {
if (xhr.readyState !== 4) return;
if (xhr.status >= 200 && xhr.status < 300) {
try {
let resp = xhr.responseText;
pg.logger.d("resp->" + JSON.stringify(resp));
callback(resp);
resolve(resp);
} catch (e) {
}
}
else {
}
};
xhr.onerror = (e) => {
pg.logger.w("onerror->" + url);
};
xhr.ontimeout = (e) => {
pg.logger.w("ontimeout->" + url);
};
xhr.send(data);
})
}
},
event: Emitter.getInstance()
};
export default pg;
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "dcef5d00-e8d0-49a5-81dd-346aec8accfc",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import pg from "./pg";
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property(cc.Label)
label: cc.Label = null;
@property
text: string = 'hello';
// LIFE-CYCLE CALLBACKS:
private player: cc.Node;
private robot: cc.Node;
onLoad() {
this.player = pg.view.find(this, "player");
this.robot = pg.view.find(this, "robot");
pg.event.on("player_point_update", (data) => {
this.updatePlayer(data.isRobot, data.num);
this.updateRobot(data.isRobot, data.num);
})
}
updatePlayer(isRobot, num) {
if (!isRobot && num >= 1 && num <= 6) {
let icon_player = pg.view.find(this.player, "icon_player");
let icon_player_dice = pg.view.find(this.player, "icon_player_dice");
pg.view.visible(icon_player, false);
pg.view.visible(icon_player_dice, true);
for (let i = 1; i <= 6; i++) {
let item = pg.view.find(icon_player_dice, "icon_" + i);
item.active = i == num;
}
} else {
let icon_player = pg.view.find(this.player, "icon_player");
let icon_player_dice = pg.view.find(this.player, "icon_player_dice");
pg.view.visible(icon_player, true);
pg.view.visible(icon_player_dice, false);
}
}
updateRobot(isRobot, num) {
if (isRobot && num >= 1 && num <= 6) {
let icon_robot = pg.view.find(this.robot, "icon_robot");
let icon_robot_dice = pg.view.find(this.robot, "icon_robot_dice");
pg.view.visible(icon_robot, false);
pg.view.visible(icon_robot_dice, true);
for (let i = 1; i <= 6; i++) {
let item = pg.view.find(icon_robot_dice, "icon_" + i);
item.active = i == num;
}
} else {
let icon_robot = pg.view.find(this.robot, "icon_robot");
let icon_robot_dice = pg.view.find(this.robot, "icon_robot_dice");
pg.view.visible(icon_robot, true);
pg.view.visible(icon_robot_dice, false);
}
}
start() {
}
// update (dt) {}
}
{
"ver": "1.0.8",
"uuid": "32f0c5ef-c279-403b-9f28-85405210208e",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import pg from "./pg";
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property(cc.Label)
label: cc.Label = null;
@property
text: string = 'hello';
// LIFE-CYCLE CALLBACKS:
private text_tip: cc.Node;
private btn_audio_start: cc.Node;
private btn_audio_stop: cc.Node;
private speak_ske: cc.Node;
private bg_goodjob: cc.Node;
private bg_tryagain: cc.Node;
onLoad() {
this.text_tip = pg.view.find(this, "text_tip");
this.btn_audio_start = pg.view.find(this, "btn_audio_start");
this.btn_audio_stop = pg.view.find(this, "btn_audio_stop");
this.speak_ske = pg.view.find(this, "speak_ske");
this.bg_goodjob = pg.view.find(this, "bg_goodjob");
this.bg_tryagain = pg.view.find(this, "bg_tryagain");
this.text_tip.active = false;
this.btn_audio_start.active = false;
this.btn_audio_stop.active = false;
this.speak_ske.active = false;
this.bg_goodjob.active = false;
this.bg_tryagain.active = false;
pg.view.touchOn(this.btn_audio_start, this.onTouchStart, this);
pg.view.touchOn(this.btn_audio_stop, this.onTouchStop, this);
pg.event.on("speak_open", () => { this.open() })
}
open() {
this.text_tip.active = true;
this.btn_audio_start.active = true;
this.btn_audio_stop.active = false;
this.speak_ske.active = true;
this.bg_goodjob.active = false;
this.bg_tryagain.active = false;
}
close() {
this.text_tip.active = false;
this.btn_audio_start.active = false;
this.btn_audio_stop.active = false;
this.speak_ske.active = false;
this.bg_goodjob.active = false;
this.bg_tryagain.active = false;
}
onTouchStart() {
pg.view.playDBAnimation(this.speak_ske, "newAnimation", 0);
this.btn_audio_start.active = false;
this.btn_audio_stop.active = true;
}
onTouchStop() {
pg.view.playDBAnimation(this.speak_ske, "newAnimation", 1);
this.text_tip.active = false;
this.btn_audio_start.active = false;
this.btn_audio_stop.active = false;
this.speak_ske.active = false;
this.bg_goodjob.active = false;
this.bg_tryagain.active = false;
setTimeout(() => {
let score = Math.random() * 100 + 50;
if (score > 50) {
this.bg_goodjob.active = true;
setTimeout(() => {
this.close();
pg.event.emit("speak_success");
}, 2000);
} else {
this.bg_tryagain.active = true;
//需要处理提供两次机会。重置一次到open状态
setTimeout(() => {
this.close();
pg.event.emit("speak_fail");
}, 2000);
}
}, 200);
}
start() {
}
// update (dt) {}
}
{
"ver": "1.0.8",
"uuid": "33705c9d-cb1e-4b92-88ff-d157a7d79cf8",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import pg from "./pg";
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property(cc.Label)
label: cc.Label = null;
@property
text: string = 'hello';
// LIFE-CYCLE CALLBACKS:
onLoad() {
let panel_gray = pg.view.find(this, "panel_gray");
let btn_start = pg.view.find(this, "btn_start");
let btn_restart = pg.view.find(this, "btn_restart");
let bg_vs = pg.view.find(this, "bg_vs");
pg.view.touchOn(btn_start, this.onTouchStart, this);
panel_gray.active = true;
btn_start.active = true;
}
onTouchStart() {
let panel_gray = pg.view.find(this, "panel_gray");
let btn_start = pg.view.find(this, "btn_start");
let btn_restart = pg.view.find(this, "btn_restart");
let bg_vs = pg.view.find(this, "bg_vs");
panel_gray.active = true;
btn_start.active = false;
bg_vs.active = true;
setTimeout(() => {
bg_vs.active = false;
panel_gray.active = false;
pg.event.emit("game_start")
}, 100);
}
update(dt) { }
}
{
"ver": "1.0.8",
"uuid": "13dcba6f-c876-4e1c-a8f5-b3a0547ccb11",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import pg from "./pg";
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property(cc.Label)
label: cc.Label = null;
@property
text: string = 'hello';
// LIFE-CYCLE CALLBACKS:
private bg_1: cc.Node;
private bg_2: cc.Node;
private bg_3: cc.Node;
private bg_4: cc.Node;
private bg_5: cc.Node;
private bg_6: cc.Node;
private bg_dice1: cc.Node;
private bg_dice2: cc.Node;
private bg_dice3: cc.Node;
private bg_dice4: cc.Node;
private bg_dice5: cc.Node;
private bg_dice6: cc.Node;
onLoad() {
this.bg_1 = pg.view.find(this, "bg_1");
this.bg_2 = pg.view.find(this, "bg_2");
this.bg_3 = pg.view.find(this, "bg_3");
this.bg_4 = pg.view.find(this, "bg_4");
this.bg_5 = pg.view.find(this, "bg_5");
this.bg_6 = pg.view.find(this, "bg_6");
this.bg_dice1 = pg.view.find(this, "bg_dice1");
this.bg_dice2 = pg.view.find(this, "bg_dice2");
this.bg_dice3 = pg.view.find(this, "bg_dice3");
this.bg_dice4 = pg.view.find(this, "bg_dice4");
this.bg_dice5 = pg.view.find(this, "bg_dice5");
this.bg_dice6 = pg.view.find(this, "bg_dice6");
}
private playing: boolean;
private num: number;
startAni() {
this.playing = true;
this.num = null;
}
stopAni(number) {
return new Promise((resolve, reject) => {
this.num = number;
this.playing = false;
setTimeout(() => {
resolve('');
}, 100);
});
}
start() {
}
updatePoint(number) {
if (!number) return;
if (this.num) {
for (let i = 1; i <= 6; i++) {
this[`bg_${i}`].active = false;
}
for (let i = 1; i <= 6; i++) {
this[`bg_dice${i}`].active = i == number;
}
} else {
for (let i = 1; i <= 6; i++) {
this[`bg_${i}`].active = i == number;
}
for (let i = 1; i <= 6; i++) {
this[`bg_dice${i}`].active = false;
}
}
}
update(dt) {
if (this.playing) {
let i = Math.floor(Math.random() * 6) + 1;
this.updatePoint(i);
} else {
this.updatePoint(this.num);
}
}
}
{
"ver": "1.0.8",
"uuid": "96a89d6c-d01a-480c-8b3b-38cf93279c5c",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
"experimentalDecorators": true, "experimentalDecorators": true,
"skipLibCheck": true, "skipLibCheck": true,
"outDir": "temp/vscode-dist", "outDir": "temp/vscode-dist",
"allowJs": true,
"forceConsistentCasingInFileNames": true "forceConsistentCasingInFileNames": true
}, },
"exclude": [ "exclude": [
......
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