45 lines
1.4 KiB
C#
45 lines
1.4 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class UI_CheckMyselfItem : BaseItem
|
|
{
|
|
public ItemInfo itemInfo;
|
|
public TextMeshProUGUI tips;
|
|
public bool isOn = false;
|
|
public void Init(ItemInfo _itemInfo)
|
|
{
|
|
itemInfo = _itemInfo;
|
|
if (PacksackBagMgr.Instance.wearDic.ContainsKey(itemInfo.toolId))
|
|
{
|
|
isOn = true;
|
|
tips.text = isOn ? "ÒÑ×°Åä" : "";
|
|
}
|
|
GetControl<Image>("iconBtn").sprite = Resources.Load<Sprite>(Const.LoadToolAndMaterialPath + _itemInfo.toolName);
|
|
}
|
|
|
|
protected override void OnClick(string btnName)
|
|
{
|
|
base.OnClick(btnName);
|
|
switch (btnName)
|
|
{
|
|
case "iconBtn":
|
|
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(itemInfo.triggerID, true) == 0)
|
|
{
|
|
isOn = !isOn;
|
|
tips.text = isOn ? "ÒÑ×°Åä" : "";
|
|
PacksackBagMgr.Instance.WearItemState(itemInfo, isOn);
|
|
TooRoomMannger.Instance.Wear(itemInfo.toolName, isOn);
|
|
}
|
|
Debug.Log("IconBtn");
|
|
break;
|
|
case "UI_CheckMyselfItem":
|
|
Debug.Log("UI_CheckMyselfItem");
|
|
//TODO something
|
|
break;
|
|
}
|
|
}
|
|
} |