64 lines
1.3 KiB
C#
64 lines
1.3 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.Pool;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.EventSystems;
|
|
using WI;
|
|
|
|
public class UI_MachineInfoItem : UIBase,IPooledObject
|
|
{
|
|
TextMeshProUGUI InfoName;
|
|
TextMeshProUGUI Data;
|
|
Toggle Toggle_Check;
|
|
public Action<string, bool> onFavoritItem;
|
|
|
|
public IObjectPool<Component> Pool { get ; set ; }
|
|
|
|
public override void AfterAwake()
|
|
{
|
|
Toggle_Check.onValueChanged.AddListener(OnToggleFavoritClick);
|
|
}
|
|
|
|
public void Setting(string tag, string info)
|
|
{
|
|
InfoName.text = tag;
|
|
|
|
if (info == string.Empty || info == null)
|
|
{
|
|
Data.SetText("-");
|
|
}
|
|
else
|
|
{
|
|
Data.SetText(info);
|
|
}
|
|
|
|
transform.localScale = Vector3.one;
|
|
}
|
|
|
|
public void Lock()
|
|
{
|
|
Toggle_Check.interactable = false;
|
|
}
|
|
|
|
public void Unlock()
|
|
{
|
|
Toggle_Check.interactable = true;
|
|
}
|
|
public void SetAcitveCheckBox(bool isOn)
|
|
{
|
|
Toggle_Check.gameObject.SetActive(isOn);
|
|
}
|
|
public void ToggleIsOn(bool isOn)
|
|
{
|
|
Toggle_Check.SetIsOnWithoutNotify(isOn);
|
|
}
|
|
|
|
private void OnToggleFavoritClick(bool isOn)
|
|
{
|
|
onFavoritItem?.Invoke(InfoName.text, isOn);
|
|
}
|
|
}
|