hengyang_client/lua_probject/base_project/Game/View/NewGroup/GroupRemitView.lua

124 lines
3.9 KiB
Lua
Raw Permalink Normal View History

2025-04-01 10:48:36 +08:00
--牌友圈转让View
local GroupRemitView = {}
local GroupNumberInputView = import(".MngView.GroupNumberInputView")
local M = GroupRemitView
function GroupRemitView.new(blur_view, curGroup)
2025-11-06 17:37:53 +08:00
setmetatable(M, { __index = BaseWindow })
local self = setmetatable({}, { __index = M })
2025-04-01 10:48:36 +08:00
self.class = "GroupRemitView"
self._close_destroy = true
self._blur_view = blur_view
self.curGroup = curGroup
self:init("ui://NewGroup/Win_Remit")
self:FillView()
return self
end
function M:FillView()
local fgCtr = ControllerManager.GetController(NewGroupController)
self._ctr_result = self._view:GetController("result")
local remite_id, remite_num
local btn_id = self._view:GetChild("btn_id")
btn_id.onClick:Set(function()
local gfv = GroupNumberInputView.new(self._root_view, function(num)
remite_id = num
btn_id.title = num
self._ctr_result.selectedIndex = 0
end)
gfv:Show()
end)
local btn_num = self._view:GetChild("btn_num")
btn_num.onClick:Set(function()
local gfv = GroupNumberInputView.new(self._root_view, function(num)
remite_num = num
btn_num.title = num
end)
gfv:Show()
end)
local btn_search = self._view:GetChild("btn_search")
btn_search.onClick:Set(function()
self._ctr_result.selectedIndex = 0
2025-11-06 17:37:53 +08:00
if not remite_id then
2025-04-01 10:48:36 +08:00
ViewUtil.ErrorTip(nil, "请输入玩家ID")
2025-11-06 17:37:53 +08:00
return
2025-04-01 10:48:36 +08:00
end
2025-11-06 17:37:53 +08:00
ViewUtil.ShowModalWait2(nil)
2025-04-01 10:48:36 +08:00
fgCtr:FG_RemitFindMember(self.curGroup.id, remite_id, function(res)
2025-11-06 17:37:53 +08:00
ViewUtil.CloseModalWait2()
2025-04-01 10:48:36 +08:00
if self._is_destroy then
return
end
2025-11-06 17:37:53 +08:00
if res.ReturnCode ~= 0 then
2025-04-01 10:48:36 +08:00
ViewUtil.ErrorTip(res.ReturnCode, "查询玩家失败")
return
else
if not res.Data.uid then
ViewUtil.ErrorTip(nil, "查询玩家失败")
return
end
self._ctr_result.selectedIndex = 1
self._view:GetChild("tex_id").text = res.Data.uid
self._view:GetChild("tex_name").text = res.Data.nick
if res.Data.portrait then
ImageLoad.Load(res.Data.portrait, self._view:GetChild("btn_head")._iconObject)
end
end
end)
end)
local btn_ok = self._view:GetChild("btn_ok")
btn_ok.onClick:Set(function()
2025-11-06 17:37:53 +08:00
local msgbox = MsgWindow.new(self._root_view, "确定要转让积分吗?", MsgWindow.MsgMode.OkAndCancel)
msgbox.onOk:Add(function(...)
if not remite_id then
2025-04-01 10:48:36 +08:00
ViewUtil.ErrorTip(nil, "请输入玩家ID")
2025-11-06 17:37:53 +08:00
return
2025-04-01 10:48:36 +08:00
end
if self._ctr_result.selectedIndex == 0 then
ViewUtil.ErrorTip(nil, "请先搜索玩家")
return
end
2025-11-06 17:37:53 +08:00
if not remite_num then
2025-04-01 10:48:36 +08:00
ViewUtil.ErrorTip(nil, "请输入转让数量")
2025-11-06 17:37:53 +08:00
return
2025-04-01 10:48:36 +08:00
end
2025-11-06 17:37:53 +08:00
ViewUtil.ShowModalWait2(nil)
2025-04-01 10:48:36 +08:00
fgCtr:FG_FagRemit(self.curGroup.id, remite_id, ad2d(remite_num), function(res)
2025-11-06 17:37:53 +08:00
ViewUtil.CloseModalWait2()
2025-04-01 10:48:36 +08:00
if self._is_destroy then
return
end
2025-11-06 17:37:53 +08:00
if res.ReturnCode ~= 0 then
2025-04-01 10:48:36 +08:00
ViewUtil.ErrorTip(res.ReturnCode, "转让失败")
return
else
local msgbox2 = MsgWindow.new(self._root_view, "转让积分成功", MsgWindow.MsgMode.OnlyOk)
msgbox2:Show()
end
end)
end)
msgbox:Show()
end)
end
function M:SetCallback(callback)
self.callback = callback
end
-- 销毁窗口
function M:Destroy(remove_map)
2025-11-06 17:37:53 +08:00
if self.change and self.callback then
2025-04-01 10:48:36 +08:00
self.callback()
end
2025-11-06 17:37:53 +08:00
BaseWindow.Destroy(self, remove_map)
2025-04-01 10:48:36 +08:00
end
2025-11-06 17:37:53 +08:00
return M