Esempio n. 1
0
        private static void PrintValue(object obj, object value, HTMLWriter writer)
        {
            if (value == null)
            {
                writer.WriteValue("null");
                return;
            }

            if (value is FsmEvent && obj is FsmStateAction)
            {
                var fsmEvent = ((FsmEvent)value);
                var action   = (FsmStateAction)obj;
                var state    = action.State;
                var fsm      = action.Fsm;

                writer.WriteValue(fsmEvent.Name + " ");

                foreach (var transition in fsm.GlobalTransitions)
                {
                    if (transition.FsmEvent == fsmEvent)
                    {
                        writer.Link($"#{transition.ToState}", $"({transition.ToState})");
                    }
                }

                foreach (var transition in state.Transitions)
                {
                    if (transition.FsmEvent == fsmEvent)
                    {
                        writer.Link($"#{transition.ToState}", $"({transition.ToState})");
                    }
                }
            }
            else
            {
                writer.WriteValue(value.ToString());
            }

            if (value is NamedVariable)
            {
                string variableName = ((NamedVariable)value).Name;
                if (variableName.Length > 0)
                {
                    writer.WriteValue($" <div class=\"variable_ref\">{variableName}</div>");
                }
            }
        }
Esempio n. 2
0
        private static void PrintValue(object obj, object value, HTMLWriter writer)
        {
            if (value == null)
            {
                writer.WriteValue("null");
                return;
            }

            if (value is FsmEvent && obj is FsmStateAction)
            {
                var fsmEvent = ((FsmEvent)value);
                var action   = (FsmStateAction)obj;
                var state    = action.State;
                var fsm      = action.Fsm;

                writer.WriteValue(fsmEvent.Name + " ");

                foreach (var transition in fsm.GlobalTransitions)
                {
                    if (transition.FsmEvent == fsmEvent)
                    {
                        writer.Link($"#{transition.ToState}", $"({transition.ToState})");
                    }
                }

                foreach (var transition in state.Transitions)
                {
                    if (transition.FsmEvent == fsmEvent)
                    {
                        writer.Link($"#{transition.ToState}", $"({transition.ToState})");
                    }
                }
            }
            else
            {
                writer.WriteValue(value.ToString());
            }

            if (value is NamedVariable)
            {
                string variableName = ((NamedVariable)value).Name;
                if (variableName.Length > 0)
                {
                    writer.WriteValue($" <div class=\"variable_ref\">{variableName}</div>");
                }
            }
            if (value is FsmProperty)
            {
                string propertyName = ((FsmProperty)value).PropertyName;
                if (propertyName.Length > 0)
                {
                    writer.WriteValue($" <div class=\"variable_ref\">{propertyName}</div>");
                }
            }

            if (value is FsmOwnerDefault)
            {
                var val = (FsmOwnerDefault)value;
                writer.WriteValue(DumpOwnerDefault(val));
            }

            if (value is FsmEventTarget)
            {
                var val = (FsmEventTarget)value;

                string eventTargetInfo = val.target.ToString() + " ";

                if (val.excludeSelf.Value)
                {
                    eventTargetInfo += "(excludeSelf) ";
                }

                if (val.fsmComponent != null)
                {
                    eventTargetInfo += $"(fsmComponent: {val.fsmComponent.name}) ";
                }

                if (val.fsmName != null)
                {
                    eventTargetInfo += $"(fsmName: {val.fsmName.Value}) ";
                }

                if (val.gameObject != null)
                {
                    eventTargetInfo += "(" + DumpOwnerDefault(val.gameObject) + ") ";
                }

                if (val.sendToChildren.Value)
                {
                    eventTargetInfo += "(sendToChildren) ";
                }

                writer.WriteValue(eventTargetInfo);
            }
        }