public override void Open() { //初始化Pokemon阵容 for (int i = 0; i < slots.Length; i++) { PokemonModel p = RuntimeData.GetMyPokemonByIndex(i).GetModel(); Sprite icon = Resources.Load <Sprite>("PokemonSprites/" + StringUtil.FormatId(p.id) + "/Icon/IMG00000"); slots[i].SetProperty(icon, p.name_ch, p.hp); int index = i; //更换Pokemon slots[i].gameObject.GetComponent <Button>().onClick.AddListener(() => { RuntimeData.SetCurrentMyIndex(index); ChangePokemon(RuntimeData.GetCurrentMyPokemon(), true); }); } //默认第一个Pokemon先上场 ChangePokemon(RuntimeData.GetCurrentMyPokemon(), true); ChangePokemon(RuntimeData.GetCurrentOppPokemon(), false); UIDelegateManager.AddObserver(UIMessageType.RefreshMyHpText, RefreshMyHpText); UIDelegateManager.AddObserver(UIMessageType.RefreshMyHpBar, RefreshMyHpBar); UIDelegateManager.AddObserver(UIMessageType.RefreshOpponentHpBar, RefreshOpponentHpBar); base.Open(); }