Exemplo n.º 1
0
        public void LogAction(SkillLogType logType, string text, bool sendToUnityLog = false)
        {
            if (SkillExecutionStack.ExecutingAction != null)
            {
                SkillLogEntry entry = new SkillLogEntry
                {
                    Log     = this,
                    LogType = logType,
                    State   = SkillExecutionStack.ExecutingState,
                    Action  = SkillExecutionStack.ExecutingAction,
                    Text    = SkillUtility.StripNamespace(SkillExecutionStack.ExecutingAction.ToString()) + " : " + text
                };
                this.AddEntry(entry, sendToUnityLog);
                return;
            }
            switch (logType)
            {
            case SkillLogType.Info:
                Debug.Log(text);
                return;

            case SkillLogType.Warning:
                Debug.LogWarning(text);
                return;

            case SkillLogType.Error:
                Debug.LogError(text);
                return;

            default:
                Debug.Log(text);
                return;
            }
        }
Exemplo n.º 2
0
 public static string GetPath(SkillState state, SkillStateAction action)
 {
     if (action == null)
     {
         return(SkillUtility.GetPath(state) + "[missing action] ");
     }
     return(SkillUtility.GetPath(state) + action.GetType().get_Name() + ": ");
 }
Exemplo n.º 3
0
        public static SkillEvent ByteArrayToFsmEvent(byte[] bytes, int startIndex, int size)
        {
            string text = SkillUtility.ByteArrayToString(bytes, startIndex, size);

            if (!string.IsNullOrEmpty(text))
            {
                return(SkillEvent.GetFsmEvent(text));
            }
            return(null);
        }
Exemplo n.º 4
0
        public static ICollection <byte> FsmEventToByteArray(SkillEvent fsmEvent)
        {
            if (fsmEvent == null)
            {
                return(null);
            }
            List <byte> list = new List <byte>();

            list.AddRange(SkillUtility.StringToByteArray(fsmEvent.Name));
            return(list);
        }
Exemplo n.º 5
0
        public static ICollection <byte> FsmColorToByteArray(SkillColor fsmColor)
        {
            if (fsmColor == null)
            {
                fsmColor = new SkillColor();
            }
            List <byte> list = new List <byte>();

            list.AddRange(SkillUtility.ColorToByteArray(fsmColor.Value));
            list.AddRange(SkillUtility.BitConverter.GetBytes(fsmColor.UseVariable));
            list.AddRange(SkillUtility.StringToByteArray(fsmColor.Name));
            return(list);
        }
Exemplo n.º 6
0
        public static ICollection <byte> FsmQuaternionToByteArray(SkillQuaternion fsmQuaternion)
        {
            if (fsmQuaternion == null)
            {
                fsmQuaternion = new SkillQuaternion();
            }
            List <byte> list = new List <byte>();

            list.AddRange(SkillUtility.QuaternionToByteArray(fsmQuaternion.Value));
            list.AddRange(SkillUtility.BitConverter.GetBytes(fsmQuaternion.UseVariable));
            list.AddRange(SkillUtility.StringToByteArray(fsmQuaternion.Name));
            return(list);
        }
Exemplo n.º 7
0
        public static ICollection <byte> FsmRectToByteArray(SkillRect fsmRect)
        {
            if (fsmRect == null)
            {
                fsmRect = new SkillRect();
            }
            List <byte> list = new List <byte>();

            list.AddRange(SkillUtility.RectToByteArray(fsmRect.Value));
            list.AddRange(SkillUtility.BitConverter.GetBytes(fsmRect.UseVariable));
            list.AddRange(SkillUtility.StringToByteArray(fsmRect.Name));
            return(list);
        }
Exemplo n.º 8
0
        public static ICollection <byte> FsmVector3ToByteArray(SkillVector3 fsmVector3)
        {
            if (fsmVector3 == null)
            {
                fsmVector3 = new SkillVector3();
            }
            List <byte> list = new List <byte>();

            list.AddRange(SkillUtility.Vector3ToByteArray(fsmVector3.Value));
            list.AddRange(SkillUtility.BitConverter.GetBytes(fsmVector3.UseVariable));
            list.AddRange(SkillUtility.StringToByteArray(fsmVector3.Name));
            return(list);
        }
Exemplo n.º 9
0
        public static ICollection <byte> FsmBoolToByteArray(SkillBool fsmBool)
        {
            if (fsmBool == null)
            {
                fsmBool = new SkillBool();
            }
            List <byte> list = new List <byte>();

            list.AddRange(SkillUtility.BitConverter.GetBytes(fsmBool.Value));
            list.AddRange(SkillUtility.BitConverter.GetBytes(fsmBool.UseVariable));
            list.AddRange(SkillUtility.StringToByteArray(fsmBool.Name));
            return(list);
        }
Exemplo n.º 10
0
        public static SkillColor ByteArrayToFsmColor(Skill fsm, byte[] bytes, int startIndex, int totalLength)
        {
            string @string = SkillUtility.Encoding.GetString(bytes, startIndex + 17, totalLength - 17);

            if (@string != string.Empty)
            {
                return(fsm.GetFsmColor(@string));
            }
            return(new SkillColor
            {
                Value = SkillUtility.ByteArrayToColor(bytes, startIndex),
                UseVariable = SkillUtility.BitConverter.ToBoolean(bytes, startIndex + 16)
            });
        }
Exemplo n.º 11
0
        public static SkillVector3 ByteArrayToFsmVector3(Skill fsm, byte[] bytes, int startIndex, int totalLength)
        {
            string @string = SkillUtility.Encoding.GetString(bytes, startIndex + 13, totalLength - 13);

            if (@string != string.Empty)
            {
                return(fsm.GetFsmVector3(@string));
            }
            return(new SkillVector3
            {
                Value = SkillUtility.ByteArrayToVector3(bytes, startIndex),
                UseVariable = SkillUtility.BitConverter.ToBoolean(bytes, startIndex + 12)
            });
        }
Exemplo n.º 12
0
 public static string GetFullFsmLabel(Skill fsm)
 {
     if (fsm == null)
     {
         return("None (FSM)");
     }
     if (fsm.UsedInTemplate != null)
     {
         return("Template: " + fsm.UsedInTemplate.get_name());
     }
     if (fsm.Owner == null)
     {
         return("FSM Missing Owner");
     }
     return(fsm.OwnerName + " : " + SkillUtility.GetFsmLabel(fsm));
 }
Exemplo n.º 13
0
 public static void LogError(PlayMakerFSM fsm, SkillState state, SkillStateAction action, int actionIndex, string logLine)
 {
     ActionReport.Log(fsm, state, action, actionIndex, logLine, "", true);
     Debug.LogError(SkillUtility.GetPath(state, action) + logLine, fsm);
     ActionReport.ErrorCount++;
 }
Exemplo n.º 14
0
 public void DebugLog()
 {
     Debug.Log("Sent By: " + SkillUtility.GetPath(this.SentByState) + " : " + ((this.Action != null) ? this.Action.Name : "None (Action)"));
 }
Exemplo n.º 15
0
 public static string GetPath(SkillState state, SkillStateAction action, string parameter)
 {
     return(SkillUtility.GetPath(state, action) + parameter + ": ");
 }