开始开发大厅烹饪功能
This commit is contained in:
		
							
								
								
									
										28
									
								
								Content/Lua/HomeLand/UI/Hearth/Widgets/CookingPot.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								Content/Lua/HomeLand/UI/Hearth/Widgets/CookingPot.lua
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | ||||
| -- 锅的控件 | ||||
| local CookingPot = {} | ||||
| local Emitter = require("Utils.Emitter") | ||||
|  | ||||
| function CookingPot:ctor() | ||||
|     self.cook_slot_clicked_handle = nil | ||||
| end | ||||
|  | ||||
|  | ||||
| function CookingPot:Construct() | ||||
|     self.cook_slot_clicked_handle = Emitter.OnEvent( | ||||
|         "cook_slot_clicked", | ||||
|         function(slot) self:OnCookSlotClicked(slot) end | ||||
|     ) | ||||
| end | ||||
|  | ||||
| function CookingPot:Destruct() | ||||
|     Emitter.OffEvent("cook_slot_clicked", self.cook_slot_clicked_handle) | ||||
| end | ||||
|  | ||||
| function CookingPot:OnCookSlotClicked(slot) | ||||
|     local item = slot:ConsumeMaterial() | ||||
|     if item == nil then  end | ||||
|     self:PlayAnimation(self.Anim_Cook, 0, 1, 0, 1, false) | ||||
| end | ||||
|  | ||||
|  | ||||
| return Class(nil, nil, CookingPot) | ||||
		Reference in New Issue
	
	Block a user