Ejemplo n.º 1
0
        } // SetNullProperty

        public Panel SetAction(PanelActionName actionName, Action act)
        {
            if (this.panelActions.ContainsKey(actionName))
            {
#if PANELS_DEBUG_ON
                Debug.LogWarning(string.Format("[Panel][SetAction] Panel '{0}' already has action '{1}'. Forgot to reset?", this.gameObject.name, actionName));
#endif
                this.panelActions[actionName] = act;
                return(this);
            }
            this.panelActions.Add(actionName, act);
            return(this);
        } // SetAction
Ejemplo n.º 2
0
        public virtual void OnClick(string action)
        {
            if (this.panelActions == null || this.panelActions.Count == 0)
            {
#if PANELS_DEBUG_ON
                Debug.LogWarning("[Panel][OnClick] 'panelActions' is not inited!");
#endif
                return;
            }
            action = action.Trim().ToLowerInvariant();
            PanelActionName actionName = panelActions.Keys.FirstOrDefault((a) => a.ToString() == action);
            if (actionName == PanelActionName.none)
            {
#if PANELS_DEBUG_ON
                Debug.LogWarning(string.Format("[Panel][OnClick] Action '{0}' is not found in 'panelActions'", action));
#endif
                return;
            }
            this.panelActions[actionName].Invoke();
        } // OnClick