--进入牌友圈View对象 --author:-- local JoinGroupView = {} local M = JoinGroupView local KEY_DEL = "del" local KEY_CLEAR = "c" function JoinGroupView.new(blur_view) setmetatable(M, {__index = BaseWindow}) local self = setmetatable({}, {__index = M}) self.class = "JoinGroupView" self._currenIndex = 0 self._close_destroy = true self._blur_view = blur_view self:init("ui://NewGroup/Win_FGJoin") return self end function M:init(url) BaseWindow.init(self,url) self.tex_num = self._view:GetChild("tex_num") self:ClearNumTex() local cnt = self._view.numChildren - 1 for i = 0 , 9 do local obj = self._view:GetChild("btn_"..i) obj.onClick:Add(handler(self , self.OnNumButtonAction)) i = i + 1 end local btn_ok = self._view:GetChild("btn_ok") btn_ok.onClick:Set(function() if self._currenIndex <6 then ViewUtil.ErrorTip(-12,"您输入的大联盟ID少于六位!") return end ViewUtil.ShowModalWait(self._root_view) local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:FG_JoinGroup(tonumber(self._texnum_str),function(response) ViewUtil.CloseModalWait() if self._is_destroy then return end if (response.ReturnCode == 0) then ViewUtil.ErrorTip("请等待盟主审核") self:Destroy() else ViewUtil.ErrorTip(response.ReturnCode,"加入大联盟失败!") end end) end) local btn_del = self._view:GetChild("btn_del") btn_del.onClick:Add(handler(self , self.OnNumButtonAction)) end function M:OnNumButtonAction(context) local typer = string.sub(context.sender.name ,5) if typer == KEY_DEL then if (self._currenIndex > 0) then self._currenIndex = self._currenIndex - 1 self._texnum_str = string.sub(self._texnum_str,0,self._currenIndex) self.tex_num.text = self._texnum_str end else if (self._currenIndex < 6) then self._currenIndex = self._currenIndex + 1 self._texnum_str = self._texnum_str .. typer self.tex_num.text = self._texnum_str end end end function M:ClearNumTex() self._texnum_str = "" self._currenIndex = 0 self.tex_num.text = self._texnum_str end return M