Example #1
0
        void IJsonSerializable.Serialize(JsonWriter writer)
        {
            // Serialize static property values
            if (StaticProperties.Count > 0)
                writer.Set("static", StaticProperties.ToDictionary(
                    property => property.Name,
                    property => JsonConverter.GetPropertyValue(property, property.DeclaringType)));

            // Serialize instances
            foreach (var instance in Instances)
                writer.Set(instance.Key, instance.Value);
        }
        //adds buttons to the bottom area of the display
        private Rect DrawBottomButtons(Rect position)
        {
            //set button positions
            float buttonHeight   = 30F;
            Rect  buttonPosition = new Rect(0F, position.height - buttonHeight, position.width, buttonHeight);

            //write to json button
            if (GUI.Button(buttonPosition, "Write to File"))
            {
                writer.Process();
            }
            //move position up
            buttonPosition = new Rect(0F, buttonPosition.y - buttonHeight, position.width, buttonHeight);
            //read from json button
            if (GUI.Button(buttonPosition, "Read File"))
            {
                writer.Set();
            }
            // if not at top nested level, create back button
            if (propertyList.Count > 1)
            {
                //move position up
                buttonPosition = new Rect(0F, buttonPosition.y - buttonHeight, position.width, buttonHeight);
                //if button pressed, reset view to previous nested level
                if (GUI.Button(buttonPosition, "Back"))
                {
                    RemovePropertiesFromList();
                }
                ;
            }
            return(buttonPosition);
        }
Example #3
0
        void IJsonSerializable.Serialize(JsonWriter writer)
        {
            // Serialize static property values
            if (StaticProperties.Count > 0)
            {
                writer.Set("static", StaticProperties.ToDictionary(
                               property => property.Name,
                               property => JsonConverter.GetPropertyValue(property, property.DeclaringType)));
            }

            // Serialize instances
            foreach (var instance in Instances)
            {
                writer.Set(instance.Key, instance.Value);
            }
        }
Example #4
0
            void IJsonSerializable.Serialize(JsonWriter writer)
            {
                if (IsList)
                {
                    writer.Set("ids", Roots.Select(r => r.Id));
                }
                else
                {
                    writer.Set("id", Roots[0].Id);
                }
                writer.Set("from", From.Name);

                if (Include != null)
                {
                    writer.Set("include", Include);
                }

                writer.Set("inScope", InScope);
            }
 //ensure all properties are set
 public void Set(JsonWriter <T> sentWriter, string sentName)
 {
     writer = sentWriter;
     writer.Set();
     serializedWriter = new SerializedObject(writer);
     lineHeight       = EditorGUIUtility.singleLineHeight;
     if (propertyList == null || propertyList.Count == 0)
     {
         propertyList = new List <SerializedProperty>();
         SerializedProperty serializedConversationList = serializedWriter.FindProperty(sentName);
         propertyList.Add(serializedConversationList);
     }
 }
Example #6
0
 void IJsonSerializable.Serialize(JsonWriter writer)
 {
     writer.Set("type", Type);
     writer.Set("message", Message);
     writer.Set("stackTrace", StackTrace);
     writer.Set("url", Url);
     writer.Set("refererUrl", RefererUrl);
     writer.Set("additionalInfo", AdditionalInfo);
 }
        //adds buttons to the bottom area of the display
        private Rect DrawBottomButtons(Rect position)
        {
            //set button positions
            float buttonHeight  = 30F;
            float totalHeight   = buttonHeight * 3 + lineHeight;
            Rect  totalPosition = new Rect(0F, position.height - totalHeight, position.width, totalHeight);

            EditorGUI.DrawRect(totalPosition, GetEditorColor());
            Rect buttonPosition = new Rect(0F, position.height - buttonHeight, position.width, buttonHeight);

            //write to json button
            if (GUI.Button(buttonPosition, "Write to File"))
            {
                writer.Process();
            }
            //move position up
            buttonPosition = new Rect(0F, buttonPosition.y - buttonHeight, position.width, buttonHeight);
            //read from json button
            if (GUI.Button(buttonPosition, "Read File"))
            {
                writer.Set();
            }
            // if not at top nested level, create back button
            if (propertyList.Count > 1)
            {
                //move position up
                buttonPosition = new Rect(0F, buttonPosition.y - buttonHeight, position.width, buttonHeight);
                //if button pressed, reset view to previous nested level
                if (GUI.Button(buttonPosition, "Back"))
                {
                    RemovePropertiesFromList();
                }
                ;
            }
            Rect linePosition = new Rect(0F, totalPosition.y, position.width, lineHeight);

            EditorGUI.LabelField(linePosition, "", GUI.skin.horizontalSlider);
            totalHeight += lineHeight;
            return(totalPosition);
        }
Example #8
0
 void IJsonSerializable.Serialize(JsonWriter writer)
 {
     writer.Set("type", Type);
     writer.Set("message", Message);
     writer.Set("stackTrace", StackTrace);
     writer.Set("url", Url);
     writer.Set("refererUrl", RefererUrl);
     writer.Set("additionalInfo", AdditionalInfo);
 }
Example #9
0
            void IJsonSerializable.Serialize(JsonWriter writer)
            {
                if (IsList)
                    writer.Set("ids", Roots.Select(r => r.Id));
                else
                    writer.Set("id", Roots[0].Id);
                writer.Set("from", From.Name);

                if (Include != null)
                    writer.Set("include", Include);

                writer.Set("inScope", InScope);
            }