public override void Open() { Pokemon p = RuntimeData.GetCurrentMyPokemon(); if (p != null) { //再次编辑 //PokemonModel pModel = p.GetModel(); //if (pModel != null) //{ // pokemonDP.value = pokemonDP.options.FindIndex(t => t.text == StringUtil.FormatIdName(pModel.id, pModel.name_ch)); // OnSelectPokemon(); // CharacterModel pCh = p.GetCharacter().GetModel(); // OnSelectCharacter(pCh.id); // PersonalityModel pPer = p.GetPersonality().GetModel(); // personalityDP.value = personalityDP.options.FindIndex(t => t.text == pPer.name_ch); // OnSelectPersonality(); //} } else { Reset(); } base.Open(); }
private void RefreshCurrentParty(object _index) { PokemonModel p = RuntimeData.GetCurrentMyPokemon().GetModel(); Sprite icon = Resources.Load <Sprite>("PokemonSprites/" + StringUtil.FormatId(p.id) + "/Icon/IMG00000"); slots[(int)_index].SetProperty(icon, p.name_ch, p.hp); }
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(); }