private WebJSON.Message GetSettingsMessageJSON() { WebJSON.Message message = new WebJSON.Message() { Type = WebJSON.MessageType.Settings, Settings = GetSettingsJSON() }; return(message); }
private WebJSON.Message GetSelectionMessageJSON(bool includeLists = false, bool includeDetails = true) { WebJSON.Message selectionJSON = new WebJSON.Message() { Type = WebJSON.MessageType.Selection, Selection = new WebJSON.Selection() { Object = GetObjectJSON(selectedObject_, includeLists: includeLists, includeDetails: includeDetails) } }; return(selectionJSON); }
private WebJSON.Message GetHierarchyMessageJSON() { WebJSON.Message message = new WebJSON.Message() { Type = WebJSON.MessageType.Hierarchy, Settings = GetSettingsJSON(), Localization = GetLocalizationJSON(), Hierarchy = GetHierarchyJSON(), GameSettings = GetGameSettingsJSON() }; return(message); }
private WebJSON.Message GetHighlightMessageJSON() { WebJSON.Message selectionJSON = new WebJSON.Message() { Type = WebJSON.MessageType.Highlight, Highlight = new WebJSON.Highlight() { Object = GetObjectJSON(highlightedObject_), // Collision } }; return(selectionJSON); }
private WebJSON.Message GetHighlightMessageJSON() { WebJSON.Message selectionJSON = new WebJSON.Message() { Type = WebJSON.MessageType.Highlight, Highlight = new WebJSON.Highlight() { Perso = GetPersoJSON(highlightedPerso_), WayPoint = GetWayPointJSON(highlightedWayPoint_, true), Collider = GetColliderJSON(highlightedCollision_) } }; return(selectionJSON); }
private WebJSON.Message GetSelectionMessageJSON(bool includeLists, bool includeBrain) { MapLoader l = MapLoader.Loader; WebJSON.Message selectionJSON = new WebJSON.Message() { Type = WebJSON.MessageType.Selection, Selection = new WebJSON.Selection() { Perso = GetPersoJSON(selector.selectedPerso, includeLists: includeLists, includeBrain: includeBrain) } }; return(selectionJSON); }
public void Send(WebJSON.Message obj) { if (Application.platform == RuntimePlatform.WebGLPlayer || testMessages) { if (controller.LoadState == Controller.State.Finished) { string json = SerializeMessage(obj); if (Application.platform == RuntimePlatform.WebGLPlayer) { UnityJSMessage(json); } else if (testMessages) { Debug.Log(json); } } } }
public void Send(WebJSON.Message obj, bool allowIfUnloaded = false) { if (Application.platform == RuntimePlatform.WebGLPlayer) { if (allowIfUnloaded || Controller.LoadState == Controller.State.Finished) { string json = SerializeMessage(obj); UnityJSMessage(json); } } else if (debugMessages) { if (allowIfUnloaded || Controller.LoadState == Controller.State.Finished) { string json = SerializeMessage(obj); print(json); } } }
private WebJSON.Message GetHierarchyMessageJSON() { MapLoader l = MapLoader.Loader; WebJSON.Message message = new WebJSON.Message() { Type = WebJSON.MessageType.Hierarchy, Settings = GetSettingsJSON(), Localization = GetLocalizationJSON(), Input = GetInputJSON(), CineData = GetCineDataJSON(), Hierarchy = new WebJSON.Hierarchy() { Always = GetAlwaysJSON() }, Camera = GetCameraJSON(), GameSettings = GetGameSettingsJSON() }; switch (l) { case OpenSpace.Loader.R2ROMLoader rl: message.Hierarchy.DynamicSuperObjects = controller.romPersos.Where(p => !p.IsAlways) .Select(p => GetSuperObjectJSON(controller.superObjects.FirstOrDefault(s => s.soROMDynamic == p.superObject))).ToArray(); message.Hierarchy.FatherSector = GetSuperObjectJSON(controller.superObjects.FirstOrDefault(s => s.Offset == rl.level?.hierarchyRoot?.Value?.fatherSector?.Value?.Offset)); break; case OpenSpace.Loader.R2PS1Loader pl: message.Hierarchy.DynamicWorld = GetSuperObjectJSON(controller.superObjects.FirstOrDefault(s => s.Offset == pl.levelHeader?.dynamicWorld.Offset)); message.Hierarchy.FatherSector = GetSuperObjectJSON(controller.superObjects.FirstOrDefault(s => s.Offset == pl.levelHeader?.fatherSector.Offset)); break; default: message.Hierarchy.ActualWorld = GetSuperObjectJSON(controller.superObjects.FirstOrDefault(s => s.Offset == l.actualWorld.offset)); if (l.transitDynamicWorld != null) { message.Hierarchy.TransitDynamicWorld = GetSuperObjectJSON(controller.superObjects.FirstOrDefault(s => s.Offset == l.transitDynamicWorld.offset)); } break; } return(message); }
private WebJSON.Message GetHighlightMessageJSON() { WebJSON.Message selectionJSON = new WebJSON.Message() { Type = WebJSON.MessageType.Highlight, Highlight = new WebJSON.Highlight() { Object = GetObjectJSON(highlightedObject_) } }; // Collision if (highlightedCollision3D_ != null) { selectionJSON.Highlight.Collision = new WebJSON.Collision[1] { new WebJSON.Collision() { Type = highlightedCollision3D_.Type.ToString(), Shape = highlightedCollision3D_.Shape != Unity_IsometricCollisionTile.ShapeType.None ? highlightedCollision3D_.Shape.ToString() : null, AdditionalType = highlightedCollision3D_.AddType != Unity_IsometricCollisionTile.AdditionalTypeFlags.None ? highlightedCollision3D_.AddType.ToString() : null } }; } else if (highlightedCollision_ != null && highlightedCollision_.Length > 0) { selectionJSON.Highlight.Collision = highlightedCollision_ .Where(c => c != null) .Select(c => new WebJSON.Collision() { Type = LevelEditorData.Level.GetCollisionTypeNameFunc(c.Data?.CollisionType ?? 0), Shape = c.Data?.GBAVV_CollisionShape?.ToString() }) .Where(c => c.Type != "Empty" && c.Type != "None" && !(c.Type == "Solid" && c.Shape == "None")) // Filter out empty types .ToArray(); if (selectionJSON.Highlight.Collision?.Length == 0) { selectionJSON.Highlight.Collision = null; } } return(selectionJSON); }
public void ParseMessage(string msgString) { WebJSON.Message msg = Newtonsoft.Json.JsonConvert.DeserializeObject <WebJSON.Message>(msgString, JsonSettings); if (msg.Settings != null) { ParseSettingsJSON(msg.Settings); } if (msg.Request != null) { ParseRequestJSON(msg.Request); } if (msg.Selection != null) { ParseSelectionJSON(msg.Selection); } if (msg.Object != null) { ParseObjectJSON(msg.Object); } }
public void ParseMessage(string msgString) { WebJSON.Message msg = Newtonsoft.Json.JsonConvert.DeserializeObject <WebJSON.Message>(msgString, Settings); if (msg.SuperObject != null) { ParseSuperObjectJSON(msg.SuperObject); } if (msg.Perso != null) { ParsePersoJSON(msg.Perso); } if (msg.Settings != null) { ParseSettingsJSON(msg.Settings); } if (msg.Camera != null) { ParseCameraJSON(msg.Camera); } if (msg.Selection != null) { ParseSelectionJSON(msg.Selection); } if (msg.Request != null) { ParseRequestJSON(msg.Request); } if (msg.CineData != null) { ParseCineDataJSON(msg.CineData); } if (msg.Outline != null) { ParseOutlineJSON(msg.Outline); } }
public string SerializeMessage(WebJSON.Message obj) { string json = Newtonsoft.Json.JsonConvert.SerializeObject(obj, Settings); return(json); }