Esempio n. 1
0
        private void OnDrawInfo(StateRoot target)
        {
            GUI.changed = false;

            EditorGUILayout.BeginHorizontal("box");
            //m_IsShowRecord = EditorGUILayout.Toggle("记录按钮", m_IsShowRecord);
            var isClickSwitchState = EditorGUILayout.Toggle("点击切换状态", target.isClickSwitchState);

            EditorGUILayout.EndHorizontal();

            if (GUI.changed)
            {
                RegisterUndo();
                target.isClickSwitchState = isClickSwitchState;
            }
        }
Esempio n. 2
0
        private void OnDrawEventInfo(StateRoot target)
        {
            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical("box");
            var btn = EditorGUILayout.ObjectField("按钮", target.currentButton, typeof(Button), true) as Button;

            if (btn != target.currentButton)
            {
                RegisterUndo();
                target.currentButton = btn;
            }
            EditorGUILayout.Space();

            EditorGUILayout.PropertyField(onStateChangeProperty);
            EditorGUILayout.PropertyField(onClickProperty);

            EditorGUILayout.EndVertical();
        }
Esempio n. 3
0
        private void OnDrawElement(StateRoot target)
        {
            EditorGUI.indentLevel++;
            EditorGUILayout.BeginVertical("box");
            m_ShowElement = EditorGUILayout.Foldout(m_ShowElement, "元素");
            if (m_ShowElement)
            {
                EditorGUI.indentLevel++;
                if (target.elements != null)
                {
                    for (int i = 0; i < target.elements.Count;)
                    {
                        if (StateElementDraw.DrawElement(target.elements[i]))
                        {
                            RegisterUndo();
                            target.RemoveElement(target.elements[i]);
                        }
                        else
                        {
                            ++i;
                        }
                    }
                }

                //增加按钮
                int idx = StateElementDraw.DrawType();
                if (idx != -1)
                {
                    RegisterUndo();
                    target.AddElement((Type)idx);
                }
                EditorGUI.indentLevel--;
            }
            EditorGUI.indentLevel--;

            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();
        }
Esempio n. 4
0
        public void OnSelect(int selIndex)
        {
            StateRoot s     = null;
            int       index = -1;

            for (int i = 0; i < list.Count; ++i)
            {
                if (i == selIndex)
                {
                    s     = list[i];
                    index = i;
                }
                else
                {
                    list[i].currentState = 0;
                }
            }

            if (s != null && s.currentState != 1)
            {
                s.currentState = 1;
            }
            OnSelectChange?.Invoke(s, index);
        }