2024-09-01 20:49:41 +00:00
|
|
|
---@class XUiPhotographCapturePanel
|
|
|
|
---@field ImagePhoto UnityEngine.UI.Image
|
2023-07-14 19:35:33 +00:00
|
|
|
local XUiPhotographCapturePanel = XClass(nil, "XUiPhotographCapturePanel")
|
|
|
|
|
|
|
|
function XUiPhotographCapturePanel:Ctor(rootUi, ui)
|
|
|
|
self.GameObject = ui.gameObject
|
|
|
|
self.Transform = ui.transform
|
|
|
|
self.RootUi = rootUi
|
|
|
|
XTool.InitUiObject(self)
|
|
|
|
|
|
|
|
self:Init()
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiPhotographCapturePanel:Init()
|
|
|
|
self:AutoRegisterBtn()
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiPhotographCapturePanel:AutoRegisterBtn()
|
|
|
|
self.BtnClose.CallBack = function () self:OnBtnCloseClick() end
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiPhotographCapturePanel:OnBtnCloseClick()
|
|
|
|
self.RootUi:ChangeState(XPhotographConfigs.PhotographViewState.Normal)
|
|
|
|
if not XTool.UObjIsNil(self.ImagePhoto.mainTexture) and self.ImagePhoto.mainTexture.name ~= "UnityWhite" then -- 销毁texture2d (UnityWhite为默认的texture2d)
|
|
|
|
CS.UnityEngine.Object.Destroy(self.ImagePhoto.mainTexture)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
-- #108081
|
2023-07-14 19:35:33 +00:00
|
|
|
function XUiPhotographCapturePanel:Show()
|
|
|
|
self.GameObject:SetActiveEx(true)
|
2024-09-01 20:49:41 +00:00
|
|
|
XDataCenter.UiPcManager.OnUiEnable(self, "OnBtnCloseClick")
|
2023-07-14 19:35:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function XUiPhotographCapturePanel:Hide()
|
|
|
|
self.GameObject:SetActiveEx(false)
|
2024-09-01 20:49:41 +00:00
|
|
|
XDataCenter.UiPcManager.OnUiDisableAbandoned(true, self)
|
2023-07-14 19:35:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return XUiPhotographCapturePanel
|