public void Load(JObject jsonObject) { JArray jsonBuildings = (JArray)jsonObject["buildings"]; foreach (JObject jsonBuilding in jsonBuildings) { BuildingData bd = (BuildingData)ObjectManager.DataTables.GetDataById(jsonBuilding["data"].ToObject <int>()); Building b = new Building(bd, m_vLevel); AddGameObject(b); b.Load(jsonBuilding); } JArray jsonTraps = (JArray)jsonObject["traps"]; foreach (JObject jsonTrap in jsonTraps) { TrapData td = (TrapData)ObjectManager.DataTables.GetDataById(jsonTrap["data"].ToObject <int>()); Trap t = new Trap(td, m_vLevel); AddGameObject(t); t.Load(jsonTrap); } JArray jsonDecos = (JArray)jsonObject["decos"]; foreach (JObject jsonDeco in jsonDecos) { DecoData dd = (DecoData)ObjectManager.DataTables.GetDataById(jsonDeco["data"].ToObject <int>()); Deco d = new Deco(dd, m_vLevel); AddGameObject(d); d.Load(jsonDeco); } }
/// <summary> /// Creates the data for the specified row. /// </summary> /// <param name="Row">The row.</param> internal Data Create(Row Row) { Data Data; switch (this.Index) { case 1: { Data = new LumberjackData(Row, this); break; } case 2: { Data = new CashPackageData(Row, this); break; } case 3: { Data = new DecoData(Row, this); break; } default: { Data = new Data(Row, this); break; } } return(Data); }
public void initdata(DecoData dd) { decoData = dd; string[] namesplit = name.Split('@'); decoData.decotype = namesplit[0]; decoData.deconum = Int32.Parse(namesplit[1]); //Int32: using System Debug.Log("[" + name + "] init : " + decoData.deconum); }
internal override void Decode() { this.X = this.Reader.ReadInt32(); this.Y = this.Reader.ReadInt32(); this.DecoData = this.Reader.ReadData <DecoData>(); base.Decode(); }
public void newDecoration(string prefabname) //새로 생산공장을 만드는 함수 { bool check = false; int minusstar = 0; int plusheart = 0; switch (prefabname) { case "MacaronTree": check = IsPurable(1000, 0, 1); minusstar = 1000; plusheart = 30; break; case "Pudding": check = IsPurable(2000, 0, 1); minusstar = 2000; plusheart = 60; break; case "JellyTree": check = IsPurable(4000, 0, 2); minusstar = 4000; plusheart = 150; break; } if (check) { this.star -= minusstar; this.heart += plusheart; GameObject tem = Instantiate((GameObject)AssetDatabase.LoadAssetAtPath("Assets/Prefabs/" + prefabname + ".prefab", typeof(GameObject)), new Vector3(50, 0, 50), Quaternion.identity); //GoldFactory를 Vector(0,0,0) 위치에 회전각을 0,0,0으로 하여 복제 int temnum = SetNumber(); tem.name = prefabname + "@" + temnum; DecoData decoration = new DecoData(); decoration.decotype = prefabname; decoration.deconum = temnum; DecorationDatas.Add(decoration); //tem.GetComponent<Decoration>().init(); //tem.GetComponent<Decoration>().initdata(DecorationDatas[temnum-1]); // 건물 내용 전달하기 Debug.Log("[newProduction] product 인자 값 확인 : " + tem.GetComponent <Decoration>().decoData.decotype); ShopPanel.SetActive(false); BasicPanel.SetActive(true); IsInUI = false; IsNew = temnum; IsOneMove = true; MoveStart(); } else { Debug.Log("[newProduction] 구매 불가능"); } }
public override void Execute(Level level) { ClientAvatar ca = level.GetPlayerAvatar(); DecoData dd = (DecoData)CSVManager.DataTables.GetDataById(DecoId); if (ca.HasEnoughResources(dd.GetBuildResource(), dd.GetBuildCost())) { ResourceData rd = dd.GetBuildResource(); ca.CommodityCountChangeHelper(0, rd, -dd.GetBuildCost()); Deco d = new Deco(dd, level); d.SetPositionXY(X, Y, level.GetPlayerAvatar().GetActiveLayout()); level.GameObjectManager.AddGameObject(d); } }
internal override void Process() { ClientAvatar ca = this.Device.Player.Avatar; DecoData dd = (DecoData)CSVManager.DataTables.GetDataById(DecoId); if (ca.HasEnoughResources(dd.GetBuildResource(), dd.GetBuildCost())) { ResourceData rd = dd.GetBuildResource(); ca.CommodityCountChangeHelper(0, rd, -dd.GetBuildCost()); Deco d = new Deco(dd, this.Device.Player); d.SetPositionXY(X, Y, this.Device.Player.Avatar.m_vActiveLayout); this.Device.Player.GameObjectManager.AddGameObject(d); } }
public override void Execute(Level level) { ClientAvatar avatar = level.GetPlayerAvatar(); DecoData dataById = (DecoData)CSVManager.DataTables.GetDataById(DecoId); if (!avatar.HasEnoughResources(dataById.GetBuildResource(), dataById.GetBuildCost())) { return; } ResourceData buildResource = dataById.GetBuildResource(); avatar.CommodityCountChangeHelper(0, (Data)buildResource, -dataById.GetBuildCost()); Deco deco = new Deco((Data)dataById, level); deco.SetPositionXY(X, Y, level.GetPlayerAvatar().GetActiveLayout()); level.GameObjectManager.AddGameObject((GameObject)deco); }
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!"); } }
/// <summary> /// Creates the data for the specified row. /// </summary> /// <param name="Row">The row.</param> internal Data Create(Row Row) { Data Data; switch (this.Index) { case 1: { Data = new BuildingData(Row, this); break; } case 2: { Data = new LocaleData(Row, this); break; } case 3: { Data = new ResourceData(Row, this); break; } case 4: { Data = new CharacterData(Row, this); break; } case 6: { Data = new ProjectileData(Row, this); break; } case 7: { Data = new BuildingClassData(Row, this); break; } case 8: { Data = new ObstacleData(Row, this); break; } case 9: { Data = new EffectData(Row, this); break; } case 10: { Data = new ParticleEmitterData(Row, this); break; } case 11: { Data = new ExperienceLevelData(Row, this); break; } case 12: { Data = new TrapData(Row, this); break; } case 13: { Data = new AllianceBadgeData(Row, this); break; } case 14: { Data = new GlobalData(Row, this); break; } case 15: { Data = new TownhallLevelData(Row, this); break; } case 16: { Data = new AlliancePortalData(Row, this); break; } case 17: { Data = new NpcData(Row, this); break; } case 18: { Data = new DecoData(Row, this); break; } case 19: { Data = new ResourcePackData(Row, this); break; } case 20: { Data = new ShieldData(Row, this); break; } case 21: { Data = new MissionData(Row, this); break; } case 22: { Data = new BillingPackageData(Row, this); break; } case 23: { Data = new AchievementData(Row, this); break; } case 25: { Data = new FaqData(Row, this); break; } case 26: { Data = new SpellData(Row, this); break; } case 27: { Data = new HintData(Row, this); break; } case 28: { Data = new HeroData(Row, this); break; } case 29: { Data = new LeagueData(Row, this); break; } case 30: { Data = new NewData(Row, this); break; } case 34: { Data = new AllianceBadgeLayerData(Row, this); break; } case 37: { Data = new VariableData(Row, this); break; } case 38: { Data = new GemBundleData(Row, this); break; } case 39: { Data = new VillageObjectData(Row, this); break; } default: { Data = new Data(Row, this); break; } } return(Data); }
/// <summary> /// Creates the data for the specified row. /// </summary> /// <param name="Row">The row.</param> internal Data Create(Row Row) { Data Data; switch (this.Index) { case 1: { Data = new LocaleData(Row, this); break; } case 2: { Data = new ResourceData(Row, this); break; } case 3: { Data = new EffectData(Row, this); break; } case 4: { Data = new ParticleEmitterData(Row, this); break; } case 5: { Data = new GlobalData(Row, this); break; } case 6: { Data = new QuestData(Row, this); break; } case 10: { Data = new WorldData(Row, this); break; } case 11: { Data = new HeroData(Row, this); break; } case 24: { Data = new TauntData(Row, this); break; } case 25: { Data = new DecoData(Row, this); break; } case 26: { Data = new VariableData(Row, this); break; } case 32: { Data = new EnergyPackageData(Row, this); break; } default: { Data = new Data(Row, this); break; } } return(Data); }
internal Data Create(Row _Row) { Data _Data; switch ((Gamefile)this.Index) { case Gamefile.Buildings: _Data = new BuildingData(_Row, this); break; case Gamefile.Locales: _Data = new LocaleData(_Row, this); break; case Gamefile.Resources: _Data = new ResourceData(_Row, this); break; case Gamefile.Characters: _Data = new CharacterData(_Row, this); break; case Gamefile.Building_Classes: _Data = new BuildingClassData(_Row, this); break; case Gamefile.Obstacles: _Data = new ObstacleData(_Row, this); break; case Gamefile.Traps: _Data = new TrapData(_Row, this); break; case Gamefile.Globals: _Data = new GlobalData(_Row, this); break; case Gamefile.Experience_Levels: _Data = new ExperienceLevelData(_Row, this); break; case Gamefile.Townhall_Levels: _Data = new TownhallLevelData(_Row, this); break; case Gamefile.Npcs: _Data = new NpcData(_Row, this); break; case Gamefile.Decos: _Data = new DecoData(_Row, this); break; case Gamefile.Shields: _Data = new ShieldData(_Row, this); break; case Gamefile.Missions: _Data = new MissionData(_Row, this); break; case Gamefile.Achievements: _Data = new AchievementData(_Row, this); break; case Gamefile.Spells: _Data = new SpellData(_Row, this); break; case Gamefile.Heroes: _Data = new HeroData(_Row, this); break; case Gamefile.Leagues: _Data = new LeagueData(_Row, this); break; case Gamefile.Regions: _Data = new RegionData(_Row, this); break; case Gamefile.AllianceBadgeLayer: _Data = new AllianceBadgeLayerData(_Row, this); break; case Gamefile.Variables: _Data = new VariableData(_Row, this); break; case Gamefile.Village_Objects: _Data = new VillageObjectData(_Row, this); break; default: _Data = new Data(_Row, this); break; } return(_Data); }
/// <summary> /// Creates the data for the specified row. /// </summary> /// <param name="Row">The row.</param> internal Data Create(Row Row) { Data Data; switch (this.Index) { case 1: { Data = new LocaleData(Row, this); break; } case 2: { Data = new BillingPackageData(Row, this); break; } case 3: case 20: { Data = new GlobalData(Row, this); break; } case 4: { Data = new SoundData(Row, this); break; } case 5: { Data = new ResourceData(Row, this); break; } case 9: { Data = new CharacterBuffData(Row, this); break; } case 10: { Data = new ProjectileData(Row, this); break; } case 11: { Data = new EffectData(Row, this); break; } case 12: { Data = new PredefinedDeckData(Row, this); break; } case 14: { Data = new RarityData(Row, this); break; } case 15: { Data = new LocationData(Row, this); break; } case 16: { Data = new AllianceBadgeData(Row, this); break; } case 18: { Data = new NpcData(Row, this); break; } case 19: { Data = new TreasureChestData(Row, this); break; } case 21: { Data = new ParticleEmitterData(Row, this); break; } case 22: { Data = new AreaEffectObjectData(Row, this); break; } case 26: case 27: case 28: case 29: { Data = new SpellData(Row, this); break; } case 34: case 35: { Data = new CharacterData(Row, this); break; } case 40: { Data = new HealthBarData(Row, this); break; } case 41: { Data = new MusicData(Row, this); break; } case 42: { Data = new DecoData(Row, this); break; } case 43: { Data = new GambleChestData(Row, this); break; } case 45: case 48: { Data = new TutorialData(Row, this); break; } case 46: { Data = new ExpLevelData(Row, this); break; } case 50: { Data = new BackgroundDecoData(Row, this); break; } case 51: { Data = new SpellSetData(Row, this); break; } case 52: { Data = new ChestOrderData(Row, this); break; } case 53: { Data = new TauntData(Row, this); break; } case 54: { Data = new ArenaData(Row, this); break; } case 55: { Data = new ResourcePackData(Row, this); break; } case 56: { Data = new Data(Row, this); break; } case 57: { Data = new RegionData(Row, this); break; } case 58: { Data = new NewsData(Row, this); break; } case 59: { Data = new AllianceRoleData(Row, this); break; } case 60: { Data = new AchievementData(Row, this); break; } case 61: { Data = new HintData(Row, this); break; } case 62: { Data = new HelpshiftData(Row, this); break; } default: { Logging.Info(this.GetType(), "Invalid data table id: " + this.Index + "."); Data = null; break; } } return(Data); }
internal override void Process() { if (this.Data != null) { if (this.DataType == 0) { TauntData Taunt = (TauntData)this.Data; if (!this.Device.Player.Extras.ContainsKey(Taunt.GlobalID)) { if (!string.IsNullOrEmpty(Taunt.CharacterUnlock)) { HeroData Hero = (HeroData)CSV.Tables.Get(Gamefile.Heroes).GetData(Taunt.CharacterUnlock); if (!this.Device.Player.HeroLevels.ContainsKey(Hero.GlobalID)) { Logging.Error(this.GetType(), "Unable to buy the taunt. Avatar doesn't unlock the hero " + Taunt.CharacterUnlock + ". AvatarId:" + this.Device.Player + "."); return; } } if (Taunt.Cost > 0) { ResourceData Resource = (ResourceData)CSV.Tables.Get(Gamefile.Resources).GetData(Taunt.Resource); if (this.Device.Player.Resources.GetCount(Resource.GlobalID) < Taunt.Cost) { Logging.Error(this.GetType(), "Unable to buy the taunt. You do not have enough " + Taunt.Resource + ". Have:" + this.Device.Player.Resources.GetCount(Resource.GlobalID) + ", Require:" + Taunt.Cost + "."); return; } this.Device.Player.Resources.Remove(Resource.GlobalID, Taunt.Cost); } this.Device.Player.Extras.Set(Taunt.GlobalID, 1); } } else { DecoData Deco = (DecoData)this.Data; if (!this.Device.Player.Extras.ContainsKey(Deco.GlobalID)) { if (Deco.UnlockLevel > this.Device.Player.ExpLevel) { Logging.Error(this.GetType(), "Unable to buy the deco. You do not have the required level. AvatarId:" + this.Device.Player + "."); return; } if (Deco.Cost > 0) { ResourceData Resource = (ResourceData)CSV.Tables.Get(Gamefile.Resources).GetData(Deco.Resource); if (this.Device.Player.Resources.GetCount(Resource.GlobalID) < Deco.Cost) { Logging.Error(this.GetType(), "Unable to buy the deco. You do not have enough " + Deco.Resource + ". Have:" + this.Device.Player.Resources.GetCount(Resource.GlobalID) + ", Require:" + Deco.Cost + "."); return; } this.Device.Player.Resources.Remove(Resource.GlobalID, Deco.Cost); } this.Device.Player.Extras.Set(Deco.GlobalID, 2); if (this.Device.Player.Extras.Count > 1) { foreach (Item Item in this.Device.Player.Extras.Values) { if (Item.Id / 1000000 == Deco.GetDataType()) { if (Item.Count != 1 && Item.Id != Deco.GlobalID) { Item.Count = 1; } } } } } else { if (this.Device.Player.Extras.GetCount(Deco.GlobalID) == 1) { this.Device.Player.Extras.Set(Deco.GlobalID, 2); foreach (Item Item in this.Device.Player.Extras.Values) { if (Item.Id / 1000000 == Deco.GetDataType()) { if (Item.Count != 1 && Item.Id != Deco.GlobalID) { Item.Count = 1; } } } } else { this.Device.Player.Extras.Set(Deco.GlobalID, 1); } } } } else { Logging.Error(this.GetType(), "Unable to buy the extra. Data is null."); } }
/// <summary> /// Creates the data for the specified row. /// </summary> /// <param name="Row">The row.</param> internal Data Create(Row Row) { Data Data; switch (this.Index) { case 0: { Data = new BuildingData(Row, this); break; } case 1: { Data = new LocaleData(Row, this); break; } case 2: { Data = new ResourceData(Row, this); break; } case 3: { Data = new CharacterData(Row, this); break; } case 6: { Data = new BuildingClassData(Row, this); break; } case 7: { Data = new ObstacleData(Row, this); break; } case 8: { Data = new EffectData(Row, this); break; } case 9: { Data = new ParticleEmitterData(Row, this); break; } case 10: { Data = new ExperienceLevelData(Row, this); break; } case 11: { Data = new TrapData(Row, this); break; } case 12: { Data = new AllianceBadgeData(Row, this); break; } case 13: { Data = new GlobalData(Row, this); break; } case 14: { Data = new TownhallLevelData(Row, this); break; } case 15: { Data = new PrototypeData(Row, this); break; } case 16: { Data = new NpcData(Row, this); break; } case 17: { Data = new DecoData(Row, this); break; } case 18: { Data = new ResourcePackData(Row, this); break; } case 20: { Data = new MissionData(Row, this); break; } case 21: { Data = new BillingPackageData(Row, this); break; } case 22: { Data = new AchievementData(Row, this); break; } case 25: { Data = new SpellData(Row, this); break; } case 26: { Data = new HintData(Row, this); break; } case 27: { Data = new LandingShipData(Row, this); break; } case 28: { Data = new ArtifactData(Row, this); break; } case 29: { Data = new ArtifactBonusData(Row, this); break; } case 30: { Data = new DeepseaParameterData(Row, this); break; } case 31: { Data = new ExplorationCostData(Row, this); break; } case 34: { Data = new ResourceShipData(Row, this); break; } case 35: { Data = new LootBoxData(Row, this); break; } case 36: { Data = new LiberatedIncomeData(Row, this); break; } case 37: { Data = new RegionData(Row, this); break; } case 38: { Data = new DefenseRewardData(Row, this); break; } case 39: { Data = new LocatorData(Row, this); break; } case 40: { Data = new EventData(Row, this); break; } case 41: { Data = new FootstepData(Row, this); break; } case 42: { Data = new PersistentEventRewardData(Row, this); break; } case 43: { Data = new CommunityLinkData(Row, this); break; } case 44: { Data = new ShieldData(Row, this); break; } case 45: { Data = new AbTestData(Row, this); break; } case 46: { Data = new LetterData(Row, this); break; } case 47: { Data = new RankData(Row, this); break; } case 48: { Data = new CountryData(Row, this); break; } case 51: { Data = new BoomboxData(Row, this); break; } case 52: { Data = new HeroData(Row, this); break; } case 53: { Data = new HeroAbilityData(Row, this); break; } case 54: { Data = new OfferData(Row, this); break; } case 55: { Data = new DeepLinkData(Row, this); break; } case 56: { Data = new SectorData(Row, this); break; } case 57: { Data = new SectorBonusData(Row, this); break; } default: { Data = new Data(Row, this); break; } } return(Data); }