public void SetSkill() { Skill data = SkillSystem.GetSkill(skillId); skillType = (SkillType)data.skillType; applyType = (ApplyType)data.targetType; skillName = data.name; skillDescription = data.description; skillLevel = SkillSystem.GetUserSkillLevel(skillId); skillAbillity = SkillSystem.GetUserSkillPower(skillId); skillDelayTime = data.energy; skillImage = SkillSystem.GetSkillImage(skillId); Debugging.Log(skillId + " 스킬 세팅완료"); }
public void OpenUI(HeroData data) { heroData = data; showHeroObj = Instantiate(PrefabsDatabaseManager.instance.GetHeroPrefab(heroData.id), ShowPoint.transform); showHeroObj.transform.localScale = new Vector3(200, 200, 200); showHeroObj.transform.localPosition = Vector3.zero; if (showHeroObj.GetComponent <Hero>() != null) { Destroy(showHeroObj.GetComponent <Hero>()); } if (showHeroObj.GetComponent <Rigidbody2D>() != null) { Destroy(showHeroObj.GetComponent <Rigidbody2D>()); } foreach (var sp in showHeroObj.GetComponentsInChildren <SpriteRenderer>()) { sp.sortingLayerName = "ShowObject"; sp.gameObject.layer = 16; } showHeroObj.gameObject.SetActive(true); nameText.text = HeroSystem.GetHeroName(data.id); descriptionText.text = HeroSystem.GetHeroDescription(data.id); //Status 정보 if (statusInfoPanel != null) { statusInfoPanel.transform.GetChild(0).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusAttack(ref heroData).ToString(); statusInfoPanel.transform.GetChild(1).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusDefence(ref heroData).ToString(); statusInfoPanel.transform.GetChild(2).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusMaxHp(ref heroData).ToString(); statusInfoPanel.transform.GetChild(3).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusCriticalPercent(ref heroData).ToString(); statusInfoPanel.transform.GetChild(4).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusAttackSpeed(ref heroData).ToString(); statusInfoPanel.transform.GetChild(5).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusMoveSpeed(ref heroData).ToString(); statusInfoPanel.transform.GetChild(6).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusKnockbackResist(ref heroData).ToString("N1"); statusInfoPanel.transform.GetChild(7).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusSkillEnergy(ref heroData).ToString(); } // 스킬정보 Skill heroSkill = SkillSystem.GetSkill(heroData.skill); if (skillInfoPanel != null && heroSkill != null) { var skillImage = skillInfoPanel.transform.GetChild(0).GetChild(0).GetComponent <Image>(); skillImage.sprite = SkillSystem.GetSkillImage(heroSkill.id); skillInfoPanel.transform.GetComponentInChildren <Text>().text = string.Format("<size='27'>{0} : {1} {2}</size>\r\n\r\n<color='grey'>{3}</color>", LocalizationManager.GetText("SkillLevel"), 1, SkillSystem.GetSkillName(heroSkill.id), SkillSystem.GetSkillDescription(heroSkill.id)); } }
public void ShowUI() { skillNeedEnergys = new List <float>(); skillbuttons = new List <GameObject>(); for (var i = 0; i < this.transform.childCount; i++) { int heroIndex = i; if (User.stageHeros[i] == 0) { this.transform.GetChild(heroIndex).gameObject.SetActive(false); this.transform.GetChild(heroIndex).gameObject.SetActive(false); skillNeedEnergys.Add(0); } else { HeroProfileSet(heroIndex); skillImage = this.transform.GetChild(heroIndex).GetChild(0).GetChild(0).GetComponent <Image>(); skillEnergyText = this.transform.GetChild(heroIndex).GetComponentInChildren <Button>().GetComponentInChildren <Text>(); int skillId = HeroSystem.GetUserHero(User.stageHeros[heroIndex]).skill; Skill skill = SkillSystem.GetSkill(skillId); skillImage.sprite = SkillSystem.GetSkillImage(skill.id); int needEnergy = HeroSystem.GetHeroNeedEnergy(User.stageHeros[heroIndex], skill); skillEnergyText.text = needEnergy.ToString(); skillNeedEnergys.Add(needEnergy); this.transform.GetChild(heroIndex).GetComponentInChildren <Button>().onClick.RemoveAllListeners(); this.transform.GetChild(heroIndex).GetComponentInChildren <Button>().onClick.AddListener(delegate { OnSkillButtonClick(heroIndex, User.stageHeros[heroIndex]); }); this.transform.GetChild(heroIndex).gameObject.SetActive(true); this.transform.GetChild(heroIndex).GetComponentInChildren <Animator>().SetTrigger("showing"); this.transform.GetChild(heroIndex).GetComponentInChildren <Animator>().SetBool("isAble", true); } skillbuttons.Add(this.transform.GetChild(heroIndex).gameObject); } }
public void RefreshPlayerSkillUI() { List <Skill> playerSkillList = SkillSystem.GetSelectSkillList(); for (int i = 0; i < playerSkillList.Count; i++) { if (playerSkillList[i] != null) { playerSkillPanel.transform.GetChild(i).GetChild(0).GetComponent <Image>().enabled = true; playerSkillPanel.transform.GetChild(i).GetChild(0).GetComponent <Image>().sprite = SkillSystem.GetSkillImage(playerSkillList[i].id); } } for (int i = playerSkillList.Count; i < 2; i++) { playerSkillPanel.transform.GetChild(i).GetChild(0).GetComponent <Image>().enabled = false; } }
public void RefreshHeroStatusEquipmentPanel() { //Status 정보 if (heroStatusInfoPanel != null) { heroStatusInfoPanel.transform.GetChild(0).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusAttack(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(0) + ItemSystem.GetHeroEquipmentItemAttack(ref targetHeroData) + LabSystem.GetAddAttack(User.addAttackLevel)); heroStatusInfoPanel.transform.GetChild(1).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusDefence(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(1) + ItemSystem.GetHeroEquipmentItemDefence(ref targetHeroData) + LabSystem.GetAddDefence(User.addDefenceLevel)); heroStatusInfoPanel.transform.GetChild(2).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusMaxHp(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(2) + ItemSystem.GetHeroEquipmentItemHp(ref targetHeroData)); heroStatusInfoPanel.transform.GetChild(3).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusCriticalPercent(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>%", AbilitySystem.GetAbilityStats(3) + ItemSystem.GetHeroEquipmentItemCritical(ref targetHeroData)); heroStatusInfoPanel.transform.GetChild(4).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusAttackSpeed(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(4) + ItemSystem.GetHeroEquipmentItemAttackSpeed(ref targetHeroData)); heroStatusInfoPanel.transform.GetChild(5).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusMoveSpeed(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(5) + ItemSystem.GetHeroEquipmentItemMoveSpeed(ref targetHeroData)); heroStatusInfoPanel.transform.GetChild(6).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusKnockbackResist(ref targetHeroData).ToString("N1"); heroStatusInfoPanel.transform.GetChild(7).GetComponentInChildren <Text>().text = HeroSystem.GetHeroStatusSkillEnergy(ref targetHeroData).ToString() + string.Format("<color='yellow'><size='18'>(+{0})</size></color>", AbilitySystem.GetAbilityStats(6) + ItemSystem.GetHeroEquipmentItemSkillEnergy(ref targetHeroData)); } if (heroStatPanel != null) { for (int i = 0; i < heroStatPanel.transform.childCount; i++) { if (heroStatPanel.transform.GetComponentInChildren <Button>() != null) { heroStatPanel.transform.GetComponentInChildren <Button>().gameObject.SetActive(false); } } heroStatPanel.transform.GetChild(0).GetChild(0).GetComponent <Text>().text = targetHeroData.strength.ToString(); heroStatPanel.transform.GetChild(1).GetChild(0).GetComponent <Text>().text = targetHeroData.intelligent.ToString(); heroStatPanel.transform.GetChild(2).GetChild(0).GetComponent <Text>().text = targetHeroData.physical.ToString(); heroStatPanel.transform.GetChild(3).GetChild(0).GetComponent <Text>().text = targetHeroData.agility.ToString(); } // Equipment 장비 정보 if (heroEquimentItemSlots != null && heroEquimentItemSlots.transform.childCount > 0) { int[] equipmentItemsId = HeroSystem.GetHeroEquipmentItems(targetHeroData.id); for (int i = 0; i < equipmentItemsId.Length; i++) { if (equipmentItemsId[i] != 0) { heroEquimentItemSlots.transform.GetChild(i).GetChild(0).GetComponent <Image>().sprite = ItemSystem.GetItemClassImage(equipmentItemsId[i], true); heroEquimentItemSlots.transform.GetChild(i).GetChild(0).GetChild(0).GetComponent <Image>().sprite = ItemSystem.GetItemImage(equipmentItemsId[i], true); heroEquimentItemSlots.transform.GetChild(i).GetChild(1).GetComponent <Image>().color = ItemColor.GetItemColor(ItemSystem.GetUserEquipmentItem(equipmentItemsId[i]).itemClass); } else { heroEquimentItemSlots.transform.GetChild(i).GetChild(0).GetComponent <Image>().sprite = ItemSystem.GetItemNoneImage(); heroEquimentItemSlots.transform.GetChild(i).GetChild(0).GetChild(0).GetComponent <Image>().sprite = ItemSystem.GetItemNoneImage(); heroEquimentItemSlots.transform.GetChild(i).GetChild(1).GetComponent <Image>().color = ItemColor.D; } int buttonIndex = i; heroEquimentItemSlots.transform.GetChild(buttonIndex).GetComponent <Button>().onClick.RemoveAllListeners(); heroEquimentItemSlots.transform.GetChild(buttonIndex).GetComponent <Button>().onClick.AddListener(delegate { OnEquipmentItemClick(buttonIndex, equipmentItemsId[buttonIndex]); }); } } // 스킬정보 Skill heroSkill = SkillSystem.GetSkill(targetHeroData.skill); if (heroSkillSlot != null && heroSkill != null) { skillImage = heroSkillSlot.transform.GetChild(0).GetChild(0).GetComponent <Image>(); skillImage.sprite = SkillSystem.GetSkillImage(heroSkill.id); heroSkillSlot.transform.GetComponentInChildren <Text>().text = string.Format("<size='27'>{0} : {1}</size>\r\n<color='grey'>{2}</color>", LocalizationManager.GetText("SkillLevel"), SkillSystem.GetUserSkillLevel(heroSkill.id), SkillSystem.GetUserSkillDescription(heroSkill, targetHeroData)); // 스킬강화버튼 skillLevelUpButton = heroSkillSlot.GetComponentInChildren <Button>(); int needMoney = SkillSystem.GetUserSkillLevelUpNeedCoin(heroSkill.id); skillLevelUpButton.transform.GetChild(0).GetComponentInChildren <Text>().text = Common.GetThousandCommaText(needMoney); if (Common.PaymentAbleCheck(ref User.coin, needMoney)) { skillLevelUpButton.interactable = true; } else { skillLevelUpButton.interactable = false; } skillLevelUpButton.onClick.RemoveAllListeners(); skillLevelUpButton.onClick.AddListener(delegate { OnSkillLevelUpClick(heroSkill.id, needMoney); }); if (SkillSystem.isHeroSkillUpgradeAble(heroSkill.id, targetHeroData)) { skillLevelUpButton.interactable = true; skillLevelUpButton.transform.GetChild(2).gameObject.SetActive(false); } else { skillLevelUpButton.interactable = false; skillLevelUpButton.transform.GetChild(2).GetComponentInChildren <Text>().text = string.Format("! {0} : {1}", LocalizationManager.GetText("HeroLevel"), SkillSystem.GetUserSkillLevel(heroSkill.id) + 1); skillLevelUpButton.transform.GetChild(2).gameObject.SetActive(true); } } }
void RefreshUI() { foreach (Transform child in ScrollContentView.transform) { Destroy(child.gameObject); } for (int i = 0; i < 2; i++) { if (SelectSkillPanel.transform.GetChild(i).childCount > 0) { Destroy(SelectSkillPanel.transform.GetChild(i).GetChild(0).gameObject); } } for (var i = 0; i < playerSkillList.Count; i++) { GameObject slot = Instantiate(slotPrefab, ScrollContentView.transform); skillImage = slot.transform.GetChild(0).GetComponent <Image>(); skillButton = slot.GetComponent <Button>(); skillImage.sprite = SkillSystem.GetSkillImage(playerSkillList[i].id); skillButton.onClick.RemoveAllListeners(); int index = i; skillButton.onClick.AddListener(delegate { OnSelectSkill(playerSkillList[index]); }); if (SkillSystem.isPlayerSkillAble(playerSkillList[i].id)) { skillButton.enabled = true; slot.transform.GetChild(2).gameObject.SetActive(false); } else { skillButton.enabled = false; slot.transform.GetChild(2).gameObject.SetActive(true); } } for (var i = 0; i < selectedSkillList.Count && i < 2; i++) { if (selectedSkillList[i] != null) { GameObject slot = Instantiate(slotPrefab, SelectSkillPanel.transform.GetChild(i).transform); slot.transform.localPosition = Vector3.zero; slot.GetComponent <RectTransform>().anchoredPosition = new Vector2(0.5f, 0.5f); skillImage = slot.transform.GetChild(0).GetComponent <Image>(); skillButton = slot.GetComponent <Button>(); skillImage.sprite = SkillSystem.GetSkillImage(selectedSkillList[i].id); skillButton.onClick.RemoveAllListeners(); int index = i; skillButton.onClick.AddListener(delegate { OnCancleSelectedSkill(selectedSkillList[index]); }); SelectSkillInformationPanel.transform.GetChild(i).gameObject.SetActive(true); SelectSkillInformationPanel.transform.GetChild(i).GetChild(0).GetComponent <Text>().text = SkillSystem.GetSkillName(selectedSkillList[i].id); SelectSkillInformationPanel.transform.GetChild(i).GetChild(1).GetComponent <Text>().text = SkillSystem.GetSkillDescription(selectedSkillList[i].id); } } for (var i = selectedSkillList.Count; i < SelectSkillInformationPanel.transform.childCount; i++) { SelectSkillInformationPanel.transform.GetChild(i).gameObject.SetActive(false); } }
void RefreshUI() { if (ScrollContentView != null) { foreach (Transform child in ScrollContentView.transform) { Destroy(child.gameObject); } playerSkillList.Clear(); playerSkillList = SkillSystem.GetPlayerSkillList(); for (var i = 0; i < playerSkillList.Count; i++) { GameObject slot = Instantiate(slotPrefab, ScrollContentView.transform); skillImage = slot.transform.GetChild(0).GetChild(0).GetComponent <Image>(); skillDescriptionText = slot.transform.GetChild(1).GetComponent <Text>(); skillUpgradeButton = slot.transform.GetComponentInChildren <Button>(); skillNeedCrystalText = skillUpgradeButton.GetComponentInChildren <Text>(); skillImage.sprite = SkillSystem.GetSkillImage(playerSkillList[i].id); skillDescriptionText.text = SkillSystem.GetPlayerSkillDescription(playerSkillList[i]); int upgradePayment = 100; skillNeedCrystalText.text = Common.GetThousandCommaText(upgradePayment); skillUpgradeButton.onClick.RemoveAllListeners(); int index = i; skillUpgradeButton.onClick.AddListener(delegate { OnClickSkillUpgrate(index, playerSkillList[index].id, upgradePayment); }); if (Common.PaymentAbleCheck(ref User.blackCrystal, upgradePayment)) { skillUpgradeButton.enabled = true; } else { skillUpgradeButton.enabled = false; } if (SkillSystem.isPlayerSkillAble(playerSkillList[i].id)) { slot.transform.GetChild(3).gameObject.SetActive(false); if (SkillSystem.isPlayerSkillUpgradeAble(playerSkillList[i].id)) { skillUpgradeButton.enabled = true; skillUpgradeButton.transform.GetChild(2).gameObject.SetActive(false); } else { skillUpgradeButton.enabled = false; skillUpgradeButton.transform.GetChild(2).gameObject.SetActive(true); skillUpgradeButton.transform.GetChild(2).GetComponentInChildren <Text>().text = string.Format("! {0} : {1}", LocalizationManager.GetText("UserLevel"), SkillSystem.GetUserSkillLevel(playerSkillList[i].id) + 1); } } else { slot.transform.GetChild(3).gameObject.SetActive(true); slot.transform.GetChild(3).GetComponentInChildren <Text>().text = string.Format("! {0} : {1}", LocalizationManager.GetText("UnlockLevel"), playerSkillList[i].level); } } } }