// ------------------------------------------------------------------------------- public virtual void init(GameObject _localPlayer, UIButtonGroup _buttonGroup = null) { button.onClick.RemoveAllListeners(); localPlayer = _localPlayer; if (delayDuration <= 0 && _buttonGroup == null) { return; } buttonGroup = _buttonGroup; _interactable = button.interactable; if (buttonGroup) { buttonGroup.Add(this); } button.onClick.AddListener(() => { if (buttonGroup) { buttonGroup.OnPressed(); } else { OnPressed(); } }); }
// ------------------------------------------------------------------------------- public override void init(GameObject _localPlayer, UIButtonGroup _buttonGroup = null) { base.init(_localPlayer, _buttonGroup); if (manager == null) { manager = localPlayer.GetComponent <PermissionManager>(); } button.interactable = manager.CheckRequirements(objectType, actionType); button.onClick.AddListener(() => { targetPanel.Show(category); }); }
// ------------------------------------------------------------------------------- protected override void ThrottledUpdate() { windowPanel.SetActive(localPlayer != null); if (localPlayer == null) { return; } if (buttonGroup == null) { buttonGroup = GetComponent <UIButtonGroup>(); } if (buttonGroup != null) { buttonGroup.Clear(); } foreach (GameObject go in navigationButtons) { go.GetComponent <UIButton>().init(localPlayer, buttonGroup); } }