You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

139 lines
4.4 KiB

using UnityEngine;
using UnityEngine.UI;
using TMPro;
using IVDataFormat;
public class EfcAddItem : MonoBehaviour
{
[SerializeField]
private int iType;
private Toggle tglLock;
private GameObject goOpened;
private GameObject goClosed;
private Image imgUnlock;
private Image imgLock;
private TextMeshProUGUI txtNumber;
private TextMeshProUGUI txtAbility;
private bool bEmpty = true;
public void Init()
{
Transform trf = transform;
tglLock = GetComponent<Toggle>();
goOpened = trf.Find("open").gameObject;
goClosed = trf.Find("close").gameObject;
imgUnlock = goOpened.transform.Find("imgUnlock").GetComponent<Image>();
imgLock = goOpened.transform.Find("imgLock").GetComponent<Image>();
txtNumber = goOpened.transform.Find("txtNumber").GetComponent<TextMeshProUGUI>();
txtAbility = goOpened.transform.Find("txtAbility").GetComponent<TextMeshProUGUI>();
}
public void SetCondition(int iawaken)
{
if (GuardianMgr.GetIsOpenAwaken())
{
goClosed.transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = FormatString.StringFormat(LocalizationText.GetText("guardian_awaken_lock"), iawaken.ToString());
}
else
{
goClosed.transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = FormatString.StringFormat(LocalizationText.GetText("all_awakenopen"), iawaken.ToString());
}
}
public void SetCondition(string strcond)
{
goClosed.transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = strcond;
}
// 효과 변경 가능 상태. 해금되었으며 잠겨있지 않음.
public bool IsChangable()
{
return gameObject.activeSelf && goOpened.activeSelf && (bEmpty || !tglLock.isOn);
}
// 무기/펫 전환.
public void SetChangeOpen(bool bopen)
{
tglLock.interactable = bopen;
goOpened.SetActive(bopen);
goClosed.SetActive(!bopen);
imgLock.gameObject.SetActive(!bopen);
imgUnlock.gameObject.SetActive(bopen);
tglLock.SetIsOnWithoutNotify(false);
}
// 해금 상태 설정.
public void SetOpen(bool bopen)
{
goOpened.SetActive(bopen);
goClosed.SetActive(!bopen);
}
// 효과 설정.
public void SetEffect(int key)
{
if (key < 0)
{
bEmpty = true;
Color clr = Global.CLR_White;
clr.a = 0f;
imgLock.color = clr;
imgUnlock.color = clr;
txtAbility.text = LocalizationText.GetText("efc0");
txtAbility.color = Global.CLR_RarityBack[0];
txtNumber.color = txtAbility.color;
tglLock.SetIsOnWithoutNotify(false);
return;
}
bEmpty = false;
dExtraAbility ability = DataHandler.GetExtraAbility(key);
imgLock.color = Global.CLR_White;
imgUnlock.color = Global.CLR_White;
txtAbility.text = FormatString.TextEffectTitleValue(ability.abilityType, ability.abilityValue);
txtAbility.color = Global.CLR_RarityBack[ability.rarity];
txtNumber.color = txtAbility.color;
}
// 효과 설정.
public void SetEffect(eEffectType abilitytype, long abilityvalue)
{
if (abilitytype == eEffectType.None)
{
bEmpty = true;
Color clr = Global.CLR_White;
clr.a = 0f;
imgLock.color = clr;
imgUnlock.color = clr;
txtAbility.text = LocalizationText.GetText("efc0");
txtAbility.color = Global.CLR_RarityBack[0];
txtNumber.color = txtAbility.color;
tglLock.SetIsOnWithoutNotify(false);
return;
}
bEmpty = false;
imgLock.color = Global.CLR_White;
imgUnlock.color = Global.CLR_White;
txtAbility.text = FormatString.TextEffectTitleValue(abilitytype, abilityvalue);
txtAbility.color = Global.CLR_White;
txtNumber.color = txtAbility.color;
}
public void ToggleLock(bool btoggle)
{
SoundMgr.PlaySfx(SoundName.BtnPress);
imgLock.gameObject.SetActive(btoggle);
imgUnlock.gameObject.SetActive(!btoggle);
if (iType == cGoods.TBag)
BagMgr.SSetEfcAddCost();
else if (iType == cGoods.TPet)
PetMgr.SSetEfcAddCost();
else
GuardianMgr.SSetEfcAddCost();
}
}