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.
84 lines
2.0 KiB
84 lines
2.0 KiB
using IVDataFormat;
|
|
using TMPro;
|
|
using UnityEngine.UI;
|
|
|
|
public class EScrEfcOption : EScrCell
|
|
{
|
|
private Toggle tglSelect;
|
|
private TextMeshProUGUI txtName;
|
|
|
|
public override void InitCell()
|
|
{
|
|
tglSelect = GetComponent<Toggle>();
|
|
txtName = transform.Find("txt").GetComponent<TextMeshProUGUI>();
|
|
}
|
|
|
|
public override void RefreshCellView()
|
|
{
|
|
base.RefreshCellView();
|
|
SetData(itemID);
|
|
}
|
|
|
|
public override void SetData(int itemid)
|
|
{
|
|
itemID = itemid;
|
|
|
|
if (iType == cGoods.TBag)
|
|
{
|
|
txtName.text = FormatString.TextEffectTitle(BagMgr.SGetEfcAddAutoType(itemid));
|
|
SetSelected(BagMgr.SGetEfcAddAutoSelect(itemid));
|
|
}
|
|
else if (iType == cGoods.TPet)
|
|
{
|
|
txtName.text = FormatString.TextEffectTitle(PetMgr.SGetEfcAddAutoType(itemid));
|
|
SetSelected(PetMgr.SGetEfcAddAutoSelect(itemid));
|
|
}
|
|
else if (iType == cGoods.TGuardian)
|
|
{
|
|
txtName.text = FormatString.TextEffectTitle(GuardianMgr.SGetEfcAddAutoType(itemid));
|
|
SetSelected(GuardianMgr.SGetEfcAddAutoSelect(itemid));
|
|
}
|
|
}
|
|
|
|
public void SetText(string strtext)
|
|
{
|
|
txtName.text = strtext;
|
|
}
|
|
|
|
public bool IsSelected()
|
|
{
|
|
return tglSelect.isOn;
|
|
}
|
|
|
|
public void SetSelected(bool bselect)
|
|
{
|
|
if (bselect)
|
|
txtName.color = Global.CLR_TextYellow;
|
|
else
|
|
txtName.color = Global.CLR_White;
|
|
tglSelect.SetIsOnWithoutNotify(bselect);
|
|
}
|
|
|
|
public void SetToggle()
|
|
{
|
|
tglSelect.isOn = true;
|
|
}
|
|
|
|
public void ToggleSelect(bool bselect)
|
|
{
|
|
SoundMgr.Instance.PlaySfx(SoundName.BtnPress);
|
|
|
|
if (iType == cGoods.TBag)
|
|
{
|
|
BagMgr.SToggleSelect(itemID, bselect);
|
|
}
|
|
else if (iType == cGoods.TPet)
|
|
{
|
|
PetMgr.SToggleSelect(itemID, bselect);
|
|
}
|
|
else if(iType == cGoods.TGuardian)
|
|
{
|
|
GuardianMgr.SToggleSelect(itemID, bselect);
|
|
}
|
|
}
|
|
}
|