Beispiel #1
0
    private void OnGUIFSMState()
    {
        if (m_curFsmStateSet == null)
        {
            return;
        }

        EditorGUILayout.BeginVertical("box", GUILayout.MinWidth(200), GUILayout.MinHeight(200));
        {
            GUILayout.Label("State List", EditorStyles.boldLabel);
            m_stateScrollPosition = GUILayout.BeginScrollView(m_stateScrollPosition);
            {
                var stateElementList = m_curFsmStateSet.stateElementList;
                for (int i = 0; i < stateElementList.Count; ++i)
                {
                    string name = stateElementList[i].StateName;

                    bool selected = i == m_selectedStateIndex;
                    EditorGUIUtil.Label(name, selected, 0, 2, EditorGUIUtil.GetSelectedTextColorByEditorSkin(selected));

                    if (EditorGUIEventUtil.IsLastRectClicked())
                    {
                        SelectState(i);
                    }
                }
            }
            GUILayout.EndScrollView();
        }
        EditorGUILayout.EndVertical();
    }
Beispiel #2
0
    private void OnGUI()
    {
        EditorGUILayout.BeginVertical();
        {
            EditorGUILayout.BeginHorizontal();
            {
                OnGUIEventList();

                OnGUIEventFilter();
            }
            EditorGUILayout.EndHorizontal();

            OnGUIEventLogDetail();
        }
        EditorGUILayout.EndVertical();

        EditorGUIEventUtil.ResetFocus();
    }
Beispiel #3
0
    private void OnGUICharacterViewInfoList()
    {
        GUI.enabled = Application.isPlaying;

        EditorGUILayout.BeginVertical("box");
        {
            GUI.color = Color.cyan;
            eActorEditorType newState = (eActorEditorType)GUILayout.Toolbar((int)m_actorEditorType, System.Enum.GetNames(typeof(eActorEditorType)));
            GUI.color = Color.white;
            if (m_actorEditorType != newState)
            {
                m_actorEditorType = newState;
                RefreshCharacterList();
            }

            m_lookDBInfoScrollPosition = EditorGUILayout.BeginScrollView(m_lookDBInfoScrollPosition, GUILayout.MinHeight(160));
            {
                for (int i = 0; i < m_actorInfoList.Count; ++i)
                {
                    BaseEntityInfo actorInfo = m_actorInfoList[i];

                    bool selected = i == GetSelectedLookIndex(m_actorEditorType);

                    EditorGUIUtil.Label(actorInfo.Name, selected, 0, 2, EditorGUIUtil.GetSelectedTextColorByEditorSkin(selected));
                    if (EditorGUIEventUtil.IsLastRectClicked())
                    {
                        CreateActorBySelectLookID(i, m_actorEditorType);
                    }
                }
            }
            EditorGUILayout.EndScrollView();

            GUI.enabled = true;
            string play  = Application.isPlaying == false ? "Play" : "Stop";
            Color  color = Application.isPlaying == false ? Color.green : Color.red;
            GUI.color = color;
            if (GUILayout.Button(play, GUILayout.Height(25)))
            {
                playLookDeveloper = true;
            }
            GUI.color = Color.white;
        }
        EditorGUILayout.EndVertical();
    }
Beispiel #4
0
    private void OnGUIFSMTransition()
    {
        if (m_selectFsmStateElement == null)
        {
            return;
        }

        GUILayout.BeginVertical("box", GUILayout.MinHeight(200));
        {
            GUILayout.Label("State Transition", EditorStyles.boldLabel);
            m_actorFsmStateTransitionScrollPosition = GUILayout.BeginScrollView(m_actorFsmStateTransitionScrollPosition);
            {
                for (int i = 0; i < m_selectFsmStateElement.LstGlobalTransition.Count; ++i)
                {
                    string name = m_selectFsmStateElement.LstGlobalTransition[i];

                    bool selected = i == m_selectedStateTransitionIndex;
                    EditorGUIUtil.Label(name, selected, 0, 2, selected ? Color.green : Color.red);
                    if (EditorGUIEventUtil.IsLastRectClicked())
                    {
                        SelectStateTransition(i);
                    }
                }

                for (int i = 0; i < m_selectFsmStateElement.LstTransition.Count; ++i)
                {
                    string name = m_selectFsmStateElement.LstTransition[i];

                    bool selected = i == m_selectedStateTransitionIndex;
                    EditorGUIUtil.Label(name, selected, 0, 2, EditorGUIUtil.GetSelectedTextColorByEditorSkin(selected));
                    if (EditorGUIEventUtil.IsLastRectClicked())
                    {
                        SelectStateTransition(i);
                    }
                }
            }
            GUILayout.EndScrollView();
        }
        GUILayout.EndVertical();
    }
Beispiel #5
0
        private void OnGUIHeader()
        {
            EditorGUILayout.BeginHorizontal();
            {
                GUI.color = Color.green;
                for (int i = 0; i < columnList.Count; ++i)
                {
                    Column column = columnList[i];
                    if (column.Width != -1)
                    {
                        GUILayout.Label(column.Title, EditorGUIStyle.header, GUILayout.Width(column.Width));
                    }
                    else
                    {
                        GUILayout.Label(column.Title, EditorGUIStyle.header);
                    }
                    labelRect[i] = GUILayoutUtility.GetLastRect();
                    if (i == columnList.Count - 1)
                    {
                        labelRect[i].width -= 12;
                    }

                    if (EditorGUIEventUtil.IsRectClicked(labelRect[i], 0))
                    {
                        column.OnLeftClickColumn();
                    }

                    if (EditorGUIEventUtil.IsRectClicked(labelRect[i], 1))
                    {
                        column.OnRightClickColumn();
                    }
                }
                GUI.color = Color.white;
            }
            EditorGUILayout.EndHorizontal();
        }
Beispiel #6
0
        private void OnGUIItemList(int viewCount, float canvasHeight = 0f)
        {
            KeyCode keyCode = KeyCode.None;

            GUI.color = Color.yellow;
            if (style == Style.Label)
            {
                for (int r = 0; r < rowProvider.GetCount(); ++r)
                {
                    Row row = rowProvider.GetRow(r);
                    if (!row.Visible)
                    {
                        continue;
                    }
                    OnGUILayoutRow(row, false, false);
                }
            }
            else if (style == Style.Button)
            {
                for (int r = 0; r < rowProvider.GetCount(); ++r)
                {
                    Row row = rowProvider.GetRow(r);
                    if (!row.Visible)
                    {
                        continue;
                    }

                    if (expandWidth)
                    {
                        if (GUILayout.Button(string.Empty))
                        {
                            if (onClickRow != null)
                            {
                                onClickRow(row);
                            }
                        }
                    }
                    else
                    {
                        if (GUILayout.Button(string.Empty, GUILayout.Width(totalWidth)))
                        {
                            if (onClickRow != null)
                            {
                                onClickRow(row);
                            }
                        }
                    }

                    Rect rowRect = GUILayoutUtility.GetLastRect();
                    OnGUIRow(row, rowRect.y);
                }
            }
            else if (style == Style.ToggleButton)
            {
                for (int r = 0; r < rowList.Count; ++r)
                {
                    Row row = rowList[r];
                    if (!row.Visible)
                    {
                        continue;
                    }

                    bool oldSelected = row.Selected;
                    row.Selected = GUILayout.Toggle(row.Selected, string.Empty, "button");
                    if (row.Selected != oldSelected)
                    {
                        if (onClickRow != null)
                        {
                            onClickRow(row);
                        }
                    }

                    Rect rowRect = GUILayoutUtility.GetLastRect();
                    OnGUIRow(row, rowRect.y);
                }
            }
            else if (style == Style.SelectOneRow)
            {
                int cursor   = -1;
                int count    = 0;
                int rowstart = 0;
                int rowEnd   = rowList.Count;
                if (viewCount > 0)
                {
                    if (viewCount < rowList.Count)
                    {
                        rowstart = rowList.Count - viewCount;
                    }
                }

                if (goPage > 0 && goPage != rowList.Count / viewCount)
                {
                    int tempstart = viewCount * goPage;
                    if (rowEnd < tempstart)
                    {
                        return;
                    }
                    else
                    {
                        rowstart = tempstart;
                        if (rowEnd > tempstart + viewCount)
                        {
                            rowEnd = tempstart + viewCount;
                        }
                    }
                }

                for (int r = rowstart; r < rowEnd; ++r)
                {
                    Row row = rowList[r];
                    if (!row.Visible)
                    {
                        continue;
                    }

                    Rect rect = OnGUILayoutRow(row, false, row.Selected);

                    if (EditorGUIEventUtil.IsRectDblClicked(rect, 0))
                    {
                        if (onDblClickRow != null)
                        {
                            onDblClickRow(row);
                        }
                    }

                    if (EditorGUIEventUtil.IsRectClicked(rect, 1))
                    {
                        if (onRightClickRow != null)
                        {
                            onRightClickRow(row);
                        }
                    }

                    if (EditorGUIEventUtil.IsRectClicked(rect, 0))
                    {
                        for (int i = 0; i < rowList.Count; ++i)
                        {
                            rowList[i].Selected = rowList[i] == row;
                        }

                        rowCursor = r;
                        if (onClickRow != null)
                        {
                            onClickRow(row);
                        }
                    }

                    if (row.Selected)
                    {
                        cursor = count;
                    }
                    count++;
                }

                if (HandleKeyboard && EditorGUIEventUtil.ListKeyHandler(out keyCode, ref cursor, count))
                {
                    ScrollTo(keyCode, canvasHeight);
                    int counter = 0;
                    for (int i = 0; i < rowList.Count; ++i)
                    {
                        if (!rowList[i].Visible)
                        {
                            continue;
                        }
                        bool selected = counter == cursor;
                        rowList[i].Selected = selected;

                        if (selected)
                        {
                            rowCursor = i;
                            if (onClickRow != null)
                            {
                                onClickRow(rowList[i]);
                            }
                        }
                        counter++;
                    }
                }
            }
            else if (style == Style.SelectMultipleRows)
            {
                int cursor = rowCursor;
                int count  = 0;
                for (int r = 0; r < rowList.Count; ++r)
                {
                    Row row = rowList[r];
                    if (!row.Visible)
                    {
                        continue;
                    }

                    Rect rect = OnGUILayoutRow(row, false, row.Selected);

                    if (EditorGUIEventUtil.IsRectDblClicked(rect, 0))
                    {
                        if (onDblClickRow != null)
                        {
                            onDblClickRow(row);
                        }
                    }

                    if (EditorGUIEventUtil.IsRectClicked(rect, 1))
                    {
                        if (onRightClickRow != null)
                        {
                            onRightClickRow(row);
                        }
                    }

                    if (EditorGUIEventUtil.IsRectClicked(rect, 0))
                    {
                        if (Event.current.control)
                        {
                            row.Selected = !row.Selected;
                        }
                        else if (Event.current.shift && rowCursor != -1)
                        {
                            if (r < cursor)
                            {
                                for (int i = r; i < cursor; ++i)
                                {
                                    rowList[i].Selected = true;
                                }
                            }
                            else
                            {
                                for (int i = cursor; i <= r; ++i)
                                {
                                    rowList[i].Selected = true;
                                }
                            }
                        }
                        else
                        {
                            rowCursor = r;
                            for (int i = 0; i < rowList.Count; ++i)
                            {
                                rowList[i].Selected = rowList[i] == row;
                            }
                        }
                        if (onClickRow != null)
                        {
                            onClickRow(row);
                        }
                    }
                    count++;
                }

                if (HandleKeyboard && EditorGUIEventUtil.ListKeyHandler(out keyCode, ref rowCursor, count))
                {
                    for (int i = 0; i < rowList.Count; ++i)
                    {
                        rowList[i].Selected = i == rowCursor;
                    }
                }
            }
            GUI.color = Color.white;
        }