public static CostType costType(RuneType rune_type, ToyType toy_type) { //{ Dreams, Wishes, SensibleHeroPoint, AiryHeroPoint, VexingHeroPoint, ScorePoint }; if (toy_type == ToyType.Hero) { switch (rune_type) { case RuneType.SensibleCity: return(CostType.SensibleCityHeroPoint); case RuneType.Sensible: return(CostType.SensibleHeroPoint); case RuneType.Airy: return(CostType.AiryHeroPoint); case RuneType.Vexing: return(CostType.VexingHeroPoint); default: Debug.Log("Invalid costtype for " + rune_type + " " + toy_type + " \n"); return(CostType.Dreams); } } else if (toy_type == ToyType.Temporary) { return(CostType.Wishes); } else { return(CostType.Dreams); } }
public void loadSnapshot(RuneSaver saver) { runetype = saver.runetype; toy_type = saver.toy_type; invested_cost = saver.invested_cost; ID = saver.ID; level = saver.level; xp = saver.xp; distance_bonus = saver.distance_bonus; order = saver.order; if (saver.max_level < 0) { saver.max_level = 0; } int max_level = Mathf.Max(saver.max_level, LevelStore.getMaxLevel(Central.Instance.current_lvl, Peripheral.Instance.difficulty, runetype, toy_type)); setMaxLevel(max_level); Sun.OnDayTimeChange += OnDayTimeChange; StaticRune.assignStatBits(ref stats, this); foreach (StatBitSaver s in saver.stats) { StatBit stat = getStat(s.effect_type); stat.loadSnapshot(s, this); } UpdateTimeOfDay(); setXpReqs(); UpdateStats(); }
public static float GetTimeBonus(RuneType rune_type, ToyType toytype) { //if (Central.Instance.state != GameState.InGame) return 0f; //if (toytype == ToyType.Hero) return 0f; //meh this makes things confusing cuz the hero towers are identical to regular towers but somehow do less damage during the day?? //if (rune_type == Rune) TimeName now = Sun.Instance.GetCurrentTime(); float default_time_bonus = 0.33f; float ghost_time_bonus = 0.33f; switch (rune_type) { case RuneType.Sensible: return((now == TimeName.Dawn || now == TimeName.Day) ? default_time_bonus : 0f); case RuneType.Airy: return((now == TimeName.Dawn || now == TimeName.Day) ? default_time_bonus : 0f); case RuneType.Vexing: return((now == TimeName.Dawn || now == TimeName.Day) ? default_time_bonus : 0f); case RuneType.Slow: return((now == TimeName.Night || now == TimeName.Dusk) ? ghost_time_bonus : 0f); case RuneType.Time: return((now == TimeName.Night || now == TimeName.Dusk) ? ghost_time_bonus : 0f); case RuneType.Fast: return((now == TimeName.Night || now == TimeName.Dusk) ? ghost_time_bonus : 0f); } return(0f); }
public HomeController(ToyContext context) { db = context; // добавляем начальные данные if (db.Types.Count() != 0) { return; } var cat = new ToyType { Name = "cat" }; var lego = new ToyType { Name = "lego" }; var dog = new ToyType { Name = "dog" }; var mouse = new ToyType { Name = "mouse" }; var doll = new ToyType { Name = "doll" }; var toy1 = new Toy { Name = "Grumpy Cat", Type = cat, Price = 599 }; var toy2 = new Toy { Name = "Tom The Cat", Type = cat, Price = 499 }; var toy3 = new Toy { Name = "Jerry The Mouse", Type = mouse, Price = 599 }; var toy4 = new Toy { Name = "Mickey Mouse", Type = mouse, Price = 1099 }; var toy5 = new Toy { Name = "Minnie Mouse", Type = mouse, Price = 399 }; var toy6 = new Toy { Name = "Barbie", Type = doll, Price = 299 }; var toy7 = new Toy { Name = "Ken", Type = doll, Price = 1199 }; var toy8 = new Toy { Name = "Blue Sad Dog", Type = dog, Price = 899 }; var toy9 = new Toy { Name = "Star Wars", Type = lego, Price = 199 }; var toy10 = new Toy { Name = "Ninjago", Type = lego, Price = 299 }; db.Types.AddRange(cat, dog, lego, mouse, doll); db.Toys.AddRange(toy1, toy2, toy3, toy4, toy5, toy6, toy7, toy8, toy9, toy10); db.SaveChanges(); }
public int CompareTo(RuneType runetype, ToyType toy_type) { if (runetype == this.rune_type && toy_type == this.toy_type) { return(0); } return(1); }
void onPlacedToy(string content, RuneType runetype, ToyType toytype) { // Debug.Log("trigger Got onplacedtoy " + content + ", need " + text + "\n"); if (text.Equals("") || content.Contains(text)) { selected = true; } }
public void UpgradeRune(ToyType toy_type, EffectType effect_type) { float hey = rune.Upgrade(effect_type, true); if (hey != 0) { UpgradeTargetGhosts(); } }
public ToySaver(string _name, float _ammo, RuneSaver _rune, ToyType _type, float _construction_time, tower_stats _tower_stats) { toy_name = _name; ammo = _ammo; rune_saver = _rune; type = _type; construnction_time = _construction_time; tower_stats = _tower_stats; }
public static string getImage(RuneType rune_type, ToyType toy_type) { //{ Dreams, Wishes, SensibleHeroPoint, AiryHeroPoint, VexingHeroPoint, ScorePoint }; switch (rune_type) { case RuneType.SensibleCity: return("sensible_city"); case RuneType.Sensible: if (toy_type == ToyType.Hero) { return("sensible_tower_hero"); } else { return("sensible_tower"); } case RuneType.Airy: if (toy_type == ToyType.Hero) { return("airy_tower_hero"); } else { return("airy_tower"); } case RuneType.Vexing: if (toy_type == ToyType.Hero) { return("vexing_tower_hero"); } else { return("vexing_tower"); } case RuneType.Slow: return("slow_ghost"); case RuneType.Fast: return("sensible_tower_ghost"); case RuneType.Time: return("time_ghost"); case RuneType.Modulator: return("modulator"); default: return("selected_island_image"); } }
public unitStats getToy(RuneType rt, ToyType tt) { foreach (unitStats actor in actors) { if (actor.CompareTo(rt, tt) == 0) { return(actor); } } return(null); }
//this is aweful but necessary for the support of too much old shit that I don't feel like refactoring/trawling through a ton of prefabs to fix public static string getBasicName(RuneType rune_type, ToyType toy_type) { switch (rune_type) { case RuneType.SensibleCity: return("sensible_city"); case RuneType.Sensible: if (toy_type == ToyType.Hero) { return("sensible_tower_hero"); } else { return("sensible_tower"); } case RuneType.Airy: if (toy_type == ToyType.Hero) { return("airy_tower_hero"); } else { return("airy_tower"); } case RuneType.Vexing: if (toy_type == ToyType.Hero) { return("vexing_tower_hero"); } else { return("vexing_tower"); } case RuneType.Slow: return("slow_ghost"); case RuneType.Fast: return("sensible_tower_ghost"); case RuneType.Time: return("time_ghost"); case RuneType.Modulator: return("modulator"); default: return("castle"); } }
public CompleteToySaver(string _name, float _ammo, Rune _rune, ToyType _type, float _construction_time) { toy_name = _name; ammo = _ammo; rune_saver = _rune; type = _type; construnction_time = _construction_time; rune_saver.ID = -99; rune_saver.stat_sum.towerID = -99; rune_saver.special_stat_sum.towerID = -99; }
TowerSpriteList getList(RuneType runeType, ToyType toyType) { foreach (TowerSpriteList list in sprites) { if (list.runeType == runeType && list.toyType == toyType) { return(list); } } Debug.Log($"!!! Could not find a tower sprite list for {runeType} {toyType}\n"); return(null); }
public static IToy GetToy(ToyType type) { switch (type) { case ToyType.Car: return(new CarToy()); case ToyType.Ferry: return(new FerryToy()); case ToyType.Helicopter: return(new HelicopterToy()); default: throw new Exception("Invalid toy type"); } }
public void SpawnToy(ToyType toyType) { lastSpawnTime = Time.time; if (toyType == null) { return; } ToyController newToy = Instantiate(toyPrefab.gameObject).GetComponent <ToyController>(); newToy.transform.position = transform.position; newToy.toyType = toyType; }
public IToys GeToys(ToyType toyType) { switch (toyType) { case ToyType.duck: return(new DuckToy()); case ToyType.car: return(new CarToy()); default: throw new ArgumentOutOfRangeException(nameof(toyType), toyType, null); } }
public IActionResult Edit(ToyType type) { if (type == null) { return(new BadRequestResult()); } var newtype = db.Types.Find(type.Id); newtype.Name = type.Name; db.SaveChanges(); return(Redirect("/Type/Index")); }
public void setSelectedIslandImage(RuneType runeType, ToyType toyType) { selected_island_image.sprite = TowerStore.getPreviewSprite(runeType, toyType); if (selected_island == null) { return; } Vector3 set_to = selected_island.transform.position; //if (runeType != RuneType.Null && toyType != ToyType.Null) set_to.y += 0.17f; selected_island_image.GetComponent <RectTransform>().position = set_to; }
void onPlacedToy(string content, RuneType runetype, ToyType toytype) { if (vocal) { Debug.Log("Received to onPlacedToy for " + this.gameObject.name + "\n"); } // if (!isInitialized()) return; if (skill.rune_type == runetype && toytype == ToyType.Hero) { Hero_is_present = true; if (vocal) { Debug.Log("Hero for " + this.gameObject.name + "\n"); } } }
public void initStats(RuneType rtype, int _max_lvl, ToyType _toy_type) { runetype = rtype; if (_max_lvl < 0) { _max_lvl = 0; } setMaxLevel(_max_lvl); toy_type = _toy_type; invested_cost = 0; Sun.OnDayTimeChange += OnDayTimeChange; StaticRune.assignStatBits(ref stats, this); dmg_xp = 0f; setXpReqs(); UpdateStats(); }
public static Tree GetInstanceOfTree(ToyType toySType) { if (null == _tree) { _tree = new Tree(); if (toySType == ToyType.Garland) { _tree.Add(new Garland()); } else if (toySType == ToyType.Lights) { _tree.Add(new Lights()); } else if (toySType == ToyType.Stuffedtoys) { _tree.Add(new StuffedToys()); } } return(_tree); }
public IProduct GetToy(ToyType type) { switch (type) { case ToyType.Car: Console.WriteLine("create car"); return(new Car { Name = "a car" }); case ToyType.Soldier: Console.WriteLine("create soldier"); return(new Soldier { Name = "a soldier" }); default: Console.WriteLine("unsupported type"); break; } return(null); }
public void InitMainSignal(RuneType runeType, ToyType toyType)//for external use { // Debug.Log("Init signal " + selected + " " + " island " + island_selected + "\n"); if (runeType == RuneType.Null || toyType == ToyType.Null) { SetMainSignal(false); } else { if (toyType == ToyType.Hero) { Rune rune = Central.Instance.getHeroStats(runeType); if (rune != null) { float hero_range = rune.getRange() / 2f; InitSignal(signal, islands[island_selected], rune.getRange() / 2f, true); return; } } float size = getSignalSize(runeType, toyType); InitSignal(signal, islands[island_selected], size, true); } }
public static float[] getXpReqs(ToyType toyType, RuneType runeType) {// THIS IS CUMULATIVE, NOT XP NEEDED PER LEVEL switch (toyType) { case ToyType.Hero: return(runeType == RuneType.Castle ? new float[12] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } : new float[12] { 150, 320, 510, 720, 950, 1200, 1470, 1760, 2070, 2400, 2750, 3120 }); case ToyType.Normal: //return new float[12] {40, 130, 380, 700, 1400, 3000, 6000, 12000, 24000, 48000, 96000, 192000}; return(new float[12] { 100, 220, 360, 520, 700, 900, 1120, 1360, 1620, 1900, 2200, 2520 }); default: return(new float[12] { 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 }); } }
public IActionResult Create(ToyType type) { db.Types.Add(type); db.SaveChanges(); return(View()); }
public unitStats LoadActor(string line) { // Debug.Log("Loading actor\n"); JSONObject pname = new JSONObject(); JSONObject pcost = new JSONObject(); JSONObject ptoytype = new JSONObject(); //JSONObject pcost_runetype = new JSONObject (); JSONObject prune_type = new JSONObject(); JSONObject pcost_wishtype = new JSONObject(); JSONParser p = new JSONParser(line); JSONObject ppermanent = new JSONObject(); JSONObject pammo = new JSONObject(); JSONObject inv = new JSONObject(); JSONObject pmax_lvl = new JSONObject(); JSONObject exclude_skills = new JSONObject(); JSONObject required_building = new JSONObject(); p.parse(); p.root.TryGetValue("name", out pname); p.root.TryGetValue("cost", out pcost); p.root.TryGetValue("toy_type", out ptoytype); p.root.TryGetValue("rune_type", out prune_type); p.root.TryGetValue("cost_wishtype", out pcost_wishtype); p.root.TryGetValue("max_lvl", out pmax_lvl); p.root.TryGetValue("ammo", out pammo); p.root.TryGetValue("inventory", out inv); p.root.TryGetValue("islandtype", out ppermanent); p.root.TryGetValue("exclude_skills", out exclude_skills); p.root.TryGetValue("required_building", out required_building); unitStats test = Central.Instance.getToy(pname.value); if (test != null) { if (pmax_lvl != null) { test.setMaxLvl(int.Parse(pmax_lvl.value)); } // Debug.Log("Loading actor again\n"); //thing has already been defined in a previous level. do not load most stats again return(test); } else { int cost = int.Parse(pcost.value); unitStats stats = new unitStats(pname.value); if (pmax_lvl != null) { stats.setMaxLvl(int.Parse(pmax_lvl.value)); } stats.isUnlocked = false; RuneType rune_type = (prune_type != null) ? EnumUtil.EnumFromString(prune_type.value, RuneType.Null) : RuneType.Null; ToyType toy_type = (ptoytype != null) ? EnumUtil.EnumFromString(ptoytype.value, ToyType.Null) : ToyType.Null; //WishType wish_type = WishType.Null; CostType cost_type = CostType.Dreams; stats.toy_id.toy_type = toy_type; stats.toy_id.rune_type = rune_type; cost_type = TowerStore.costType(rune_type, toy_type); //if (pcost_wishtype != null) wish_type = Get.WishTypeFromString(pcost_wishtype.value); if (required_building != null) { stats.required_building = (required_building.value); } stats.setCost(cost_type, cost); stats.island_type = ppermanent != null?EnumUtil.EnumFromString(ppermanent.value, IslandType.Permanent) : IslandType.Permanent; if (pammo != null) { stats.ammo = int.Parse(pammo.value); } Central.Instance.setUnitStats(stats, false); return(stats); } }
public static IToy MakeToy(ToyType toyType) => toyType switch {
public int CompareTo(RuneType runetype, ToyType toy_type) { return(toy_id.CompareTo(runetype, toy_type)); }
public unitStats(string name, RuneType rune_type, ToyType toy_type) { this.name = name; this.toy_id = new ToyID(rune_type, toy_type); }
static void Main(string[] args) { Customer customer20 = new Customer(); Plant plant10 = new Plant(); ToyDomain toyDomain = new ToyDomain(); PlantDomain plantDomain = new PlantDomain(); ToyType toyType10 = new ToyType(); Customer customer = new Customer(); ToyTypeDomain toyTypeDomain = new ToyTypeDomain(); CustomerDomain customerDomain = new CustomerDomain(); OrderDomain orderDomain = new OrderDomain(); repeate: Console.WriteLine("--->>Welcome to Toy Store application<<---"); Console.WriteLine("-->>Choose form the below given options<<--"); Console.WriteLine("=1.1:->Enter ToyType..{this option adds which type of toy you Manufacturing}"); Console.WriteLine("=1.2:->Show list of ToyTypes..{this option shows whole list of entered ToyTypes}"); Console.WriteLine("=1.3:->Delete ToyType..{this option deletes selected field}"); Console.WriteLine("=2.1:->Enter Plant..{this option adds the information regarding to the Manufacturing Plants}"); Console.WriteLine("=2.2:->Show list of Plants..{this option shows list of Manufacturing Plants}"); Console.WriteLine("=2.3:->Delete Plant..{this option deletes Manufacturing plants}"); Console.WriteLine("=3.1:->Enter Customer..{this option adds the information regarding to Customer}"); Console.WriteLine("=3.2:->Show list of Customers..{this option shows list of Customers}"); Console.WriteLine("=3.3:->Delete Customer..{this option deletes Customers}"); Console.WriteLine("=4.1:->Enter Toys..{this option adds information regarding to the Toys}"); Console.WriteLine("=4.2:->Show list of Toys..{this option shows the list of enterd Toys}"); Console.WriteLine("=5.1:->Enter Order..{this option adds order details}"); Console.WriteLine("=5.2:->Show list of Orders..{this option shows the list of enterd Orders}"); Console.WriteLine("Enter any other numeric key to Exit the program"); double c = double.Parse(Console.ReadLine()); switch (c) { case 1.1: toyTypeDomain.AddToyType(); Console.WriteLine(""); goto repeate; case 1.2: Console.WriteLine("Id\t ToyType"); foreach (ToyType toyType in toyTypeDomain.GetToyType()) { Console.WriteLine($"{toyType.ToyTypeId}\t {toyType.ToyTypeName}"); } Console.WriteLine(""); goto repeate; case 1.3: Console.WriteLine("--->>Delete ToyType<<---"); Console.WriteLine("Enter typeId"); toyType10.ToyTypeId = Int32.Parse(Console.ReadLine()); toyTypeDomain.DeleteToyType(toyType10); Console.WriteLine(""); goto repeate; case 2.1: plantDomain.AddPlant(); Console.WriteLine(""); goto repeate; case 2.2: Console.WriteLine("Id\tPlantName PlantAddress"); foreach (Plant plant in plantDomain.GetAllPlant()) { Console.WriteLine($"{plant.PlantId}\t{plant.PlantName}\t\t{plant.PlantAddress}"); } Console.WriteLine(""); goto repeate; case 2.3: Console.WriteLine("--->> Delete Plant <<---"); Console.WriteLine("Enter Id To delete Plant: "); plant10.PlantId = Int32.Parse(Console.ReadLine()); plantDomain.DeletePlant(plant10); Console.WriteLine(""); goto repeate; case 3.1: customerDomain.AddCustomer(); Console.WriteLine(""); goto repeate; case 3.2: Console.WriteLine("\n--->> View All Customers <<---"); Console.WriteLine("Id \t CustomerName \t CustomerAddress"); foreach (Customer customer1 in customerDomain.GetAllCustomers()) { Console.WriteLine($"{customer1.CustomerId}\t {customer1.CustomerName}\t\t{customer1.CustomerPermanentAddress} "); } Console.WriteLine(""); goto repeate; case 3.3: Console.WriteLine("--->> Delete Plant <<---"); Console.WriteLine("Enter Id To delete Plant: "); customer20.CustomerId = Int32.Parse(Console.ReadLine()); customerDomain.DeleteCustomer(customer20); Console.WriteLine(""); goto repeate; case 4.1: toyDomain.AddToy(); Console.WriteLine(""); goto repeate; case 4.2: Console.WriteLine("\n--->> View All Toys <<---"); Console.WriteLine("Id \t ToyPrice\tToyTypeId\tPlantId"); foreach (Toy toy in toyDomain.GetAllToy()) { Console.WriteLine($"{toy.ToyId}\t {toy.ToyPrice}\t\t{toy.ToyTypeId}\t\t{toy.PlantId} "); } Console.WriteLine(""); goto repeate; case 5.1: orderDomain.AddOrder(); Console.WriteLine(""); goto repeate; case 5.2: Console.WriteLine("\n--->> View All Orders <<---"); Console.WriteLine("Id \tQuantity\tAddress\tDiscount\tToyId\tCustomerId"); foreach (Order order in orderDomain.GetAllOrders()) { Console.WriteLine($"{order.OrderId}\t{order.OrderQuantity}\t\t{order.OrderAddress}\t{order.OrderDiscount}\t\t{order.ToyId}\t\t{order.CustomerId} "); } Console.WriteLine(""); goto repeate; default: break; } /* customerDomain.AddCustomer();*/ /*Console.WriteLine("\n--->> View All Customers <<---"); * * Console.WriteLine("Id \t CustomerName \t CustomerAddress"); * foreach (Customer customer1 in customerDomain.GetAllCustomers()) * { * * Console.WriteLine($"{customer1.CustomerId}\t {customer1.CustomerName}\t\t{customer1.CustomerPermanentAddress} "); * } * * * Console.WriteLine("--->> Delete Customer <<---"); * Console.WriteLine("Enter Id To delete Customer: "); * customer.CustomerId = Int32.Parse(Console.ReadLine()); * * * Console.WriteLine("Hello World!"); * Console.ReadLine();*/ /*toyTypeDomain.AddToyType();*/ /*Console.Writeline("Delete ToyType"); * Console.WriteLine("Enter typeId"); * toyType.ToyTypeId = Int32.Parse(Console.ReadLine()); * toyTypeDomain.DeleteToyType(toyType);*/ /*toyDomain.AddToy();*/ /*Console.WriteLine("\n--->> View All Toys <<---"); * * Console.WriteLine("Id \t ToyPrice\tToyTypeId\tPlantId" ); * foreach (Toy toy in toyDomain.GetAllToy()) * { * Console.WriteLine($"{toy.ToyId}\t {toy.ToyPrice}\t\t{toy.ToyTypeId}\t\t{toy.PlantId} "); * }*/ //orderDomain.AddOrder(); /*Console.WriteLine("\n--->> View All Orders <<---"); * * Console.WriteLine("Id \tQuantity\tAddress\tDiscount\tToyId\tCustomerId"); * foreach (Order order in orderDomain.GetAllOrders()) * { * Console.WriteLine($"{order.OrderId}\t{order.OrderQuantity}\t\t{order.OrderAddress}\t{order.OrderDiscount}\t\t{order.ToyId}\t\t{order.CustomerId} "); * }*/ }