private void UpgradeSkill() { int needCoin = 0; if (petData.activeSkillType == skillData.skillType) { if (DataManager.GetInstance().IsEnoughCoin(skillData.GetSkillCost(petData.aSkillLv), ref needCoin)) { DataManager.GetInstance().UseCoin(skillData.GetSkillCost(petData.aSkillLv)); petData.ActiveSkillLevelUp(); } } else { if (DataManager.GetInstance().IsEnoughCoin(skillData.GetSkillCost(petData.pSkillLv), ref needCoin)) { DataManager.GetInstance().UseCoin(skillData.GetSkillCost(petData.pSkillLv)); petData.PassiveSkillLevelUp(); } } UpdateAll(); UISystem.UpdateNews(); DataManager.GetInstance().SaveAllData(); }
public override void BeforeOpen() { characterImage.spriteName = petData.GetOnGameImage(); characterOutline.spriteName = petData.GetPopupOutline(); characterImage.MakePixelPerfect(); characterOutline.MakePixelPerfect(); bool bActiveSkill = (petData.activeSkillType == skillData.skillType); Define.SkillType skillType = bActiveSkill ? petData.activeSkillType : petData.passiveSkillType; int skillLv = bActiveSkill ? petData.aSkillLv : petData.pSkillLv; bool noCooltime = !bActiveSkill; bool noValue = bActiveSkill ? petData.GetActiveSkill().GetSkillValue(skillLv) == Define.nullValue : petData.GetPassiveSkill().GetSkillValue(skillLv) == Define.nullValue; skillIcon.spriteName = skillData.skillIcon; skillInfoLable.text = SkillManager.GetInstance().GetSkillInfo(skillType, skillLv); //구매하기 전의 동물의 스킬. // if (!DataManager.GetInstance().IsInHasPetDataList(petData.unqIdx)) { maxLevelPanel.SetActive(true); notMaxLevelPanel.SetActive(false); bottomGuideLabel.text = DataManager.GetText(TextTable.adoptLevelKey); SettingUI(maxSkill, noCooltime, noValue, skillLv); } //최대 레벨. // else if (skillData.IsMaxLevel(skillLv)) { maxLevelPanel.SetActive(true); notMaxLevelPanel.SetActive(false); bottomGuideLabel.text = DataManager.GetText(TextTable.maxLevelKey); SettingUI(maxSkill, noCooltime, noValue, skillLv); } //스킬 업그레이드 불가. // else if (skillLv >= petData.level) { maxLevelPanel.SetActive(false); notMaxLevelPanel.SetActive(true); SettingUI(nowSkill, noCooltime, noValue, skillLv); SettingUI(nextSkill, noCooltime, noValue, skillLv + 1); notUpgradePanel.SetActive(true); upgradeBtn.SetActive(false); notUpgradeLabel.text = string.Format(DataManager.GetText(TextTable.cantUpgradeKey), petData.GetName(), skillLv + 2); Vector3 pos = coinLabelBody.localPosition; pos.x = 32 - coinLabel.width; coinLabelBody.localPosition = pos; pos = coinIcon.localPosition; pos.x = 24 - coinLabel.width; coinIcon.localPosition = pos; } //스킬 업그레이드 가능. // else { maxLevelPanel.SetActive(false); notMaxLevelPanel.SetActive(true); SettingUI(nowSkill, noCooltime, noValue, skillLv); SettingUI(nextSkill, noCooltime, noValue, skillLv + 1); notUpgradePanel.SetActive(false); upgradeBtn.SetActive(true); upgradeLabel.text = DataManager.GetText(TextTable.upgradeBtnKey); coinLabel.text = skillData.GetSkillCost(skillLv).ToString(); Vector3 pos = coinLabelBody.localPosition; pos.x = 32 - coinLabel.width; coinLabelBody.localPosition = pos; pos = coinIcon.localPosition; pos.x = 24 - coinLabel.width; coinIcon.localPosition = pos; } }