示例#1
0
        private static void PrintObjectFields(object obj, HTMLWriter writer)
        {
            if (obj == null)
            {
                return;
            }

            writer.StartTag("table", "class=\"fields_table\"");

            Type type = obj.GetType();

            FieldInfo[] fields =
                type.GetFields(BindingFlags.Instance | BindingFlags.NonPublic |
                               BindingFlags.Public | BindingFlags.FlattenHierarchy);

            foreach (var fi in fields)
            {
                writer.StartTag("tr");
                {
                    var fieldType = fi.FieldType;

                    writer.StartTag("td", "width=\"50px\"");
                    {
                        writer.StartTag("div", "class=\"field_type\"");
                        writer.WriteValue(fieldType.Name);
                        writer.EndTag();
                    }
                    writer.EndTag();

                    writer.StartTag("td", "width=\"100px\"");
                    { writer.WriteValue(fi.Name); }
                    writer.EndTag();

                    writer.StartTag("td", "width=\"300px\"");
                    {
                        writer.StartTag("div", "class=\"field_value\"");
                        {
                            var value = fi.GetValue(obj);
                            PrintValue(obj, value, writer);
                        }
                        writer.EndTag();
                    }
                    writer.EndTag();
                }
                writer.EndTag();
            }
            writer.EndTag();
        }
示例#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>");
                }
            }
        }
示例#3
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);
            }
        }
示例#4
0
        private void WriteStyles(HTMLWriter writer)
        {
            writer.StartTag("style", "type=\"text/css\"");
            {
                writer.WriteValue("body { background: #202020; color: #b3b3b3;  font-family: sans-serif; }");
                writer.WriteValue("a { color: #9e9e9e; }");
                writer.WriteValue(".field_type { background: #418dff; color: #000; text-align: center; border: 1px solid #203e6b; padding: 3px; }");
                writer.WriteValue(".field_value { background: #000; color: #fff; border: 1px solid black; padding: 3px;  }");
                writer.WriteValue(".fields_table { font-size: 10px; margin: 5px; }");

                writer.WriteValue(".fsm_state { background: #252525; color: #a9a9a9; border: 1px solid #cecece; margin: 10px; width: 600px; }");
                writer.WriteValue(".fsm_active_state { border: 2px solid gold; }");
                writer.WriteValue(".fsm_state_name { background: #101010; padding: 10px; }");
                writer.WriteValue(".error { background: #a90000; }");
                writer.WriteValue(".fsm_action { background: #383838; border: 1px solid #000000; margin: 5px; border-radius: 5px; }");
                writer.WriteValue(".fsm_action_name { padding: 10px; font-size: 14px; font-weight: bold; border-bottom: 1px solid black; }");

                writer.WriteValue(".variable_ref { background: #ffb441; color: #000; font-size: 9px; display: inline-block; border-radius: 3px; border: 1px solid #6b4b1a; }");

                writer.WriteValue(".transition_table { margin: 2px; font-size: 12px; }");

                writer.WriteValue(".state_phase { background: #383838; border: 1px solid #000000; margin: 5px; border-radius: 5px; font-size: 18px; text-align: center; }");

                writer.WriteValue(".arrow { border: solid #909090; border-width: 0 2px 2px 0; display: inline-block; padding: 10px; width: 1px; }");

                writer.WriteValue(".right { transform: rotate(-45deg); -webkit-transform: rotate(-45deg); }");
                writer.WriteValue(".left { transform: rotate(135deg); -webkit-transform: rotate(135deg); }");
                writer.WriteValue(".up { transform: rotate(-135deg); -webkit-transform: rotate(-135deg); }");
                writer.WriteValue(".down { transform: rotate(45deg); -webkit-transform: rotate(45deg); }");

                writer.WriteValue(".center_arrow { margin-left: 289px; margin-top: -10px; margin-bottom: 2px; }");
            }
            writer.EndTag();
        }