烹饪基本流程完成
This commit is contained in:
		| @ -5,6 +5,7 @@ local Emitter = require("Utils.Emitter") | ||||
| local ESlateVisibility = import("ESlateVisibility") | ||||
|  | ||||
| function CookingPot:ctor() | ||||
|     self.cookware_click_handle = nil | ||||
|     self.cook_material_change_handle = nil | ||||
| end | ||||
|  | ||||
| @ -16,10 +17,16 @@ function CookingPot:Construct() | ||||
|         function(cook_material_id, is_auto_push) self:OnCookMaterialChange(cook_material_id, is_auto_push) end | ||||
|     ) | ||||
|  | ||||
|     self.cookware_click_handle = Emitter.OnEvent( | ||||
|         "use_cookward", | ||||
|         function(cookware_id) self:OnUseCookware(cookware_id) end | ||||
|     ) | ||||
|  | ||||
| end | ||||
|  | ||||
| function CookingPot:Destruct() | ||||
|     Emitter.OffEvent("cook_material_change", self.cook_material_change_handle) | ||||
|     Emitter.OffEvent("use_cookward", self.cookware_click_handle) | ||||
| end | ||||
|  | ||||
|  | ||||
| @ -34,6 +41,11 @@ function CookingPot:OnCookMaterialChange(cook_material_id, is_auto_push) | ||||
|     end | ||||
| end | ||||
|  | ||||
| function CookingPot:OnUseCookware(cookware_id) | ||||
|     self:PlayAnimation(self.Anim_StirFry, 0, 1, 0, 1, false) | ||||
| end | ||||
|  | ||||
|  | ||||
| function CookingPot:OnCookSlotClicked(config) | ||||
|     if config == nil then return end | ||||
|     self.MaterialImg:SetVisibility(ESlateVisibility.SelfHitTestInvisible) | ||||
|  | ||||
							
								
								
									
										22
									
								
								Content/Lua/HomeLand/UI/Hearth/Widgets/Cookware.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								Content/Lua/HomeLand/UI/Hearth/Widgets/Cookware.lua
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | ||||
| ---@class Cookware | ||||
| local Cookware = {} | ||||
| local Emitter = require("Utils.Emitter") | ||||
| local CookManager = require("GamePlay.CookSystem.CookManager") | ||||
|  | ||||
|  | ||||
| function Cookware:OnInitialized() | ||||
|     self.cookware_id = 0 | ||||
|     self.MainBtn.OnClicked:Add(function() | ||||
|         CookManager:UseCookware(self.cookware_id) | ||||
|     end) | ||||
| end | ||||
| function Cookware:Construct() | ||||
|  | ||||
| end | ||||
|  | ||||
| function Cookware:Destruct() | ||||
|  | ||||
| end | ||||
|  | ||||
|  | ||||
| return Class(nil, nil, Cookware) | ||||
		Reference in New Issue
	
	Block a user