diff --git a/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua b/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua index a286f112..4e0702c8 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua @@ -69,7 +69,7 @@ function M:FillList(numbers) print("lingmengtextBtn_detail") fgCtr:FG_FindMember(self._group.id, numbers[i].uid, function(res) local familyNumberDetail = FamilyNumberDetail.new(self._group.id, self._group.lev, res) - familyNumberDetail:SetTickCallback(self.TickNumberCallback) + familyNumberDetail:SetTickCallback(handler(self, self.TickNumberCallback)) familyNumberDetail:Show() end) end) @@ -77,9 +77,9 @@ function M:FillList(numbers) self._viewList_allNumbers.numItems = #numbers end -function M.TickNumberCallback(res) +function M:TickNumberCallback(res) if res.ReturnCode == 0 then - -- self:FillList(self._group.members) + self:FillList(self._group.members) else ViewUtil.ErrorTip(res.ReturnCode, "删除成员失败") end diff --git a/lua_probject/base_project/Game/View/Family/FamilyAuditNumber.lua b/lua_probject/base_project/Game/View/Family/FamilyAuditNumber.lua new file mode 100644 index 00000000..d88161b7 --- /dev/null +++ b/lua_probject/base_project/Game/View/Family/FamilyAuditNumber.lua @@ -0,0 +1,55 @@ +local FamilyAuditNumber = {} + +local M = FamilyAuditNumber + +function FamilyAuditNumber.new(root) + setmetatable(M, { __index = root }) + local self = setmetatable({}, { __index = M }) + + self:InitList() + + return self +end + +function M:InitList() + local fgCtr = ControllerManager.GetController(NewGroupController) + fgCtr:FG_GroupJoins(self._group.id, function(res) + pt(res) + if res.ReturnCode ~= 0 then + ViewUtil.ErrorTip(res.ReturnCode, "获取成员列表失败") + else + local data = res.Data.joins + self.familyType.selectedIndex = 6 + local list = self._view:GetChild('list_auditNumberList') + list:SetVirtual() + list.itemRenderer = function(index, obj) + local info = data[index + 1] + obj:GetChild('text_name').text = info.nick + obj:GetChild('text_id').text = info.id + obj:GetChild('text_time').text = os.date('%Y-%m-%d %H:%M', os.time()) + ImageLoad.Load(info.portrait, obj:GetChild('btn_head')._iconObject) + obj:GetChild('btn_allow').onClick:Set(function() + self:ClickBtn(1, info.id) + end) + obj:GetChild('btn_unAllow').onClick:Set(function() + self:ClickBtn(0, info.id) + end) + end + list.numItems = #data + end + end) +end + +function M:ClickBtn(isAllow, uid) + local fgCtr = ControllerManager.GetController(NewGroupController) + fgCtr:FG_GroupVerifyJoin(self._group.id, uid, isAllow == 1, function(res) + if res.ReturnCode ~= 0 then + ViewUtil.ErrorTip(res.ReturnCode, "获取成员列表失败") + else + ViewUtil.ShowOneChooose("审核成功") + self:InitList() + end + end) +end + +return M diff --git a/lua_probject/base_project/Game/View/Family/FamilyJoinAndCreate.lua b/lua_probject/base_project/Game/View/Family/FamilyJoinAndCreate.lua new file mode 100644 index 00000000..4a00f48b --- /dev/null +++ b/lua_probject/base_project/Game/View/Family/FamilyJoinAndCreate.lua @@ -0,0 +1,110 @@ +local FamilyJoinAndCreate = {} + +local M = FamilyJoinAndCreate + +function FamilyJoinAndCreate.new(root) + setmetatable(M, { __index = root }) + local self = setmetatable({}, { __index = M }) + local fgCtr = ControllerManager.GetController(NewGroupController) + local createOrJoin = self._view:GetController('createOrJoin') + + + self._currenIndex = 0 + self.tex_num = self._view:GetChild('text_inputNum') + + self._view:GetChild('btn_joinFamily').onClick:Add(function() + createOrJoin.selectedIndex = 1 + end) + self._view:GetChild('btn_createFamily').onClick:Add(function() + createOrJoin.selectedIndex = 0 + end) + self._view:GetChild('list_num').onClickItem:Set(handler(self, self.OnNumButtonAction)) + + local input_name = self._view:GetChild('input_name') + local input_wxId = self._view:GetChild('input_wxId') + input_name.onChanged:Set(function() + input_name.alpha = 1 + end) + input_name.onFocusOut:Set(function() + if #input_name.text > 0 then + input_name.alpha = 1 + else + input_name.alpha = 0.5 + end + end) + + input_wxId.onChanged:Set(function() + input_wxId.alpha = 1 + end) + input_wxId.onFocusOut:Set(function() + if #input_wxId.text > 0 then + input_wxId.alpha = 1 + else + input_wxId.alpha = 0.5 + end + end) + self._view:GetChild('btn_create').onClick:Add(function() + fgCtr:FG_GroupList(function(res) + fgCtr:FG_CreateGroup(input_name.text, 1, 2, function(res) + if res.ReturnCode == 0 then + self.familyType.selectedIndex = 1 + self:ConnetFamily(1, DataManager.groups.groupList, true) + else + ViewUtil.ErrorTip(res.ReturnCode, '创建大联盟失败!') + end + end) + end) + end) + return self +end + +function M:OnNumButtonAction(context) + local item = context.data + local index = self._view:GetChild('list_num'):GetChildIndex(item) + if index < 9 or index == 10 then + if (self._currenIndex < 6) then + self._currenIndex = self._currenIndex + 1 + self.tex_num.text = self.tex_num.text .. (index < 9 and index + 1 or index - 10) + if (self._currenIndex == 6) then + self:JoinRoom(self.tex_num.text) + end + end + elseif index == 9 then + self:ClearNumTex() + else + if (self._currenIndex > 0) then + self._currenIndex = self._currenIndex - 1 + self.tex_num.text = string.sub(self.tex_num.text, 0, self._currenIndex) + end + end +end + +function M:ClearNumTex() + self.tex_num.text = "" + self._currenIndex = 0 +end + +function M:JoinRoom(roomId) + local fgCtr = ControllerManager.GetController(NewGroupController) + --后端似乎还未调通 + self:ClearNumTex() + fgCtr:FG_JoinGroup(tonumber(roomId), function(res) + if res.ReturnCode ~= 0 then + ViewUtil.ShowOneChooose("加入失败" .. res.ReturnCode) + else + end + end) + --先换成邀请玩家 + -- fgCtr:FG_AddMember(self._group.id, tonumber(roomId), function(res) + -- if (res.ReturnCode == 0) then + -- ViewUtil.ShowBannerOnScreenCenter('添加成功!', 1) + -- else + -- ViewUtil.ErrorTip(res.ReturnCode, '邀请玩家失败!') + -- end + + -- self:ChangeNumber(fgCtr, self._group.id, 0, self._group.total_member_num1, false, + -- 1) + -- end) +end + +return M diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index 7ff56a8b..1f357b68 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -5,6 +5,8 @@ local GroupGameSettingView = import(".NewGroup.MngView.GroupGameSettingView_jain ---无窗口 local FamilyAllNumbers = import(".Family.FamilyAllNumbers") local FamilyNumberRecord = import(".Family.FamilyNumberRecord") +local FamilyAuditNumber = import(".Family.FamilyAuditNumber") +local FamilyJoinAndCreate = import(".Family.FamilyJoinAndCreate") --- FamilyView = {} @@ -29,7 +31,6 @@ function M:init(url) local view = self._view local fgCtr = ControllerManager.GetController(NewGroupController) - local createOrJoin = view:GetController('createOrJoin') self.familyType = view:GetController('familyType') self.btn_close = view:GetChild('btn_close') @@ -44,55 +45,6 @@ function M:init(url) self.familyType.selectedIndex = 3 end end) - --------初始化创建和加入亲友圈界面--------------- - self._currenIndex = 0 - self.tex_num = view:GetChild('text_inputNum') - - view:GetChild('btn_joinFamily').onClick:Add(function() - createOrJoin.selectedIndex = 1 - self.lastType = 3 - end) - view:GetChild('btn_createFamily').onClick:Add(function() - createOrJoin.selectedIndex = 0 - self.lastType = 3 - end) - view:GetChild('list_num').onClickItem:Set(handler(self, self.OnNumButtonAction)) - - local input_name = view:GetChild('input_name') - local input_wxId = view:GetChild('input_wxId') - input_name.onChanged:Set(function() - input_name.alpha = 1 - end) - input_name.onFocusOut:Set(function() - if #input_name.text > 0 then - input_name.alpha = 1 - else - input_name.alpha = 0.5 - end - end) - - input_wxId.onChanged:Set(function() - input_wxId.alpha = 1 - end) - input_wxId.onFocusOut:Set(function() - if #input_wxId.text > 0 then - input_wxId.alpha = 1 - else - input_wxId.alpha = 0.5 - end - end) - view:GetChild('btn_create').onClick:Add(function() - fgCtr:FG_GroupList(function(res) - fgCtr:FG_CreateGroup(input_name.text, 1, 2, function(res) - if res.ReturnCode == 0 then - self.familyType.selectedIndex = 1 - self:ConnetFamily(1, DataManager.groups.groupList, true) - else - ViewUtil.ErrorTip(res.ReturnCode, '创建大联盟失败!') - end - end) - end) - end) -------绑定成员战绩按钮 view:GetChild('btn_family_record').onClick:Set(function() self._child_familyNumberRecord = FamilyNumberRecord.New(self) @@ -109,7 +61,6 @@ function M:InitCloseClick() self.familyType.selectedIndex = self.lastType if self.lastType == 3 then self.lastType = 1 - createOrJoin.selectedIndex = (createOrJoin.selectedIndex + 1) % 2 end end end) @@ -124,6 +75,7 @@ function M:CreateFamily() self.familyType.selectedIndex = 3 self.lastType = 1 self._view:GetController('createOrJoin').selectedIndex = 0 + self._child_familyJoinAndCreate = FamilyJoinAndCreate.new(self) end function M:JoinFamily() @@ -142,6 +94,11 @@ function M:AllNumber() self._child_familyAllNumbers = FamilyAllNumbers.new(self) end +function M:AuditNumber() + self.lastType = 1 + self._child_familyAuditNumber = FamilyAuditNumber.new(self) +end + function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type) local list_familyNumber = self._view:GetChild('list_familyNumber') list_familyNumber:SetVirtual() @@ -334,56 +291,6 @@ function M:ConnetFamily(index, groups, isCreate) UpdateBeat:Add(self.OnUpdate, self) end -----------创建和加入--------------------- -function M:OnNumButtonAction(context) - local item = context.data - local index = self._view:GetChild('list_num'):GetChildIndex(item) - if index < 9 or index == 10 then - if (self._currenIndex < 6) then - self._currenIndex = self._currenIndex + 1 - self.tex_num.text = self.tex_num.text .. (index < 9 and index + 1 or index - 10) - if (self._currenIndex == 6) then - self:JoinRoom(self.tex_num.text) - end - end - elseif index == 9 then - self:ClearNumTex() - else - if (self._currenIndex > 0) then - self._currenIndex = self._currenIndex - 1 - self.tex_num.text = string.sub(self.tex_num.text, 0, self._currenIndex) - end - end -end - -function M:ClearNumTex() - self.tex_num.text = "" - self._currenIndex = 0 -end - -function M:JoinRoom(roomId) - local fgCtr = ControllerManager.GetController(NewGroupController) - --后端似乎还未调通 - self:ClearNumTex() - fgCtr:FG_JoinGroup(tonumber(roomId), function(res) - if res.ReturnCode ~= 0 then - ViewUtil.ShowOneChooose("加入失败" .. res.ReturnCode) - else - end - end) - --先换成邀请玩家 - -- fgCtr:FG_AddMember(self._group.id, tonumber(roomId), function(res) - -- if (res.ReturnCode == 0) then - -- ViewUtil.ShowBannerOnScreenCenter('添加成功!', 1) - -- else - -- ViewUtil.ErrorTip(res.ReturnCode, '邀请玩家失败!') - -- end - - -- self:ChangeNumber(fgCtr, self._group.id, 0, self._group.total_member_num1, false, - -- 1) - -- end) -end - function M:OnUpdate() -- --12001事件 -- if self._group.update_room then @@ -444,7 +351,7 @@ local IDENTITY_LIST = { }, { name = "申请消息", - Fct = M.ShareWx + Fct = M.AuditNumber }, { name = "查看成员", @@ -486,7 +393,7 @@ local IDENTITY_LIST = { }, { name = "申请消息", - Fct = M.ShareWx + Fct = M.AuditNumber }, { name = "查看成员", @@ -501,13 +408,9 @@ local IDENTITY_LIST = { Fct = M.CreateFamily }, { - name = "添加助理", + name = "亲友圈排行榜", Fct = M.CreateFamily - }, - { - name = "加入亲友圈", - Fct = M.JoinFamily - }, + } } }, diff --git a/wb_unity_pro/Assets/ART/base/Family/ui/Family_fui.bytes b/wb_unity_pro/Assets/ART/base/Family/ui/Family_fui.bytes index b91d1a15..a2575326 100644 Binary files a/wb_unity_pro/Assets/ART/base/Family/ui/Family_fui.bytes and b/wb_unity_pro/Assets/ART/base/Family/ui/Family_fui.bytes differ