public void FromJSON(FloorController api, JSONNode root) { collection = root["collection"] ?? ""; begin = new CallNumber(root["call_start"]); end = new CallNumber(root["call_end"]); isSideA = root["side"].AsInt == 0; }
public void FromJSON(FloorController api, JSONNode root) { Rectangle r = GetComponent <Rectangle>(); r.SetCenter(new Vector2(root["center_x"].AsFloat, root["center_y"].AsFloat)); r.SetSize(new Vector2(root["width"].AsFloat, root["height"].AsFloat)); r.SetRotation(root["rotation"].AsFloat); foreach (JSONNode node in root["aisles"].AsArray) { Aisle aisle = api.CreateAisle(Rect.zero, false, true, true); aisle.transform.SetParent(container, false); aisle.FromJSON(api, node); } }
/// <summary> /// Overwrites this floor's content with JSON object root. /// </summary> /// <param name = "api">The FloorController.</param> /// <param name="root">Root.</param> public void FromJSON(FloorController api, JSONNode root) { if (root == null) { return; } floorId = root["floor_id"]; floorName = root["floor_name"]; floorOrder = root["floor_order"]; libraryId = root["library"]; if (api == null) { // Not ready to expand yet! floorJSONCache = root.ToString(); return; } aisles.Clear(); aisleAreas.Clear(); walls.Clear(); landmarks.Clear(); foreach (JSONObject obj in root["aisles"].AsArray) { Aisle aisle = api.CreateAisle(Rect.zero, false, true); aisle.FromJSON(api, obj); } foreach (JSONObject obj in root["aisle_areas"].AsArray) { AisleArea aisleArea = api.CreateAisleArea(Rect.zero, false, true); aisleArea.FromJSON(api, obj); } foreach (JSONObject obj in root["walls"].AsArray) { Wall wall = api.CreateWall(Vector2.zero, Vector2.zero, false, true); wall.FromJSON(api, obj); } foreach (JSONObject obj in root["landmarks"].AsArray) { Landmark landmark = api.CreateLandmark(Rect.zero, false, true); landmark.FromJSON(api, obj); } }
public void FromJSON(FloorController api, JSONNode root) { Rectangle r = GetComponent <Rectangle>(); r.SetCenter(new Vector2(root["center_x"].AsFloat, root["center_y"].AsFloat)); r.SetSize(new Vector2(root["width"].AsFloat, root["height"].AsFloat)); r.SetRotation(root["rotation"].AsFloat); singleSided = root["is_double_sided"].AsInt == 0; callNumberRanges = new List <CallNumberRange>(); foreach (JSONNode node in root["call_ranges"].AsArray) { CallNumberRange range = new CallNumberRange(); range.FromJSON(api, node); callNumberRanges.Add(range); } }
public void FromJSON(FloorController api, JSONNode root) { Rectangle r = GetComponent <Rectangle>(); r.SetCenter(new Vector2(root["center_x"].AsFloat, root["center_y"].AsFloat)); r.SetSize(new Vector2(root["width"].AsFloat, root["height"].AsFloat)); r.SetRotation(root["rotation"].AsFloat); LandmarkType t; try { t = (LandmarkType)Enum.Parse(typeof(LandmarkType), root["landmark_type"]); } catch (ArgumentException ex) { Debug.LogWarning("Bad landmark type loaded! " + ex.Message); t = LandmarkType.Restroom; } landmarkType = t; Update(); }
public void FromJSON(FloorController api, JSONNode root) { SetStart(new Vector2(root["start_x"].AsFloat, root["start_y"].AsFloat)); SetEnd(new Vector2(root["end_x"].AsFloat, root["end_y"].AsFloat)); }