准备制作食材预处理流程,为lua直接读data table做基建
...
This commit is contained in:
		| @ -1,14 +1,39 @@ | ||||
| local WidgetUtils = require("Utils.UI.WidgetUtils") | ||||
| local Emitter = require("Utils.Emitter") | ||||
| local HearthMain = {} | ||||
|  | ||||
| function HearthMain:ctor() | ||||
|     self.switch_to_prep_cook_station_handle = nil | ||||
| end | ||||
|  | ||||
| function HearthMain:OnInitialized() | ||||
|     self.BtnBack.OnClicked:Add(function() | ||||
|         WidgetUtils.Hide(self, "HearthMain") | ||||
|     end) | ||||
|     self.BtnOpenRecipe.OnClicked:Add(function() | ||||
|         WidgetUtils.Show(self, "RecipeMenu") | ||||
|         self:BP_Close() | ||||
|     end) | ||||
| end | ||||
|  | ||||
| function HearthMain:Construct() | ||||
|     self.switch_to_prep_cook_station_handle = Emitter.OnEvent( | ||||
|         "switch_to_prep_station", function() self:SwitchToPrepCookStation() end | ||||
|     ) | ||||
| end | ||||
|  | ||||
| function HearthMain:Destruct() | ||||
|     Emitter.OffEvent("switch_to_prep_station", self.switch_to_prep_cook_station_handle) | ||||
| end | ||||
|  | ||||
| function HearthMain:SwitchToPrepCookStation() | ||||
|     if self:IsAnimationPlaying(self.Anim_StartPrepCook) then | ||||
|         return | ||||
|     end | ||||
|     self:PlayAnimation(self.Anim_StartPrepCook, 0, 1, 0, 1, false) | ||||
| end | ||||
|  | ||||
| function HearthMain:OnAnimationFinished(anim) | ||||
|     if anim == self.Anim_StartPrepCook then | ||||
|         WidgetUtils.Show(self, "PreCookStation") | ||||
|         print("HearthMain:OnAnimationFinished") | ||||
|     end | ||||
| end | ||||
|  | ||||
| return Class(nil, nil, HearthMain) | ||||
		Reference in New Issue
	
	Block a user