39 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
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()
 | 
						|
        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) |