public override void Execute(Level level) { ClientAvatar ca = level.GetPlayerAvatar(); GameObject go = level.GameObjectManager.GetGameObjectByID(m_vBuildingId); if (go != null) { if (go.ClassId == 4) { Trap t = (Trap)go; int upgradeLevel = t.GetUpgradeLevel(); var rd = t.GetTrapData().GetBuildResource(upgradeLevel); int sellPrice = t.GetTrapData().GetSellPrice(upgradeLevel); ca.CommodityCountChangeHelper(0, rd, sellPrice); level.GameObjectManager.RemoveGameObject(t); } else if (go.ClassId == 6) { Deco d = (Deco)go; var rd = d.GetDecoData().GetBuildResource(); int sellPrice = d.GetDecoData().GetSellPrice(); if (rd.PremiumCurrency) { ca.SetDiamonds(ca.GetDiamonds() + sellPrice); } else { ca.CommodityCountChangeHelper(0, rd, sellPrice); } level.GameObjectManager.RemoveGameObject(d); } else { //TODO BUILDING /* * Building b = (Building)go; * level.GameObjectManager.RemoveGameObject(b); * */ } } }
internal override void Execute() { Level Level = this.Device.GameMode.Level; GameObject Building = Level.GameObjectManager.Filter.GetGameObjectByPreciseId(this.BuildingId); if (Building != null) { if (Building is Deco) { Deco Deco = (Deco)Building; DecoData Data = Deco.DecoData; ResourceData ResourceData = Data.BuildResourceData; if (ResourceData != null) { int SellPrice = Data.SellPrice; if (ResourceData.PremiumCurrency) { Level.Player.AddDiamonds(SellPrice); } else if (Level.Player.Resources.GetCountByData(ResourceData) >= SellPrice) { Level.Player.Resources.Plus(ResourceData.GlobalId, SellPrice); Level.GameObjectManager.RemoveGameObject(Deco, Data.VillageType); } } else { Logging.Error(this.GetType(), "Unable to sell buidling. The resource data is null!"); } } else { Logging.Error(this.GetType(), "Unable to sell buidling. The player tried to sell unsurported buidling!"); } } else { Logging.Error(this.GetType(), "Unable to sell buidling. The player tried to sell a null building!"); } }
public void Load(JObject jsonObject) { var jsonBuildings = (JArray)jsonObject["buildings"]; foreach (JObject jsonBuilding in jsonBuildings) { var bd = CSV.Tables.Get(Gamefile.Buildings).GetDataWithID(jsonBuilding["data"].ToObject <int>()) as Buildings; var b = new Building(bd, this.Level); AddGameObject(b); b.Load(jsonBuilding); } var jsonTraps = (JArray)jsonObject["traps"]; foreach (JObject jsonTrap in jsonTraps) { var td = CSV.Tables.Get(Gamefile.Traps).GetDataWithID(jsonTrap["data"].ToObject <int>()) as Traps; var t = new Trap(td, this.Level); AddGameObject(t); t.Load(jsonTrap); } var jsonDecos = (JArray)jsonObject["decos"]; foreach (JObject jsonDeco in jsonDecos) { var dd = CSV.Tables.GetWithGlobalID(jsonDeco["data"].ToObject <int>()) as Decos; var d = new Deco(dd, this.Level); AddGameObject(d); d.Load(jsonDeco); } var jsonObstacles = (JArray)jsonObject["obstacles"]; foreach (JObject jsonObstacle in jsonObstacles) { var dd = CSV.Tables.Get(Gamefile.Obstacles).GetDataWithID(jsonObstacle["data"].ToObject <int>()) as Obstacles; var d = new Obstacle(dd, this.Level); AddGameObject(d); d.Load(jsonObstacle); } }
public override void BindToParkitect(GameObject hider, AssetBundle bundle) { BaseDecorator baseDecorator = DecoratorByInstance <BaseDecorator>(); GridDecorator gridDecorator = DecoratorByInstance <GridDecorator>(); CategoryDecorator categoryDecorator = DecoratorByInstance <CategoryDecorator>(); ColorDecorator colorDecorator = DecoratorByInstance <ColorDecorator>(); BoundingBoxDecorator boxDecorator = DecoratorByInstance <BoundingBoxDecorator>(); GameObject gameObject = Instantiate(bundle.LoadAsset <GameObject>(Key)); gameObject.transform.parent = hider.transform; _deco = gameObject.AddComponent <Deco>(); _deco.name = Key; _deco.buildOnLayerMask = 4096; _deco.heightChangeDelta = gridDecorator.HeightDelta; _deco.defaultGridSubdivision = gridDecorator.GridSubdivision; _deco.buildOnGrid = gridDecorator.Grid; _deco.defaultSnapToGridCenter = gridDecorator.Snap; _deco.isPreview = true; _deco.isStatic = true; _deco.dontSerialize = true; RemapUtility.RemapMaterials(gameObject); baseDecorator.Decorate(gameObject, hider, this, bundle); colorDecorator.Decorate(gameObject, hider, this, bundle); categoryDecorator.Decorate(gameObject, hider, this, bundle); foreach (var box in boxDecorator.BoundingBoxes) { var b = gameObject.AddComponent <BoundingBox>(); b.setBounds(box.Bounds); } AssetManager.Instance.registerObject(_deco); }
public override void Execute(Level level) { ClientAvatar avatar = level.GetPlayerAvatar(); GameObject gameObjectById = level.GameObjectManager.GetGameObjectByID(m_vBuildingId); if (gameObjectById == null) { return; } if (gameObjectById.ClassId == 4) { Trap trap = (Trap)gameObjectById; int upgradeLevel = trap.GetUpgradeLevel(); ResourceData buildResource = trap.GetTrapData().GetBuildResource(upgradeLevel); int sellPrice = trap.GetTrapData().GetSellPrice(upgradeLevel); avatar.CommodityCountChangeHelper(0, (Data)buildResource, sellPrice); level.GameObjectManager.RemoveGameObject((GameObject)trap); } else { if (gameObjectById.ClassId != 6) { return; } Deco deco = (Deco)gameObjectById; ResourceData buildResource = deco.GetDecoData().GetBuildResource(); int sellPrice = deco.GetDecoData().GetSellPrice(); if (buildResource.PremiumCurrency) { avatar.SetDiamonds(avatar.GetDiamonds() + sellPrice); } else { avatar.CommodityCountChangeHelper(0, (Data)buildResource, sellPrice); } level.GameObjectManager.RemoveGameObject((GameObject)deco); } }
/** * @before Insert a character in list by ascending X value. * @param x = x pixel of upper left corner of character * @param y = y pixel of upper left corner of character * @param c = character to be added */ public void InsertDeco (Deco deco) { if (lox > deco.x) lox = deco.x; if (loy > deco.y) loy = deco.y; if (hix < deco.x + deco.w) hix = deco.x + deco.w; if (hiy < deco.y + deco.h) hiy = deco.y + deco.h; for (LinkedListNode<Deco> ptr = decos.First; ptr != null; ptr = ptr.Next) { if (deco.x < ptr.Value.x) { decos.AddBefore (ptr, deco); return; } } decos.AddLast (deco); }
/** * @brief Alternate constructor to create a cluster from a known lat/lon value. * @param ll = lat/lon string value */ public Cluster (string ll) { foreach (char c in ll) { Deco deco = new Deco (); deco.c = c; decos.AddLast (deco); } }
/** * @brief Try to decode the character at upper-left corner blacks[y,x] * @param x,y = upper left corner * @param w,h = width/height of box (exclusive) */ private static void DecodeCharacter (int x, int y, int w, int h) { byte[,] grays = null; char ch; bool debug = false; // (x >= 1420) && (x <= 1540) && (y >= 2210) && (y <= 2250); if (debug) Console.WriteLine ("DecodeCharacter*: " + x + "," + y + " " + w + "x" + h); if ((w <= 0) || (w > Deco.MAXWH)) return; if ((h <= 0) || (h > Deco.MAXWH)) return; // decimal point if ((w < 5) && (h < 5)) { ch = '.'; } // seconds mark else if (CheckForSecMark (x, y, w, h)) { ch = '\''; } // degrees mark else if ((w < 13) && (h < 13)) { ch = '^'; } // digit '1' else if (CheckForOneDigit (x, y, w, h)) { ch = '1'; } // something that needs to be decoded else if ((w > 7) && (h > 13)) { grays = BuildGraysArray (x, y, w, h); ch = DecodeGraysArray (grays, false); /* * Sometimes we misread what is really a 2 as a 7. * Real 7's don't have any black pixels in lower right corner. * See NUW 122^38'W (the second 2). */ if (ch == '7') { int nb = blacks[y+h-1,x+w-1] + blacks[y+h-1,x+w-2] + blacks[y+h-1,x+w-3] + blacks[y+h-2,x+w-1] + blacks[y+h-2,x+w-2] + blacks[y+h-2,x+w-3]; if (nb > 0) ch = '2'; } } // some garbage else return; if (debug) Console.WriteLine ("DecodeCharacter*: " + x + "," + y + " " + w + "x" + h + " => " + ch); // add to list of all decoded characters by ascending X value. // because strings go from left-to-right (ascending X value). // we sort out the Y values in GatherIntoClusters(). Deco deco = new Deco (); deco.x = x; deco.y = y; deco.w = w; deco.h = h; deco.c = ch; deco.grays = grays; for (LinkedListNode<Deco> ptr = allDecos.First; ptr != null; ptr = ptr.Next) { Deco d = ptr.Value; if ((deco.x < d.x) || ((deco.x == d.x) && (deco.y < d.y))) { allDecos.AddBefore (ptr, deco); return; } } allDecos.AddLast (deco); }
public async Task <int> InsertAsync(Deco item) { using (var conn = new SqlConnection(ConfigurationManager.GetEnvironmentVariable("OalConnectionString"))) using (var cmd = new SqlCommand(@"INSERT INTO [dbo].[Deco_log] ( [version], [beat_no], [comment], [console_no], [courier_id], [data_entry_beat_no], [data_entry_location_id], [data_entry_staff_id], [date_created], [date_created_ori], [date_generated], [date_time], [filename], [last_updated], [location_id], [status], [all_connotes] ) VALUES( @version, @beat_no, @comment, @console_no, @courier_id, @data_entry_beat_no, @data_entry_location_id, @data_entry_staff_id, @date_created, @date_created_ori, @date_generated, @date_time, @filename, @last_updated, @location_id, @status, @all_connotes )", conn)) { await conn.OpenAsync(); cmd.Parameters.Add("@beat_no", SqlDbType.VarChar, 3).Value = item.beat_no; cmd.Parameters.Add("@courier_id", SqlDbType.VarChar, 255).Value = item.courier_id; cmd.Parameters.Add("@comment", SqlDbType.VarChar, 255).Value = item.comment; cmd.Parameters.Add("@console_no", SqlDbType.VarChar, 40).Value = item.console_no; cmd.Parameters.Add("data_entry_location_id", SqlDbType.VarChar, 4).Value = item.data_entry_location_id; cmd.Parameters.Add("@data_entry_staff_id", SqlDbType.VarChar, 255).Value = item.data_entry_staff_id; cmd.Parameters.Add("@date_created", SqlDbType.DateTime, 8).Value = DateTime.Now; cmd.Parameters.Add("@date_time", SqlDbType.DateTime, 8).Value = item.date_time; cmd.Parameters.Add("@date_created_ori", SqlDbType.DateTime, 8).Value = item.date_created; cmd.Parameters.Add("@date_generated", SqlDbType.DateTime, 8).Value = DateTime.Now; cmd.Parameters.Add("@last_updated", SqlDbType.DateTime, 8).Value = item.last_updated; cmd.Parameters.Add("@filename", SqlDbType.VarChar, 255).Value = item.filename; cmd.Parameters.Add("@location_id", SqlDbType.VarChar, 4).Value = item.location_id; cmd.Parameters.Add("@status", SqlDbType.VarChar, 255).Value = item.status; cmd.Parameters.Add("@data_entry_beat_no", SqlDbType.VarChar, 3).Value = item.data_entry_beat_no; cmd.Parameters.Add("@all_connotes", SqlDbType.VarChar, 2000).Value = item.all_connotes; cmd.Parameters.Add("@version", SqlDbType.Int, 19).Value = item.version; return(await cmd.ExecuteNonQueryAsync()); } }
/// <summary> /// Clears all gameobjects and loads the objects from the JSON given /// </summary> /// <param name="json"></param> public void LoadJson(string json) { Home.ComponentManager.Clear(); var j = JObject.Parse(json); if (j.ContainsKey("exp_ver")) { _expVersion = j["exp_ver"].ToObject <int>(); } if (j.ContainsKey("last_news_seen")) { LastNewsSeen = j["last_news_seen"].ToObject <int>(); } if (j.ContainsKey("buildings")) { Buildings.Clear(); foreach (var jToken in j["buildings"]) { var obj = (JObject)jToken; var building = new Building(Home) { Id = 500000000 + Buildings.Count }; building.Load(obj); Buildings.Add(building); } } if (j.ContainsKey("obstacles")) { Obstacles.Clear(); foreach (var jToken in j["obstacles"]) { var obj = (JObject)jToken; var obstacle = new Obstacle(Home) { Id = 503000000 + Obstacles.Count }; obstacle.Load(obj); Obstacles.Add(obstacle); } } if (j.ContainsKey("decos")) { Decos.Clear(); foreach (var jToken in j["decos"]) { var obj = (JObject)jToken; var deco = new Deco(Home) { Id = 506000000 + Decos.Count }; deco.Load(obj); Decos.Add(deco); } } if (j.ContainsKey("traps")) { Traps.Clear(); foreach (var jToken in j["traps"]) { var obj = (JObject)jToken; var trap = new Trap(Home) { Id = 504000000 + Traps.Count }; trap.Load(obj); Traps.Add(trap); } } if (j.ContainsKey("vobjs")) { VillageObjects.Clear(); foreach (var jToken in j["vobjs"]) { var obj = (JObject)jToken; var villageObject = new VillageObject(Home) { Id = 508000000 + VillageObjects.Count }; villageObject.Load(obj); VillageObjects.Add(villageObject); } } if (j.ContainsKey("buildings2")) { Buildings2.Clear(); foreach (var jToken in j["buildings2"]) { var obj = (JObject)jToken; var building2 = new Building(Home) { Id = 500000000 + Buildings2.Count }; building2.Load(obj); Buildings2.Add(building2); } } if (j.ContainsKey("obstacles2")) { Obstacles2.Clear(); foreach (var jToken in j["obstacles2"]) { var obj = (JObject)jToken; var obstacle = new Obstacle(Home) { Id = 503000000 + Obstacles2.Count }; obstacle.Load(obj); Obstacles2.Add(obstacle); } } if (j.ContainsKey("decos2")) { Decos2.Clear(); foreach (var jToken in j["decos2"]) { var obj = (JObject)jToken; var deco = new Deco(Home) { Id = 506000000 + Decos2.Count }; deco.Load(obj); Decos2.Add(deco); } } if (j.ContainsKey("traps2")) { Traps2.Clear(); foreach (var jToken in j["traps2"]) { var obj = (JObject)jToken; var trap = new Trap(Home) { Id = 504000000 + Traps2.Count }; trap.Load(obj); Traps2.Add(trap); } } if (j.ContainsKey("vobjs2")) { VillageObjects2.Clear(); foreach (var jToken in j["vobjs2"]) { var obj = (JObject)jToken; var villageObject = new VillageObject(Home) { Id = 508000000 + VillageObjects2.Count }; villageObject.Load(obj); VillageObjects2.Add(villageObject); } } }
Deco x; [SetUp] public void Setup() => x = new Deco();
public void Load(JObject jsonObject) { var jsonBuildings = (JArray) jsonObject["buildings"]; foreach (JObject jsonBuilding in jsonBuildings) { var bd = CSV.Tables.Get(Gamefile.Buildings) .GetDataWithID(jsonBuilding["data"].ToObject<int>()) as Buildings; var b = new Building(bd, Level); AddGameObject(b); b.Load(jsonBuilding); } var jsonObstacles = (JArray) jsonObject["obstacles"]; foreach (JObject jsonObstacle in jsonObstacles) { var dd = CSV.Tables.Get(Gamefile.Obstacles).GetDataWithID(jsonObstacle["data"].ToObject<int>()) as Obstacles; var d = new Obstacle(dd, Level); AddGameObject(d); d.Load(jsonObstacle); } var jsonTraps = (JArray) jsonObject["traps"]; foreach (JObject jsonTrap in jsonTraps) { var td = CSV.Tables.Get(Gamefile.Traps).GetDataWithID(jsonTrap["data"].ToObject<int>()) as Traps; var t = new Trap(td, Level); AddGameObject(t); t.Load(jsonTrap); } var jsonDecos = (JArray) jsonObject["decos"]; foreach (JObject jsonDeco in jsonDecos) { var dd = CSV.Tables.GetWithGlobalID(jsonDeco["data"].ToObject<int>()) as Decos; var d = new Deco(dd, Level); AddGameObject(d); d.Load(jsonDeco); } var villageObjects = (JArray) jsonObject["vobjs"]; foreach (JObject villageObject in villageObjects) { var dd = CSV.Tables.GetWithGlobalID(villageObject["data"].ToObject<int>()) as Village_Objects; var d = new Village_Object(dd, Level); AddGameObject(d); d.Load(villageObject); } var jsonBuildings2 = (JArray) jsonObject["buildings2"]; foreach (JObject jsonBuilding2 in jsonBuildings2) { var bd = CSV.Tables.Get(Gamefile.Buildings) .GetDataWithID(jsonBuilding2["data"].ToObject<int>()) as Buildings; var b = new Builder_Building(bd, Level); AddGameObject(b); b.Load(jsonBuilding2); } var jsonObstacles2 = (JArray) jsonObject["obstacles2"]; foreach (JObject jsonObstacle2 in jsonObstacles2) { var dd = CSV.Tables.Get(Gamefile.Obstacles) .GetDataWithID(jsonObstacle2["data"].ToObject<int>()) as Obstacles; var d = new Builder_Obstacle(dd, Level); AddGameObject(d); d.Load(jsonObstacle2); } var jsonTraps2 = (JArray) jsonObject["traps2"]; foreach (JObject jsonTrap2 in jsonTraps2) { var td = CSV.Tables.Get(Gamefile.Traps).GetDataWithID(jsonTrap2["data"].ToObject<int>()) as Traps; var t = new Builder_Trap(td, Level); AddGameObject(t); t.Load(jsonTrap2); } var jsonDecos2 = (JArray) jsonObject["decos2"]; foreach (JObject jsonDeco2 in jsonDecos2) { var dd = CSV.Tables.GetWithGlobalID(jsonDeco2["data"].ToObject<int>()) as Decos; var d = new Builder_Deco(dd, Level); AddGameObject(d); d.Load(jsonDeco2); } var jsonObjects2 = (JArray) jsonObject["vobjs2"]; foreach (JObject jsonObject2 in jsonObjects2) { var dd = CSV.Tables.GetWithGlobalID(jsonObject2["data"].ToObject<int>()) as Village_Objects; var d = new Builder_Village_Object(dd, Level); AddGameObject(d); d.Load(jsonObject2); } }
public JObject Save() { ClientAvatar pl = m_vLevel.GetPlayerAvatar(); var jsonData = new JObject(); jsonData.Add("exp_ver", 1); jsonData.Add("android_client", pl.GetAndroid()); jsonData.Add("active_layout", pl.GetActiveLayout()); jsonData.Add("war_layout", pl.GetActiveLayout()); jsonData.Add("layout_state", new JArray { 0, 0, 0, 0, 0, 0 }); JArray JBuildings = new JArray(); int c = 0; foreach (GameObject go in new List <GameObject>(m_vGameObjects[0])) { Building b = (Building)go; JObject j = new JObject(); j.Add("data", b.GetBuildingData().GetGlobalID()); j.Add("id", 500000000 + c); b.Save(j); JBuildings.Add(j); c++; } jsonData.Add("buildings", JBuildings); JArray JTraps = new JArray(); int u = 0; foreach (GameObject go in new List <GameObject>(m_vGameObjects[4])) { Trap t = (Trap)go; JObject j = new JObject(); j.Add("data", t.GetTrapData().GetGlobalID()); j.Add("id", 504000000 + u); t.Save(j); JTraps.Add(j); u++; } jsonData.Add("traps", JTraps); JArray JDecos = new JArray(); int e = 0; foreach (GameObject go in new List <GameObject>(m_vGameObjects[6])) { Deco d = (Deco)go; JObject j = new JObject(); j.Add("data", d.GetDecoData().GetGlobalID()); j.Add("id", 506000000 + e); d.Save(j); JDecos.Add(j); e++; } jsonData.Add("decos", JDecos); JArray JObstacles = new JArray(); int o = 0; foreach (GameObject go in new List <GameObject>(m_vGameObjects[3])) { Obstacle d = (Obstacle)go; JObject j = new JObject(); j.Add("data", d.GetObstacleData().GetGlobalID()); j.Add("id", 503000000 + o); d.Save(j); JObstacles.Add(j); o++; } jsonData.Add("obstacles", JObstacles); m_vObstacleManager.Save(jsonData); var cooldowns = new JArray(); jsonData.Add("cooldowns", cooldowns); var newShopBuildings = new JArray { 4, 0, 7, 4, 7, 4, 4, 1, 7, 8, 275, 5, 4, 4, 1, 5, 0, 0, 0, 4, 1, 4, 1, 3, 1, 1, 2, 2, 2, 1, 1, 1 }; jsonData.Add("newShopBuildings", newShopBuildings); var newShopTraps = new JArray { 6, 6, 5, 0, 0, 5, 5, 0, 3 }; jsonData.Add("newShopTraps", newShopTraps); var newShopDecos = new JArray { 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; jsonData.Add("newShopDecos", newShopDecos); jsonData.Add("troop_req_msg", "UCS Developement Team"); jsonData.Add("last_league_rank", m_vLevel.GetPlayerAvatar().GetLeagueId()); jsonData.Add("last_league_shuffle", 1); jsonData.Add("last_season_seen", 1); jsonData.Add("last_news_seen", 999); jsonData.Add("edit_mode_shown", true); jsonData.Add("war_tutorials_seen", 1); jsonData.Add("war_base", true); jsonData.Add("help_opened", true); jsonData.Add("bool_layout_edit_shown_erase", false); return(jsonData); }
public void LoadScenery() { LoadFromXML(); try { GameObject hider = new GameObject(); char dsc = System.IO.Path.DirectorySeparatorChar; using (WWW www = new WWW("file://" + Path + dsc + "assetbundle" + dsc + "mod")) { if (www.error != null) { throw new Exception("Loading had an error:" + www.error); } AssetBundle bundle = www.assetBundle; foreach (ParkitectObject PO in ParkitectObjects) { try { Debug.Log("================== [Loading: " + PO.ObjName + "-- InGame Named: " + PO.inGameName + " -HP- ] =================="); GameObject asset = Instantiate(bundle.LoadAsset(PO.inGameName)) as GameObject; switch (PO.type) { case ParkitectObject.ObjType.deco: case ParkitectObject.ObjType.trashbin: case ParkitectObject.ObjType.seating: case ParkitectObject.ObjType.seatingAuto: case ParkitectObject.ObjType.lamp: case ParkitectObject.ObjType.fence: Debug.Log("Decoration are not supported for this template"); break; case ParkitectObject.ObjType.FlatRide: (new FlatRideDecorator()).Decorate(asset, PO); break; default: print("Failed"); break; } Deco deco = asset.GetComponent <Deco>(); if (deco) { deco.categoryTag = PO.XMLNode["category"].InnerText; deco.buildOnGrid = PO.grid; } if (PO.XMLNode["BoudingBoxes"] != null) { XmlNodeList BoudingBoxNodes = PO.XMLNode.SelectNodes("BoudingBoxes/BoudingBox"); foreach (XmlNode Box in BoudingBoxNodes) { BoundingBox BB = asset.AddComponent <BoundingBox>(); BB.isStatic = false; BB.bounds.min = getVector3(Box["min"].InnerText); BB.bounds.max = getVector3(Box["max"].InnerText); BB.layers = BoundingVolume.Layers.Buildvolume; BB.isStatic = true; Debug.Log("BoudingBox Added"); } } BuildableObject BO = asset.GetComponent <BuildableObject>(); BO.price = PO.price; BO.setDisplayName(PO.inGameName); new RecolorableDecorator().Decorate(asset, PO); DontDestroyOnLoad(asset); BuildableObject buildableObject = asset.GetComponent <BuildableObject>(); buildableObject.dontSerialize = true; buildableObject.isPreview = true; AssetManager.Instance.registerObject(buildableObject); _sceneryObjects.Add(asset.GetComponent <BuildableObject>()); Debug.Log("Loaded: " + buildableObject.gameObject.name); // hide it from view asset.transform.parent = hider.transform; } catch (Exception e) { Debug.Log(e); LogException(e); } } bundle.Unload(false); } hider.SetActive(false); } catch (Exception e) { LogException(e); } }
public async Task Run(Deco deco) { await SendToIpcApiAsync(deco); }
public JObject Save() { JArray JBuildings = new JArray(); int c = 0; foreach (GameObject go in new List <GameObject>(this.GameObjects[0])) { Building b = (Building)go; JObject j = new JObject { { "data", b.GetBuildingData().GetGlobalID() }, { "id", 500000000 + c } }; b.Save(j); JBuildings.Add(j); c++; } JArray JTraps = new JArray(); int u = 0; foreach (GameObject go in new List <GameObject>(this.GameObjects[4])) { Trap t = (Trap)go; JObject j = new JObject { { "data", t.GetTrapData().GetGlobalID() }, { "id", 504000000 + u } }; t.Save(j); JTraps.Add(j); u++; } JArray JObstacles = new JArray(); int o = 0; foreach (GameObject go in new List <GameObject>(this.GameObjects[3])) { Obstacle d = (Obstacle)go; JObject j = new JObject { { "data", d.GetObstacleData().GetGlobalID() }, { "id", 503000000 + o } }; d.Save(j); JObstacles.Add(j); o++; } JArray JDecos = new JArray(); int e = 0; foreach (GameObject go in new List <GameObject>(this.GameObjects[6])) { Deco d = (Deco)go; JObject j = new JObject { { "data", d.GetDecoData().GetGlobalID() }, { "id", 506000000 + e } }; d.Save(j); JDecos.Add(j); e++; } Avatar pl = this.Level.Avatar; var jsonData = new JObject { //{"exp_ver", 1}, { "buildings", JBuildings }, { "obstacles", JObstacles }, { "traps", JTraps }, { "decos", JDecos } }; return(jsonData); }