using UnityEngine; using UnityEngine.UI; using ModTool; using TMPro; public class ModItem : MonoBehaviour { [SerializeField] public TextMeshProUGUI modName; [SerializeField] public TextMeshProUGUI modInfo; public Text modType; public Toggle toggle; public Mod mod; /// /// Initialze this ModItem with a Mod and ModMenu. /// /// /// public void Initialize(Mod mod) { this.mod = mod; modName.text = mod.name; modType.text = mod.contentType.ToString(); toggle.isOn = mod.isEnabled; toggle.onValueChanged.AddListener( value => Toggle(value)); } /// /// Toggle whether the mod should be loaded /// public void Toggle(bool isEnabled) { mod.isEnabled = isEnabled; } /// /// Enable or disable this ModItem's toggle. /// /// public void SetToggleInteractable(bool interactable) { toggle.interactable = interactable; } }