public void WriteCustomPropertiesJson(JsonWriter output, string key, AGS.Types.CustomProperties customProperties)
 {
     using (output.BeginObject(key))
     {
         foreach (AGS.Types.CustomProperty property in customProperties.PropertyValues.Values)
         {
             output.WriteValue(property.Name, property.Value);
         }
     }
 }
 private void WriteImageSheetJson(JsonWriter output, string key, ImageSheet sheet)
 {
     using (output.BeginObject(key))
     {
         using (output.BeginArray("entries"))
         {
             foreach (ImageSheetEntry entry in sheet)
             {
                 entry.WriteJson(output);
             }
         }
     }
 }
        public void WriteCharacterJson(JsonWriter output, string key, AGS.Types.Character character)
        {
            using (output.BeginObject(key))
            {
                output.WriteValue("scriptName", character.ScriptName);
                output.WriteValue("room", character.StartingRoom);
                output.WriteValue("clickable", character.Clickable);
                output.WriteValue("x", character.StartX);
                output.WriteValue("y", character.StartY);
                output.WriteValue("name", character.RealName);
                output.WriteValue("speechColor", character.SpeechColor);
                output.WriteValue("animationDelay", character.AnimationDelay);
                output.WriteValue("normalView", character.NormalView);

                WriteCustomPropertiesJson(output, "properties", character.Properties);
                WriteInteractionsJson(output, "interactions", character.Interactions);
            }
        }
 public void WriteTranslationJson(JsonWriter output, string key, AGS.Types.Translation translation)
 {
     using (output.BeginObject(key))
     {
         output.WriteValue("game", GetCurrentGameGuid());
         output.WriteValue("normalFont", translation.NormalFont);
         output.WriteValue("speechFont", translation.SpeechFont);
         using (output.BeginObject("translatedLines"))
         {
             foreach (KeyValuePair<string, string> line in translation.TranslatedLines)
             {
                 if (!String.IsNullOrEmpty(line.Value))
                 {
                     output.WriteValue(line.Key, line.Value);
                 }
             }
         }
     }
 }
 public void WriteDialogJson(JsonWriter output, string key, AGS.Types.Dialog dialog)
 {
     if (dialog == null)
     {
         output.WriteNull(key);
         return;
     }
     using (output.BeginObject(key))
     {
         output.WriteValue("scriptName", dialog.Name);
         output.WriteValue("showTextParser", dialog.ShowTextParser);
         using (output.BeginArray("options"))
         {
             foreach (AGS.Types.DialogOption option in dialog.Options)
             {
                 WriteDialogOptionJson(output, option);
             }
         }
     }
 }
 private void WriteStringArrayJson(JsonWriter output, string key, IEnumerable strings)
 {
     using (output.BeginArray(key))
     {
         foreach (string str in strings)
         {
             output.WriteValue(str);
         }
     }
 }
 private void WriteStringArrayJson(JsonWriter output, IEnumerable strings)
 {
     WriteStringArrayJson(output, null, strings);
 }
 public void WriteViewJson(JsonWriter output, AGS.Types.View view)
 {
     WriteView(output, null, view);
 }
 public void WriteCustomPropertiesJson(JsonWriter output, AGS.Types.CustomProperties customProperties)
 {
     WriteCustomPropertiesJson(output, null, customProperties);
 }
 public void WriteTranslationJson(JsonWriter output, AGS.Types.Translation translation)
 {
     WriteTranslationJson(output, null, translation);
 }
示例#11
0
 internal JsonContainer(JsonWriter output)
 {
     this.j_output = output;
 }
 public void WriteDialogOptionJson(JsonWriter output, string key, AGS.Types.DialogOption option)
 {
     if (option == null)
     {
         output.WriteNull();
         return;
     }
     using (output.BeginObject(key))
     {
         output.WriteValue("text", option.Text);
         output.WriteValue("show", option.Show);
         output.WriteValue("say", option.Say);
     }
 }
 public void WriteMouseCursorJson(JsonWriter output, string key, AGS.Types.MouseCursor cursor)
 {
     if (cursor == null)
     {
         output.WriteNull(key);
         return;
     }
     using (output.BeginObject(key))
     {
         output.WriteValue("animate", cursor.Animate);
         output.WriteValue("animateOnlyOnHotspots", cursor.AnimateOnlyOnHotspots);
         output.WriteValue("animateOnlyWhenMoving", cursor.AnimateOnlyWhenMoving);
         output.WriteValue("image", cursor.Image);
         output.WriteValue("view", cursor.View);
         output.WriteValue("hotspotX", cursor.HotspotX);
         output.WriteValue("hotspotY", cursor.HotspotY);
         output.WriteValue("name", cursor.Name);
         output.WriteValue("standardMode", cursor.StandardMode);
     }
 }
 public void WriteMouseCursorJson(JsonWriter output, AGS.Types.MouseCursor cursor)
 {
     WriteMouseCursorJson(output, null, cursor);
 }
 public void WriteLoopJson(JsonWriter output, string key, AGS.Types.ViewLoop loop)
 {
     if (loop == null)
     {
         output.WriteNull(key);
         return;
     }
     using (output.BeginObject(key))
     {
         output.WriteValue("runNextLoop", loop.RunNextLoop);
         using (output.BeginArray("frames"))
         {
             foreach (AGS.Types.ViewFrame frame in loop.Frames)
             {
                 WriteFrameJson(output, frame);
             }
         }
     }
 }
 public void WriteLoopJson(JsonWriter output, AGS.Types.ViewLoop loop)
 {
     WriteLoopJson(output, null, loop);
 }
 public void WriteInventoryItemJson(JsonWriter output, string key, AGS.Types.InventoryItem inventoryItem)
 {
     using (output.BeginObject(key))
     {
         output.WriteValue("scriptName", inventoryItem.Name);
         output.WriteValue("name", inventoryItem.Description);
         output.WriteValue("image", inventoryItem.Image);
         output.WriteValue("hotspotX", inventoryItem.HotspotX);
         output.WriteValue("hotspotY", inventoryItem.HotspotY);
         output.WriteValue("cursorImage", inventoryItem.CursorImage);
         WriteCustomPropertiesJson(output, "properties", inventoryItem.Properties);
         WriteInteractionsJson(output, "interactions", inventoryItem.Interactions);
     }
 }
 public void WriteInventoryItemJson(JsonWriter output, AGS.Types.InventoryItem inventoryItem)
 {
     WriteInventoryItemJson(output, null, inventoryItem);
 }
 public void WriteInteractionsJson(JsonWriter output, string key, AGS.Types.Interactions interactions)
 {
     using (output.BeginObject(key))
     {
         for (int i = 0; i < interactions.ScriptFunctionNames.Length; i++)
         {
             if (!String.IsNullOrEmpty(interactions.ScriptFunctionNames[i]))
             {
                 using (output.BeginObject(i.ToString()))
                 {
                     output.WriteValue("func", interactions.ScriptFunctionNames[i]);
                     if (!String.IsNullOrEmpty(interactions.ImportedScripts[i]))
                     {
                         output.WriteValue("script", interactions.ImportedScripts[i]);
                     }
                 }
             }
         }
     }
 }
 private void WriteView(JsonWriter output, string key, AGS.Types.View view)
 {
     if (view == null)
     {
         output.WriteNull(key);
         return;
     }
     using (output.BeginObject(key))
     {
         using (output.BeginArray("loops"))
         {
             foreach (AGS.Types.ViewLoop loop in view.Loops)
             {
                 WriteLoopJson(output, loop);
             }
         }
     }
 }
 public void WriteDialogOptionJson(JsonWriter output, AGS.Types.DialogOption option)
 {
     WriteDialogOptionJson(output, null, option);
 }
 public void WriteSettingsJson(JsonWriter output)
 {
     WriteSettingsJson(output, null);
 }
示例#23
0
 internal Object(JsonWriter output)
     : base(output)
 {
 }
 private void WriteSpritesJson(JsonWriter output)
 {
     WriteSpritesJson(output, null);
 }
示例#25
0
 internal Array(JsonWriter output)
     : base(output)
 {
 }
        public void WriteGuiJson(JsonWriter output, string key, AGS.Types.GUI gui)
        {
            if (gui == null)
            {
                output.WriteNull(key);
                return;
            }
            using (output.BeginObject(key))
            {
                output.WriteValue("scriptName", gui.Name);
                output.WriteValue("backgroundColor", gui.BackgroundColor);
                output.WriteValue("backgroundImage", gui.BackgroundImage);

                if (gui is AGS.Types.NormalGUI)
                {
                    output.WriteValue("type", "normal");
                    AGS.Types.NormalGUI normalGui = (AGS.Types.NormalGUI)gui;

                    output.WriteValue("borderColor", normalGui.BorderColor);
                    output.WriteValue("clickable", normalGui.Clickable);
                    output.WriteValue("left", normalGui.Left);
                    output.WriteValue("top", normalGui.Top);
                    output.WriteValue("width", normalGui.Width);
                    output.WriteValue("height", normalGui.Height);
                    output.WriteValue("onClick", normalGui.OnClick);
                    output.WriteValue("popupYPos", normalGui.PopupYPos);
                    output.WriteValue("transparency", normalGui.Transparency);
                    switch (normalGui.Visibility)
                    {
                        case AGS.Types.GUIVisibility.MouseYPos:
                            output.WriteValue("visibility", "mouseYPos");
                            break;
                        case AGS.Types.GUIVisibility.Normal:
                            output.WriteValue("visibility", "normal");
                            break;
                        case AGS.Types.GUIVisibility.NormalButInitiallyOff:
                            output.WriteValue("visibility", "normalButInitiallyOff");
                            break;
                        case AGS.Types.GUIVisibility.Persistent:
                            output.WriteValue("visibility", "persistent");
                            break;
                        case AGS.Types.GUIVisibility.PopupModal:
                            output.WriteValue("visibility", "popupModal");
                            break;
                        default:
                            throw new Exception("Unknown GUIVisibility: " + normalGui.Visibility);
                    }
                    output.WriteValue("zOrder", normalGui.ZOrder);
                }
                else if (gui is AGS.Types.TextWindowGUI)
                {
                    output.WriteValue("type", "textWindow");
                    AGS.Types.TextWindowGUI textWindowGui = (AGS.Types.TextWindowGUI)gui;

                    output.WriteValue("borderColor", textWindowGui.BorderColor);
                    output.WriteValue("textColor", textWindowGui.TextColor);
                }
                else
                {
                    throw new Exception("Unknown GUI Type: " + gui);
                }

                using (output.BeginArray("controls"))
                {
                    foreach (AGS.Types.GUIControl control in gui.Controls)
                    {
                        WriteGuiControlJson(output, control);
                    }
                }
            }
        }
        public void WriteSettingsJson(JsonWriter output, string key)
        {
            using (output.BeginObject(key))
            {
                AGS.Types.Settings settings = editor.CurrentGame.Settings;

                switch (settings.ColorDepth)
                {
                    case AGS.Types.GameColorDepth.Palette:
                        output.WriteValue("colorDepth", 8);
                        break;
                    case AGS.Types.GameColorDepth.HighColor:
                        output.WriteValue("colorDepth", 16);
                        break;
                    case AGS.Types.GameColorDepth.TrueColor:
                        output.WriteValue("colorDepth", 32);
                        break;
                    default:
                        throw new Exception("unknown color depth: " + settings.ColorDepth);
                }

                switch (settings.Resolution)
                {
                    case AGS.Types.GameResolutions.R320x200:
                        output.WriteValue("width", 320);
                        output.WriteValue("height", 200);
                        break;
                    case AGS.Types.GameResolutions.R320x240:
                        output.WriteValue("width", 320);
                        output.WriteValue("height", 240);
                        break;
                    case AGS.Types.GameResolutions.R640x400:
                        output.WriteValue("width", 640);
                        output.WriteValue("height", 400);
                        break;
                    case AGS.Types.GameResolutions.R640x480:
                        output.WriteValue("width", 640);
                        output.WriteValue("height", 480);
                        break;
                    case AGS.Types.GameResolutions.R800x600:
                        output.WriteValue("width", 800);
                        output.WriteValue("height", 600);
                        break;
                    case AGS.Types.GameResolutions.R1024x768:
                        output.WriteValue("width", 1024);
                        output.WriteValue("height", 768);
                        break;
                    default:
                        throw new Exception("unknown resolution: " + settings.Resolution);
                }

                using (output.BeginObject("skipSpeech"))
                {
                    switch (settings.SkipSpeech)
                    {
                        case AGS.Types.SkipSpeechStyle.MouseOrKeyboardOrTimer:
                            output.WriteValue("mouse", true);
                            output.WriteValue("keyboard", true);
                            output.WriteValue("timer", true);
                            break;
                        case AGS.Types.SkipSpeechStyle.MouseOrKeyboard:
                            output.WriteValue("mouse", true);
                            output.WriteValue("keyboard", true);
                            output.WriteValue("timer", false);
                            break;
                        case AGS.Types.SkipSpeechStyle.MouseOnly:
                            output.WriteValue("mouse", true);
                            output.WriteValue("keyboard", false);
                            output.WriteValue("timer", true);
                            break;
                        case AGS.Types.SkipSpeechStyle.KeyboardOnly:
                            output.WriteValue("mouse", false);
                            output.WriteValue("keyboard", true);
                            output.WriteValue("timer", false);
                            break;
                        case AGS.Types.SkipSpeechStyle.TimerOnly:
                            output.WriteValue("mouse", false);
                            output.WriteValue("keyboard", false);
                            output.WriteValue("timer", true);
                            break;
                    }
                }

                output.WriteValue("name", settings.GameName);
                output.WriteValue("maxScore", settings.MaximumScore);
                output.WriteValue("mouseWheelSupport", settings.MouseWheelEnabled);
                output.WriteValue("gameWideSpeechAnimationSpeed", settings.LegacySpeechAnimationSpeed);
                output.WriteValue("useLowResCoordinates", settings.UseLowResCoordinatesInScript);
                output.WriteValue("autoMoveLookMode", settings.WalkInLookMode);
                output.WriteValue("autoMoveWalkMode", settings.AutoMoveInWalkMode);
                output.WriteValue("turnBeforeWalking", settings.TurnBeforeWalking);
                output.WriteValue("turnToFaceDirection", settings.TurnBeforeFacing);
                output.WriteValue("debug", settings.DebugMode);
                output.WriteValue("dialogBulletPointImage", settings.DialogOptionsBullet);
                output.WriteValue("dialogGapPixels", settings.DialogOptionsGap);
                output.WriteValue("numberDialogOptions", settings.NumberDialogOptions);
                output.WriteValue("dialogOptionsUpwards", settings.DialogOptionsBackwards);
                output.WriteValue("animateDuringDialogOptions", settings.RunGameLoopsWhileDialogOptionsDisplayed);
                output.WriteValue("speechPortraitSide", EnumName(settings.SpeechPortraitSide));
                output.WriteValue("speechStyle", EnumName(settings.SpeechStyle));
                output.WriteValue("dialogOptionsGui", settings.DialogOptionsGUI);
                output.WriteValue("multipleInventoryIcons", settings.DisplayMultipleInventory);

                AGS.Types.InventoryHotspotMarker marker = settings.InventoryHotspotMarker;
                if (marker == null)
                {
                    output.WriteNull("inventoryItemCursorHotspotMarker");
                }
                else
                {
                    switch (marker.Style)
                    {
                        case AGS.Types.InventoryHotspotMarkerStyle.None:
                            output.WriteNull("inventoryItemCursorHotspotMarker");
                            break;
                        case AGS.Types.InventoryHotspotMarkerStyle.Sprite:
                            using (output.BeginObject("inventoryItemCursorHotspotMarker"))
                            {
                                output.WriteValue("type", "sprite");
                                output.WriteValue("image", marker.Image);
                            }
                            break;
                        case AGS.Types.InventoryHotspotMarkerStyle.Crosshair:
                            using (output.BeginObject("inventoryItemCursorHotspotMarker"))
                            {
                                output.WriteValue("type", "crosshair");
                                output.WriteValue("crosshairColor", marker.CrosshairColor);
                                output.WriteValue("dotColor", marker.DotColor);
                            }
                            break;
                        default:
                            throw new Exception("Unknown InventoryHotspotMarkerStyle: " + marker.Style);
                    }
                }

                output.WriteValue("overrideInventoryWindowClick", settings.HandleInvClicksInScript);
                output.WriteValue("inventoryItemCursor", settings.InventoryCursors);
                output.WriteValue("scoreSound", settings.PlaySoundOnScore);
                output.WriteValue("alwaysDisplaySpeech", settings.AlwaysDisplayTextAsSpeech);
                output.WriteValue("antiAliasTtf", settings.AntiAliasFonts);
                output.WriteValue("textWindowGui", settings.TextWindowGUI);
                output.WriteValue("thoughtBubbleGui", settings.ThoughtGUI);
                output.WriteValue("fontsHiRes", settings.FontsForHiRes);
                output.WriteValue("gameTextLeftToRight", settings.BackwardsText);
                output.WriteValue("roomTransition", EnumName(settings.RoomTransition));
                output.WriteValue("guiAlphaStyle", EnumName(settings.GUIAlphaStyle));
                output.WriteValue("pixelPerfect", settings.PixelPerfect);
                output.WriteValue("whenInterfaceDisabled", EnumName(settings.WhenInterfaceDisabled));
            }
        }
 public void WriteInteractionsJson(JsonWriter output, AGS.Types.Interactions interactions)
 {
     WriteInteractionsJson(output, null, interactions);
 }
 private void WriteSpritesJson(JsonWriter output, string key)
 {
     using (output.BeginArray(key))
     {
         foreach (SpriteImageSheetEntry entry in spriteImageSheetEntries)
         {
             if (entry == null || entry.Width == 0 || entry.Height == 0)
             {
                 output.WriteNull();
             }
             else
             {
                 using (output.BeginObject())
                 {
                     output.WriteValue("s", GameImageSheets.IndexOf(entry.OwningSheet));
                     output.WriteValue("n", entry.EntryNumber);
                 }
             }
         }
     }
 }
 public void WriteDialogJson(JsonWriter output, AGS.Types.Dialog dialog)
 {
     WriteDialogJson(output, null, dialog);
 }