2022-09-20 15:50:01 +00:00
|
|
|
cc.Class({
|
|
|
|
extends: cc.Component,
|
|
|
|
|
|
|
|
properties: {
|
|
|
|
modeButton: {
|
|
|
|
type: cc.Button,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
mapNode: {
|
|
|
|
type: cc.Node,
|
|
|
|
default: null
|
|
|
|
},
|
2023-02-12 10:20:04 +00:00
|
|
|
characterSelectCells: {
|
|
|
|
type: cc.Node,
|
|
|
|
default: []
|
|
|
|
},
|
2023-02-12 15:04:20 +00:00
|
|
|
chosenSpeciesId: {
|
|
|
|
type: cc.Integer,
|
|
|
|
default: 0
|
|
|
|
},
|
2023-02-13 02:34:56 +00:00
|
|
|
loadingNode: {
|
|
|
|
default: null,
|
|
|
|
type: cc.Node
|
|
|
|
},
|
2022-09-20 15:50:01 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
2023-02-13 02:34:56 +00:00
|
|
|
onLoad() {
|
|
|
|
},
|
2023-02-12 10:20:04 +00:00
|
|
|
|
2023-02-12 14:10:42 +00:00
|
|
|
onSpeciesSelected(evt, val) {
|
2023-02-12 10:20:04 +00:00
|
|
|
for (let cell of this.characterSelectCells) {
|
|
|
|
const comp = cell.getComponent("CharacterSelectCell");
|
2023-02-12 14:10:42 +00:00
|
|
|
if (comp.speciesId != val) {
|
|
|
|
comp.chosenFlag.node.active = false;
|
2023-02-12 10:20:04 +00:00
|
|
|
} else {
|
2023-02-12 14:10:42 +00:00
|
|
|
comp.chosenFlag.node.active = true;
|
2023-02-12 15:04:20 +00:00
|
|
|
this.chosenSpeciesId = val;
|
2023-02-12 10:20:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2023-02-12 15:04:20 +00:00
|
|
|
|
|
|
|
onModeButtonClicked(evt) {
|
2023-02-13 02:34:56 +00:00
|
|
|
for (let cell of this.characterSelectCells) {
|
|
|
|
const comp = cell.getComponent("CharacterSelectCell");
|
|
|
|
comp.setInteractable(false);
|
|
|
|
}
|
|
|
|
this.modeButton.node.active = false;
|
|
|
|
this.loadingNode.active = true;
|
|
|
|
this.loadingNode.runAction(
|
|
|
|
cc.repeatForever(cc.rotateBy(1.0, 360))
|
|
|
|
);
|
2023-02-12 15:04:20 +00:00
|
|
|
this.mapNode.getComponent("Map").onGameRule1v1ModeClicked(this.chosenSpeciesId);
|
|
|
|
},
|
2022-09-20 15:50:01 +00:00
|
|
|
});
|