forked from endernon/PGRData
82 lines
No EOL
2.9 KiB
Lua
82 lines
No EOL
2.9 KiB
Lua
|
|
local XUiPhotographSet = XLuaUiManager.Register(XLuaUi, "UiPhotographSet")
|
|
local UiButtonState = CS.UiButtonState
|
|
local CsDropDown = CS.UnityEngine.UI.Dropdown
|
|
|
|
function XUiPhotographSet:OnAwake()
|
|
self:InitCb()
|
|
end
|
|
|
|
function XUiPhotographSet:OnStart(setData)
|
|
self.SetData = setData
|
|
self:InitView()
|
|
end
|
|
|
|
function XUiPhotographSet:InitCb()
|
|
self.BtnTanchuangClose.CallBack = function() self:Close() end
|
|
self.BtnBack.CallBack = function() self:Close() end
|
|
self.BtnCancel.CallBack = function() self:Close() end
|
|
self.BtnConfirm.CallBack = function() self:SaveSet() end
|
|
|
|
self.CardDrdSort.onValueChanged:AddListener(function(value)
|
|
self:OnCardDrdSortValueChanged(value)
|
|
end)
|
|
|
|
self.LogoDrdSort.onValueChanged:AddListener(function(value)
|
|
self:OnLogoDrdSortValueChanged(value)
|
|
end)
|
|
end
|
|
|
|
function XUiPhotographSet:InitView()
|
|
local valueOfShowLevel = self.SetData:GetProperty("_OpenLevel")
|
|
local valueOfShowId = self.SetData:GetProperty("_OpenUId")
|
|
self.BtnShowLevel:SetButtonState(XTool.IsNumberValid(valueOfShowLevel) and UiButtonState.Select or UiButtonState.Normal)
|
|
self.BtnShowId:SetButtonState(XTool.IsNumberValid(valueOfShowId) and UiButtonState.Select or UiButtonState.Normal)
|
|
|
|
local alignment = self.SetData:GetAlignment()
|
|
|
|
self.CardDrdSort:ClearOptions()
|
|
self.LogoDrdSort:ClearOptions()
|
|
for _, data in pairs(alignment or {}) do
|
|
local op = CsDropDown.OptionData()
|
|
op.text = data.Name
|
|
self.CardDrdSort.options:Add(op)
|
|
self.LogoDrdSort.options:Add(op)
|
|
end
|
|
self.LastCardValue = self.SetData:GetProperty("_InfoAlignment").Value
|
|
self.CardDrdSort.value = self.LastCardValue
|
|
self.LastLogoValue = self.SetData:GetProperty("_LogoAlignment").Value
|
|
self.LogoDrdSort.value = self.LastLogoValue
|
|
end
|
|
|
|
function XUiPhotographSet:OnCardDrdSortValueChanged(value)
|
|
if value == self.LogoDrdSort.value and (value ~= 0 or self.LogoDrdSort.value ~= 0) then
|
|
XUiManager.TipText("PhotoModeLogoInfoMutex")
|
|
self.CardDrdSort.value = self.LastCardValue
|
|
return
|
|
end
|
|
self.LastCardValue = self.CardDrdSort.value
|
|
end
|
|
|
|
function XUiPhotographSet:OnLogoDrdSortValueChanged(value)
|
|
if value == self.CardDrdSort.value and (value ~= 0 or self.CardDrdSort.value ~= 0) then
|
|
XUiManager.TipText("PhotoModeLogoInfoMutex")
|
|
self.LogoDrdSort.value = self.LastLogoValue
|
|
return
|
|
end
|
|
self.LastLogoValue = self.LogoDrdSort.value
|
|
end
|
|
|
|
|
|
function XUiPhotographSet:SaveSet()
|
|
local logoValue = self.LastLogoValue
|
|
local infoValue = self.LastCardValue
|
|
if logoValue == infoValue and (logoValue ~= 0 or infoValue ~= 0) then
|
|
XUiManager.TipText("PhotoModeLogoInfoMutex")
|
|
return
|
|
end
|
|
local valueOfShowLevel = self.BtnShowLevel:GetToggleState() and 1 or 0
|
|
local valueOfShowId = self.BtnShowId:GetToggleState() and 1 or 0
|
|
self.SetData:Update(logoValue, infoValue, valueOfShowLevel, valueOfShowId)
|
|
self:Close()
|
|
end |