|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
public class PopupItemGain : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public Animation popup;
|
|
|
|
|
public Text txtName;
|
|
|
|
|
|
|
|
|
|
public List<Image> imgDesc;
|
|
|
|
|
public List<Text> txtDesc;
|
|
|
|
|
|
|
|
|
|
Character player;
|
|
|
|
|
Inventory inven;
|
|
|
|
|
public void OnInitialized(MapManager mapManager)
|
|
|
|
|
{
|
|
|
|
|
inven = mapManager.player.inven;
|
|
|
|
|
|
|
|
|
|
inven.ec.Remove(OnEvent);
|
|
|
|
|
inven.ec.Add(OnEvent);
|
|
|
|
|
}
|
|
|
|
|
void OnEvent(int type, object value)
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < imgDesc.Count; i++)
|
|
|
|
|
imgDesc[i].gameObject.SetActive(false);
|
|
|
|
|
|
|
|
|
|
switch ((Character.State)type)
|
|
|
|
|
{
|
|
|
|
|
case Character.State.EquipItem:
|
|
|
|
|
{
|
|
|
|
|
ItemData item = (ItemData)value;
|
|
|
|
|
txtName.text = $"{DataManager.Instance.dataLanguage.Search("item", $"{item.idx}")}";
|
|
|
|
|
|
|
|
|
|
string desc = "";
|
|
|
|
|
for (int i = 0; i < item.skills.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (item.skills[i].IDX.Equals("AddEffect") || item.skills[i].IDX.Equals("AH"))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (desc != string.Empty)
|
|
|
|
|
desc += " + ";
|
|
|
|
|
|
|
|
|
|
string str = (item.skills[i].value - (int)item.skills[i].value) == 0 ? $"{item.skills[i].value}" : $"{item.skills[i].value * 100}%";
|
|
|
|
|
desc += string.Format(DataManager.Instance.dataLanguage.Search("skill", $"{item.skills[i].IDX}_Desc"), str, (int)(item.skills[i].rate / 10f), $"{DataManager.Instance.dataLanguage.Search("item", $"{item.skills[i].work2}")}"); ;
|
|
|
|
|
|
|
|
|
|
//txtDesc[i].text = string.Format(DataManager.Instance.dataLanguage.Search("skill", $"{item.skills[i].IDX}_Desc"), str, (int)(item.skills[i].rate / 10f), $"{DataManager.Instance.dataLanguage.Search("item", $"{item.skills[i].value2}")}");
|
|
|
|
|
//imgDesc[i].gameObject.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
txtDesc[0].text = desc;
|
|
|
|
|
imgDesc[0].gameObject.SetActive(desc != string.Empty);
|
|
|
|
|
|
|
|
|
|
popup.gameObject.SetActive(false);
|
|
|
|
|
popup.gameObject.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|