Пример #1
0
 public static GenericMenu AddColorMenu(GenericMenu menu, string root, int selectedColorIndex, GenericMenu.MenuFunction2 function)
 {
     root = Menus.MakeMenuRoot(root);
     for (int i = 0; i < 8; i++)
     {
         string text = PlayMakerPrefs.get_ColorNames()[i];
         menu.AddItem(new GUIContent(root + text), selectedColorIndex == i, function, i);
     }
     menu.AddSeparator(root);
     for (int j = 8; j < 24; j++)
     {
         string text2 = PlayMakerPrefs.get_ColorNames()[j];
         if (!string.IsNullOrEmpty(text2))
         {
             menu.AddItem(new GUIContent(root + text2), selectedColorIndex == j, function, j);
         }
     }
     return(menu);
 }
Пример #2
0
        private void DrawTimelineBar(float startTime, float endTime, SkillState state)
        {
            if (state == null)
            {
                return;
            }
            this.stateBox.Set(startTime * this.timeScale, 0f, (endTime - startTime) * this.timeScale, 20f);
            GUI.set_backgroundColor(PlayMakerPrefs.get_Colors()[state.get_ColorIndex()]);
            GUI.Box(this.stateBox, new GUIContent("", state.get_Name()), SkillEditorStyles.TimelineBar);
            GUI.set_backgroundColor(Color.get_white());
            GUIStyle gUIStyle = SkillEditorStyles.TimelineBarText;

            if (startTime < this.timelineControl.VisibleRangeStart)
            {
                this.stateBox.set_x(this.timelineControl.VisibleRangeStart * this.timeScale);
                this.stateBox.set_width((endTime - this.timelineControl.VisibleRangeStart) * this.timeScale);
                gUIStyle = SkillEditorStyles.TimelineLabelLeft;
            }
            if (GUI.Button(this.stateBox, state.get_Name(), gUIStyle))
            {
                this.SelectFsm(state.get_Fsm());
                this.TimelineClicked(startTime);
            }
        }
Пример #3
0
        private void DoLogLine(SkillLogEntry entry, int index)
        {
            if (!this.EntryIsVisible(entry))
            {
                return;
            }
            if (entry.get_LogType() == 6)
            {
                this.currentState = entry.get_State();
                SkillEditorGUILayout.Divider(new GUILayoutOption[0]);
            }
            if (this.selectedEntry != null && index > this.selectedEntryIndex)
            {
                GUI.set_color(new Color(1f, 1f, 1f, 0.3f));
            }
            if (entry.get_LogType() == 9 || entry.get_LogType() == 10)
            {
                GUI.set_backgroundColor(SkillEditorStyles.DefaultBackgroundColor);
            }
            else
            {
                GUI.set_backgroundColor((this.currentState != null) ? PlayMakerPrefs.get_Colors()[this.currentState.get_ColorIndex()] : Color.get_grey());
            }
            GUILayout.BeginVertical(SkillEditorStyles.LogBackground, new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            Color backgroundColor = GUI.get_backgroundColor();

            GUI.set_backgroundColor(Color.get_white());
            GUIStyle gUIStyle = SkillEditorStyles.GetLogTypeStyles()[entry.get_LogType()];

            GUILayout.Label("", gUIStyle, new GUILayoutOption[]
            {
                GUILayout.MaxWidth(20f)
            });
            GUI.set_backgroundColor(backgroundColor);
            gUIStyle = SkillEditorStyles.LogLine;
            if (GUILayout.Button(FsmEditorSettings.LogShowTimecode ? entry.get_TextWithTimecode() : entry.get_Text(), gUIStyle, new GUILayoutOption[0]))
            {
                this.SelectLogEntry(entry);
            }
            GUILayout.EndHorizontal();
            if (this.ShowSentBy(entry))
            {
                if (string.IsNullOrEmpty(entry.get_Text2()))
                {
                    entry.set_Text2(Strings.get_FsmLog_Label_Sent_By() + Labels.GetFullStateLabel(entry.get_SentByState()));
                    if (entry.get_Action() != null)
                    {
                        entry.set_Text2(entry.get_Text2() + " : " + Labels.GetActionLabel(entry.get_Action()));
                    }
                }
                if (GUILayout.Button(entry.get_Text2(), SkillEditorStyles.LogLine2, new GUILayoutOption[0]))
                {
                    SkillLogger.OnClickSentBy(entry);
                }
                EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), 4);
            }
            else
            {
                if (this.ShowEventTarget(entry))
                {
                    if (string.IsNullOrEmpty(entry.get_Text2()))
                    {
                        entry.set_Text2(Strings.get_FsmLog_Label_Target() + SkillLogger.GetEventTargetLabel(entry));
                    }
                    if (GUILayout.Button(entry.get_Text2(), SkillEditorStyles.LogLine2, new GUILayoutOption[0]))
                    {
                        this.OnClickEventTarget(entry);
                        GUIUtility.ExitGUI();
                        return;
                    }
                    EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), 4);
                }
                else
                {
                    if (this.ShowHitGameObject(entry))
                    {
                        if (string.IsNullOrEmpty(entry.get_Text2()))
                        {
                            entry.set_Text2("WITH: " + entry.get_GameObjectName());
                            entry.set_GameObjectIcon(EditorHacks.GetIconForObject(entry.get_GameObject()));
                        }
                        if (entry.get_GameObject() != null)
                        {
                            if (GUILayout.Button(entry.get_Text2(), SkillEditorStyles.LogLine2, new GUILayoutOption[0]))
                            {
                                Selection.set_activeGameObject(entry.get_GameObject());
                                GUIUtility.ExitGUI();
                                return;
                            }
                            Rect lastRect = GUILayoutUtility.GetLastRect();
                            EditorGUIUtility.AddCursorRect(lastRect, 4);
                            if (entry.get_GameObjectIcon() != null)
                            {
                                lastRect.Set(lastRect.get_xMin(), lastRect.get_yMin() + 2f, 27f, lastRect.get_height() - 2f);
                                GUI.Label(lastRect, entry.get_GameObjectIcon());
                            }
                        }
                        else
                        {
                            GUILayout.Label(entry.get_Text2() + " (Destroyed)", SkillEditorStyles.LogLine2, new GUILayoutOption[0]);
                        }
                    }
                }
            }
            GUILayout.EndVertical();
            if (entry == this.selectedEntry)
            {
                this.beforeSelected = this.prevEntry;
                GUI.set_backgroundColor(Color.get_white());
                GUILayout.Box(GUIContent.none, SkillEditorStyles.LogLineTimeline, new GUILayoutOption[0]);
            }
            if (this.prevEntry == this.selectedEntry)
            {
                this.afterSelected = entry;
            }
            this.prevEntry = entry;
            this.numEntriesDrawn++;
        }
Пример #4
0
 public static void SaveChanges()
 {
     PlayMakerPrefs.UpdateMinimapColors();
 }