예제 #1
0
        /// <summary>
        /// Draws the embeded event popup.
        /// </summary>
        /// <returns>The popup.</returns>
        /// <param name="_component">Component.</param>
        /// <param name="_event">Event.</param>
        /// <param name="_methods">Methods.</param>
        /// <param name="_custom">Custom.</param>
        /// <param name="_help">Help.</param>
        /// <param name="_title">Title.</param>
        /// <param name="_hint">Hint.</param>
        public static BehaviourEventInfo EventPopup(ICEWorldBehaviour _component, BehaviourEventInfo _event, BehaviourEventInfo[] _events, ref bool _custom, string _help = "", string _title = "", string _hint = "")
        {
            if (string.IsNullOrEmpty(_title))
            {
                _title = "Event";
            }
            if (string.IsNullOrEmpty(_hint))
            {
                _hint = "";
            }
            if (string.IsNullOrEmpty(_help))
            {
                _help = Info.EVENT_POPUP;
            }

            ICEEditorLayout.BeginHorizontal();
            _event = EventPopupLine(_component, _event, _events, ref _custom, _help, _title, _hint);
            ICEEditorLayout.EndHorizontal(_help);
            return(_event);
        }
예제 #2
0
        /// <summary>
        /// Draws the basic event popup line.
        /// </summary>
        /// <returns>The message popup.</returns>
        /// <param name="_title">Title.</param>
        /// <param name="_hint">Hint.</param>
        /// <param name="_component">Component.</param>
        /// <param name="_msg">Message.</param>
        /// <param name="_messages">Messages.</param>
        /// <param name="_custom">Custom.</param>
        /// <param name="_help">Help.</param>
        public static BehaviourEventInfo EventPopupLine(ICEWorldBehaviour _component, BehaviourEventInfo _event, BehaviourEventInfo[] _events, ref bool _custom, string _help = "", string _title = "", string _hint = "")
        {
            if (_custom || _events.Length == 0)
            {
                _event.ComponentName = "";
                _event.FunctionName  = ICEEditorLayout.Text(_title, _hint, _event.FunctionName, "");
                int indent = EditorGUI.indentLevel;
                EditorGUI.indentLevel = 0;
                _event.ParameterType  = (BehaviourEventParameterType)EditorGUILayout.EnumPopup(_event.ParameterType, GUILayout.Width(60));
                EditorGUI.indentLevel = indent;

                _custom = true;
            }
            else
            {
                string[] _array = new string[_events.Length + 1];
                _array[0] = " ";

                for (int i = 0; i < _events.Length; i++)
                {
                    _array[i + 1] = _events[i].Key;
                }

                int _selected = ICEEditorLayout.Popup(_title, _hint, EditorTools.StringToIndex(_event.Key, _array), _array, "");

                if (_selected == 0)
                {
                    _event.Reset();
                }
                else
                {
                    for (int i = 0; i < _events.Length; i++)
                    {
                        if (_events[i].Key == _array[_selected])
                        {
                            _event.Copy(_events[i]);
                        }
                    }
                }
            }


            EditorGUI.BeginDisabledGroup(_events.Length == 0);
            _custom = ICEEditorLayout.CheckButtonMiddle("CUSTOM", "", _custom);
            EditorGUI.EndDisabledGroup();

            return(_event);
        }