1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- cc.Class({
- extends: cc.Component,
- properties: {
- player1: cc.Node,
- player2: cc.Node,
- player3: cc.Node,
- player4: cc.Node,
- player5: cc.Node,
- player6: cc.Node,
- },
- initData(baseScript) {
- this.baseScript = baseScript;
- this.spine_bg = cc.find("rootNode/layer_bg/spine_bg", this.node);
- this.label_rate = cc.find("rootNode/label_rate", this.node);
- let spine = this.spine_bg.getComponent(sp.Skeleton);
- spine.setCompleteListener((event) => {
- let type1 = event.animation.name[0];
- let type2 = event.animation.name[1];
- if (type2 == "a") {
- spine.getComponent(sp.Skeleton).setAnimation(0, type1 + "b", false);
- } else if (type2 == "c") {
- spine.getComponent(sp.Skeleton).setAnimation(0, type1 + "d", false);
- }
- });
- },
- showPanel(data) {
- this.node.active = true;
- let nextType = data.lPlayerWinScore >= 0 ? "a" : "c";
- let itemSpineIndex = this.baseScript.layer_itemSpine.children[data.cbWinIndex].itemType + 1;
- data.lPlayerWinScore >= 0 ? this.node.parent.BCBMAudioManager.playWin() : this.node.parent.BCBMAudioManager.playFail();
- let spine = this.spine_bg.getComponent(sp.Skeleton);
- spine.setAnimation(0, ["", 1, 5, 2, 6, 3, 8, 4, 7][itemSpineIndex] + nextType, false);
- this.label_rate.getComponent(cc.Label).string = ["x40", "x5", "x30", "x5", "x20", "x5", "x10", "x5"][itemSpineIndex - 1];
- for (let i = 1; i < 7; i += 1) {
- let node = this["player" + i];
- if (i == 1) {
- let winscore = parseInt((data.lPlayerWinScore / 100).toFixed(0));
- node.setChildString("label_name", cc.vv.globalUserInfo.getNickName())
- node.setChildString("label_score", (winscore >= 0 ? "+" : "") + winscore);
- } else {
- let winscore = parseInt((data.lPlayerScoreInfo[i - 2].lWinScore / 100).toFixed(0));
- node.setChildString("label_name", data.lPlayerScoreInfo[i - 2].szNickName);
- node.setChildString("label_score", (winscore >= 0 ? "+" : "") + winscore);
- }
- node.opacity = 0;
- this.scheduleOnce(() => {
- node.runAction(cc.fadeTo(0.1, 255))
- }, 0.3 + i * 0.05);
- }
- },
- closePanel() {
- this.node.parent.BCBMAudioManager.playButton();
- this.node.active = false;
- this.baseScript.wait_start.opacity = 255;
- },
- });
|