70 lines
2.0 KiB
Lua
70 lines
2.0 KiB
Lua
|
|
--创建牌友圈View对象
|
|||
|
|
--author:--
|
|||
|
|
|
|||
|
|
local CreateGroupView = {}
|
|||
|
|
|
|||
|
|
|
|||
|
|
local M = CreateGroupView
|
|||
|
|
|
|||
|
|
local url = {"ui://NewGroup/Win_CreateGroup","ui://NewGroup/Win_UpdateGroup"}
|
|||
|
|
function CreateGroupView.new(blur_view,default_str)
|
|||
|
|
setmetatable(M, {__index = BaseWindow})
|
|||
|
|
local self = setmetatable({}, {__index = M})
|
|||
|
|
self.class = "CreateGroupView"
|
|||
|
|
self._close_destroy = true
|
|||
|
|
self._close_zone = false
|
|||
|
|
self._blur_view = blur_view
|
|||
|
|
self.default_str = default_str
|
|||
|
|
self:init(url[self.is_update and 2 or 1])
|
|||
|
|
return self
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
function M:init(url)
|
|||
|
|
BaseWindow.init(self,url)
|
|||
|
|
local tex_name = self._view:GetChild("tex_name")
|
|||
|
|
|
|||
|
|
local ctr_agent = self._view:GetController("agent")
|
|||
|
|
local user = DataManager.SelfUser
|
|||
|
|
|
|||
|
|
|
|||
|
|
self._view:GetController("index").selectedIndex = 2
|
|||
|
|
self._view:GetController("alliance").selectedIndex = 1
|
|||
|
|
|
|||
|
|
local btn_ok = self._view:GetChild("btn_ok")
|
|||
|
|
btn_ok.onClick:Set(function()
|
|||
|
|
if string.utf8len(tex_name.text) == 0 then
|
|||
|
|
ViewUtil.ErrorTip(-12,"请输入圈子名称!")
|
|||
|
|
return
|
|||
|
|
end
|
|||
|
|
if MsgParser:checkString(tex_name.text) then
|
|||
|
|
ViewUtil.ErrorTip(-12,"您输入的名称存在敏感字!")
|
|||
|
|
return
|
|||
|
|
end
|
|||
|
|
-- if not self.is_update and not self.config then
|
|||
|
|
-- ViewUtil.ErrorTip(-12,"请选择玩法!")
|
|||
|
|
-- return
|
|||
|
|
-- end
|
|||
|
|
if self.callback then
|
|||
|
|
local ctr_index = self._view:GetController("index")
|
|||
|
|
local index = ctr_index.selectedIndex + 1
|
|||
|
|
local pay_type = index
|
|||
|
|
local fg_type = 1
|
|||
|
|
if index == 3 then
|
|||
|
|
pay_type = 1
|
|||
|
|
fg_type = 2
|
|||
|
|
end
|
|||
|
|
self.callback(tex_name.text, pay_type, fg_type)
|
|||
|
|
end
|
|||
|
|
self:Destroy()
|
|||
|
|
end)
|
|||
|
|
local btn_cal = self._view:GetChild("btn_cal")
|
|||
|
|
btn_cal.onClick:Set(function()
|
|||
|
|
self:Destroy()
|
|||
|
|
end)
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
function M:SetCallback(callback)
|
|||
|
|
self.callback = callback
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
return M
|