static WoodLathe() { _id = ApplianceID.WoodLathe; _name = "木工車床"; _methods = new Dictionary<ProduceMethodID, ProduceMethod>() { { ProduceMethodID.Machete__Log__Firewood, new ProduceMethod(ProduceMethodID.Machete__Log__Firewood, "製作柴薪", new Item[]{ new Log(1) }, new Object[]{ new Firewood(3) }, 0) }, { ProduceMethodID.Machete__Log__Timber, new ProduceMethod(ProduceMethodID.Machete__Log__Timber, "製作木材", new Item[] { new Log(1) }, new Object[] { new Timber(1) },0) }, { ProduceMethodID.Machete__Rock__StoneBlade, new ProduceMethod(ProduceMethodID.Machete__Rock__StoneBlade, "製作石刀片", new Item[] { new Rock(2) }, new Object[] { new StoneBlade(1) } ,0) }, { ProduceMethodID.Machete__Hemp__HempRope, new ProduceMethod(ProduceMethodID.Machete__Hemp__HempRope, "製作麻繩", new Item[] { new Hemp(4) }, new Object[] { new HempRope(1) } ,30) }, { ProduceMethodID.Machete__StoneBlade_HempRope_Timber__StoneAxe, new ProduceMethod(ProduceMethodID.Machete__StoneBlade_HempRope_Timber__StoneAxe, "製作石斧", new Item[] { new StoneBlade(1), new HempRope(1), new Timber(1) }, new Object[] { new StoneAxe(1,100,100) } ,20) }, { ProduceMethodID.Machete__StoneBlade_HempRope_Timber__StonePickaxe, new ProduceMethod(ProduceMethodID.Machete__StoneBlade_HempRope_Timber__StonePickaxe, "製作石鎬", new Item[] { new StoneBlade(1), new HempRope(1), new Timber(1) }, new Object[] { new StonePickaxe(1,100,100) } , 20) }, { ProduceMethodID.Machete__StoneBlade_HempRope_Timber__StoneShovel, new ProduceMethod(ProduceMethodID.Machete__StoneBlade_HempRope_Timber__StoneShovel, "製作石鏟", new Item[] { new StoneBlade(1), new HempRope(1), new Timber(1) }, new Object[] { new StoneShovel(1,100,100) } , 20) }, { ProduceMethodID.WorkTable__Log__WoodenAxle, new ProduceMethod(ProduceMethodID.WorkTable__Log__WoodenAxle, "製作木製輪軸", new Item[]{ new Log(1) }, new Object[]{ new WoodenAxle(1) }, 20) }, { ProduceMethodID.SawPlatform__Oak__OakTimber, new ProduceMethod(ProduceMethodID.SawPlatform__Oak__OakTimber, "製作橡木材", new Item[]{ new Oak(1) }, new Object[]{ new OakTimber(1) }, 0) }, { ProduceMethodID.SawPlatform__Cypress__CypressTimber, new ProduceMethod(ProduceMethodID.SawPlatform__Cypress__CypressTimber, "製作檜木材", new Item[] { new Cypress(1) }, new Object[] { new CypressTimber(1) }, 0) }, { ProduceMethodID.SawPlatform__OakTimber__Barrel, new ProduceMethod(ProduceMethodID.SawPlatform__OakTimber__Barrel, "製作木桶", new Item[] { new OakTimber(5) }, new Object[] { new Barrel(1) } , 30) }, { ProduceMethodID.SawPlatform__Barrel_Timber_WoodenAxle__Agitator, new ProduceMethod(ProduceMethodID.SawPlatform__Barrel_Timber_WoodenAxle__Agitator, "製作攪拌器", new Item[] { new Barrel(1), new Timber(2), new WoodenAxle(1) }, new Object[] { new Agitator() } , 100) }, { ProduceMethodID.WoodLathe__CypressTimber_WoodenAxle__Loom, new ProduceMethod(ProduceMethodID.WoodLathe__CypressTimber_WoodenAxle__Loom, "製作織布機", new Item[]{ new CypressTimber(10), new WoodenAxle(3) }, new Object[]{ new Loom() }, 600) }, { ProduceMethodID.WoodLathe__CypressTimber_WoodenAxle__PaperMachine, new ProduceMethod(ProduceMethodID.WoodLathe__CypressTimber_WoodenAxle__PaperMachine, "製作造紙機", new Item[] { new CypressTimber(8), new WoodenAxle(2) }, new Object[] { new PaperMachine() }, 480) } }; }
public void SelectAppliance(ApplianceID id) { applianceSelectPanel.gameObject.SetActive(false); applianceMenu.gameObject.SetActive(true); selectedAppliance = GameGlobal.Appliances[id]; applianceNameText.text = selectedAppliance.name; UpdateApplianceMenu(); }
static Agitator() { _id = ApplianceID.Agitator; _name = "攪拌器"; _methods = new Dictionary<ProduceMethodID, ProduceMethod>() { { ProduceMethodID.Agitator__Clay_Rock__StoneStove, new ProduceMethod(ProduceMethodID.Agitator__Clay_Rock__StoneStove, "製作石灶", new Item[]{ new Clay(5), new Rock(5) }, new Object[]{ new StoneStove() }, 180) } }; }
static PaperMachine() { _id = ApplianceID.PaperMachine; _name = "造紙機"; _methods = new Dictionary<ProduceMethodID, ProduceMethod>() { { ProduceMethodID.PaperMachine__Log_Water__Paper, new ProduceMethod(ProduceMethodID.PaperMachine__Log_Water__Paper, "製作紙", new Item[]{ new Log(1), new Water(1) }, new Object[]{ new Paper(1) }, 60) }, { ProduceMethodID.PaperMachine__Bamboo_Water__Paper, new ProduceMethod(ProduceMethodID.PaperMachine__Bamboo_Water__Paper, "製作紙", new Item[] { new Bamboo(2), new Water(1) }, new Object[] { new Paper(1) }, 60) } }; }
static StoneStove() { _id = ApplianceID.StoneStove; _name = "石灶"; _methods = new Dictionary<ProduceMethodID, ProduceMethod>() { { ProduceMethodID.StoneStove__Log_Firewood__Charcoal, new ProduceMethod(ProduceMethodID.StoneStove__Log_Firewood__Charcoal, "製作木炭", new Item[]{ new Log(1), new Firewood(1) }, new Object[]{ new Charcoal(3) }, 60) }, { ProduceMethodID.StoneStove__Clay_Firewood__Brick, new ProduceMethod(ProduceMethodID.StoneStove__Clay_Firewood__Brick, "製作磚塊", new Item[] { new Clay(1), new Firewood(1) }, new Object[] { new Brick(1) }, 60) }, { ProduceMethodID.StoneStove__Clay_StoneStove__LTKiln, new ProduceMethod(ProduceMethodID.StoneStove__Clay_StoneStove__LTKiln, "升級成低溫窯", new Item[] { new Clay(10) }, new Object[] { new LTKiln() } , 300) } }; }
static BlacksmithPlatform() { _id = ApplianceID.BlacksmithPlatform; _name = "鍛造平台"; _methods = new Dictionary<ProduceMethodID, ProduceMethod>() { { ProduceMethodID.BlacksmithPlatform__Copper__CopperSheet, new ProduceMethod(ProduceMethodID.BlacksmithPlatform__Copper__CopperSheet, "製作銅片", new Item[]{ new Copper(1) }, new Object[]{ new CopperSheet(1) }, 60) }, { ProduceMethodID.BlacksmithPlatform__WroughIron__IronSheet, new ProduceMethod(ProduceMethodID.BlacksmithPlatform__WroughIron__IronSheet, "製作鐵皮", new Item[] { new WroughIron(1) }, new Object[] { new IronSheet(1) },60) }, { ProduceMethodID.BlacksmithPlatform__WroughIron__Blade, new ProduceMethod(ProduceMethodID.BlacksmithPlatform__WroughIron__Blade, "製作刀片", new Item[] { new WroughIron(1) }, new Object[] { new Blade(1) } ,60) } }; }
static Loom() { _id = ApplianceID.Loom; _name = "織布機"; _methods = new Dictionary<ProduceMethodID, ProduceMethod>() { { ProduceMethodID.Loom__Cotton__Cottonwool, new ProduceMethod(ProduceMethodID.Loom__Cotton__Cottonwool, "製作棉絮", new Item[]{ new Cotton(1) }, new Object[]{ new Cottonwool(1) }, 30) }, { ProduceMethodID.Loom__Cottonwool__CottonThread, new ProduceMethod(ProduceMethodID.Loom__Cottonwool__CottonThread, "製作棉線", new Item[] { new Cottonwool(1) }, new Object[] { new CottonThread(1) }, 60) }, { ProduceMethodID.Loom__CottonThread__CottonRope, new ProduceMethod(ProduceMethodID.Loom__CottonThread__CottonRope, "製作棉繩", new Item[] { new CottonThread(3) }, new Object[] { new CottonRope(1) }, 60) }, { ProduceMethodID.Loom__CottonThread__CottonCloth, new ProduceMethod(ProduceMethodID.Loom__CottonThread__CottonCloth, "製作棉布", new Item[] { new CottonThread(10) }, new Object[] { new CottonCloth(1) }, 300) } }; }
static SteelMold() { _id = ApplianceID.SteelMold; _name = "鋼鐵鑄模"; _methods = new Dictionary<ProduceMethodID, ProduceMethod>() { { ProduceMethodID.SteelMold__WroughIron__CircularSawBlade, new ProduceMethod(ProduceMethodID.SteelMold__WroughIron__CircularSawBlade, "製作圓鋸鋸片", new Item[]{ new WroughIron(1) }, new Object[]{ new CircularSawBlade(1) }, 120) }, { ProduceMethodID.SteelMold__WroughIron__MetalGear, new ProduceMethod(ProduceMethodID.SteelMold__WroughIron__MetalGear, "製作金屬齒輪", new Item[] { new WroughIron(1) }, new Object[] { new MetalGear(4) }, 120) }, { ProduceMethodID.SteelMold__WroughIron__Rivet, new ProduceMethod(ProduceMethodID.SteelMold__WroughIron__Rivet, "製作鉚釘", new Item[] { new WroughIron(1) }, new Object[] { new Rivet(6) } , 120) }, { ProduceMethodID.SteelMold__WroughIron__IronBar, new ProduceMethod(ProduceMethodID.SteelMold__WroughIron__IronBar, "製作鐵條", new Item[] { new WroughIron(1) }, new Object[] { new IronBar(1) } , 120) }, { ProduceMethodID.SteelMold__WroughIron__IronPipe, new ProduceMethod(ProduceMethodID.SteelMold__WroughIron__IronPipe, "製作鐵管", new Item[] { new WroughIron(1) }, new Object[] { new IronPipe(1) } , 120) } }; }
static LTKiln() { _id = ApplianceID.LTKiln; _name = "低溫窯"; _methods = new Dictionary<ProduceMethodID, ProduceMethod>() { { ProduceMethodID.StoneStove__Log_Firewood__Charcoal, new ProduceMethod(ProduceMethodID.StoneStove__Log_Firewood__Charcoal, "製作木炭", new Item[]{ new Log(1), new Firewood(1) }, new Object[]{ new Charcoal(3) }, 30) }, { ProduceMethodID.StoneStove__Clay_Firewood__Brick, new ProduceMethod(ProduceMethodID.StoneStove__Clay_Firewood__Brick, "製作磚塊", new Item[] { new Clay(1), new Firewood(1) }, new Object[] { new Brick(1) }, 30) }, { ProduceMethodID.LTKiln__RawRubber_Firewood__Rubber, new ProduceMethod(ProduceMethodID.LTKiln__RawRubber_Firewood__Rubber, "製作橡膠", new Item[]{ new RawRubber(1), new Firewood(1) }, new Object[]{ new Rubber(1) }, 60) }, { ProduceMethodID.LTKiln__Clay_LTKiln__HTKiln, new ProduceMethod(ProduceMethodID.LTKiln__Clay_LTKiln__HTKiln, "升級成高溫窯", new Item[] { new Clay(10) }, new Object[] { new HTKiln() }, 600) } }; }
static Cupola() { _id = ApplianceID.Cupola; _name = "熔鐵爐"; _methods = new Dictionary<ProduceMethodID, ProduceMethod>() { { ProduceMethodID.Cupola__IronOre_Coal__IronBlock, new ProduceMethod(ProduceMethodID.Cupola__IronOre_Coal__IronBlock, "製作鐵塊", new Item[]{ new IronOre(2), new Coal(1) }, new Object[]{ new IronBlock(2) }, 60) }, { ProduceMethodID.Cupola__IronOre_Charcoal__IronBlock, new ProduceMethod(ProduceMethodID.Cupola__IronOre_Charcoal__IronBlock, "製作鐵塊", new Item[] { new IronOre(2), new Charcoal(2) }, new Object[] { new IronBlock(2) }, 60) }, { ProduceMethodID.Cupola__CopperOre_Coal__CopperBlock, new ProduceMethod(ProduceMethodID.Cupola__CopperOre_Coal__CopperBlock, "製作銅塊", new Item[] { new CopperOre(2), new Coal(1) }, new Object[] { new CopperBlock(2) } , 60) }, { ProduceMethodID.Cupola__CopperOre_Charcoal__CopperBlock, new ProduceMethod(ProduceMethodID.Cupola__CopperOre_Charcoal__CopperBlock, "製作銅塊", new Item[] { new CopperOre(2), new Charcoal(2) }, new Object[] { new CopperBlock(2) } , 60) }, { ProduceMethodID.Cupola__IronBlock_Coal__WroughIron, new ProduceMethod(ProduceMethodID.Cupola__IronBlock_Coal__WroughIron, "製作熟鐵材", new Item[] { new IronBlock(2), new Coal(1) }, new Object[] { new WroughIron(1) } , 120) }, { ProduceMethodID.Cupola__IronBlock_Charcoal__WroughIron, new ProduceMethod(ProduceMethodID.Cupola__IronBlock_Charcoal__WroughIron, "製作熟鐵材", new Item[] { new IronBlock(2), new Charcoal(2) }, new Object[] { new WroughIron(1) } , 120) }, { ProduceMethodID.Cupola__CopperBlock_Coal__Copper, new ProduceMethod(ProduceMethodID.Cupola__CopperBlock_Coal__Copper, "製作銅材", new Item[] { new CopperBlock(2), new Coal(1) }, new Object[] { new Copper(1) } , 120) }, { ProduceMethodID.Cupola__CopperBlock_Charcoal__Copper, new ProduceMethod(ProduceMethodID.Cupola__CopperBlock_Charcoal__Copper, "製作銅材", new Item[] { new CopperBlock(2), new Charcoal(2) }, new Object[] { new Copper(1) } , 120) } }; }
static Machete() { _id = ApplianceID.Machete; _name = "柴刀"; _methods = new Dictionary<ProduceMethodID, ProduceMethod>() { { ProduceMethodID.Machete__Log__Firewood, new ProduceMethod(ProduceMethodID.Machete__Log__Firewood, "製作柴薪", new Item[]{ new Log(1) }, new object[]{ new Firewood(3) }, 0) }, { ProduceMethodID.Machete__Log__Timber, new ProduceMethod(ProduceMethodID.Machete__Log__Timber, "製作木材", new Item[] { new Log(1) }, new object[] { new Timber(1) },0) }, { ProduceMethodID.Machete__Rock__StoneBlade, new ProduceMethod(ProduceMethodID.Machete__Rock__StoneBlade, "製作石刀片", new Item[] { new Rock(2) }, new object[] { new StoneBlade(1) } ,0) }, { ProduceMethodID.Machete__Hemp__HempRope, new ProduceMethod(ProduceMethodID.Machete__Hemp__HempRope, "製作麻繩", new Item[] { new Hemp(4) }, new object[] { new HempRope(1) } ,30) }, { ProduceMethodID.Machete__StoneBlade_HempRope_Timber__StoneAxe, new ProduceMethod(ProduceMethodID.Machete__StoneBlade_HempRope_Timber__StoneAxe, "製作石斧", new Item[] { new StoneBlade(1), new HempRope(1), new Timber(1) }, new object[] { new StoneAxe(1,100,100) } ,60) }, { ProduceMethodID.Machete__StoneBlade_HempRope_Timber__StonePickaxe, new ProduceMethod(ProduceMethodID.Machete__StoneBlade_HempRope_Timber__StonePickaxe, "製作石鎬", new Item[] { new StoneBlade(1), new HempRope(1), new Timber(1) }, new object[] { new StonePickaxe(1,100,100) } ,60) }, { ProduceMethodID.Machete__StoneBlade_HempRope_Timber__StoneShovel, new ProduceMethod(ProduceMethodID.Machete__StoneBlade_HempRope_Timber__StoneShovel, "製作石鏟", new Item[] { new StoneBlade(1), new HempRope(1), new Timber(1) }, new object[] { new StoneShovel(1,100,100) } ,60) }, { ProduceMethodID.Machete__Timber_HempRope__WorkTable, new ProduceMethod(ProduceMethodID.Machete__Timber_HempRope__WorkTable, "升級成工作桌", new Item[] { new Timber(10), new HempRope(4) }, new object[] { new WorkTable() } ,300) } }; }
static HTKiln() { _id = ApplianceID.HTKiln; _name = "高溫窯"; _methods = new Dictionary<ProduceMethodID, ProduceMethod>() { { ProduceMethodID.StoneStove__Log_Firewood__Charcoal, new ProduceMethod(ProduceMethodID.StoneStove__Log_Firewood__Charcoal, "製作木炭", new Item[]{ new Log(1), new Firewood(1) }, new Object[]{ new Charcoal(3) }, 10) }, { ProduceMethodID.StoneStove__Clay_Firewood__Brick, new ProduceMethod(ProduceMethodID.StoneStove__Clay_Firewood__Brick, "製作磚塊", new Item[] { new Clay(1), new Firewood(1) }, new Object[] { new Brick(1) }, 10) }, { ProduceMethodID.LTKiln__RawRubber_Firewood__Rubber, new ProduceMethod(ProduceMethodID.LTKiln__RawRubber_Firewood__Rubber, "製作橡膠", new Item[]{ new RawRubber(1), new Firewood(1) }, new Object[]{ new Rubber(1) }, 30) }, { ProduceMethodID.HTKiln__IronOre_Coal__IronBlock, new ProduceMethod(ProduceMethodID.HTKiln__IronOre_Coal__IronBlock, "製作鐵塊", new Item[]{ new IronOre(1), new Coal(1) }, new Object[]{ new IronBlock(1) }, 60) }, { ProduceMethodID.HTKiln__IronOre_Charcoal__IronBlock, new ProduceMethod(ProduceMethodID.HTKiln__IronOre_Charcoal__IronBlock, "製作鐵塊", new Item[] { new IronOre(1), new Charcoal(2) }, new Object[] { new IronBlock(1) }, 60) }, { ProduceMethodID.HTKiln__CopperOre_Coal__CopperBlock, new ProduceMethod(ProduceMethodID.HTKiln__CopperOre_Coal__CopperBlock, "製作銅塊", new Item[] { new CopperOre(1), new Coal(1) }, new Object[] { new CopperBlock(1) } , 60) }, { ProduceMethodID.HTKiln__CopperOre_Charcoal__CopperBlock, new ProduceMethod(ProduceMethodID.HTKiln__CopperOre_Charcoal__CopperBlock, "製作銅塊", new Item[] { new CopperOre(1), new Charcoal(2) }, new Object[] { new CopperBlock(1) } , 60) }, { ProduceMethodID.HTKiln__Clay_IronBlock_Coal__Cupola, new ProduceMethod(ProduceMethodID.HTKiln__Clay_IronBlock_Coal__Cupola, "製作熔鐵爐", new Item[] { new Clay(10), new IronBlock(10), new Coal(6) }, new Object[] { new Cupola() } , 600) }, { ProduceMethodID.HTKiln__IronBlock_Brick_Timber__BlacksmithPlatform, new ProduceMethod(ProduceMethodID.HTKiln__IronBlock_Brick_Timber__BlacksmithPlatform, "製作鍛造平台", new Item[] { new IronBlock(10), new Brick(8), new Timber(4) }, new Object[] { new BlacksmithPlatform() } , 600) }, { ProduceMethodID.HTKiln__WroughIron_Copper_Timber_Clay__SteelMold, new ProduceMethod(ProduceMethodID.HTKiln__WroughIron_Copper_Timber_Clay__SteelMold, "製作鋼鐵鑄模", new Item[] { new WroughIron(8), new Copper(5), new Timber(10), new Clay(8) }, new Object[] { new SteelMold() } , 900) } }; }
public void ProduceEventAction(bool produceStatus, ApplianceID applianceID, ProduceMethodID produceMethodID, ApplianceID selectedApplianceID, bool isNewAppliance) { applianceContentController.workingAnimation.SetActive(false); applianceContentController.remainTime = 0; if (produceStatus) { if (GameGlobal.Appliances.ContainsKey(applianceID) && GameGlobal.Appliances[applianceID].methods.ContainsKey(produceMethodID)) { if (isNewAppliance) { applianceContentController.SelectAppliance(selectedApplianceID); applianceContentController.UpdateApplianceScelectPanel(); } else { applianceContentController.UpdateMethodMaterial(); } } } applianceContentController.processButton.enabled = applianceContentController.selectedProduceMethod.Sufficient(GameGlobal.Inventory); applianceContentController.processButton.image.color = (applianceContentController.processButton.enabled) ? Color.white : Color.grey; }
async Task Produce(ApplianceID applianceID, ProduceMethodID produceMethodID, object[] results, byte operationCode) { try { await Task.Delay(player.appliances[applianceID].methods[produceMethodID].processTime * 1000, cancelTokenSource.Token); foreach (object result in results) { if (result is Item) { Item item = result as Item; player.inventory.Stack(item); } else if (result is Appliance) { Appliance appliance = result as Appliance; if (!player.appliances.ContainsKey(appliance.id)) { if (player.appliances[applianceID] is IUpgradable) { IUpgradable target = player.appliances[applianceID] as IUpgradable; if (target.UpgradeCheck(appliance)) { player.appliances.Remove(player.appliances[applianceID].id); Appliance upgraded = target.Upgrade() as Appliance; player.appliances.Add(upgraded.id, upgraded); } else { player.appliances.Add(appliance.id, appliance); } } else { player.appliances.Add(appliance.id, appliance); } } } } Dictionary<byte, object> parameter = new Dictionary<byte, object> { {(byte)ProduceResponseItem.ApplianceID,applianceID}, {(byte)ProduceResponseItem.ProduceMethodID,produceMethodID} }; OperationResponse response = new OperationResponse(operationCode, parameter) { ReturnCode = (short)ErrorType.Correct, DebugMessage = "" }; SendOperationResponse(response, new SendParameters()); } catch (TaskCanceledException ex) { OperationResponse response = new OperationResponse(operationCode) { ReturnCode = (short)ErrorType.Canceled, DebugMessage = "工作已經消了" }; SendOperationResponse(response, new SendParameters()); } catch(Exception ex) { throw ex; } }