コード例 #1
0
        private static void ClearFsmErrors(Skill fsm)
        {
            List <FsmError> list = new List <FsmError>();

            using (List <FsmError> .Enumerator enumerator = FsmErrorChecker.FsmErrorList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    FsmError current = enumerator.get_Current();
                    if (current.Fsm == fsm && !current.RuntimeError)
                    {
                        list.Add(current);
                    }
                    if (!SkillEditor.FsmList.Contains(current.Fsm))
                    {
                        list.Add(current);
                    }
                }
            }
            using (List <FsmError> .Enumerator enumerator2 = list.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    FsmError current2 = enumerator2.get_Current();
                    FsmErrorChecker.FsmErrorList.Remove(current2);
                }
            }
        }
コード例 #2
0
        private static FsmError AddRequiredFieldError()
        {
            FsmError fsmError = FsmErrorChecker.AddError(FsmErrorChecker.checkingState, FsmErrorChecker.checkingAction, FsmErrorChecker.checkingParameter, Strings.get_FsmErrorChecker_RequiredFieldError());

            fsmError.Type = FsmError.ErrorType.requiredField;
            return(fsmError);
        }
コード例 #3
0
 private void DoErrorHierarchyGUI()
 {
     this.scrollPosition = GUILayout.BeginScrollView(this.scrollPosition, new GUILayoutOption[0]);
     GUILayout.BeginVertical(new GUILayoutOption[0]);
     using (List <FsmError> .Enumerator enumerator = FsmErrorChecker.GetErrors().GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             FsmError current = enumerator.get_Current();
             if (!this.filterByFsm || current.Fsm == SkillEditor.SelectedFsm)
             {
                 GUIStyle gUIStyle = SkillEditorStyles.ActionItem;
                 if (this.selectedError == current)
                 {
                     gUIStyle = SkillEditorStyles.ActionItemSelected;
                 }
                 SkillEditorGUILayout.LightDivider(new GUILayoutOption[0]);
                 if (GUILayout.Button(current.ErrorString, gUIStyle, new GUILayoutOption[0]) || GUILayout.Button(current.ToString(), gUIStyle, new GUILayoutOption[0]))
                 {
                     this.selectedError = current;
                     ErrorSelector.GotoError(this.selectedError);
                 }
             }
         }
     }
     GUILayout.EndVertical();
     EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), 4);
     GUILayout.EndScrollView();
 }
コード例 #4
0
        public static FsmError AddRuntimeError(string error)
        {
            FsmError error2 = new FsmError
            {
                Fsm          = SkillExecutionStack.get_ExecutingFsm(),
                State        = SkillExecutionStack.get_ExecutingState(),
                Action       = SkillExecutionStack.get_ExecutingAction(),
                ErrorString  = error,
                RuntimeError = true
            };

            return(FsmErrorChecker.AddError(error2));
        }
コード例 #5
0
 private static void CheckGameObjectHasComponent(GameObject go, Type component)
 {
     if (go == null || component == null)
     {
         return;
     }
     if (go.GetComponent(component) == null)
     {
         FsmError fsmError = FsmErrorChecker.AddParameterError(Strings.get_FsmErrorChecker_RequiresComponentError() + Labels.StripUnityEngineNamespace(component.ToString()) + " Component!");
         fsmError.Type       = FsmError.ErrorType.missingRequiredComponent;
         fsmError.GameObject = go;
         fsmError.ObjectType = component;
     }
 }
コード例 #6
0
 public static bool StateHasErrors(SkillState state)
 {
     using (List <FsmError> .Enumerator enumerator = FsmErrorChecker.FsmErrorList.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             FsmError current = enumerator.get_Current();
             if (current.State == state)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #7
0
 public static FsmError FindError(FsmError error)
 {
     using (List <FsmError> .Enumerator enumerator = FsmErrorChecker.FsmErrorList.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             FsmError current = enumerator.get_Current();
             if (current.SameAs(error))
             {
                 return(current);
             }
         }
     }
     return(null);
 }
コード例 #8
0
        private static void CheckForEventErrors(SkillEvent fsmEvent)
        {
            if (SkillEvent.IsNullOrEmpty(fsmEvent))
            {
                return;
            }
            SkillEventTarget fsmEventTarget = FsmErrorChecker.fsmEventTargetContextGlobal;

            if (FsmErrorChecker.fsmEventTargetContext != null)
            {
                fsmEventTarget = FsmErrorChecker.fsmEventTargetContext;
            }
            if (fsmEventTarget == null)
            {
                fsmEventTarget = new SkillEventTarget();
            }
            Skill fsmTarget = Events.GetFsmTarget(FsmErrorChecker.checkingFsm, fsmEventTarget);

            switch (fsmEventTarget.target)
            {
            case 0:
                if (FsmErrorChecker.checkingState != null && !Events.FsmStateRespondsToEvent(FsmErrorChecker.checkingState, fsmEvent))
                {
                    FsmError fsmError = FsmErrorChecker.AddParameterError(Strings.get_FsmErrorChecker_InvalidEventError());
                    fsmError.Type = FsmError.ErrorType.missingTransitionEvent;
                    fsmError.info = fsmEvent.get_Name();
                }
                break;

            case 1:
            case 2:
                break;

            case 3:
                if (fsmTarget != null && !Events.FsmRespondsToEvent(fsmTarget, fsmEvent))
                {
                    FsmErrorChecker.AddParameterError(Strings.get_FsmErrorChecker_TargetFsmMissingEventError());
                }
                return;

            case 4:
                FsmErrorChecker.CheckGlobalEvent(fsmEvent);
                return;

            default:
                return;
            }
        }
コード例 #9
0
 private static FsmError AddError(FsmError error)
 {
     using (List <FsmError> .Enumerator enumerator = FsmErrorChecker.FsmErrorList.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             FsmError current = enumerator.get_Current();
             if (current.SameAs(error))
             {
                 return(error);
             }
         }
     }
     FsmErrorChecker.FsmErrorList.Add(error);
     return(error);
 }
コード例 #10
0
        public static List <string> GetRuntimeErrors(SkillStateAction action)
        {
            List <string> list = new List <string>();

            using (List <FsmError> .Enumerator enumerator = FsmErrorChecker.FsmErrorList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    FsmError current = enumerator.get_Current();
                    if (current.RuntimeError && current.Action == action)
                    {
                        list.Add(current.ErrorString);
                    }
                }
            }
            return(list);
        }
コード例 #11
0
        public static string GetStateErrors(SkillState state)
        {
            string text = "";

            using (List <FsmError> .Enumerator enumerator = FsmErrorChecker.FsmErrorList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    FsmError current = enumerator.get_Current();
                    if (current.State == state)
                    {
                        text += current.ErrorString;
                    }
                }
            }
            return(text);
        }
コード例 #12
0
        public static List <string> GetTransitionErrors(SkillTransition transition)
        {
            List <string> list = new List <string>();

            using (List <FsmError> .Enumerator enumerator = FsmErrorChecker.FsmErrorList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    FsmError current = enumerator.get_Current();
                    if (current.Transition == transition)
                    {
                        list.Add(current.ErrorString);
                    }
                }
            }
            return(list);
        }
コード例 #13
0
        public static List <FsmError> GetParameterErrors(SkillStateAction action, string parameter)
        {
            List <FsmError> list = new List <FsmError>();

            using (List <FsmError> .Enumerator enumerator = FsmErrorChecker.FsmErrorList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    FsmError current = enumerator.get_Current();
                    if (current.Action == action && current.Parameter == parameter)
                    {
                        list.Add(current);
                    }
                }
            }
            return(list);
        }
コード例 #14
0
        public static int CountActionErrors(SkillStateAction action)
        {
            int num = 0;

            using (List <FsmError> .Enumerator enumerator = FsmErrorChecker.FsmErrorList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    FsmError current = enumerator.get_Current();
                    if (current.Action == action)
                    {
                        num++;
                    }
                }
            }
            return(num);
        }
コード例 #15
0
        public static int CountRuntimeErrors()
        {
            int num = 0;

            using (List <FsmError> .Enumerator enumerator = FsmErrorChecker.FsmErrorList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    FsmError current = enumerator.get_Current();
                    if (current.RuntimeError)
                    {
                        num++;
                    }
                }
            }
            return(num);
        }
コード例 #16
0
        public static void ClearErrors(bool deleteRuntimeErrors = true)
        {
            if (!Application.get_isPlaying() && !deleteRuntimeErrors)
            {
                List <FsmError> list = new List <FsmError>();
                using (List <FsmError> .Enumerator enumerator = FsmErrorChecker.FsmErrorList.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        FsmError current = enumerator.get_Current();
                        if (!current.RuntimeError)
                        {
                            list.Add(current);
                        }
                    }
                }
                using (List <FsmError> .Enumerator enumerator2 = list.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        FsmError current2 = enumerator2.get_Current();
                        FsmErrorChecker.FsmErrorList.Remove(current2);
                    }
                    goto IL_8E;
                }
            }
            FsmErrorChecker.FsmErrorList.Clear();
IL_8E:
            FsmErrorChecker.gameObject                  = null;
            FsmErrorChecker.checkingFsm                 = null;
            FsmErrorChecker.checkingState               = null;
            FsmErrorChecker.checkingAction              = null;
            FsmErrorChecker.checkingParameter           = null;
            FsmErrorChecker.attributes                  = null;
            FsmErrorChecker.checkForErrors              = false;
            FsmErrorChecker.checkFsm                    = null;
            FsmErrorChecker.fsmEventTargetContext       = null;
            FsmErrorChecker.fsmEventTargetContextGlobal = null;
        }
コード例 #17
0
 private static void GotoError(FsmError error)
 {
     if (error == null)
     {
         return;
     }
     if (error.Fsm == null)
     {
         return;
     }
     SkillEditor.SelectFsm(error.Fsm);
     if (error.State == null)
     {
         return;
     }
     SkillEditor.SelectState(error.State, true);
     if (error.Action == null)
     {
         return;
     }
     SkillEditor.SelectAction(error.Action, true);
     SkillEditor.Repaint(true);
 }
コード例 #18
0
 public bool SameAs(FsmError error)
 {
     return(error != null && this.Fsm == error.Fsm && this.State == error.State && this.Action == error.Action && !(this.Parameter != error.Parameter) && this.Transition == error.Transition && !(this.ErrorString != error.ErrorString) && this.Type == error.Type && this.ObjectType == error.ObjectType);
 }