private void Save() { errorText.text = string.Empty; List <int> skillIds = new List <int>(); for (int i = 0; i < skillDPs.Length; i++) { skillIds.Add(int.Parse(skillDPs[i].captionText.text.Substring(0, 3))); } //存在重复技能 if (skillIds.Count() != skillIds.Distinct().Count()) { errorText.text = "技能不能重复选择"; } else { for (int i = 0; i < skills.Length; i++) { skills[i] = PublicDataManager.instance.GetSkillModel(skillIds[i]); } //各项属性修改为最终能力值 for (int i = 0; i < abilityValueTexts.Length; i++) { switch (i) { case 0: pokemon.hp = int.Parse(abilityValueTexts[i].text); break; case 1: pokemon.attack = int.Parse(abilityValueTexts[i].text); break; case 2: pokemon.defense = int.Parse(abilityValueTexts[i].text); break; case 3: pokemon.sp_attack = int.Parse(abilityValueTexts[i].text); break; case 4: pokemon.sp_defense = int.Parse(abilityValueTexts[i].text); break; case 5: pokemon.speed = int.Parse(abilityValueTexts[i].text); break; } } Pokemon p = new Pokemon(pokemon, character, personality, item, skills); p.isMe = true; RuntimeData.SetCurrentMyPokemon(p); UIDelegateManager.NotifyUI(UIMessageType.RefreshParty, RuntimeData.GetCurrentMyIndex()); Close(); } }