Drafted character selection.

This commit is contained in:
genxium
2023-02-12 18:20:04 +08:00
parent de16e8e8de
commit d111de0a7a
10 changed files with 2508 additions and 35 deletions

View File

@@ -59,6 +59,12 @@
"__uuid__": "0ecf4a0c-0f13-42fa-a214-b4826acd8556"
}
},
{
"frame": 0.3,
"value": {
"__uuid__": "cabf9cb6-99ca-426d-9a23-95cdec6f06b9"
}
},
{
"frame": 0.3333333333333333,
"value": {

File diff suppressed because it is too large Load Diff

View File

@@ -461,7 +461,7 @@
"array": [
0,
0,
216.50635094610968,
223.42897822823446,
0,
0,
0,

View File

@@ -547,7 +547,7 @@
"array": [
0,
0,
216.05530045313827,
209.61049002258042,
0,
0,
0,

View File

@@ -0,0 +1,41 @@
cc.Class({
extends: cc.Component,
properties: {
panelNode: {
type: cc.Node,
default: null
},
chosenFlag: {
type: cc.Sprite,
default: null
},
avatarNode: {
type: cc.Button,
default: null
},
animNode: {
type: cc.Node,
default: null
},
speciesId: {
type: cc.Integer,
default: 0
},
},
ctor() {},
setInteractable(enabled) {
this.avatarNode.interactable = enabled;
},
onLoad() {
const avatarNodeClickEventHandler = new cc.Component.EventHandler();
avatarNodeClickEventHandler.target = this.panelNode;
avatarNodeClickEventHandler.component = "GameRule";
avatarNodeClickEventHandler.handler = "onSpeciesSelected";
avatarNodeClickEventHandler.customEventData = this.speciesId;
this.avatarNode.clickEvents.push(avatarNodeClickEventHandler);
},
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "6dd2c047-fa5c-4080-8221-27fabfd275d6",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -10,15 +10,29 @@ cc.Class({
type: cc.Node,
default: null
},
characterSelectCells: {
type: cc.Node,
default: []
},
},
// LIFE-CYCLE CALLBACKS:
onLoad() {
const modeBtnClickEventHandler = new cc.Component.EventHandler();
modeBtnClickEventHandler.target = this.mapNode;
modeBtnClickEventHandler.target = this.mapNode;
modeBtnClickEventHandler.component = "Map";
modeBtnClickEventHandler.handler = "onGameRule1v1ModeClicked";
this.modeButton.clickEvents.push(modeBtnClickEventHandler);
}
},
onSpeciesSelected(val) {
for (let cell of this.characterSelectCells) {
const comp = cell.getComponent("CharacterSelectCell");
if (cell.speciesId != val) {
cell.chosenFlag.active = false;
} else {
cell.chosenFlag.active = true;
}
}
},
});