57 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
		
		
			
		
	
	
			57 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
| 
								 | 
							
								local BagPanel = {}
							 | 
						||
| 
								 | 
							
								local UIUtils = require("UI.Utils")
							 | 
						||
| 
								 | 
							
								local GameplayStatics = import("GameplayStatics")
							 | 
						||
| 
								 | 
							
								local BusyActorManagerSubSystem = import("BusyActorManagerSubSystem")
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function BagPanel:ctor()
							 | 
						||
| 
								 | 
							
								    self.widgets = {}
							 | 
						||
| 
								 | 
							
								end
							 | 
						||
| 
								 | 
							
								function BagPanel:OnInitialized()
							 | 
						||
| 
								 | 
							
								    print("BagPanel:OnInitialized")
							 | 
						||
| 
								 | 
							
								    self.BtnClose.OnClicked:Add(function() self:Close() end)
							 | 
						||
| 
								 | 
							
								end
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function BagPanel:Construct()
							 | 
						||
| 
								 | 
							
								    self["WBP_TableSwitcher"]:SetSelectedSwitcher("RoleInventory")
							 | 
						||
| 
								 | 
							
								end
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function BagPanel:GetInventory(name)
							 | 
						||
| 
								 | 
							
								    if name == "Bonfire" then
							 | 
						||
| 
								 | 
							
								        local sub_system = BusyActorManagerSubSystem.Get(self)
							 | 
						||
| 
								 | 
							
								        local bonfire = sub_system:GetNearestBonfire()
							 | 
						||
| 
								 | 
							
								        return bonfire.Inventory
							 | 
						||
| 
								 | 
							
								    end
							 | 
						||
| 
								 | 
							
								end
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function BagPanel:Close()
							 | 
						||
| 
								 | 
							
								    GameplayStatics.SetGamePaused(self, false)
							 | 
						||
| 
								 | 
							
								    UIUtils.CloseWidget(self)
							 | 
						||
| 
								 | 
							
								end
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function BagPanel:Refresh()
							 | 
						||
| 
								 | 
							
								    GameplayStatics.SetGamePaused(self, true)
							 | 
						||
| 
								 | 
							
								    -- self:SetVisibility(ESlateVisibility.Visible)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    -- local sub_system = BusyActorManagerSubSystem.Get(self)
							 | 
						||
| 
								 | 
							
								    -- local bonfire = sub_system:GetNearestBonfire()
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    -- bonfire.Inventory:ForEach(slua.createDelegate(function(idx, grid)
							 | 
						||
| 
								 | 
							
								    --     local widget = self.widgets[idx+1]
							 | 
						||
| 
								 | 
							
								    --     widget:SetData(grid)
							 | 
						||
| 
								 | 
							
								    --     widget:SetInventoryInfo(bonfire.Inventory, idx)
							 | 
						||
| 
								 | 
							
								    -- end))
							 | 
						||
| 
								 | 
							
								    -- local drop_visible = ESlateVisibility.Collapsed
							 | 
						||
| 
								 | 
							
								    -- self.Overlay_Confim:SetVisibility(drop_visible)
							 | 
						||
| 
								 | 
							
								end
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function BagPanel:Destruct()
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								end
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function BagPanel:OnDestroy()
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								end
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								return Class(nil, nil, BagPanel)
							 |