Files
ChunilENG/Assets/Scripts/UI/UI_MachineInfoItem.cs

64 lines
1.3 KiB
C#
Raw Normal View History

2025-02-20 09:59:37 +09:00
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.Pool;
using UnityEngine.UI;
2025-04-17 16:36:08 +09:00
using UnityEngine.EventSystems;
2025-02-20 09:59:37 +09:00
using WI;
public class UI_MachineInfoItem : UIBase,IPooledObject
2025-02-20 09:59:37 +09:00
{
2025-02-25 17:31:42 +09:00
TextMeshProUGUI InfoName;
TextMeshProUGUI Data;
Toggle Toggle_Check;
2025-02-20 09:59:37 +09:00
public Action<string, bool> onFavoritItem;
public IObjectPool<Component> Pool { get ; set ; }
public override void AfterAwake()
{
2025-02-25 17:31:42 +09:00
Toggle_Check.onValueChanged.AddListener(OnToggleFavoritClick);
2025-02-20 09:59:37 +09:00
}
public void Setting(string tag, string info)
{
2025-02-25 17:31:42 +09:00
InfoName.text = tag;
2025-04-28 15:59:32 +09:00
if (info == string.Empty || info == null)
{
Data.SetText("-");
}
else
{
Data.SetText(info);
}
2025-02-20 09:59:37 +09:00
transform.localScale = Vector3.one;
}
public void Lock()
{
2025-02-25 17:31:42 +09:00
Toggle_Check.interactable = false;
2025-02-20 09:59:37 +09:00
}
public void Unlock()
{
2025-02-25 17:31:42 +09:00
Toggle_Check.interactable = true;
2025-02-20 09:59:37 +09:00
}
public void SetAcitveCheckBox(bool isOn)
{
Toggle_Check.gameObject.SetActive(isOn);
}
2025-02-20 09:59:37 +09:00
public void ToggleIsOn(bool isOn)
{
2025-02-25 17:31:42 +09:00
Toggle_Check.SetIsOnWithoutNotify(isOn);
2025-02-20 09:59:37 +09:00
}
private void OnToggleFavoritClick(bool isOn)
{
2025-02-25 17:31:42 +09:00
onFavoritItem?.Invoke(InfoName.text, isOn);
2025-02-20 09:59:37 +09:00
}
}