コード例 #1
0
ファイル: NodeDesigner.cs プロジェクト: mengtest/StateTree
        private Rect Rectangle(Vector2 offset)
        {
            if (!this.mRectIsDirty)
            {
                return(this.mRectangle);
            }
            this.mCacheIsDirty = true;
            if (this.mTask == null)
            {
                return(default(Rect));
            }
            float num = BehaviorDesignerUtility.TaskTitleGUIStyle.CalcSize(new GUIContent(this.ToString())).x + 20f;

            if (!this.isParent)
            {
                float num2;
                float num3;
                BehaviorDesignerUtility.TaskCommentGUIStyle.CalcMinMaxWidth(new GUIContent(this.mTask.NodeData.Comment), out num2, out num3);
                num3 += 20f;
                num   = ((num <= num3) ? num3 : num);
            }
            num = Mathf.Min(220f, Mathf.Max(100f, num));
            Vector2 absolutePosition = this.GetAbsolutePosition();
            float   num4             = (float)(20 + ((!BehaviorDesignerPreferences.GetBool(BDPreferences.CompactMode)) ? 52 : 22));

            this.mRectangle   = new Rect(absolutePosition.x + offset.x - num / 2f, absolutePosition.y + offset.y, num, num4);
            this.mRectIsDirty = false;
            return(this.mRectangle);
        }
コード例 #2
0
ファイル: NodeDesigner.cs プロジェクト: mengtest/StateTree
 private void DrawNodeTexture(Rect nodeRect, Texture2D connectionTopTexture, Texture2D connectionBottomTexture, GUIStyle backgroundGUIStyle, Texture2D iconBorderTexture)
 {
     if (!this.isEntryDisplay)
     {
         GUI.DrawTexture(this.incomingConnectionTextureRect, connectionTopTexture, (ScaleMode)2);
     }
     if (this.isParent)
     {
         GUI.DrawTexture(this.outgoingConnectionTextureRect, connectionBottomTexture, (ScaleMode)2);
     }
     GUI.Label(nodeRect, string.Empty, backgroundGUIStyle);
     if (this.mTask.NodeData.ExecutionStatus == TaskStatus.Success)
     {
         if (this.mTask.NodeData.IsReevaluating)
         {
             GUI.DrawTexture(this.successReevaluatingExecutionStatusTextureRect, BehaviorDesignerUtility.ExecutionSuccessRepeatTexture);
         }
         else
         {
             GUI.DrawTexture(this.successExecutionStatusTextureRect, BehaviorDesignerUtility.ExecutionSuccessTexture);
         }
     }
     else if (this.mTask.NodeData.ExecutionStatus == TaskStatus.Failure)
     {
         GUI.DrawTexture(this.failureExecutionStatusTextureRect, (!this.mTask.NodeData.IsReevaluating) ? BehaviorDesignerUtility.ExecutionFailureTexture : BehaviorDesignerUtility.ExecutionFailureRepeatTexture);
     }
     if (!BehaviorDesignerPreferences.GetBool(BDPreferences.CompactMode))
     {
         GUI.DrawTexture(this.iconBorderTextureRect, iconBorderTexture);
     }
 }
コード例 #3
0
        public void OnGUI()
        {
            this.mScrollPosition = EditorGUILayout.BeginScrollView(this.mScrollPosition, new GUILayoutOption[0]);
            if (this.mErrorDetails != null && this.mErrorDetails.Count > 0)
            {
                for (int i = 0; i < this.mErrorDetails.Count; i++)
                {
                    ErrorDetails errorDetails = this.mErrorDetails[i];
                    if (errorDetails != null && !(errorDetails.NodeDesigner == null) && errorDetails.NodeDesigner.Task != null)
                    {
                        string text = string.Empty;
                        switch (errorDetails.Type)
                        {
                        case BehaviorDesigner.Editor.ErrorDetails.ErrorType.RequiredField:
                            text = string.Format("The task {0} ({1}, index {2}) requires a value for the field {3}.", new object[]
                            {
                                errorDetails.TaskFriendlyName,
                                errorDetails.TaskType,
                                errorDetails.NodeDesigner.Task.ID,
                                BehaviorDesignerUtility.SplitCamelCase(errorDetails.FieldName)
                            });
                            break;

                        case BehaviorDesigner.Editor.ErrorDetails.ErrorType.SharedVariable:
                            text = string.Format("The task {0} ({1}, index {2}) has a Shared Variable field ({3}) that is marked as shared but is not referencing a Shared Variable.", new object[]
                            {
                                errorDetails.TaskFriendlyName,
                                errorDetails.TaskType,
                                errorDetails.NodeDesigner.Task.ID,
                                BehaviorDesignerUtility.SplitCamelCase(errorDetails.FieldName)
                            });
                            break;

                        case BehaviorDesigner.Editor.ErrorDetails.ErrorType.MissingChildren:
                            text = string.Format("The {0} task ({1}, index {2}) is a parent task which does not have any children", errorDetails.TaskFriendlyName, errorDetails.TaskType, errorDetails.NodeDesigner.Task.ID);
                            break;

                        case BehaviorDesigner.Editor.ErrorDetails.ErrorType.UnknownTask:
                            text = string.Format("The task at index {0} is unknown. Has a task been renamed or deleted?", errorDetails.NodeDesigner.Task.ID);
                            break;
                        }
                        EditorGUILayout.LabelField(text, (i % 2 != 0) ? BehaviorDesignerUtility.ErrorListDarkBackground : BehaviorDesignerUtility.ErrorListLightBackground, new GUILayoutOption[]
                        {
                            GUILayout.Height(30f),
                            GUILayout.Width((float)(Screen.width - 7))
                        });
                    }
                }
            }
            else if (!BehaviorDesignerPreferences.GetBool(BDPreferences.ErrorChecking))
            {
                EditorGUILayout.LabelField("Enable realtime error checking from the preferences to view the errors.", BehaviorDesignerUtility.ErrorListLightBackground, new GUILayoutOption[0]);
            }
            else
            {
                EditorGUILayout.LabelField("The behavior tree has no errors.", BehaviorDesignerUtility.ErrorListLightBackground, new GUILayoutOption[0]);
            }
            EditorGUILayout.EndScrollView();
        }
コード例 #4
0
 private static bool FoldOut(int hash)
 {
     if (FieldInspector.foldoutDictionary.ContainsKey(hash))
     {
         return(FieldInspector.foldoutDictionary[hash]);
     }
     FieldInspector.foldoutDictionary.Add(hash, BehaviorDesignerPreferences.GetBool(BDPreferences.FoldoutFields));
     return(true);
 }
コード例 #5
0
ファイル: NodeDesigner.cs プロジェクト: mengtest/StateTree
        public Vector2 GetAbsolutePosition()
        {
            Vector2 vector = this.mTask.NodeData.Offset;

            if (this.parentNodeDesigner != null)
            {
                vector += this.parentNodeDesigner.GetAbsolutePosition();
            }
            if (BehaviorDesignerPreferences.GetBool(BDPreferences.SnapToGrid))
            {
                vector.Set(BehaviorDesignerUtility.RoundToNearest(vector.x, 10f), BehaviorDesignerUtility.RoundToNearest(vector.y, 10f));
            }
            return(vector);
        }
コード例 #6
0
 // Token: 0x060001A6 RID: 422 RVA: 0x0000F010 File Offset: 0x0000D210
 private void SerializeVariables()
 {
     if (this.mVariableSource == null)
     {
         this.mVariableSource = GlobalVariables.Instance;
     }
     if (BehaviorDesignerPreferences.GetBool(BDPreferences.BinarySerialization))
     {
         BinarySerialization.Save(this.mVariableSource);
     }
     else
     {
         JSONSerialization.Save(this.mVariableSource);
     }
 }
コード例 #7
0
 private static void HierarchyWindowItemOnGUI(int instanceID, Rect selectionRect)
 {
     if (BehaviorDesignerPreferences.GetBool(BDPreferences.ShowHierarchyIcon))
     {
         GameObject gameObject = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
         if (gameObject != null && gameObject.GetComponent <Behavior>() != null)
         {
             Rect position = new Rect(selectionRect);
             position.x      = position.width + (selectionRect.x - 16f);
             position.width  = 16f;
             position.height = 16f;
             GUI.DrawTexture(position, HierarchyIcon.icon);
         }
     }
 }
コード例 #8
0
        // Token: 0x060002B9 RID: 697 RVA: 0x0001AB2C File Offset: 0x00018D2C
        public static bool DrawVariables(IVariableSource variableSource, BehaviorSource behaviorSource, ref string variableName, ref bool focusNameField, ref int variableTypeIndex, ref Vector2 scrollPosition, ref List <float> variablePosition, ref float variableStartPosition, ref int selectedVariableIndex, ref string selectedVariableName, ref int selectedVariableTypeIndex)
        {
            scrollPosition = GUILayout.BeginScrollView(scrollPosition, new GUILayoutOption[0]);
            bool flag  = false;
            bool flag2 = false;
            List <SharedVariable> list = (variableSource == null) ? null : variableSource.GetAllVariables();

            if (VariableInspector.DrawHeader(variableSource, behaviorSource == null, ref variableStartPosition, ref variableName, ref focusNameField, ref variableTypeIndex, ref selectedVariableIndex, ref selectedVariableName, ref selectedVariableTypeIndex))
            {
                flag = true;
            }
            list = ((variableSource == null) ? null : variableSource.GetAllVariables());
            if (list != null && list.Count > 0)
            {
                GUI.enabled = !flag2;
                if (VariableInspector.DrawAllVariables(true, variableSource, ref list, true, ref variablePosition, ref selectedVariableIndex, ref selectedVariableName, ref selectedVariableTypeIndex, true, true))
                {
                    flag = true;
                }
            }
            if (flag && variableSource != null)
            {
                variableSource.SetAllVariables(list);
            }
            GUI.enabled = true;
            GUILayout.EndScrollView();
            if (flag && !EditorApplication.isPlayingOrWillChangePlaymode && behaviorSource != null && behaviorSource.Owner is Behavior)
            {
                Behavior behavior = behaviorSource.Owner as Behavior;
                if (behavior.ExternalBehavior != null)
                {
                    if (BehaviorDesignerPreferences.GetBool(BDPreferences.BinarySerialization))
                    {
                        BinarySerialization.Save(behaviorSource);
                    }
                    else
                    {
                        JSONSerialization.Save(behaviorSource);
                    }
                    BehaviorSource behaviorSource2 = behavior.ExternalBehavior.GetBehaviorSource();
                    behaviorSource2.CheckForSerialization(true, null);
                    VariableInspector.SyncVariables(behaviorSource2, list);
                }
            }
            return(flag);
        }
コード例 #9
0
 // Token: 0x06000187 RID: 391 RVA: 0x0000D71C File Offset: 0x0000B91C
 public static bool DrawInspectorGUI(BehaviorSource behaviorSource, bool fromInspector, ref bool showVariables)
 {
     EditorGUI.BeginChangeCheck();
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     EditorGUILayout.LabelField("Behavior Name", new GUILayoutOption[]
     {
         GUILayout.Width(120f)
     });
     behaviorSource.behaviorName = EditorGUILayout.TextField(behaviorSource.behaviorName, new GUILayoutOption[0]);
     if (fromInspector && GUILayout.Button("Open", new GUILayoutOption[0]))
     {
         BehaviorDesignerWindow.ShowWindow();
         BehaviorDesignerWindow.instance.LoadBehavior(behaviorSource, false, true);
     }
     GUILayout.EndHorizontal();
     EditorGUILayout.LabelField("Behavior Description", new GUILayoutOption[0]);
     behaviorSource.behaviorDescription = EditorGUILayout.TextArea(behaviorSource.behaviorDescription, new GUILayoutOption[]
     {
         GUILayout.Height(48f)
     });
     if (fromInspector)
     {
         string text = "BehaviorDesigner.VariablesFoldout." + behaviorSource.GetHashCode();
         if (showVariables = EditorGUILayout.Foldout(EditorPrefs.GetBool(text, true), "Variables"))
         {
             EditorGUI.indentLevel++;
             List <SharedVariable> allVariables = behaviorSource.GetAllVariables();
             if (allVariables != null && VariableInspector.DrawAllVariables(false, behaviorSource, ref allVariables, false, ref ExternalBehaviorInspector.variablePosition, ref ExternalBehaviorInspector.selectedVariableIndex, ref ExternalBehaviorInspector.selectedVariableName, ref ExternalBehaviorInspector.selectedVariableTypeIndex, true, false))
             {
                 if (BehaviorDesignerPreferences.GetBool(BDPreferences.BinarySerialization))
                 {
                     BinarySerialization.Save(behaviorSource);
                 }
                 else
                 {
                     JSONSerialization.Save(behaviorSource);
                 }
             }
             EditorGUI.indentLevel--;
         }
         EditorPrefs.SetBool(text, showVariables);
     }
     return(EditorGUI.EndChangeCheck());
 }
コード例 #10
0
        // Token: 0x0600001B RID: 27 RVA: 0x00002DCC File Offset: 0x00000FCC
        private static void DrawBoolPref(BDPreferences pref, string text, PreferenceChangeHandler callback)
        {
            bool @bool = BehaviorDesignerPreferences.GetBool(pref);
            bool flag  = GUILayout.Toggle(@bool, text, new GUILayoutOption[0]);

            if (flag != @bool)
            {
                BehaviorDesignerPreferences.SetBool(pref, flag);
                callback(pref, flag);
                if (pref == BDPreferences.EditablePrefabInstances && flag && BehaviorDesignerPreferences.GetBool(BDPreferences.BinarySerialization))
                {
                    BehaviorDesignerPreferences.SetBool(BDPreferences.BinarySerialization, false);
                    callback(BDPreferences.BinarySerialization, false);
                }
                else if (pref == BDPreferences.BinarySerialization && flag && BehaviorDesignerPreferences.GetBool(BDPreferences.EditablePrefabInstances))
                {
                    BehaviorDesignerPreferences.SetBool(BDPreferences.EditablePrefabInstances, false);
                    callback(BDPreferences.EditablePrefabInstances, false);
                }
            }
        }
コード例 #11
0
        // Token: 0x0600001A RID: 26 RVA: 0x00002C30 File Offset: 0x00000E30
        public static void DrawPreferencesPane(PreferenceChangeHandler callback)
        {
            BehaviorDesignerPreferences.DrawBoolPref(BDPreferences.ShowWelcomeScreen, "Show welcome screen", callback);
            BehaviorDesignerPreferences.DrawBoolPref(BDPreferences.ShowSceneIcon, "Show Behavior Designer icon in the scene", callback);
            BehaviorDesignerPreferences.DrawBoolPref(BDPreferences.ShowHierarchyIcon, "Show Behavior Designer icon in the hierarchy window", callback);
            BehaviorDesignerPreferences.DrawBoolPref(BDPreferences.OpenInspectorOnTaskSelection, "Open inspector on single task selection", callback);
            BehaviorDesignerPreferences.DrawBoolPref(BDPreferences.OpenInspectorOnTaskDoubleClick, "Open inspector on task double click", callback);
            BehaviorDesignerPreferences.DrawBoolPref(BDPreferences.FadeNodes, "Fade tasks after they are done running", callback);
            BehaviorDesignerPreferences.DrawBoolPref(BDPreferences.EditablePrefabInstances, "Allow edit of prefab instances", callback);
            BehaviorDesignerPreferences.DrawBoolPref(BDPreferences.PropertiesPanelOnLeft, "Position properties panel on the left", callback);
            BehaviorDesignerPreferences.DrawBoolPref(BDPreferences.MouseWhellScrolls, "Mouse wheel scrolls graph view", callback);
            BehaviorDesignerPreferences.DrawBoolPref(BDPreferences.FoldoutFields, "Grouped fields start visible", callback);
            BehaviorDesignerPreferences.DrawBoolPref(BDPreferences.CompactMode, "Compact mode", callback);
            BehaviorDesignerPreferences.DrawBoolPref(BDPreferences.SnapToGrid, "Snap to grid", callback);
            BehaviorDesignerPreferences.DrawBoolPref(BDPreferences.ShowTaskDescription, "Show selected task description", callback);
            BehaviorDesignerPreferences.DrawBoolPref(BDPreferences.ErrorChecking, "Realtime error checking", callback);
            BehaviorDesignerPreferences.DrawBoolPref(BDPreferences.SelectOnBreakpoint, "Select GameObject if a breakpoint is hit", callback);
            BehaviorDesignerPreferences.DrawBoolPref(BDPreferences.UpdateCheck, "Check for updates", callback);
            BehaviorDesignerPreferences.DrawBoolPref(BDPreferences.AddGameGUIComponent, "Add Game GUI Component", callback);
            bool @bool = BehaviorDesignerPreferences.GetBool(BDPreferences.BinarySerialization);

            if (EditorGUILayout.Popup("Serialization", (!@bool) ? 1 : 0, BehaviorDesignerPreferences.serializationString, new GUILayoutOption[0]) != ((!@bool) ? 1 : 0))
            {
                BehaviorDesignerPreferences.SetBool(BDPreferences.BinarySerialization, !@bool);
                callback(BDPreferences.BinarySerialization, !@bool);
            }
            int @int = BehaviorDesignerPreferences.GetInt(BDPreferences.GizmosViewMode);
            int num  = (int)((Behavior.GizmoViewMode)EditorGUILayout.EnumPopup("Gizmos View Mode", (Behavior.GizmoViewMode)@int, new GUILayoutOption[0]));

            if (num != @int)
            {
                BehaviorDesignerPreferences.SetInt(BDPreferences.GizmosViewMode, num);
                callback(BDPreferences.GizmosViewMode, num);
            }
            if (GUILayout.Button("Restore to Defaults", EditorStyles.miniButtonMid, new GUILayoutOption[0]))
            {
                BehaviorDesignerPreferences.ResetPrefs();
            }
        }
コード例 #12
0
 // Token: 0x060002C6 RID: 710 RVA: 0x0001BDC4 File Offset: 0x00019FC4
 private static void PropertySelected(object selected)
 {
     VariableInspector.SelectedPropertyMapping selectedPropertyMapping = selected as VariableInspector.SelectedPropertyMapping;
     if (selectedPropertyMapping.Property.Equals("None"))
     {
         VariableInspector.mPropertyMappingVariable.PropertyMapping      = string.Empty;
         VariableInspector.mPropertyMappingVariable.PropertyMappingOwner = null;
     }
     else
     {
         VariableInspector.mPropertyMappingVariable.PropertyMapping      = selectedPropertyMapping.Property;
         VariableInspector.mPropertyMappingVariable.PropertyMappingOwner = selectedPropertyMapping.GameObject;
     }
     if (BehaviorDesignerPreferences.GetBool(BDPreferences.BinarySerialization))
     {
         BinarySerialization.Save(VariableInspector.mPropertyMappingBehaviorSource);
     }
     else
     {
         JSONSerialization.Save(VariableInspector.mPropertyMappingBehaviorSource);
     }
 }
コード例 #13
0
        private static void PropertySelected(object selected)
        {
            bool flag = false;

            if (!Application.isPlaying && VariableInspector.mPropertyMappingBehaviorSource.Owner.GetObject() is Behavior && (VariableInspector.mPropertyMappingBehaviorSource.Owner.GetObject() as Behavior).ExternalBehavior != null)
            {
                VariableInspector.mPropertyMappingBehaviorSource.CheckForSerialization(true, null);
                VariableInspector.mPropertyMappingVariable = VariableInspector.mPropertyMappingBehaviorSource.GetVariable(VariableInspector.mPropertyMappingVariable.Name);
                flag = true;
            }
            VariableInspector.SelectedPropertyMapping selectedPropertyMapping = selected as VariableInspector.SelectedPropertyMapping;
            if (selectedPropertyMapping.Property.Equals("None"))
            {
                VariableInspector.mPropertyMappingVariable.PropertyMapping      = string.Empty;
                VariableInspector.mPropertyMappingVariable.PropertyMappingOwner = null;
            }
            else
            {
                VariableInspector.mPropertyMappingVariable.PropertyMapping      = selectedPropertyMapping.Property;
                VariableInspector.mPropertyMappingVariable.PropertyMappingOwner = selectedPropertyMapping.GameObject;
            }
            if (BehaviorDesignerPreferences.GetBool(BDPreferences.BinarySerialization))
            {
                BinarySerialization.Save(VariableInspector.mPropertyMappingBehaviorSource);
            }
            else
            {
                SerializeJSON.Save(VariableInspector.mPropertyMappingBehaviorSource);
            }
            if (flag)
            {
                ExternalBehavior externalBehavior = (VariableInspector.mPropertyMappingBehaviorSource.Owner as Behavior).ExternalBehavior;
                externalBehavior.BehaviorSource.Owner = externalBehavior;
                externalBehavior.BehaviorSource.CheckForSerialization(true, VariableInspector.mPropertyMappingBehaviorSource);
            }
        }
コード例 #14
0
ファイル: NodeDesigner.cs プロジェクト: mengtest/StateTree
        public bool DrawNode(Vector2 offset, bool drawSelected, bool disabled)
        {
            if (drawSelected != this.mSelected)
            {
                return(false);
            }
            if (ToString().Length != prevFriendlyNameLength)
            {
                prevFriendlyNameLength = ToString().Length;
                mRectIsDirty           = true;
            }
            Rect rect = Rectangle(offset, false, false);

            UpdateCache(rect);
            bool  flag   = (this.mTask.NodeData.PushTime != -1f && this.mTask.NodeData.PushTime >= this.mTask.NodeData.PopTime) || (this.isEntryDisplay && this.outgoingNodeConnections.Count > 0 && this.outgoingNodeConnections[0].DestinationNodeDesigner.Task.NodeData.PushTime != -1f);
            bool  flag2  = this.mIdentifyUpdateCount != -1;
            bool  result = this.prevRunningState != flag;
            float num    = (!BehaviorDesignerPreferences.GetBool(BDPreferences.FadeNodes)) ? 0.01f : 0.5f;
            float num2   = 0f;

            if (flag2)
            {
                if (2000 - this.mIdentifyUpdateCount < 500)
                {
                    num2 = (float)(2000 - this.mIdentifyUpdateCount) / 500f;
                }
                else
                {
                    num2 = 1f;
                }
                if (this.mIdentifyUpdateCount != -1)
                {
                    this.mIdentifyUpdateCount++;
                    if (this.mIdentifyUpdateCount > 2000)
                    {
                        this.mIdentifyUpdateCount = -1;
                    }
                }
                result = true;
            }
            else if (flag)
            {
                num2 = 1f;
            }
            else if ((this.mTask.NodeData.PopTime != -1f && num != 0f && Time.realtimeSinceStartup - this.mTask.NodeData.PopTime < num) || (this.isEntryDisplay && this.outgoingNodeConnections.Count > 0 && this.outgoingNodeConnections[0].DestinationNodeDesigner.Task.NodeData.PopTime != -1f && Time.realtimeSinceStartup - this.outgoingNodeConnections[0].DestinationNodeDesigner.Task.NodeData.PopTime < num))
            {
                if (this.isEntryDisplay)
                {
                    num2 = 1f - (Time.realtimeSinceStartup - this.outgoingNodeConnections[0].DestinationNodeDesigner.Task.NodeData.PopTime) / num;
                }
                else
                {
                    num2 = 1f - (Time.realtimeSinceStartup - this.mTask.NodeData.PopTime) / num;
                }
                result = true;
            }
            if (!this.isEntryDisplay && !this.prevRunningState && this.parentNodeDesigner != null)
            {
                this.parentNodeDesigner.BringConnectionToFront(this);
            }
            this.prevRunningState = flag;
            if (num2 != 1f)
            {
                GUI.color = ((!disabled && !this.mTask.NodeData.Disabled) ? Color.white : this.grayColor);
                GUIStyle backgroundGUIStyle;
                if (BehaviorDesignerPreferences.GetBool(BDPreferences.CompactMode))
                {
                    backgroundGUIStyle = ((!this.mSelected) ? BehaviorDesignerUtility.GetTaskCompactGUIStyle(this.mTask.NodeData.ColorIndex) : BehaviorDesignerUtility.GetTaskSelectedCompactGUIStyle(this.mTask.NodeData.ColorIndex));
                }
                else
                {
                    backgroundGUIStyle = ((!this.mSelected) ? BehaviorDesignerUtility.GetTaskGUIStyle(this.mTask.NodeData.ColorIndex) : BehaviorDesignerUtility.GetTaskSelectedGUIStyle(this.mTask.NodeData.ColorIndex));
                }
                this.DrawNodeTexture(rect, BehaviorDesignerUtility.GetTaskConnectionTopTexture(this.mTask.NodeData.ColorIndex), BehaviorDesignerUtility.GetTaskConnectionBottomTexture(this.mTask.NodeData.ColorIndex), backgroundGUIStyle, BehaviorDesignerUtility.GetTaskBorderTexture(this.mTask.NodeData.ColorIndex));
            }
            if (num2 > 0f)
            {
                GUIStyle  backgroundGUIStyle2;
                Texture2D iconBorderTexture;
                if (flag2)
                {
                    if (BehaviorDesignerPreferences.GetBool(BDPreferences.CompactMode))
                    {
                        if (this.mSelected)
                        {
                            backgroundGUIStyle2 = BehaviorDesignerUtility.TaskIdentifySelectedCompactGUIStyle;
                        }
                        else
                        {
                            backgroundGUIStyle2 = BehaviorDesignerUtility.TaskIdentifyCompactGUIStyle;
                        }
                    }
                    else if (this.mSelected)
                    {
                        backgroundGUIStyle2 = BehaviorDesignerUtility.TaskIdentifySelectedGUIStyle;
                    }
                    else
                    {
                        backgroundGUIStyle2 = BehaviorDesignerUtility.TaskIdentifyGUIStyle;
                    }
                    iconBorderTexture = BehaviorDesignerUtility.TaskBorderIdentifyTexture;
                }
                else
                {
                    if (BehaviorDesignerPreferences.GetBool(BDPreferences.CompactMode))
                    {
                        if (this.mSelected)
                        {
                            backgroundGUIStyle2 = BehaviorDesignerUtility.TaskRunningSelectedCompactGUIStyle;
                        }
                        else
                        {
                            backgroundGUIStyle2 = BehaviorDesignerUtility.TaskRunningCompactGUIStyle;
                        }
                    }
                    else if (this.mSelected)
                    {
                        backgroundGUIStyle2 = BehaviorDesignerUtility.TaskRunningSelectedGUIStyle;
                    }
                    else
                    {
                        backgroundGUIStyle2 = BehaviorDesignerUtility.TaskRunningGUIStyle;
                    }
                    iconBorderTexture = BehaviorDesignerUtility.TaskBorderRunningTexture;
                }
                Color color = (!disabled && !this.mTask.NodeData.Disabled) ? Color.white : this.grayColor;
                color.a   = num2;
                GUI.color = (color);
                Texture2D connectionTopTexture    = null;
                Texture2D connectionBottomTexture = null;
                if (!this.isEntryDisplay)
                {
                    if (flag2)
                    {
                        connectionTopTexture = BehaviorDesignerUtility.TaskConnectionIdentifyTopTexture;
                    }
                    else
                    {
                        connectionTopTexture = BehaviorDesignerUtility.TaskConnectionRunningTopTexture;
                    }
                }
                if (this.isParent)
                {
                    if (flag2)
                    {
                        connectionBottomTexture = BehaviorDesignerUtility.TaskConnectionIdentifyBottomTexture;
                    }
                    else
                    {
                        connectionBottomTexture = BehaviorDesignerUtility.TaskConnectionRunningBottomTexture;
                    }
                }
                this.DrawNodeTexture(rect, connectionTopTexture, connectionBottomTexture, backgroundGUIStyle2, iconBorderTexture);
                GUI.color = (Color.white);
            }
            if (this.mTask.NodeData.Collapsed)
            {
                GUI.DrawTexture(this.nodeCollapsedTextureRect, BehaviorDesignerUtility.TaskConnectionCollapsedTexture);
            }
            if (!BehaviorDesignerPreferences.GetBool(BDPreferences.CompactMode))
            {
                GUI.DrawTexture(iconTextureRect, mTask.NodeData.Icon);
            }
            if (this.mTask.NodeData.InterruptTime != -1f && Time.realtimeSinceStartup - this.mTask.NodeData.InterruptTime < 0.75f + num)
            {
                float a;
                if (Time.realtimeSinceStartup - this.mTask.NodeData.InterruptTime < 0.75f)
                {
                    a = 1f;
                }
                else
                {
                    a = 1f - (Time.realtimeSinceStartup - (this.mTask.NodeData.InterruptTime + 0.75f)) / num;
                }
                Color white = Color.white;
                white.a   = a;
                GUI.color = (white);
                GUI.Label(rect, string.Empty, BehaviorDesignerUtility.TaskHighlightGUIStyle);
                GUI.color = (Color.white);
            }
            GUI.Label(this.titleRect, this.ToString(), BehaviorDesignerUtility.TaskTitleGUIStyle);
            if (this.mTask.NodeData.IsBreakpoint)
            {
                GUI.DrawTexture(this.breakpointTextureRect, BehaviorDesignerUtility.BreakpointTexture);
            }
            if (this.showReferenceIcon)
            {
                GUI.DrawTexture(this.referenceTextureRect, BehaviorDesignerUtility.ReferencedTexture);
            }
            if (this.hasError)
            {
                GUI.DrawTexture(this.errorTextureRect, BehaviorDesignerUtility.ErrorIconTexture);
            }
            if (this.mTask is Composite && (this.mTask as Composite).AbortType != AbortType.None)
            {
                switch ((this.mTask as Composite).AbortType)
                {
                case AbortType.Self:
                    GUI.DrawTexture(this.conditionalAbortTextureRect, BehaviorDesignerUtility.ConditionalAbortSelfTexture);
                    break;

                case AbortType.LowerPriority:
                    GUI.DrawTexture(this.conditionalAbortLowerPriorityTextureRect, BehaviorDesignerUtility.ConditionalAbortLowerPriorityTexture);
                    break;

                case AbortType.Both:
                    GUI.DrawTexture(this.conditionalAbortTextureRect, BehaviorDesignerUtility.ConditionalAbortBothTexture);
                    break;
                }
            }
            GUI.color = (Color.white);
            if (this.showHoverBar)
            {
                GUI.DrawTexture(this.disabledButtonTextureRect, (!this.mTask.NodeData.Disabled) ? BehaviorDesignerUtility.DisableTaskTexture : BehaviorDesignerUtility.EnableTaskTexture, (ScaleMode)2);
                if (this.isParent || this.mTask is BehaviorReference)
                {
                    bool collapsed = this.mTask.NodeData.Collapsed;
                    if (this.mTask is BehaviorReference)
                    {
                        collapsed = (this.mTask as BehaviorReference).collapsed;
                    }
                    GUI.DrawTexture(this.collapseButtonTextureRect, (!collapsed) ? BehaviorDesignerUtility.CollapseTaskTexture : BehaviorDesignerUtility.ExpandTaskTexture, (ScaleMode)2);
                }
            }
            return(result);
        }
コード例 #15
0
ファイル: NodeDesigner.cs プロジェクト: mengtest/StateTree
 private void UpdateCache(Rect nodeRect)
 {
     if (this.mCacheIsDirty)
     {
         this.nodeCollapsedTextureRect = new Rect(nodeRect.x + (nodeRect.width - 26f) / 2f + 1f, nodeRect.yMax + 2f, 26f, 6f);
         this.iconTextureRect          = new Rect(nodeRect.x + (nodeRect.width - 44f) / 2f, nodeRect.y + 4f + 2f, 44f, 44f);
         this.titleRect                   = new Rect(nodeRect.x, nodeRect.yMax - (float)((!BehaviorDesignerPreferences.GetBool(BDPreferences.CompactMode)) ? 20 : 28) - 1f, nodeRect.width, 20f);
         this.breakpointTextureRect       = new Rect(nodeRect.xMax - 16f, nodeRect.y + 3f, 14f, 14f);
         this.errorTextureRect            = new Rect(nodeRect.xMax - 12f, nodeRect.y - 8f, 20f, 20f);
         this.referenceTextureRect        = new Rect(nodeRect.x + 2f, nodeRect.y + 3f, 14f, 14f);
         this.conditionalAbortTextureRect = new Rect(nodeRect.x + 3f, nodeRect.y + 3f, 16f, 16f);
         this.conditionalAbortLowerPriorityTextureRect = new Rect(nodeRect.x + 3f, nodeRect.y, 16f, 16f);
         this.disabledButtonTextureRect     = new Rect(nodeRect.x - 1f, nodeRect.y - 17f, 14f, 14f);
         this.collapseButtonTextureRect     = new Rect(nodeRect.x + 15f, nodeRect.y - 17f, 14f, 14f);
         this.incomingConnectionTextureRect = new Rect(nodeRect.x + (nodeRect.width - 42f) / 2f, nodeRect.y - 14f - 3f + 3f, 42f, 17f);
         this.outgoingConnectionTextureRect = new Rect(nodeRect.x + (nodeRect.width - 42f) / 2f, nodeRect.yMax - 3f, 42f, 19f);
         this.successReevaluatingExecutionStatusTextureRect = new Rect(nodeRect.xMax - 37f, nodeRect.yMax - 38f, 35f, 36f);
         this.successExecutionStatusTextureRect             = new Rect(nodeRect.xMax - 37f, nodeRect.yMax - 33f, 35f, 31f);
         this.failureExecutionStatusTextureRect             = new Rect(nodeRect.xMax - 37f, nodeRect.yMax - 38f, 35f, 36f);
         this.iconBorderTextureRect = new Rect(nodeRect.x + (nodeRect.width - 46f) / 2f, nodeRect.y + 3f + 2f, 46f, 46f);
         CalculateNodeCommentRect(nodeRect);
         mCacheIsDirty = false;
     }
 }
コード例 #16
0
 // Token: 0x0600019D RID: 413 RVA: 0x0000ED84 File Offset: 0x0000CF84
 public static void UpdateGizmo(Behavior behavior)
 {
     behavior.gizmoViewMode             = (Behavior.GizmoViewMode)BehaviorDesignerPreferences.GetInt(BDPreferences.GizmosViewMode);
     behavior.showBehaviorDesignerGizmo = BehaviorDesignerPreferences.GetBool(BDPreferences.ShowSceneIcon);
 }
コード例 #17
0
        // Token: 0x06000208 RID: 520 RVA: 0x000131F4 File Offset: 0x000113F4
        public void DrawConnection(Vector2 source, Vector2 destination, bool disabled)
        {
            Color color = (!disabled) ? Color.white : new Color(0.7f, 0.7f, 0.7f);
            bool  flag  = this.destinationNodeDesigner != null && this.destinationNodeDesigner.Task != null && this.destinationNodeDesigner.Task.NodeData.PushTime != -1f && this.destinationNodeDesigner.Task.NodeData.PushTime >= this.destinationNodeDesigner.Task.NodeData.PopTime;
            float num   = (!BehaviorDesignerPreferences.GetBool(BDPreferences.FadeNodes)) ? 0.01f : 0.5f;

            if (this.selected)
            {
                if (disabled)
                {
                    if (EditorGUIUtility.isProSkin)
                    {
                        color = this.selectedDisabledProColor;
                    }
                    else
                    {
                        color = this.selectedDisabledStandardColor;
                    }
                }
                else if (EditorGUIUtility.isProSkin)
                {
                    color = this.selectedEnabledProColor;
                }
                else
                {
                    color = this.selectedEnabledStandardColor;
                }
            }
            else if (flag)
            {
                if (EditorGUIUtility.isProSkin)
                {
                    color = this.taskRunningProColor;
                }
                else
                {
                    color = this.taskRunningStandardColor;
                }
            }
            else if (num != 0f && this.destinationNodeDesigner != null && this.destinationNodeDesigner.Task != null && this.destinationNodeDesigner.Task.NodeData.PopTime != -1f && this.destinationNodeDesigner.Task.NodeData.PopTime <= Time.realtimeSinceStartup && Time.realtimeSinceStartup - this.destinationNodeDesigner.Task.NodeData.PopTime < num)
            {
                float num2  = 1f - (Time.realtimeSinceStartup - this.destinationNodeDesigner.Task.NodeData.PopTime) / num;
                Color white = Color.white;
                if (EditorGUIUtility.isProSkin)
                {
                    white = this.taskRunningProColor;
                }
                else
                {
                    white = this.taskRunningStandardColor;
                }
                color = Color.Lerp(Color.white, white, num2);
            }
            Handles.color = color;
            if (this.horizontalDirty)
            {
                this.startHorizontalBreak = new Vector2(source.x, this.horizontalHeight);
                this.endHorizontalBreak   = new Vector2(destination.x, this.horizontalHeight);
                this.horizontalDirty      = false;
            }
            this.linePoints[0] = source;
            this.linePoints[1] = this.startHorizontalBreak;
            this.linePoints[2] = this.endHorizontalBreak;
            this.linePoints[3] = destination;
            Handles.DrawPolyLine(this.linePoints);
            for (int i = 0; i < this.linePoints.Length; i++)
            {
                Vector3[] array = this.linePoints;
                int       num3  = i;
                array[num3].x = array[num3].x + 1f;
                Vector3[] array2 = this.linePoints;
                int       num4   = i;
                array2[num4].y = array2[num4].y + 1f;
            }
            Handles.DrawPolyLine(this.linePoints);
        }
コード例 #18
0
        public static bool DrawInspectorGUI(Behavior behavior, SerializedObject serializedObject, bool fromInspector, ref bool externalModification, ref bool showOptions, ref bool showVariables)
        {
            EditorGUI.BeginChangeCheck();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            EditorGUILayout.LabelField("Behavior Name", new GUILayoutOption[]
            {
                GUILayout.Width(120f)
            });
            behavior.GetBehaviorSource().behaviorName = EditorGUILayout.TextField(behavior.GetBehaviorSource().behaviorName, new GUILayoutOption[0]);
            if (fromInspector && GUILayout.Button("Open", new GUILayoutOption[0]))
            {
                BehaviorDesignerWindow.ShowWindow();
                BehaviorDesignerWindow.instance.LoadBehavior(behavior.GetBehaviorSource(), false, true);
            }
            GUILayout.EndHorizontal();
            EditorGUILayout.LabelField("Behavior Description", new GUILayoutOption[0]);
            behavior.GetBehaviorSource().behaviorDescription = EditorGUILayout.TextArea(behavior.GetBehaviorSource().behaviorDescription, BehaviorDesignerUtility.TaskInspectorCommentGUIStyle, new GUILayoutOption[]
            {
                GUILayout.Height(48f)
            });
            serializedObject.Update();
            GUI.enabled = (PrefabUtility.GetPrefabType(behavior) != PrefabType.PrefabInstance || BehaviorDesignerPreferences.GetBool(BDPreferences.EditablePrefabInstances));
            SerializedProperty serializedProperty = serializedObject.FindProperty("externalBehavior");
            ExternalBehavior   externalBehavior   = serializedProperty.objectReferenceValue as ExternalBehavior;

            EditorGUILayout.PropertyField(serializedProperty, true, new GUILayoutOption[0]);
            serializedObject.ApplyModifiedProperties();
            if ((!object.ReferenceEquals(behavior.ExternalBehavior, null) && !behavior.ExternalBehavior.Equals(externalBehavior)) || (!object.ReferenceEquals(externalBehavior, null) && !externalBehavior.Equals(behavior.ExternalBehavior)))
            {
                if (!object.ReferenceEquals(behavior.ExternalBehavior, null))
                {
                    behavior.ExternalBehavior.BehaviorSource.Owner = behavior.ExternalBehavior;
                    behavior.ExternalBehavior.BehaviorSource.CheckForSerialization(true, behavior.GetBehaviorSource());
                }
                else
                {
                    behavior.GetBehaviorSource().EntryTask     = null;
                    behavior.GetBehaviorSource().RootTask      = null;
                    behavior.GetBehaviorSource().DetachedTasks = null;
                    behavior.GetBehaviorSource().Variables     = null;
                    behavior.GetBehaviorSource().CheckForSerialization(true, null);
                    behavior.GetBehaviorSource().Variables = null;
                    if (BehaviorDesignerPreferences.GetBool(BDPreferences.BinarySerialization))
                    {
                        BinarySerialization.Save(behavior.GetBehaviorSource());
                    }
                    else
                    {
                        SerializeJSON.Save(behavior.GetBehaviorSource());
                    }
                }
                externalModification = true;
            }
            GUI.enabled        = true;
            serializedProperty = serializedObject.FindProperty("group");
            EditorGUILayout.PropertyField(serializedProperty, true, new GUILayoutOption[0]);
            if (fromInspector && (showVariables = EditorGUILayout.Foldout(showVariables, "Variables")))
            {
                EditorGUI.indentLevel++;
                List <SharedVariable> allVariables   = behavior.GetAllVariables();
                BehaviorSource        behaviorSource = behavior.GetBehaviorSource();
                bool flag = false;
                if (!Application.isPlaying && behavior.ExternalBehavior != null)
                {
                    behaviorSource.CheckForSerialization(true, null);
                    flag = true;
                }
                bool flag2 = false;
                if (VariableInspector.SyncVariables(behaviorSource, allVariables))
                {
                    flag2 = true;
                }
                if (allVariables != null && allVariables.Count > 0)
                {
                    List <SharedVariable> allVariables2 = behaviorSource.GetAllVariables();
                    if (VariableInspector.DrawAllVariables(false, behaviorSource, ref allVariables2, false, ref BehaviorInspector.variablePosition, ref BehaviorInspector.selectedVariableIndex, ref BehaviorInspector.selectedVariableName, ref BehaviorInspector.selectedVariableTypeIndex, false, true))
                    {
                        flag2 = true;
                    }
                }
                else
                {
                    EditorGUILayout.LabelField("There are no variables to display", new GUILayoutOption[0]);
                }
                if (flag)
                {
                    ExternalBehavior externalBehavior2 = (behaviorSource.Owner as Behavior).ExternalBehavior;
                    externalBehavior2.BehaviorSource.Owner = externalBehavior2;
                    externalBehavior2.BehaviorSource.CheckForSerialization(true, behaviorSource);
                }
                if (flag2)
                {
                    if (BehaviorDesignerPreferences.GetBool(BDPreferences.BinarySerialization))
                    {
                        BinarySerialization.Save(behaviorSource);
                    }
                    else
                    {
                        SerializeJSON.Save(behaviorSource);
                    }
                }
                EditorGUI.indentLevel--;
            }
            if (!fromInspector || (showOptions = EditorGUILayout.Foldout(showOptions, "Options")))
            {
                if (fromInspector)
                {
                    EditorGUI.indentLevel++;
                }
                serializedProperty = serializedObject.FindProperty("startWhenEnabled");
                EditorGUILayout.PropertyField(serializedProperty, true, new GUILayoutOption[0]);
                serializedProperty = serializedObject.FindProperty("pauseWhenDisabled");
                EditorGUILayout.PropertyField(serializedProperty, true, new GUILayoutOption[0]);
                serializedProperty = serializedObject.FindProperty("restartWhenComplete");
                EditorGUILayout.PropertyField(serializedProperty, true, new GUILayoutOption[0]);
                serializedProperty = serializedObject.FindProperty("resetValuesOnRestart");
                EditorGUILayout.PropertyField(serializedProperty, true, new GUILayoutOption[0]);
                serializedProperty = serializedObject.FindProperty("logTaskChanges");
                EditorGUILayout.PropertyField(serializedProperty, true, new GUILayoutOption[0]);
                if (fromInspector)
                {
                    EditorGUI.indentLevel--;
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                return(true);
            }
            return(false);
        }
コード例 #19
0
        public void OnGUI()
        {
            GUI.DrawTexture(this.m_WelcomeScreenImageRect, this.m_WelcomeScreenImage);
            GUI.Label(this.m_WelcomeIntroRect, "Welcome To Behavior Designer", BehaviorDesignerUtility.WelcomeScreenIntroGUIStyle);
            GUI.DrawTexture(this.m_SamplesImageRect, this.m_SamplesImage);
            GUI.Label(this.m_SamplesHeaderRect, "Samples", BehaviorDesignerUtility.WelcomeScreenTextHeaderGUIStyle);
            GUI.Label(this.m_SamplesDescriptionRect, "Download sample projects to get a feel for Behavior Designer.", BehaviorDesignerUtility.WelcomeScreenTextDescriptionGUIStyle);
            GUI.DrawTexture(this.m_DocImageRect, this.m_DocImage);
            GUI.Label(this.m_DocHeaderRect, "Documentation", BehaviorDesignerUtility.WelcomeScreenTextHeaderGUIStyle);
            GUI.Label(this.m_DocDescriptionRect, "Browser our extensive online documentation.", BehaviorDesignerUtility.WelcomeScreenTextDescriptionGUIStyle);
            GUI.DrawTexture(this.m_VideoImageRect, this.m_VideoImage);
            GUI.Label(this.m_VideoHeaderRect, "Videos", BehaviorDesignerUtility.WelcomeScreenTextHeaderGUIStyle);
            GUI.Label(this.m_VideoDescriptionRect, "Watch our tutorial videos which cover a wide variety of topics.", BehaviorDesignerUtility.WelcomeScreenTextDescriptionGUIStyle);
            GUI.DrawTexture(this.m_ForumImageRect, this.m_ForumImage);
            GUI.Label(this.m_ForumHeaderRect, "Forums", BehaviorDesignerUtility.WelcomeScreenTextHeaderGUIStyle);
            GUI.Label(this.m_ForumDescriptionRect, "Join the forums!", BehaviorDesignerUtility.WelcomeScreenTextDescriptionGUIStyle);
            GUI.DrawTexture(this.m_ContactImageRect, this.m_ContactImage);
            GUI.Label(this.m_ContactHeaderRect, "Contact", BehaviorDesignerUtility.WelcomeScreenTextHeaderGUIStyle);
            GUI.Label(this.m_ContactDescriptionRect, "We are here to help.", BehaviorDesignerUtility.WelcomeScreenTextDescriptionGUIStyle);
            GUI.Label(this.m_VersionRect, "Version 1.5.5");
            bool flag = GUI.Toggle(this.m_ToggleButtonRect, BehaviorDesignerPreferences.GetBool(BDPreferences.ShowWelcomeScreen), "Show at Startup");

            if (flag != BehaviorDesignerPreferences.GetBool(BDPreferences.ShowWelcomeScreen))
            {
                BehaviorDesignerPreferences.SetBool(BDPreferences.ShowWelcomeScreen, flag);
            }
            EditorGUIUtility.AddCursorRect(this.m_SamplesImageRect, (MouseCursor)4);
            EditorGUIUtility.AddCursorRect(this.m_SamplesHeaderRect, (MouseCursor)4);
            EditorGUIUtility.AddCursorRect(this.m_SamplesDescriptionRect, (MouseCursor)4);
            EditorGUIUtility.AddCursorRect(this.m_DocImageRect, (MouseCursor)4);
            EditorGUIUtility.AddCursorRect(this.m_DocHeaderRect, (MouseCursor)4);
            EditorGUIUtility.AddCursorRect(this.m_DocDescriptionRect, (MouseCursor)4);
            EditorGUIUtility.AddCursorRect(this.m_VideoImageRect, (MouseCursor)4);
            EditorGUIUtility.AddCursorRect(this.m_VideoHeaderRect, (MouseCursor)4);
            EditorGUIUtility.AddCursorRect(this.m_VideoDescriptionRect, (MouseCursor)4);
            EditorGUIUtility.AddCursorRect(this.m_ForumImageRect, (MouseCursor)4);
            EditorGUIUtility.AddCursorRect(this.m_ForumHeaderRect, (MouseCursor)4);
            EditorGUIUtility.AddCursorRect(this.m_ForumDescriptionRect, (MouseCursor)4);
            EditorGUIUtility.AddCursorRect(this.m_ContactImageRect, (MouseCursor)4);
            EditorGUIUtility.AddCursorRect(this.m_ContactHeaderRect, (MouseCursor)4);
            EditorGUIUtility.AddCursorRect(this.m_ContactDescriptionRect, (MouseCursor)4);
            if (Event.current.type == (EventType)1)
            {
                Vector2 mousePosition = Event.current.mousePosition;
                if (this.m_SamplesImageRect.Contains(mousePosition) || this.m_SamplesHeaderRect.Contains(mousePosition) || this.m_SamplesDescriptionRect.Contains(mousePosition))
                {
                    Application.OpenURL("http://www.opsive.com/assets/BehaviorDesigner/samples.php");
                }
                else if (this.m_DocImageRect.Contains(mousePosition) || this.m_DocHeaderRect.Contains(mousePosition) || this.m_DocDescriptionRect.Contains(mousePosition))
                {
                    Application.OpenURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php");
                }
                else if (this.m_VideoImageRect.Contains(mousePosition) || this.m_VideoHeaderRect.Contains(mousePosition) || this.m_VideoDescriptionRect.Contains(mousePosition))
                {
                    Application.OpenURL("http://www.opsive.com/assets/BehaviorDesigner/videos.php");
                }
                else if (this.m_ForumImageRect.Contains(mousePosition) || this.m_ForumHeaderRect.Contains(mousePosition) || this.m_ForumDescriptionRect.Contains(mousePosition))
                {
                    Application.OpenURL("http://www.opsive.com/forum");
                }
                else if (this.m_ContactImageRect.Contains(mousePosition) || this.m_ContactHeaderRect.Contains(mousePosition) || this.m_ContactDescriptionRect.Contains(mousePosition))
                {
                    Application.OpenURL("http://www.opsive.com/assets/BehaviorDesigner/documentation.php?id=12");
                }
            }
        }
コード例 #20
0
 // Token: 0x06000018 RID: 24 RVA: 0x000029E0 File Offset: 0x00000BE0
 public static void InitPrefernces()
 {
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[0]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.ShowWelcomeScreen, true);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[1]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.ShowSceneIcon, true);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[2]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.ShowHierarchyIcon, true);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[3]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.OpenInspectorOnTaskSelection, false);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[3]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.OpenInspectorOnTaskSelection, false);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[5]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.FadeNodes, true);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[6]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.EditablePrefabInstances, false);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[7]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.PropertiesPanelOnLeft, true);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[8]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.MouseWhellScrolls, false);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[9]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.FoldoutFields, true);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[10]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.CompactMode, false);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[11]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.SnapToGrid, true);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[12]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.ShowTaskDescription, true);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[13]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.BinarySerialization, true);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[14]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.ErrorChecking, true);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[15]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.SelectOnBreakpoint, false);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[16]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.UpdateCheck, true);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[17]))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.AddGameGUIComponent, false);
     }
     if (!EditorPrefs.HasKey(BehaviorDesignerPreferences.PrefString[18]))
     {
         BehaviorDesignerPreferences.SetInt(BDPreferences.GizmosViewMode, 2);
     }
     if (BehaviorDesignerPreferences.GetBool(BDPreferences.EditablePrefabInstances) && BehaviorDesignerPreferences.GetBool(BDPreferences.BinarySerialization))
     {
         BehaviorDesignerPreferences.SetBool(BDPreferences.BinarySerialization, false);
     }
 }
コード例 #21
0
ファイル: BehaviorInspector.cs プロジェクト: zentia/StateTree
        public static bool DrawInspectorGUI(Behavior behavior, SerializedObject serializedObject, bool fromInspector, ref bool externalModification, ref bool showOptions, ref bool showVariables)
        {
            EditorGUI.BeginChangeCheck();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            EditorGUILayout.LabelField("Behavior Name", new GUILayoutOption[]
            {
                GUILayout.Width(120f)
            });
            behavior.GetBehaviorSource().behaviorName = EditorGUILayout.TextField(behavior.GetBehaviorSource().behaviorName, new GUILayoutOption[0]);
            if (fromInspector && GUILayout.Button("Open", new GUILayoutOption[0]))
            {
                BehaviorDesignerWindow.ShowWindow();
                BehaviorDesignerWindow.instance.LoadBehavior(behavior.GetBehaviorSource(), false, true);
            }
            GUILayout.EndHorizontal();
            EditorGUILayout.LabelField("Behavior Description", new GUILayoutOption[0]);
            behavior.GetBehaviorSource().behaviorDescription = EditorGUILayout.TextArea(behavior.GetBehaviorSource().behaviorDescription, BehaviorDesignerUtility.TaskInspectorCommentGUIStyle, new GUILayoutOption[]
            {
                GUILayout.Height(48f)
            });
            serializedObject.Update();
            GUI.enabled = PrefabUtility.GetPrefabInstanceStatus(behavior) != PrefabInstanceStatus.MissingAsset || BehaviorDesignerPreferences.GetBool(BDPreferences.EditablePrefabInstances);
            SerializedProperty serializedProperty = serializedObject.FindProperty("externalBehavior");
            ExternalBehavior   externalBehavior   = serializedProperty.objectReferenceValue as ExternalBehavior;

            EditorGUILayout.PropertyField(serializedProperty, true, new GUILayoutOption[0]);
            serializedObject.ApplyModifiedProperties();
            if ((!(behavior.ExternalBehavior is null) && !behavior.ExternalBehavior.Equals(externalBehavior)) || (!ReferenceEquals(externalBehavior, null) && !externalBehavior.Equals(behavior.ExternalBehavior)))
            {
                if (!(behavior.ExternalBehavior is null))
                {
                    behavior.ExternalBehavior.BehaviorSource.Owner = behavior.ExternalBehavior;
                    behavior.ExternalBehavior.BehaviorSource.CheckForSerialization(true, behavior.GetBehaviorSource());
                }