[fix] Lobby 初始化清空 Child
This commit is contained in:
@@ -131,6 +131,7 @@ export class Badminton extends cc.Component {
|
||||
CoroutineV2.Single(self.HistoryPanel.Hide()).Start();
|
||||
}
|
||||
// textToSpeech = FindObjectOfType<TextToSpeech>();
|
||||
self.AvatarPanel.Initial(self);
|
||||
CoroutineV2.Single(self.Show()).Start();
|
||||
};
|
||||
CoroutineV2.Single(AsyncFunction()).Start();
|
||||
@@ -158,17 +159,19 @@ export class Badminton extends cc.Component {
|
||||
this._updateCurSelMember();
|
||||
// this.toggleItem.gameObject.SetActive(false);
|
||||
// this.teamItem.gameObject.SetActive(false);
|
||||
|
||||
let parent: cc.Node = this.TeamItemContent;
|
||||
for (let i: number = parent.childrenCount - 1; i > 0; i--) {
|
||||
parent.children[i].destroy();
|
||||
}
|
||||
// for (let i: number = parent.childrenCount - 1; i > 0; i--) {
|
||||
// parent.children[i].destroy();
|
||||
// }
|
||||
parent.removeAllChildren();
|
||||
this._m_teamList.Clear();
|
||||
|
||||
|
||||
parent = this.ToggleItemContent;
|
||||
for (let i: number = parent.childrenCount - 1; i > 0; i--) {
|
||||
parent.children[i].destroy();
|
||||
}
|
||||
// for (let i: number = parent.childrenCount - 1; i > 0; i--) {
|
||||
// parent.children[i].destroy();
|
||||
// }
|
||||
parent.removeAllChildren();
|
||||
this._m_toggleList.Clear();
|
||||
|
||||
for (let idx: number = 0; idx < this.TeamMemberList.length; idx++) {
|
||||
@@ -180,7 +183,7 @@ export class Badminton extends cc.Component {
|
||||
let picObj: cc.Node = item.node.getChildByName("Avatar").getChildByName("Pic");
|
||||
if (picObj != null) {
|
||||
picObj.getComponent(cc.Sprite).spriteFrame = this.config.GetAvatarPicById(this.TeamMemberList[idx].AvatarId);
|
||||
picObj.parent.getComponent(HoldButton).OnInvoke.AddListener(() => { this.OnChangeAvatar(idx); });
|
||||
picObj.parent.getComponent(HoldButton).OnInvoke.AddListener(() => { this.OnChangeAvatar(+idx); });
|
||||
picObj.parent.on("click", () => {
|
||||
item.isChecked = !item.isChecked;
|
||||
self._onChangeSelMember(item);
|
||||
@@ -347,9 +350,7 @@ export class Badminton extends cc.Component {
|
||||
}
|
||||
|
||||
public OnChangeAvatar(index: number): void {
|
||||
index = +index;
|
||||
console.log("OnChangeAvatar");
|
||||
// this.AvatarPanel.OpenChange(teamMemberList[index]);
|
||||
CoroutineV2.Single(this.AvatarPanel.Show(this.TeamMemberList[index])).Start();
|
||||
}
|
||||
|
||||
public LoadStatus(): void {
|
||||
|
||||
@@ -8,22 +8,18 @@ import { AvatarData, MemberData } from "./MemberData";
|
||||
/** ConfigManager */
|
||||
export default class ConfigManager {
|
||||
|
||||
//#region get
|
||||
//#region public
|
||||
|
||||
public Main: Badminton = null;
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region public
|
||||
|
||||
public Avatars: AvatarData[] = [];
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Lifecycle
|
||||
|
||||
constructor(mainControl: Badminton) {
|
||||
this.Main = mainControl;
|
||||
constructor(main: Badminton) {
|
||||
this.Main = main;
|
||||
}
|
||||
|
||||
public *Init(): IterableIterator<any> {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
//#region Enum
|
||||
@@ -25,8 +26,9 @@ export class MemberData {
|
||||
/**
|
||||
* @param {string} name 名稱
|
||||
*/
|
||||
constructor(name: string) {
|
||||
constructor(name: string, avatarId: number = 0) {
|
||||
this.Name = name;
|
||||
this.AvatarId = avatarId;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user