diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..52efc250 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# 忽略所有文件和文件夹 +* + +# 上传两个文件夹 +!lua_probject/ +!wb_unity_pro/ +wb_unity_pro/* +!wb_unity_pro/Assets/ +wb_unity_pro/Assets/* +!wb_unity_pro/Assets/ART/ + +!lua_probject/** +!wb_unity_pro/Assets/ART/** +!.gitignore \ No newline at end of file diff --git a/lua_probject/base_project/Game/Controller/LoginController.lua b/lua_probject/base_project/Game/Controller/LoginController.lua index 7afcd049..e22d6862 100644 --- a/lua_probject/base_project/Game/Controller/LoginController.lua +++ b/lua_probject/base_project/Game/Controller/LoginController.lua @@ -14,7 +14,7 @@ end local _LocalConfigAllGame = { -- 10, 33, - 90, + -- 90, 66, 86, 87, 88, 89 } diff --git a/lua_probject/base_project/Game/Controller/NewGroupController.lua b/lua_probject/base_project/Game/Controller/NewGroupController.lua index aee4e55c..4cb9d4a5 100644 --- a/lua_probject/base_project/Game/Controller/NewGroupController.lua +++ b/lua_probject/base_project/Game/Controller/NewGroupController.lua @@ -41,6 +41,7 @@ function M:FG_GroupList(callback) group.room_num = tem.room_num group.option = tem.option group.show_num = tem.show_num + group.isShow = tem.isShow l_groups:add(group) end end @@ -1264,6 +1265,27 @@ function M:FG_SetBanTable(group_id, member_id, list, del_list, callback) end) end +-- 设置添加&禁止同桌 2025.6.21 +-- 添加同桌时 tableId = -1 table = {} +---@param id 亲友圈id +---@param tableId 同桌id +---@param table 同桌玩家 +---@param tableName 同桌备注&名字 +function M:FG_SetBanTable1(id, tableId, players, name, callback) + + local _data = {} + _data.id = id + _data.tableId = tableId + _data.table = players + _data.tableName = name + print("发送同桌协议") + pt(_data) + local _client = ControllerManager.GroupClient + _client:send(Protocol.SET_BAN_TABLE, _data, function(res) + callback(res) + end) +end + function M:FG_GetBanTable(group_id, member_id, callback) local _client = ControllerManager.GroupClient local _data = {} @@ -1274,6 +1296,19 @@ function M:FG_GetBanTable(group_id, member_id, callback) end) end +-- 获取禁止同桌 2025.6.21 +---@param group_id 亲友圈id +function M:FG_GetBanTable1(group_id, callback) + + local _data = {} + _data.id = group_id + + local _client = ControllerManager.GroupClient + _client:send(Protocol.GET_BAN_TABLE, _data, function(res) + callback(res) + end) +end + function M:GetAddMember(group_id, member_id, callback) local _client = ControllerManager.GroupClient local _data = {} @@ -1383,13 +1418,21 @@ function M:FG_DelAllMail(group_id, uid, callback) end) end --- 设置成员备注 -function M:FG_SetMemberTag(group_id, uid, score, callback) +-- 设置成员备注 2025.6.21 服务器有id信息不传score,tag = 备注 +---@param group_id 亲友圈id +---@param uid 玩家 +---@param tag 备注 +function M:FG_SetMemberTag(group_id, uid, tag, callback) local _client = ControllerManager.GroupClient local _data = {} + --_data.id = group_id + --_data.tag = uid + --_data.score = 0 + _data.id = group_id - _data.tag = uid - _data.score = score + _data.uid = uid + _data.tag = tag + _client:send(Protocol.WEB_FG_SET_MEMBER_TAG, _data, function(res) callback(res) end) @@ -1526,3 +1569,26 @@ function M:FG_SetFamilyHeartbeat(group_id, playerId, callback) callback(res) end) end + +--显示&隐藏成员 +---@param isShow 1是显示 0是隐藏 +function M:FG_SetGroupShow(isShow, groupId, callback) + local _client = ControllerManager.GroupClient + local _data = {} + _data.isShow = isShow + _data.groupId = groupId + _client:send(Protocol.SHOW_GROUP, _data, function(res) + callback(res) + end) +end + +--聊天室 +---@groupId 亲友圈id +function M:GetChatRoom(groupId, callback) + local _client = ControllerManager.GroupClient + local _data = {} + _data.id = groupId + _client:send(Protocol.WEB_FG_GETCHATROOM, _data, function(res) + callback(res) + end) +end diff --git a/lua_probject/base_project/Game/Data/Room.lua b/lua_probject/base_project/Game/Data/Room.lua index b7a91dd4..ead83b96 100644 --- a/lua_probject/base_project/Game/Data/Room.lua +++ b/lua_probject/base_project/Game/Data/Room.lua @@ -38,6 +38,7 @@ local Room = { -- 观战玩家列表 witness_player_list = nil, + _flag_updateWitness = false, -- 游戏中 playing = false, diff --git a/lua_probject/base_project/Game/Protocol.lua b/lua_probject/base_project/Game/Protocol.lua index 6c493690..96beb6d7 100644 --- a/lua_probject/base_project/Game/Protocol.lua +++ b/lua_probject/base_project/Game/Protocol.lua @@ -123,6 +123,12 @@ Protocol = { WEB_FG_SET_GROUP_VIP = "group/set_group_vip", -- 禁止同桌 WEB_FG_SET_BAN_TABLE = "group/set_ban_desk", + -- 设置禁止同桌 2025.6.21 新增 + SET_BAN_TABLE = "group/set_ban_deskList", + -- 获取禁止同桌 2025.6.21 新增 + GET_BAN_TABLE = "group/get_ban_desk_list2", + -- 显示%隐藏成员 + SHOW_GROUP = "group/show_group", -- 添加玩家 WEB_FG_INVITE_MEMBER = "group/invite_group_member", --获取添加玩家 @@ -265,6 +271,9 @@ Protocol = { WEB_FG_SET_Family_Diamond = "group/add_group_diamo", -- 亲友圈发送伪心跳 WEB_FG_SET_Family_Heartbeat = "group/set_group_heartbeat", + + -- 亲友圈聊天室 + WEB_FG_GETCHATROOM = 'group/get_chat_rooms', -------------- group-log--------------------- -- 获取奖励日志 WEB_FG_GET_REWARDS_LOG = "group/log/get_reward_log", diff --git a/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua b/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua index fccb4f7f..691b827b 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyAllNumbers.lua @@ -64,6 +64,13 @@ function M:FillList(numbers) obj:GetController('ban').selectedIndex = numbers[i].ban obj:GetChild('name').text = numbers[i].nick obj:GetChild('id').text = string.format("ID:%s", numbers[i].uid) + + if numbers[i].tag == "" then + obj:GetChild("remark").text = "备注:无" + else + obj:GetChild("remark").text = numbers[i].tag + end + ImageLoad.Load(numbers[i].portrait, obj:GetChild('btn_head')._iconObject) obj.onClick:Set(function() diff --git a/lua_probject/base_project/Game/View/Family/FamilyBanDesk.lua b/lua_probject/base_project/Game/View/Family/FamilyBanDesk.lua index 0e2a0e8d..4d3f3649 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyBanDesk.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyBanDesk.lua @@ -1,80 +1,286 @@ +local FamilySelectNumber = import(".FamilySelectNumber") + --region LOCAL local BanDesk = {} -local root = {} local rootLastIndex = 0 -local function HideMainView() - rootLastIndex = root.familyType.selectedIndex - root.familyType.selectedIndex = 0 +local function HideMainView(self) + rootLastIndex = self.root.familyType.selectedIndex + self.root.familyType.selectedIndex = 0 end -local function ShowMainView() - root.familyType.selectedIndex = rootLastIndex or 1 +local function ShowMainView(self) + self.root.familyType.selectedIndex = rootLastIndex or 1 +end + +local function LoadData(BanData) + +end + +local function GetIconFromGroupData(playerId, group) + local player = group.memberMap[playerId] + if player then + return player.portrait + end + + print("玩家不在group中,无法找到头像 玩家id=",playerId) + + return "" +end + +local function AllUid(deskList) + + local re = {} + pt(deskList) + for _, player in pairs(deskList) do + re[#re + 1] = player.uid + end + return re +end + +local function AddPlayer(data, self) + -- 点击弹出选择成员界面 + local view = FamilySelectNumber.New() + view:Show(self.root._group.id, function(number) + local players = AllUid(data.deskList) + players[#players + 1] = number.uid + local fgCtr = ControllerManager.GetController(NewGroupController) + fgCtr:FG_SetBanTable1(self.root._group.id, data.deskId, players, data.deskName, function() self:ReflashDesk() end) + end) +end + +local function DelPalyer(data, uid, self) + local players = AllUid(data.deskList) + for _, id in pairs(players) do + if id == uid then + players[_] = nil + end + end + + -- 修复下标的连续性,不然json.encode会吧空下标也解析出来 + local fix = {} + for _, id in pairs(players) do + fix[#fix + 1] = id + end + players = fix + + local fgCtr = ControllerManager.GetController(NewGroupController) + fgCtr:FG_SetBanTable1(self.root._group.id, data.deskId, players, data.deskName, function() self:ReflashDesk() end) +end + +local function DelDesk(data, self) + local fgCtr = ControllerManager.GetController(NewGroupController) + fgCtr:FG_SetBanTable1(self.root._group.id, data.deskId, {}, data.deskName, function() self:Reflash() end) +end + +local function ChangeName(deskData, name, self) + local fgCtr = ControllerManager.GetController(NewGroupController) + fgCtr:FG_SetBanTable1(self.root._group.id, deskData.deskId, AllUid(deskData.deskList), name, function() + self:ReflashDesk() + self:CloseRemaskWindow() + end) +end + +local function Sort(BanData) + -- 把空的桌子放到下面 + local emtpy = {} + for index, desk in pairs(BanData) do + if desk.deskList == nil or #desk.deskList == 0 then + emtpy[#emtpy + 1] = desk + BanData[index] = nil + end + end + + local re = {} + for _, desk in pairs(BanData) do + re[#re + 1] = desk + end + + for _, desk in pairs(emtpy) do + re[#re + 1] = desk + end + + return re end --endregion --- 禁止同桌数据 -BanDesk.BanData = {} function BanDesk:TryShow(r) - if not self._view then - self:Init() - end - root = r - HideMainView() - self:Show() + local view = BanDesk.New() + + self.root = r + HideMainView(self) + view:Show() +end + +function BanDesk:Show() + BaseWindow.Show(self) + self:Reflash() end function BanDesk:Close() BaseView.Close(self) - ShowMainView() + ShowMainView(self) +end + +function BanDesk.New() + setmetatable(BanDesk, {__index = BaseView}) + local inst = setmetatable({}, {__index = BanDesk}) + inst._close_destroy = true + inst._full = true + inst._animation = false + inst._full_offset = false + inst._anim_pop = 0 + BaseWindow.init(inst, 'ui://Family/com_banDesk') + inst:Init() + inst._root_view:GetChild("win_mode").visible = false + return inst end function BanDesk:Init() - setmetatable(BanDesk, {__index = BaseView}) - self:InitView("ui://Family/com_banDesk") self.btn_close = self._view:GetChild("btn_close") self.list_banItem = self._view:GetChild("list_banItem") + self.cSetName = self._view:GetController("cSetName") + self.btn_bgRemask = self._view:GetChild("btn_bgRemask") + self.btn_confirmRemask = self._view:GetChild("btn_confirmRemask") + self.btn_quitRemask = self._view:GetChild("btn_quitRemask") + self.input_name = self._view:GetChild("input_name") + self.btn_confirmRemask = self._view:GetChild("btn_confirmRemask") + self.input_name = self._view:GetChild('input_name') self.btn_close.onClick:Set(function() self:Close() end) + self.btn_quitRemask.onClick:Set(function() + self:CloseRemaskWindow() + end) + + self.btn_bgRemask.onClick:Set(function() + self:CloseRemaskWindow() + end) + + self.btn_confirmRemask.onClick:Set(function() + local name = self.input_name.text + ChangeName(self.selectBanItem, name, self) + end) + self.list_banItem.itemRenderer = function(index, obj) - local data = self.BanData[index] + local data = self.BanData[index +1] local tex_name = obj:GetChild("tex_name") local list_BanedPlayers = obj:GetChild("list_BanedPlayers") local btn_del = obj:GetChild("btn_del") - local btn_addBanItem = obj:GetChild("btn_addBanItem") + local btn_edit = obj:GetChild("btn_edit") - btn_addBanItem.onClick:Set(function() - local fgCtr = ControllerManager.GetController(NewGroupController) - local groupId = root._group - local userId = DataManager.SelfUser.account_id - local banList = {} - --fgCtr:FG_SetBanTable(groupId, userId, , {},function() - --end) + tex_name.text = data.deskName + obj:GetController("cStyle").selectedIndex = 0 + + btn_edit.onClick:Set(function() + -- 修改备注 + self.changedIndex = index + self.selectBanItem = data + self:OpenRemaskWindow() end) - list_BanedPlayers.itemRenderer = function(i, o) - - end - end + btn_del.onClick:Set(function() + -- 删除整个桌子 + DelDesk(data, self) + end) + list_BanedPlayers.itemRenderer = function(playerIndex, playerObj) + + local loader_icon = playerObj:GetChild("loader_icon") + local tex_name = playerObj:GetChild("tex_name") + + local player = data.deskList[playerIndex + 1] + playerObj:GetController("cStyle").selectedIndex = 0 + tex_name.text = player.nick + local img = GetIconFromGroupData(player.uid, self.root._group) + ImageLoad.Load(img, loader_icon) + + local btn_delPlayer = playerObj:GetChild("btn_delPlayer") + btn_delPlayer.onClick:Set(function() + -- 删除玩家按钮 + self.changedIndex = index + DelPalyer(data, player.uid, self) + end) + end + + list_BanedPlayers.numItems = #data.deskList + + local add_play = list_BanedPlayers:AddItemFromPool() + add_play:GetController("cStyle").selectedIndex = 1 + add_play:GetChild("btn_addPlayer").onClick:Set(function() + -- 添加玩家按钮 + self.changedIndex = index + AddPlayer(data, self) + end) + end end function BanDesk:Reflash() - -- 最后一个添加ban按钮 - local addBanItem = self.list_banItem:AddItemFromPool() - addBanItem:GetController("cStyle").selectedIndex = 1 - --addBanItem + local fgCtr = ControllerManager.GetController(NewGroupController) + local groupId = self.root._group.id + + fgCtr:FG_GetBanTable1(groupId,function(res) + self:GetBanTableCallback(res) + end) end +function BanDesk:GetBanTableCallback(res) + print("BanDesk:GetBanTableCallback") + + self.BanData = Sort(res.Data.ban_list) + self.list_banItem.numItems = #self.BanData + + -- 最后一个添加ban按钮 + local addBanItem = self.list_banItem:AddItemFromPool() + local btn_addBanItem = addBanItem:GetChild("btn_addBanItem") + addBanItem:GetController("cStyle").selectedIndex = 1 + btn_addBanItem.onClick:Set(function() + local fgCtr = ControllerManager.GetController(NewGroupController) + local groupId = self.root._group.id + local banList = {} + fgCtr:FG_SetBanTable1(groupId, -1, banList, "新建关系", function() + self:Reflash() + end) + end) +end + +function BanDesk:ReflashDesk() + -- 只刷新一个元素,暂时怎么处理,有时间优化 + local data = self.BanData[self.changedIndex +1] + local obj = self.list_banItem:GetChildAt(self.changedIndex) + local tex_name = obj:GetChild("tex_name") + local list_BanedPlayers = obj:GetChild("list_BanedPlayers") + tex_name.text = data.deskName + obj:GetController("cStyle").selectedIndex = 0 + list_BanedPlayers.numItems = #data.deskList + + local add_play = list_BanedPlayers:AddItemFromPool() + add_play:GetController("cStyle").selectedIndex = 1 + add_play:GetChild("btn_addPlayer").onClick:Set(function() + -- 添加玩家按钮 + self.changedIndex = self.changedIndex + AddPlayer(data, self) + end) +end + +-- 打开备注界面 +function BanDesk:OpenRemaskWindow() + self.cSetName.selectedIndex = 1 +end + +function BanDesk:CloseRemaskWindow() + self.cSetName.selectedIndex = 0 +end + + return BanDesk \ No newline at end of file diff --git a/lua_probject/base_project/Game/View/Family/FamilyChatRoom.lua b/lua_probject/base_project/Game/View/Family/FamilyChatRoom.lua new file mode 100644 index 00000000..476a9e4e --- /dev/null +++ b/lua_probject/base_project/Game/View/Family/FamilyChatRoom.lua @@ -0,0 +1,57 @@ +require 'FairyGUI' + +local FamilyChatRoom = {} + +--[[ +function FamilyChatRoom.New() + --转移进family界面 + --setmetatable(FamilyChatRoom, { __index = BaseWindow }) + --local inst = setmetatable({}, { __index = FamilyChatRoom}) + + inst:Init(com) + + return inst +end +]] + +function FamilyChatRoom:Init(com, root) + --转移进family界面 + --self._full = true + --self._full_offset = false + --self._animation = false + --BaseWindow.init(self, "ui://Family/com_chatRoom") + + self.root = root + self._view = com + + self.list_chat = self._view:GetChild("list_chat") + self.btn_quit = self._view:GetChild("btn_quit") + + self.btn_quit.onClick:Set(function() + self:Close() + end) + + return self +end + +function FamilyChatRoom:Close() + local cChatRoom = self.root._view:GetController("cIsChatRoom") + cChatRoom.selectedIndex = 0 +end + +function FamilyChatRoom:Show() + local cChatRoom = self.root._view:GetController("cIsChatRoom") + cChatRoom.selectedIndex = 1 + + local fgCtr = ControllerManager.GetController(NewGroupController) + fgCtr:GetChatRoom(self.root._group.id, function(res) + self:GetChatCallBack(res) + end) +end + +function FamilyChatRoom:GetChatCallBack(res) + print("收到聊天室协议") + pt(res) +end + +return FamilyChatRoom \ No newline at end of file diff --git a/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua b/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua index 920e7d19..222bd5ac 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyMyFamily.lua @@ -1,3 +1,5 @@ +local FamilyRoomCardRecord = import(".FamilyRoomCardRecord") + --region LOCAL local FamilyMyFamily = {} @@ -37,17 +39,27 @@ end function FamilyMyFamily:Refalsh() - --local family = root._group - local family = DataManager.groups.groupMap[self.groupId] + self.family = DataManager.groups.groupMap[self.groupId] - self.tex_fName.text = family.name - self.tex_playerName.text = "亲友圈号:" .. family.id - self.tex_fNumber.text = family.member_num - self.tex_cradNum.text = family.diamo - self.tex_nocice.text = family.notice - ImageLoad.Load(family.o_portrait, self.loader_icon) + self.tex_fName.text = self.family.name + self.tex_playerName.text = "亲友圈号:" .. self.family.id + self.tex_fNumber.text = self.family.member_num + self.tex_cradNum.text = self.family.diamo + self.tex_nocice.text = self.family.notice + ImageLoad.Load(self.family.o_portrait, self.loader_icon) - self.cStyle.selectedIndex = family.lev -1 + self.cStyle.selectedIndex = self.family.lev -1 + + -- index = 0 是显示隐藏按钮 + self.showNumber = self.family.isShow + print("self.family.isShow",self.family.isShow) + pt(self.family) + if self.showNumber == 0 then + self.cDisplayNumber.selectedIndex = 1 + self.tex_fNumber.text = "*" + elseif self.showNumber == 1 then + self.cDisplayNumber.selectedIndex = 0 + end end function FamilyMyFamily:Init() @@ -57,6 +69,7 @@ function FamilyMyFamily:Init() self._full = true self._animation = false self._full_offset = false + self._anim_pop = 0 BaseWindow.init(self, 'ui://Family/com_myFamily') -- 隐藏背景图 self._root_view:GetChild("win_mode").visible = false @@ -84,11 +97,14 @@ function FamilyMyFamily:Init() self.btn_quitNotice = self._view:GetChild("btn_quitNotice") self.btn_bgNotice = self._view:GetChild("btn_bgNotice") self.btn_confirmNotice = self._view:GetChild("btn_confirmNotice") + self.btn_hideNumber = self._view:GetChild("btn_hideNumber") + self.btn_showNumber = self._view:GetChild("btn_showNumber") self.input_notice = self._view:GetChild("input_notice") self.cStyle = self._view:GetController("cStyle") self.cWindow = self._view:GetController("cWindow") + self.cDisplayNumber = self._view:GetController("cDisplayNumber") self.btn_playSet.onClick:Set(function() self:Close() @@ -105,10 +121,14 @@ function FamilyMyFamily:Init() root:ShowShop() end) + self.btn_czRecord.onClick:Set(function() + local view = FamilyRoomCardRecord.New() + view:Show() + end) + self.btn_checkNumber.onClick:Set(function() self:Close() - local family = DataManager.groups.groupMap[self.groupId] - root:OpenAllNumber(family) + root:OpenAllNumber(self.family) end) self.btn_applyMsg.onClick:Set(function() @@ -118,8 +138,8 @@ function FamilyMyFamily:Init() self.btn_quitFamily.onClick:Set(function() local fgCtr = ControllerManager.GetController(NewGroupController) - print("发送了退出协议 familyid = ",root._group.id) - fgCtr:FG_ExitGroup(root._group.id, function(res) + print("发送了退出协议 familyid = ",self.family.id) + fgCtr:FG_ExitGroup(self.family.id, function(res) pt(res) end) end) @@ -137,26 +157,25 @@ function FamilyMyFamily:Init() end) self.btn_confirmNotice.onClick:Set(function() - local family = root._group local fgCtr = ControllerManager.GetController(NewGroupController) fgCtr:FG_UpdateGroupInfo( - family.id, - family.name, + self.family.id, + self.family.name, self.input_notice.text, - not family.ban, - family.dissolve_opt, - family.kick_opt, - family.apply, - family.ban_chat1, - family.ban_chat2, - family.option, + not self.family.ban, + self.family.dissolve_opt, + self.family.kick_opt, + self.family.apply, + self.family.ban_chat1, + self.family.ban_chat2, + self.family.option, 0, function(res) if res.ReturnCode ~= 0 then ViewUtil.ErrorTip(res.ReturnCode, "更改公告失败,请稍后再试") else ViewUtil.ErrorTip(res.ReturnCode, "修改成功!") - family.notice = self.input_notice.text + self.family.notice = self.input_notice.text self:Refalsh() self.cWindow.selectedIndex = 0 end @@ -164,6 +183,55 @@ function FamilyMyFamily:Init() ) end) + self.btn_hideNumber.onClick:Set(function() + + if self.isShowContenting == true then + ViewUtil.ShowBannerOnScreenCenter("设置中,请稍后再试。。") + return + end + + print("点击了") + + local fgCtr = ControllerManager.GetController(NewGroupController) + self.isShowContenting = true + fgCtr:FG_SetGroupShow(0, self.family.id, function (res) + print("收到协议M:FG_SetGroupShow") + pt(res) + self.isShowContenting = false + if res.ReturnCode ~= 0 then + ViewUtil.ShowBannerOnScreenCenter("设置失败,请稍后再试。。") + return + end + self.family.isShow = 0 + self:Refalsh() + ViewUtil.ShowBannerOnScreenCenter("设置成功") + end) + end) + + self.btn_showNumber.onClick:Set(function() + if self.isShowContenting == true then + ViewUtil.ShowBannerOnScreenCenter("设置中,请稍后再试。。") + return + end + + print("点击了") + + local fgCtr = ControllerManager.GetController(NewGroupController) + self.isShowContenting = true + fgCtr:FG_SetGroupShow(1, self.family.id, function (res) + print("收到协议M:FG_SetGroupShow") + pt(res) + self.isShowContenting = false + if res.ReturnCode ~= 0 then + ViewUtil.ShowBannerOnScreenCenter("设置失败,请稍后再试。。") + return + end + self.family.isShow = 1 + self:Refalsh() + ViewUtil.ShowBannerOnScreenCenter("设置成功") + end) + end) + return self end diff --git a/lua_probject/base_project/Game/View/Family/FamilyMyfamilyList.lua b/lua_probject/base_project/Game/View/Family/FamilyMyfamilyList.lua index c35b6948..54232cfe 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyMyfamilyList.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyMyfamilyList.lua @@ -26,6 +26,8 @@ function FamilyMyfamilyList.New(root) Instance._full = true Instance._close_destroy = true Instance._full_offset = false + Instance._anim_pop = 0 + Instance._animation = false BaseWindow.init(Instance, "ui://Family/com_myFamilyList") -- 隐藏背景图 diff --git a/lua_probject/base_project/Game/View/Family/FamilyNumberDetail.lua b/lua_probject/base_project/Game/View/Family/FamilyNumberDetail.lua index 7314e812..d394ba40 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyNumberDetail.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyNumberDetail.lua @@ -19,11 +19,15 @@ function M:init(url, lev, res) local fgCtr = ControllerManager.GetController(NewGroupController) BaseWindow.init(self, url) + print("res.Data.members[1]") + pt(res.Data.members[1]) local info = res.Data.members[1] local flag_assistant = info.lev == 2 and 1 or 0 local flag_band = info.ban local MJScore = info.mj_score local PKScore = info.pk_score + local remark = info.tag + local icon_url = info.portrait self._view:GetChild('name').text = string.format("%s(%s)", info.nick, info.uid) self._view:GetChild('text_allRounds').text = info.total_round @@ -31,6 +35,14 @@ function M:init(url, lev, res) self._view:GetChild('text_score_majiang').text = MJScore self._view:GetChild('text_score_poker').text = PKScore + ImageLoad.Load(icon_url, self._view:GetChild('btn_head'):GetChild('icon')) + + if remark == "" then + self._view:GetChild("tex_remark").text = "备注:无" + else + self._view:GetChild("tex_remark").text = remark + end + self._view:GetController('isAssistant').selectedIndex = info.lev == 1 and 0 or (lev == 2 and 1 or 2) self._view:GetChild('btn_changeTag').onClick:Set(function() diff --git a/lua_probject/base_project/Game/View/Family/FamilyNumberRecord.lua b/lua_probject/base_project/Game/View/Family/FamilyNumberRecord.lua index 060a3ee7..c04b9266 100644 --- a/lua_probject/base_project/Game/View/Family/FamilyNumberRecord.lua +++ b/lua_probject/base_project/Game/View/Family/FamilyNumberRecord.lua @@ -30,6 +30,7 @@ function FamilyNumberRecord.New(root) local text_score_poker = self._view:GetChild('text_score_poker') local text_score_majiang = self._view:GetChild('text_score_majiang') local box_type = self._view:GetChild('combBox_type') + local box_mumberTime = self._view:GetChild('box_mumberTime') local ctr_day = self._view:GetController('day') local ctr_sort = self._view:GetController('sort') local ctr_limitDay = self._view:GetController('limitDay') @@ -39,6 +40,8 @@ function FamilyNumberRecord.New(root) self._viewList_numberRankUnRead = self._view:GetChild('comp_numberRecordByGameType'):GetChild('n3') self._viewList_numverRecord = self._view:GetChild('list_numverRecord') self._viewlist_numberRecordDetail = self._view:GetChild('list_numberRecordDetail') + self._viewList_players = self._view:GetChild('list_players') + self._viewList_recordDetail = self._view:GetChild('list_record_detail') self._viewText_titleRecord = self._view:GetChild('text_titleRecord') self.ctr_numberRecord = self._view:GetController('page') @@ -48,6 +51,7 @@ function FamilyNumberRecord.New(root) box_type.items, box_type.values = self:InitBoxType() + box_mumberTime.items, box_mumberTime.values = self:InitBoxTime() text_score_majiang.text = 0 - MJScore text_score_poker.text = 0 - PKScore self._viewText_titleRecord.text = string.format("%s 成员记录", self._text_groupTitle) @@ -59,6 +63,11 @@ function FamilyNumberRecord.New(root) self:NumverRankRenderer(group_id) self:NumberRecordDetailRender() + box_mumberTime.onChanged:Set(function() + self._data_leftTime = tonumber(box_mumberTime.value) + self._data_rightTime = tonumber(box_mumberTime.value) + 86399 + self:OnClickNumberRank(group_id, self.rankNumber.uid, 0) + end) ctr_day.onChanged:Set(function(context) local timeTable = os.date("*t", os.time()) timeTable.hour = 0 @@ -70,7 +79,7 @@ function FamilyNumberRecord.New(root) self:OnClickSortType() end) - ctr_sort.onChanged:Set(function() + ctr_sort.onChanged:Set(function(context) local index = context.sender.selectedIndex self._data_sortType = index self:OnClickSortType() @@ -201,6 +210,19 @@ function M:InitBoxType() return items, values end +function M:InitBoxTime() + local items = { "今天", "昨天" } + local values = {} + local timeTable = os.date("*t", os.time()) + timeTable.hour = 0 + timeTable.min = 0 + timeTable.sec = 0 + for i = 0, 1 do + table.insert(values, tostring(os.time(timeTable) - 86400 * i)) + end + return items, values +end + function M:InitTimeAndSord() local timeTable = os.date("*t", os.time()) timeTable.hour = 0 @@ -259,7 +281,17 @@ function M:NumberRecordDetailRender() obj:GetChild('text_roomID').text = info.room_id obj:GetChild('text_userDiamond').text = 0 obj:GetChild('btn_lookRecord').onClick:Set(function() - print("lingmeng查看") + self._viewList_recordDetail:RemoveChildrenToPool() + for i = 1, tonumber(info.round) do + local obj = self._viewList_recordDetail:AddItemFromPool() + self:RecordItemDetailRender(i, info, info[string.format("round_%d", i)], obj) + end + self._viewList_players:RemoveChildrenToPool() + for j = 1, #info.totalScore do + local obj = self._viewList_players:AddItemFromPool() + self:RecordItemPlayersRender(json.decode(info.round_1), obj) + end + self.ctr_numberRecord.selectedIndex = 3 end) obj:GetController('seleted').onChanged:Set(function(context) pt(getmetatable(context.sender)) @@ -298,6 +330,71 @@ function M:NumberRecordDetailRender() end end +function M:RecordItemDetailRender(round, allDate, rdata, obj) + obj:GetChild('text_round').text = round + obj:GetChild('text_time').text = os.date("%Y-%m-%d\n%H:%M:%S", tonumber(allDate.createTime)) + local list = obj:GetChild('list_score') + rdata = json.decode(rdata) + list:RemoveChildrenToPool(); + for i = 1, #rdata do + local obj2 = list:AddItemFromPool() + obj2:GetChild('title').text = rdata[i].score + end + + local btn_play = obj:GetChild("n10") + btn_play.onClick:Set(function() + local group = DataManager.groups:get(self.group_id) + if DataManager.SelfUser.playback[allDate.military_id] ~= nil and DataManager.SelfUser.playback[allDate.military_id][round] ~= nil then + local room = ExtendManager.GetExtendConfig(allDate.game_info.game_id):NewRoom() + DataManager.CurrenRoom = room + room.lev = group.lev + room.game_id = allDate.game_info.game_id + local extend = ExtendManager.GetExtendConfig(allDate.game_info.game_id) + extend:FillPlayBackData(DataManager.SelfUser.playback[allDate.military_id][round]) + if not room.self_player then + room.self_player = room:GetPlayerBySeat(1) + end + local main = self:GenaratePlayBack(ViewManager.View_PlayBack, allDate.game_info.game_id) + main._currentId = allDate.military_id + main._currentRound = round + main._totalRound = tonumber(rdata.round) + main:FillRoomData(DataManager.SelfUser.playback[allDate.military_id][round]) + else + ViewUtil.ShowModalWait(self._view) + local _data = {} + _data["military_id"] = allDate.military_id + _data["round"] = tostring(round) + local loddyCtr1 = ControllerManager.GetController(LoddyController) + loddyCtr1:RequestPlayBack(_data, function(code, data) + ViewUtil.CloseModalWait() + if code == 0 then + if DataManager.SelfUser.playback[allDate.military_id] ~= nil then + DataManager.SelfUser.playback[allDate.military_id][round] = data + else + local playback_data = {} + playback_data[round] = data + DataManager.SelfUser.playback[allDate.military_id] = playback_data + end + + local main = self:GenaratePlayBack(ViewManager.View_PlayBack, allDate.game_info.game_id) + main._currentId = allDate.military_id + main._currentRound = round + main._totalRound = tonumber(allDate.round) + main:FillRoomData(data) + main._room.lev = group.lev + elseif code == 25 then + ViewUtil.ErrorTip(-1, "回放未找到!") + -- btn_play_back.grayed = true + end + end, allDate.game_info) + end + end) +end + +function M:RecordItemPlayersRender(data, obj) + obj:GetChild('n2').text = data.nick +end + function M:NumverRankRenderer(groupId) local numberRecordList = self._viewList_numverRecord numberRecordList:SetVirtual() @@ -354,9 +451,13 @@ end function M:OnClickNumberRank(groupId, uid, round) print("lingmengOnClickNumberRank") local fgCtr = ControllerManager.GetController(NewGroupController) - local numberRankListRead = self._viewList_numberRankRead - local numberRankListUnRead = self._viewList_numberRankUnRead - fgCtr:FG_GetGroupRecordSpe(groupId, GetPlatform(), uid, 0, 0, round, self._data_leftTime, self._data_rightTime, 3, + self:ResetRecords() + self:RecursionGetNumberRecord(fgCtr, groupId, uid, 0) +end + +function M:RecursionGetNumberRecord(fgCtr, groupId, uid, index) + fgCtr:FG_GetGroupRecordSpe(groupId, GetPlatform(), uid, 0, index * 100, 100, self._data_leftTime, + self._data_rightTime, 0, function(res) pt(res) if res.ReturnCode ~= 0 then @@ -364,34 +465,33 @@ function M:OnClickNumberRank(groupId, uid, round) self.ctr_numberRecord.selectedIndex = 0 else local records = res.Data.records - self:ResetRecords() - for i = 1, #records do - local info = records[i] - local tempTableChild = self.records[info.game_info.gameType][tonumber(info.is_read) + 1] - info.totalScore = json.decode(info.totalScore) - local totalScore - for i = 1, 2 do - if info.totalScore[i].accId == uid then - totalScore = info.totalScore[i].score + if records and #records > 0 then + for i = 1, #records do + local info = records[i] + local tempTableChild = self.records[info.game_info.gameType][tonumber(info.is_read) + 1] + info.totalScore = json.decode(info.totalScore) + local totalScore + for i = 1, #info.totalScore do + if info.totalScore[i].accId == uid then + totalScore = info.totalScore[i].score + end + end + if info.round ~= "1" or totalScore ~= 0 then + table.insert(tempTableChild, info) + tempTableChild.totalScore = tempTableChild.totalScore + totalScore + tempTableChild.childNum = tempTableChild.childNum + 1 + tempTableChild.winNum = tempTableChild.winNum + (totalScore > 0 and 1 or 0) end end - if info.round ~= "1" or totalScore ~= 0 then - table.insert(tempTableChild, info) - tempTableChild.totalScore = tempTableChild.totalScore + totalScore - tempTableChild.childNum = tempTableChild.childNum + 1 - tempTableChild.winNum = tempTableChild.winNum + (totalScore > 0 and 1 or 0) - end + self:RecursionGetNumberRecord(fgCtr, groupId, uid, index + 1) + else + self._viewList_numberRankRead:RefreshVirtualList() + self._viewList_numberRankUnRead:RefreshVirtualList() end - numberRankListRead:RefreshVirtualList() - numberRankListUnRead:RefreshVirtualList() end end) end -function M:RecursionGetNumberRecord() - -end - function M:ResetRecords() self.records = {} for i = 1, 2 do @@ -399,4 +499,21 @@ function M:ResetRecords() end end +function M:GenaratePlayBack(id, game_id, ...) + local tem = nil + local dview_class = nil + if not dview_class then + local exconfig = ExtendManager.GetExtendConfig(game_id) + dview_class = exconfig:GetView(id) + end + if not dview_class then + return + end + local arg = { ... } + tem = dview_class.new(...) + tem.Id = id + tem:Show() + return tem +end + return M diff --git a/lua_probject/base_project/Game/View/Family/FamilyRoomCardRecord.lua b/lua_probject/base_project/Game/View/Family/FamilyRoomCardRecord.lua new file mode 100644 index 00000000..0645866c --- /dev/null +++ b/lua_probject/base_project/Game/View/Family/FamilyRoomCardRecord.lua @@ -0,0 +1,30 @@ +local FamilyRoomCardRecord = {} + +function FamilyRoomCardRecord.New() + + --[[ 由于层级原因暂时不独立new界面了 + setmetatable(FamilyRoomCardRecord, { __index = BaseWindow }) + local inst = setmetatable({}, { __index = FamilyRoomCardRecord }) + + inst._full_offset = false + inst._full = true + inst._animation = false + BaseWindow.init(inst, "ui://Family/com_familyRoomCardRecord") + inst:Init() + + return inst + ]] +end + +function FamilyRoomCardRecord:Init(root) + local _view = root + self.btn_close = _view:GetChild("btn_close") + self.box_time = _view:GetChild("box_time") + self.list_record = _view:GetChild("list_record") +end + +function FamilyRoomCardRecord:Show() + --BaseWindow.Show(self) +end + +return FamilyRoomCardRecord \ No newline at end of file diff --git a/lua_probject/base_project/Game/View/Family/FamilySelectNumber.lua b/lua_probject/base_project/Game/View/Family/FamilySelectNumber.lua new file mode 100644 index 00000000..b4bf6d4c --- /dev/null +++ b/lua_probject/base_project/Game/View/Family/FamilySelectNumber.lua @@ -0,0 +1,57 @@ +local FamilySelectNumber = {} + +function FamilySelectNumber.New() + setmetatable(FamilySelectNumber, { __index = BaseWindow}) + local inst = setmetatable({}, { __index = FamilySelectNumber}) + inst._full = true + inst._close_destroy = true + inst._full_offset = false + inst._anim_pop = 0 + inst._animation = false + + BaseWindow.init(inst, "ui://Family/com_SelectNumber") + + inst:Init() + + return inst +end + +function FamilySelectNumber:Show(groupId, callback) + self.group = DataManager.groups.groupMap[groupId] + self.callback = callback + self.list_number.numItems = #self.group.members + BaseWindow.Show(self) +end + +function FamilySelectNumber:Init() + self.list_number = self._view:GetChild("list_number") + self.btn_search = self._view:GetChild("btn_search") + self.btn_close = self._view:GetChild("btn_close") + + self.btn_search.onClick:Set(function() + + end) + + self.btn_close.onClick:Set(function() + self:Close() + end) + + self.list_number.itemRenderer = function(index, obj) + local i = index + 1 + local player = self.group.members[i] + obj:GetController('lev').selectedIndex = player.lev - 1 + obj:GetController('ban').selectedIndex = player.ban + obj:GetChild('name').text = player.nick + obj:GetChild('id').text = string.format("ID:%s", player.uid) + obj.onClick:Set(function() + if self.callback then + self.callback(player) + end + self.callback = nil + self:Close() + end) + end + +end + +return FamilySelectNumber \ No newline at end of file diff --git a/lua_probject/base_project/Game/View/FamilyView.lua b/lua_probject/base_project/Game/View/FamilyView.lua index c752f8e8..e6e474c8 100644 --- a/lua_probject/base_project/Game/View/FamilyView.lua +++ b/lua_probject/base_project/Game/View/FamilyView.lua @@ -15,6 +15,7 @@ local FamilyBanDesk = import(".Family.FamilyBanDesk") local FamilyMyFamily = import(".Family.FamilyMyFamily") local FamilyRoomCard = import(".Family.FamilyRoomCard") local FamilyMyfamilyList = import(".Family.FamilyMyfamilyList") +local FamilyChatRoom = import(".Family.FamilyChatRoom") --- FamilyView = {} @@ -37,6 +38,9 @@ function M:init(url) BaseView.InitView(self, url) self._full_offset = false local view = self._view + + FamilyChatRoom = FamilyChatRoom:Init(view:GetChild('com_chatRoom'), self) + local fgCtr = ControllerManager.GetController(NewGroupController) self.familyType = view:GetController('familyType') @@ -47,6 +51,7 @@ function M:init(url) self._mgr_ctr = ControllerManager.GetController(GroupMgrController) self.cMyfamilyList = view:GetController("cMyfamilyList") self.btn_quitMyfamilyTab = view:GetChild("btn_quitMyfamilyTab") + self.btn_chatRoom = view:GetChild("btn_chatRoom") self:InitCloseClick() @@ -93,6 +98,12 @@ function M:init(url) self.btn_quitMyfamilyTab.onClick:Set(function() self.cMyfamilyList.selectedIndex = 0 end) + + self.btn_chatRoom.onClick:Set(function() + --local view = FamilyChatRoom.New() + --view:Show() + FamilyChatRoom:Show() + end) end function M:InitCloseClick() diff --git a/lua_probject/base_project/Game/View/MainView.lua b/lua_probject/base_project/Game/View/MainView.lua index 80dff40c..e59a1740 100644 --- a/lua_probject/base_project/Game/View/MainView.lua +++ b/lua_probject/base_project/Game/View/MainView.lua @@ -816,6 +816,7 @@ function M:EventInit() local arg = { ... } local witnessPlayerList = arg[1] _room.witness_player_list = witnessPlayerList + _room._flag_updateWitness = true end ) @@ -826,12 +827,13 @@ function M:EventInit() local arg = { ... } local player = arg[1] local witnessPlayerList = _room.witness_player_list - -- for i, _player in ipairs(witnessPlayerList) do - -- if _player.uid == player then - -- table.remove(witnessPlayerList, i) - -- return - -- end - -- end + for i, _player in ipairs(witnessPlayerList) do + if _player.uid == player then + table.remove(witnessPlayerList, i) + return + end + end + _room._flag_updateWitness = true end ) end @@ -1132,9 +1134,11 @@ function M:OnUpdate() if (self._popEvent) then local func = self._gamectr:PopEvent() if (func ~= nil) then - if pcall(func) then + local result, resultInfo = pcall(func) + if result then else + error(resultInfo) self._gamectr = ControllerManager.GetController(GameController) if self._gamectr then self._gamectr:ResetConnect() diff --git a/lua_probject/base_project/Game/View/NewGroup/GroupSetTagView.lua b/lua_probject/base_project/Game/View/NewGroup/GroupSetTagView.lua index f06080b1..25fdd4c9 100644 --- a/lua_probject/base_project/Game/View/NewGroup/GroupSetTagView.lua +++ b/lua_probject/base_project/Game/View/NewGroup/GroupSetTagView.lua @@ -42,7 +42,7 @@ function M:init(url, member) ViewUtil.ShowBannerOnScreenCenter("备注成功") --member.score = score self:Destroy() - self.callback(true) + --self.callback(true) end end) end) diff --git a/lua_probject/base_project/Game/View/NewGroup/MngView/GroupGameSettingView.lua b/lua_probject/base_project/Game/View/NewGroup/MngView/GroupGameSettingView.lua index b0f5e3e6..e2b16c88 100644 --- a/lua_probject/base_project/Game/View/NewGroup/MngView/GroupGameSettingView.lua +++ b/lua_probject/base_project/Game/View/NewGroup/MngView/GroupGameSettingView.lua @@ -41,8 +41,7 @@ function M:init(url) self._view:GetChild("btn_next").onClick:Set(function() if self._view:GetChild("tex_name").text == "" then - ViewUtil.ErrorTip(nil, "输入玩法名才能进入下一步") - return + self._view:GetChild("tex_name").text = " " end local game_data = self.gl_view:GetModeData().data.game_data diff --git a/lua_probject/base_project/Game/View/NewGroup/MngView/GroupGameSettingView_jaingxi.lua b/lua_probject/base_project/Game/View/NewGroup/MngView/GroupGameSettingView_jaingxi.lua index 1a8536fe..4dec6f64 100644 --- a/lua_probject/base_project/Game/View/NewGroup/MngView/GroupGameSettingView_jaingxi.lua +++ b/lua_probject/base_project/Game/View/NewGroup/MngView/GroupGameSettingView_jaingxi.lua @@ -41,8 +41,9 @@ function M:init(url) self._view:GetChild("btn_next").onClick:Set(function() if self._view:GetChild("tex_name").text == "" then - ViewUtil.ErrorTip(nil, "输入玩法名才能进入下一步") - return + self._view:GetChild("tex_name").text = " " + -- ViewUtil.ErrorTip(nil, "输入玩法名才能进入下一步") + -- return end local game_data = self.gl_view:GetModeData().data.game_data diff --git a/lua_probject/base_project/Game/View/PlayBackView.lua b/lua_probject/base_project/Game/View/PlayBackView.lua index 3efa8e0d..1f7b88bb 100644 --- a/lua_probject/base_project/Game/View/PlayBackView.lua +++ b/lua_probject/base_project/Game/View/PlayBackView.lua @@ -65,7 +65,12 @@ function M:InitView(url) local _player_info = self._player_info for i = 1, _room.room_config.people_num do - local tem = _view:GetChild(string.format("player_info%d_%d", i, 2)) + local tem + if _room.room_config.config.game_id == 66 then + tem = _view:GetChild(string.format("player_info%d", i)) + else + tem = _view:GetChild(string.format("player_info%d_%d", i, 2)) + end _player_info[i] = PlayerInfoView.new(tem, self) tem.visible = false end diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua index 271282a1..3a8a81db 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXMainView.lua @@ -40,7 +40,7 @@ function M:InitView(url) -- end local use_custom_bg = true MJMainView.InitView(self, string.format("ui://Main_Majiang/Main_new_%d_jiangxi", room.room_config.people_num), - use_custom_bg) + use_custom_bg, bg_config) if use_custom_bg then TableBG.LoadTableBG(1, self._room.game_id, self._root_view, bg_config) end diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua index 45a0e4cb..f0a0c1e5 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXPlayBackView.lua @@ -55,14 +55,14 @@ function M:FillRoomData(data) roominfo_panel:GetChild("tex_roomid").text = room.room_id roominfo_panel:GetChild("tex_gametype").text = room.room_config:GetGameName() - for i = 1, #room.player_list do - local p = room.player_list[i] - local card_info = _player_card_info[self:GetPos(p.seat)] - card_info:Clear() - table.sort(p.card_list, self.HandCardSortAndJing) - card_info:UpdateHandCard(false, true) - self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 - end + for i = 1, #room.player_list do + local p = room.player_list[i] + local card_info = _player_card_info[self:GetPos(p.seat)] + -- card_info:Clear() + table.sort(p.card_list, self.HandCardSortAndJing) + card_info:UpdateHandCard(false, true) + self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 + end self:GenerateAllStepData(data) self:UpdateStep(1) @@ -110,8 +110,8 @@ function M:ShowStep(index) if step.cmd == Record_Event.Evt_Win then self._win_pic = UIPackage.CreateObjectFromURL("ui://Main_Majiang/胡") local info = self._player_card_info[self:GetPos(step.win)] - info._mask_liangpai:AddChild(self._win_pic) - self._win_pic:Center() + info._view:AddChild(self._win_pic) + self._win_pic:Center() else if self._win_pic then self._win_pic:Dispose() @@ -286,8 +286,9 @@ function M:UpdateCardBox(seat) self._ctr_cardbox.selectedIndex = index end -function M:UpdateRound(round) - self._tex_round.text = "第 " .. round .. "/" .. self._room.room_config.round .. " 局" +function M:UpdateRound() + self._view:GetChild("text_round").text = string.format("当前局数:%d/%d", self._room.curren_round, + self._room.room_config.round) end function M:UpdateStep(step) diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/fuzhou/EXWitnessView.lua new file mode 100644 index 00000000..7a5ae173 --- /dev/null +++ b/lua_probject/extend_project/extend/majiang/fuzhou/EXWitnessView.lua @@ -0,0 +1,474 @@ +local EXRoomConfig = import(".EXRoomConfig") +local EXClearingView = import(".EXClearingView") +local TX_GameEvent = import(".GameEvent") +local PlayerInfoView = import(".EXPlayerInfoView") +local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView") +local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView") +local TableBG = require("Game.Data.TableBG") + + +local Record_Event = import(".RecordEvent") + +local bg_config = { + { id = 1, url = "base/main_majiang/bg/bg1", thumb = "ui://Main_Majiang/b01" }, + { id = 2, url = "base/main_majiang/bg/bg2", thumb = "ui://Main_Majiang/b02" }, + { id = 3, url = "base/main_majiang/bg/bg3", thumb = "ui://Main_Majiang/b03" } +} + +local M = {} + +--- Create a new +function M.new() + setmetatable(M, { __index = BaseView }) + local self = setmetatable({}, { __index = M }) + self.class = "EXMJWitness" + self:init() + + return self +end + +function M:init() + self._gamectr = ControllerManager.GetController(GameController) + self._room = DataManager.CurrenRoom + self._room.Witness = true + UIPackage.AddPackage('base/chat/ui/Chat') + UIPackage.AddPackage("base/main_majiang/ui/Main_Majiang") + self._eventmap = {} + -- self._full = true + self._put_map = false + self._new_hide = false + self._queue = false + self._style = 1 + self._popEvent = true + self:InitView() +end + +function M:InitView(url) + local room = self._room + UIPackage.AddPackage("extend/majiang/fuzhou/ui/Extend_MJ_FuZhou") + BaseView.InitView(self, string.format("ui://Main_Majiang/Main_new_%d_jiangxi", room.room_config.people_num)) + self:EventInit() + UpdateBeat:Add(self.OnUpdate, self) + + local centerBox = self._view:GetChild("Comp_ConterBox") + self._ctr_cardbox = centerBox:GetController("seat") + self._tex_leftTime = centerBox:GetChild("Text_Time") + self._tex_round = self._view:GetChild("tex_round") + self._tex_LeftCard = self._view:GetChild("remaining_card") + self._anchor = self._view:GetChild("mask_tips") + + ------------------渲染桌面信息-------------------------- + + local use_custom_bg = true + local default_bg = 1 + if use_custom_bg then + TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config) + end + + local config = ExtendManager.GetExtendConfig(room.game_id) + local mode = config:GetGameInfo() + local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config)) + + self._view:GetChild('text_time').text = os.date("%H:%M", os.time()) + self._view:GetChild('text_roomId').text = room.room_id + self._view:GetChild('wanfa_text').text = gamePlay + self._ctr_state = self._view:GetController("state") + + self._text_remined = self._view:GetChild('remaining_card') + self._text_round = self._view:GetChild('text_round') + self._cursor = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Ani_play_bj") + + self:UpdateRound() + self:InitPlayerInfoView() + self._player_card_info = {} + local _player_card_info = self._player_card_info + for i = 1, #room.player_list do + local p = room.player_list[i] + local index = self:GetPos(p.seat) + print("lingmeng index", index) + local info = self._player_info[index] + local tem = self._view:GetChild("player_card_info" .. index) + _player_card_info[index] = self:NewMJPlayerCardInfoView(tem, index) + local cardInfo = _player_card_info[index] + cardInfo:SetPlayer(p) + cardInfo:UpdateHandCardWitness(false) + cardInfo:UpdateOutCardList(nil, nil, self._cursor) + for i = 1, #p.fz_list do + cardInfo:UpdateFzList(p.fz_list[i], -1) + end + info:FillData(p) + info._view.visible = true + end + + -------------按钮初始化------------------------------ + local changeTable = self._view:GetChild('btn_change') + if changeTable then + changeTable.onClick:Set(function() + default_bg = default_bg + 1 > #bg_config and 1 or default_bg + 1 + TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config) + end) + end + + local btn_rule = self._view:GetChild('btn_rule') + if btn_rule ~= nil then + btn_rule.onClick:Set(function() + if self.RuleView == nil or self.RuleView._is_destroy then + self.RuleView = RoomInfoView.new(self._room) + end + self.RuleView:Show() + end) + end + + local btn_exit = self._view:GetChild('btn_exitWitness') + if btn_exit ~= nil then + btn_exit.onClick:Set(function() + self._gamectr:ExitWitnessGame() + ViewManager.ChangeView(ViewManager.View_Family) + end) + end + ------------------------------------------------------- + + self._ctr_state.selectedIndex = 4 +end + +function M:EventInit() + -- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong") + MainView.EventInit(self) + local _room = self._room + local _view = self._view + local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard") + local _player_info = self._player_info + local _gamectr = self._gamectr + + _gamectr:AddEventListener(GameEvent.PlayerEnter, function(...) + local arg = { ... } + print("lingmeng witness PlayerEnter") + end) + + _gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...) + local arg = { ... } + print("lingmeng witness SendLaiZi") + end) + + _gamectr:AddEventListener(TX_GameEvent.SendGangZi, function(...) + local arg = { ... } + print("lingmeng witness SendGangZi") + end) + + _gamectr:AddEventListener(TX_GameEvent.EventBuGang, function(...) + local arg = { ... } + print("lingmeng witness EventBuGang") + end) + + _gamectr:AddEventListener(TX_GameEvent.SendCards, function(...) + print("lingmeng witness SendCards") + -- self:ShowJing() + if self._clearingView then + self._clearingView:Destroy() + self._clearingView = nil + end + self:UpdateRound() + self._ctr_state.selectedIndex = 4 + local list = _room.player_list + for i = 1, #list do + local p = list[i] + local info = self._player_info[self:GetPos(p.seat)] + info:FillData(p) + info:MarkBank(p.seat == _room.banker_seat) + info:Ready(false) + local card_info = self._player_card_info[self:GetPos(p.seat)] + card_info:UpdateHandCardWitness() + end + end) + _gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...) + print("lingmeng witness EventTurn") + local arg = { ... } + self._left_time = 15 + local seat = arg[1] + self:UpdateCardBox(self:GetPos(seat)) + local playerInfo = self._player_info[self:GetPos(seat)] + local info = self._player_card_info[self:GetPos(seat)] + print("lingmeng hand_left_count", info._player.hand_left_count) + info._player.hand_left_count = info._player.hand_left_count + 1 + info:UpdateHandCardWitness(true) + end) + + _gamectr:AddEventListener(TX_GameEvent.OutHint, function(...) + print("lingmeng witness OutHint") + end) + + local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard" + _gamectr:AddEventListener(TX_GameEvent.OutCard, function(...) + print("lingmeng witness OutCard") + self._left_time = 0 + local arg = { ... } + local p = arg[1] + local card = arg[2] + local seat = p.seat + local info = self._player_card_info[self:GetPos(seat)] + print("lingmeng witness OutCard1", self:GetPos(seat), info) + + self:RemoveCursor() + print("lingmeng witness OutCard1-2") + + info:UpdateHandCardWitness(false) + print("lingmeng witness OutCard2") + + info:UpdateOutCardList(nil, nil, self._cursor) + print("ling 2zhihouq") + self:PlaySound("FuZhou_MJ", p.self_user.sex, tostring(card)) + self:PlayMJSound("chupai.mp3") + print("ling 2zhihou") + if seat == _room.self_player.seat then + _room.curren_outcard_seat = -1 + end + print("ling 2zhihou2") + end) + _gamectr:AddEventListener(TX_GameEvent.GetCard, function(...) + print("lingmeng witness GetCard") + end) + + _gamectr:AddEventListener(TX_GameEvent.FZTips, function(...) + print("lingmeng witness FZTips") + end) + + _gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction)) + + _gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...) + print("lingmeng witness ZPHuCard") + end) + + _gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...) + print("lingmeng witness EventNiao") + end) + + _gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...) + print("lingmeng witness ZPResult1") + self._popEvent = false + self._left_time = 0 + self:UpdateCardBox(0) + self._ctr_cardbox.selectedIndex = 0 + local arg = { ... } + local result = arg[1] + local liuju = result.liuju + local data = result.info_list + local niao = result.niao + -- if liuju then + -- local le = UIPackage.CreateObjectFromURL("ui://Main_Majiang/LiuJu") + -- self._view:AddChild(le) + -- le:Center() + -- le:GetTransition("t0"):Play() + -- coroutine.start(function() + -- coroutine.wait(1) + -- le:Dispose() + -- end) + -- end + self:RemoveCursor() + if self._clearingView == nil then + self._clearingView = EXClearingView.new(self._root_view) + coroutine.start(function() + coroutine.wait(0.5) + self._clearingView:Show() + self._popEvent = true + end) + end + print("lingmeng witness ZPResult2") + + if _room.curren_round ~= _room.room_config.round then + -- if #niao == 0 then self._view:GetChild("n13").visible = false end + for i = 1, #data do + local p = _room:GetPlayerBySeat(data[i].seat) + if p then + p.total_score = data[i].total_score + local card_info = self._player_card_info[self:GetPos(p.seat)] + local info = self._player_info[self:GetPos(p.seat)] + card_info:Clear() + card_info:ResetCardType() + if _room:checkHpNonnegative() then + p.cur_hp = data[i].hp_info.cur_hp + end + -- info:UpdateScore() + info._view:GetChild("zhanji").visible = true + local num = data[i].hp_info.total_hp + if num >= 0 then + info._view:GetController("text_color").selectedIndex = 0 + info._view:GetChild("text_jifen").text = "+" .. d2ad(num) + else + info._view:GetController("text_color").selectedIndex = 1 + info._view:GetChild("text_jifen").text = d2ad(num) + end + + info._view:GetChild("mask_piao").title = "" + info._view:GetController("piao_niao").selectedIndex = 0 + p.fz_list = {} + end + end + + self._clearingView:InitData(0, _room, result, nil, function(...) + DataManager.CurrenRoom.self_player.card_list = {} + self._ctr_state.selectedIndex = 2 + self._clearingView = nil + end, 1) + end + print("lingmeng witness ZPResult3") + + -- self._player_card_info[1]:ShowHuTip() + end) + + _gamectr:AddEventListener(TX_GameEvent.ZPResult2, function(...) + print("lingmeng witness ZPResult2") + -- self:UnmarkSelfTuoguan() + self._left_time = 0 + self:UpdateCardBox(0) + self._ctr_cardbox.selectedIndex = 0 + local arg = { ... } + local total_result = arg[2] + local result = arg[1] + local over = arg[3] + self._clearingView = EXClearingView.new() + coroutine.start(function() + coroutine.wait(0.5) + self._clearingView:Show() + end) + self._clearingView:InitData(over, _room, result, total_result) + ControllerManager.ChangeController(LoddyController) + end) + + _gamectr:AddEventListener(TX_GameEvent.EvnetPiaoTip, function() + print("lingmeng witness EvnetPiaoTip") + end) + + _gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...) + print("lingmeng witness EvnetPiao") + end) + + _gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...) + print("lingmeng witness EventResidueCard") + end) +end + +function M:InitPlayerInfoView() + self._player_info = {} + local _player_info = self._player_info + for i = 1, self._room.room_config.people_num do + local tem = self._view:GetChild(string.format("player_info%d_2", i)) + _player_info[i] = PlayerInfoView.new(tem, self) + tem.visible = false + end +end + +function M:NewMJPlayerCardInfoView(view, index) + if index == 1 then + return MJPlayerSelfCardInfoView.new(view, self) + end + return MJPlayerCardInfoView.new(view, self) +end + +function M:RemoveCursor() + self._cursor:RemoveFromParent() +end + +function M:UpdateCardBox(seat) + local index = seat - 1 + local people_num = self._room.room_config.people_num + if people_num == 2 and seat == 2 then + index = 2 + end + self._ctr_cardbox.selectedIndex = index +end + +function M:OnFangziAction(...) + print("lingmeng OnFangziAction") + -- self:__CloseTip() + print("lingmeng OnFangziAction1") + + local arg = { ... } + local _player_card_info = self._player_card_info + local fz = arg[1] + local player = arg[2] + local index = arg[3] + printlog("OnFangziAction") + local info = _player_card_info[self:GetPos(player.seat)] + -- local pNode = info._mask_liangpai + + self:RemoveCursor() + if (player.seat ~= fz.from_seat) then + local fs_info = _player_card_info[self:GetPos(fz.from_seat)] + fs_info:UpdateOutCardList() + end + print("lingmeng OnFangziAction5") + + info:UpdateFzList(fz, index, true) + local getcard = fz.type == FZType.Peng or fz.type == FZType.Chi + printlog(getcard) + + print("lingmeng hand_left_count", info._player.hand_left_count) + info._player.hand_left_count = info._player.hand_left_count - 1 + info:UpdateHandCardWitness(true) + -- self:__CloseTip() +end + +function M:UpdateRound() + self._view:GetChild("text_round").text = string.format("当前局数:%d/%d", self._room.curren_round, + self._room.room_config.round) +end + +function M:OnUpdate() + if (self._popEvent) then + local func = self._gamectr:PopEvent() + if (func ~= nil) then + local success, result = pcall(func) + if success then + + else + print("witness error") + print(result) + -- self._gamectr = ControllerManager.GetController(GameController) + -- if self._gamectr then + -- self._gamectr:ResetConnect() + -- end + end + --func() + end + end +end + +function M:ResetConnect() + +end + +function M:GetPos(seat) + return ViewUtil.GetPos(self._room.self_player.seat, seat, self._room.room_config.people_num) +end + +function M.HandCardSortAndJing(a, b) + local jing = DataManager.CurrenRoom.jing + if a == jing or b == jing then + if a == b then + return a < b + end + return a == jing + else + if a < 200 then + a = a + 1000 + elseif a < 300 then + a = a + 3000 + elseif a < 400 then + a = a + 2000 + else + a = a + 4000 + end + if b < 200 then + b = b + 1000 + elseif b < 300 then + b = b + 3000 + elseif b < 400 then + b = b + 2000 + else + b = b + 4000 + end + return a < b + end +end + +return M diff --git a/lua_probject/extend_project/extend/majiang/fuzhou/ExtendConfig.lua b/lua_probject/extend_project/extend/majiang/fuzhou/ExtendConfig.lua index 0f1694cb..139594cf 100644 --- a/lua_probject/extend_project/extend/majiang/fuzhou/ExtendConfig.lua +++ b/lua_probject/extend_project/extend/majiang/fuzhou/ExtendConfig.lua @@ -5,6 +5,7 @@ local EXMainView = import(".EXMainView") local EXGameController = import(".EXGameController") local EXRoomConfig = import(".EXRoomConfig") local EXPlayBackView = import(".EXPlayBackView") +local EXWitnessView = import(".EXWitnessView") local MJRoom = require("main.majiang.MJRoom") local ExtendConfig = {} @@ -20,6 +21,7 @@ function ExtendConfig.new() self._viewMap = {} self._viewMap[ViewManager.View_Main] = EXMainView self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView + self._viewMap[ViewManager.View_Witness] = EXWitnessView return self end @@ -69,10 +71,10 @@ function M:FillRoomData(s2croom) local _config = _tableInfo["config"] pt(_config) - room.room_config = EXRoomConfig.new(_config) - - local playerList = _tableInfo["playerData"] + room.room_config = EXRoomConfig.new(_config) + local playerList = _tableInfo["playerData"] room.curren_round = _tableInfo["round"] + self:FillPlayerData(playerList) if (reload) then @@ -106,6 +108,7 @@ function M:FillRoomData(s2croom) local fz = {} fz.type = op["type"] fz.card = op["card"] + fz.from_seat = op["from_seat"] p.fz_list[#p.fz_list + 1] = fz end if not playing and room.curren_round > 0 then @@ -170,4 +173,70 @@ function M:FillPlayBackData(pd_data) room.cmdList = pd_data["cmdList"] end +function M:FillWitnessData(pd_data) + print("==========================FillWitnessData1") + local room = DataManager.CurrenRoom + pt(room) + -- room.self_player = + local _tableInfo = pd_data["tableInfo"] + + local _config = _tableInfo["config"] + room.room_id = _tableInfo.roomid + room.room_config = EXRoomConfig.new(_config) + room.owner_id = _config["ownerid"] + local active_seat = _tableInfo["active_seat"] + local bank_seat = _tableInfo["banker_seat"] + room.left_count = _tableInfo["left_card"] + room.banker_seat = bank_seat + room.curren_turn_seat = active_seat + room.curren_round = _tableInfo["round"] + local _info_list = _tableInfo["playerData"] + for i = 1, #_info_list do + local _jp = _info_list[i] + local p = room:NewPlayer() + p.seat = _jp["seat"] + local online = _jp["online"] + p.line_state = online + p.ready = _jp["ready"] == 1 and true or false + local pid = _jp["aid"] + p.piao_niao = _jp["piao_niao"] + -- -- print(DataManager.SelfUser.account_id,pid) + -- if (278 == pid) then + -- room.self_player = p + -- p.self_user = DataManager.SelfUser + -- else + if p.seat == 1 then room.self_player = p end + local u = User.new() + u.account_id = pid + p.self_user = u + u.nick_name = _jp["nick"] + u.head_url = _jp["portrait"] + u.sex = _jp["sex"] + -- end + p.self_user.host_ip = p.self_user.host_ip + local _hand_card = {} + p.hand_left_count = _jp["card_count"] + p.card_list = _hand_card + --room.self_player.card_list = _hand_card + -- table.sort(_hand_card, self.HandCardSortAndJing) + p.total_score = _jp["score"] + p.outcard_list = _jp["outcard_list"] + local opcard = _jp["opcard"] + for k = 1, #opcard do + local op = opcard[k] + local fz = {} + fz.type = op["type"] + fz.card = op["card"] + fz.from_seat = op["from_seat"] + p.fz_list[#p.fz_list + 1] = fz + end + -- if _jp.hp_info then + -- room.room_config.isNonnegative = 1 + -- p.cur_hp = _jp.hp_info.cur_hp + -- end + + room:AddPlayer(p) + end +end + return M diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua index dff0564b..b42cd3de 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXMainView.lua @@ -40,10 +40,7 @@ function M:InitView(url) -- end local use_custom_bg = true MJMainView.InitView(self, string.format("ui://Main_Majiang/Main_new_%d_jiangxi", room.room_config.people_num), - use_custom_bg) - if use_custom_bg then - TableBG.LoadTableBG(1, self._room.game_id, self._root_view, bg_config) - end + use_custom_bg, bg_config) self._hu_tip = HuTipView.new(self) self.selectLaiziBtn = self._view:GetChild('selectlaizi') diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXPlayBackView.lua index 4eec94d0..1941bb38 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXPlayBackView.lua @@ -20,7 +20,7 @@ end function M:InitView(url) local room = self._room UIPackage.AddPackage("extend/majiang/jinxi/ui/Extend_MJ_JinXi") - MJPlayBackView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num) + MJPlayBackView.InitView(self, string.format("ui://Main_Majiang/Main_new_%d_jiangxi", room.room_config.people_num)) local _cardbox = self._view:GetChild("cardbox") --self._view:GetChild("panel_record"):GetChild("btn_LastStep").enabled = false self._ctr_cardbox = _cardbox:GetController("c1") @@ -55,14 +55,14 @@ function M:FillRoomData(data) roominfo_panel:GetChild("tex_roomid").text = room.room_id roominfo_panel:GetChild("tex_gametype").text = room.room_config:GetGameName() - for i = 1, #room.player_list do - local p = room.player_list[i] - local card_info = _player_card_info[self:GetPos(p.seat)] - card_info:Clear() - table.sort(p.card_list, self.HandCardSortAndJing) - card_info:UpdateHandCard(false, true) - self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 - end + for i = 1, #room.player_list do + local p = room.player_list[i] + local card_info = _player_card_info[self:GetPos(p.seat)] + -- card_info:Clear() + table.sort(p.card_list, self.HandCardSortAndJing) + card_info:UpdateHandCard(false, true) + self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 + end self:GenerateAllStepData(data) self:UpdateStep(1) @@ -110,7 +110,7 @@ function M:ShowStep(index) if step.cmd == Record_Event.Evt_Win then self._win_pic = UIPackage.CreateObjectFromURL("ui://Main_Majiang/胡") local info = self._player_card_info[self:GetPos(step.win)] - info._mask_liangpai:AddChild(self._win_pic) + info._view:AddChild(self._win_pic) self._win_pic:Center() else if self._win_pic then @@ -286,8 +286,9 @@ function M:UpdateCardBox(seat) self._ctr_cardbox.selectedIndex = index end -function M:UpdateRound(round) - self._tex_round.text = "第 " .. round .. "/" .. self._room.room_config.round .. " 局" +function M:UpdateRound() + self._view:GetChild("text_round").text = string.format("当前局数:%d/%d", self._room.curren_round, + self._room.room_config.round) end function M:UpdateStep(step) diff --git a/lua_probject/extend_project/extend/majiang/jinxi/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/jinxi/EXWitnessView.lua new file mode 100644 index 00000000..99d4716c --- /dev/null +++ b/lua_probject/extend_project/extend/majiang/jinxi/EXWitnessView.lua @@ -0,0 +1,474 @@ +local EXRoomConfig = import(".EXRoomConfig") +local EXClearingView = import(".EXClearingView") +local TX_GameEvent = import(".GameEvent") +local PlayerInfoView = import(".EXPlayerInfoView") +local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView") +local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView") +local TableBG = require("Game.Data.TableBG") + + +local Record_Event = import(".RecordEvent") + +local bg_config = { + { id = 1, url = "base/main_majiang/bg/bg1", thumb = "ui://Main_Majiang/b01" }, + { id = 2, url = "base/main_majiang/bg/bg2", thumb = "ui://Main_Majiang/b02" }, + { id = 3, url = "base/main_majiang/bg/bg3", thumb = "ui://Main_Majiang/b03" } +} + +local M = {} + +--- Create a new +function M.new() + setmetatable(M, { __index = BaseView }) + local self = setmetatable({}, { __index = M }) + self.class = "EXMJWitness" + self:init() + + return self +end + +function M:init() + self._gamectr = ControllerManager.GetController(GameController) + self._room = DataManager.CurrenRoom + self._room.Witness = true + UIPackage.AddPackage('base/chat/ui/Chat') + UIPackage.AddPackage("base/main_majiang/ui/Main_Majiang") + self._eventmap = {} + -- self._full = true + self._put_map = false + self._new_hide = false + self._queue = false + self._style = 1 + self._popEvent = true + self:InitView() +end + +function M:InitView(url) + local room = self._room + UIPackage.AddPackage("extend/majiang/jinxi/ui/Extend_MJ_JinXi") + BaseView.InitView(self, string.format("ui://Main_Majiang/Main_new_%d_jiangxi", room.room_config.people_num)) + self:EventInit() + UpdateBeat:Add(self.OnUpdate, self) + + local centerBox = self._view:GetChild("Comp_ConterBox") + self._ctr_cardbox = centerBox:GetController("seat") + self._tex_leftTime = centerBox:GetChild("Text_Time") + self._tex_round = self._view:GetChild("tex_round") + self._tex_LeftCard = self._view:GetChild("remaining_card") + self._anchor = self._view:GetChild("mask_tips") + + ------------------渲染桌面信息-------------------------- + + local use_custom_bg = true + local default_bg = 1 + if use_custom_bg then + TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config) + end + + local config = ExtendManager.GetExtendConfig(room.game_id) + local mode = config:GetGameInfo() + local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config)) + + self._view:GetChild('text_time').text = os.date("%H:%M", os.time()) + self._view:GetChild('text_roomId').text = room.room_id + self._view:GetChild('wanfa_text').text = gamePlay + self._ctr_state = self._view:GetController("state") + + self._text_remined = self._view:GetChild('remaining_card') + self._text_round = self._view:GetChild('text_round') + self._cursor = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Ani_play_bj") + + self:UpdateRound() + self:InitPlayerInfoView() + self._player_card_info = {} + local _player_card_info = self._player_card_info + for i = 1, #room.player_list do + local p = room.player_list[i] + local index = self:GetPos(p.seat) + print("lingmeng index", index) + local info = self._player_info[index] + local tem = self._view:GetChild("player_card_info" .. index) + _player_card_info[index] = self:NewMJPlayerCardInfoView(tem, index) + local cardInfo = _player_card_info[index] + cardInfo:SetPlayer(p) + cardInfo:UpdateHandCardWitness(false) + cardInfo:UpdateOutCardList(nil, nil, self._cursor) + for i = 1, #p.fz_list do + cardInfo:UpdateFzList(p.fz_list[i], -1) + end + info:FillData(p) + info._view.visible = true + end + + -------------按钮初始化------------------------------ + local changeTable = self._view:GetChild('btn_change') + if changeTable then + changeTable.onClick:Set(function() + default_bg = default_bg + 1 > #bg_config and 1 or default_bg + 1 + TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config) + end) + end + + local btn_rule = self._view:GetChild('btn_rule') + if btn_rule ~= nil then + btn_rule.onClick:Set(function() + if self.RuleView == nil or self.RuleView._is_destroy then + self.RuleView = RoomInfoView.new(self._room) + end + self.RuleView:Show() + end) + end + + local btn_exit = self._view:GetChild('btn_exitWitness') + if btn_exit ~= nil then + btn_exit.onClick:Set(function() + self._gamectr:ExitWitnessGame() + ViewManager.ChangeView(ViewManager.View_Family) + end) + end + ------------------------------------------------------- + + self._ctr_state.selectedIndex = 4 +end + +function M:EventInit() + -- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong") + MainView.EventInit(self) + local _room = self._room + local _view = self._view + local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard") + local _player_info = self._player_info + local _gamectr = self._gamectr + + _gamectr:AddEventListener(GameEvent.PlayerEnter, function(...) + local arg = { ... } + print("lingmeng witness PlayerEnter") + end) + + _gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...) + local arg = { ... } + print("lingmeng witness SendLaiZi") + end) + + _gamectr:AddEventListener(TX_GameEvent.SendGangZi, function(...) + local arg = { ... } + print("lingmeng witness SendGangZi") + end) + + _gamectr:AddEventListener(TX_GameEvent.EventBuGang, function(...) + local arg = { ... } + print("lingmeng witness EventBuGang") + end) + + _gamectr:AddEventListener(TX_GameEvent.SendCards, function(...) + print("lingmeng witness SendCards") + -- self:ShowJing() + if self._clearingView then + self._clearingView:Destroy() + self._clearingView = nil + end + self:UpdateRound() + self._ctr_state.selectedIndex = 4 + local list = _room.player_list + for i = 1, #list do + local p = list[i] + local info = self._player_info[self:GetPos(p.seat)] + info:FillData(p) + info:MarkBank(p.seat == _room.banker_seat) + info:Ready(false) + local card_info = self._player_card_info[self:GetPos(p.seat)] + card_info:UpdateHandCardWitness() + end + end) + _gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...) + print("lingmeng witness EventTurn") + local arg = { ... } + self._left_time = 15 + local seat = arg[1] + self:UpdateCardBox(self:GetPos(seat)) + local playerInfo = self._player_info[self:GetPos(seat)] + local info = self._player_card_info[self:GetPos(seat)] + print("lingmeng hand_left_count", info._player.hand_left_count) + info._player.hand_left_count = info._player.hand_left_count + 1 + info:UpdateHandCardWitness(true) + end) + + _gamectr:AddEventListener(TX_GameEvent.OutHint, function(...) + print("lingmeng witness OutHint") + end) + + local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard" + _gamectr:AddEventListener(TX_GameEvent.OutCard, function(...) + print("lingmeng witness OutCard") + self._left_time = 0 + local arg = { ... } + local p = arg[1] + local card = arg[2] + local seat = p.seat + local info = self._player_card_info[self:GetPos(seat)] + print("lingmeng witness OutCard1", self:GetPos(seat), info) + + self:RemoveCursor() + print("lingmeng witness OutCard1-2") + + info:UpdateHandCardWitness(false) + print("lingmeng witness OutCard2") + + info:UpdateOutCardList(nil, nil, self._cursor) + print("ling 2zhihouq") + self:PlaySound("JinXi_MJ", p.self_user.sex, tostring(card)) + self:PlayMJSound("chupai.mp3") + print("ling 2zhihou") + if seat == _room.self_player.seat then + _room.curren_outcard_seat = -1 + end + print("ling 2zhihou2") + end) + _gamectr:AddEventListener(TX_GameEvent.GetCard, function(...) + print("lingmeng witness GetCard") + end) + + _gamectr:AddEventListener(TX_GameEvent.FZTips, function(...) + print("lingmeng witness FZTips") + end) + + _gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction)) + + _gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...) + print("lingmeng witness ZPHuCard") + end) + + _gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...) + print("lingmeng witness EventNiao") + end) + + _gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...) + print("lingmeng witness ZPResult1") + self._popEvent = false + self._left_time = 0 + self:UpdateCardBox(0) + self._ctr_cardbox.selectedIndex = 0 + local arg = { ... } + local result = arg[1] + local liuju = result.liuju + local data = result.info_list + local niao = result.niao + -- if liuju then + -- local le = UIPackage.CreateObjectFromURL("ui://Main_Majiang/LiuJu") + -- self._view:AddChild(le) + -- le:Center() + -- le:GetTransition("t0"):Play() + -- coroutine.start(function() + -- coroutine.wait(1) + -- le:Dispose() + -- end) + -- end + self:RemoveCursor() + if self._clearingView == nil then + self._clearingView = EXClearingView.new(self._root_view) + coroutine.start(function() + coroutine.wait(0.5) + self._clearingView:Show() + self._popEvent = true + end) + end + print("lingmeng witness ZPResult2") + + if _room.curren_round ~= _room.room_config.round then + -- if #niao == 0 then self._view:GetChild("n13").visible = false end + for i = 1, #data do + local p = _room:GetPlayerBySeat(data[i].seat) + if p then + p.total_score = data[i].total_score + local card_info = self._player_card_info[self:GetPos(p.seat)] + local info = self._player_info[self:GetPos(p.seat)] + card_info:Clear() + card_info:ResetCardType() + if _room:checkHpNonnegative() then + p.cur_hp = data[i].hp_info.cur_hp + end + -- info:UpdateScore() + info._view:GetChild("zhanji").visible = true + local num = data[i].hp_info.total_hp + if num >= 0 then + info._view:GetController("text_color").selectedIndex = 0 + info._view:GetChild("text_jifen").text = "+" .. d2ad(num) + else + info._view:GetController("text_color").selectedIndex = 1 + info._view:GetChild("text_jifen").text = d2ad(num) + end + + info._view:GetChild("mask_piao").title = "" + info._view:GetController("piao_niao").selectedIndex = 0 + p.fz_list = {} + end + end + + self._clearingView:InitData(0, _room, result, nil, function(...) + DataManager.CurrenRoom.self_player.card_list = {} + self._ctr_state.selectedIndex = 2 + self._clearingView = nil + end, 1) + end + print("lingmeng witness ZPResult3") + + -- self._player_card_info[1]:ShowHuTip() + end) + + _gamectr:AddEventListener(TX_GameEvent.ZPResult2, function(...) + print("lingmeng witness ZPResult2") + -- self:UnmarkSelfTuoguan() + self._left_time = 0 + self:UpdateCardBox(0) + self._ctr_cardbox.selectedIndex = 0 + local arg = { ... } + local total_result = arg[2] + local result = arg[1] + local over = arg[3] + self._clearingView = EXClearingView.new() + coroutine.start(function() + coroutine.wait(0.5) + self._clearingView:Show() + end) + self._clearingView:InitData(over, _room, result, total_result) + ControllerManager.ChangeController(LoddyController) + end) + + _gamectr:AddEventListener(TX_GameEvent.EvnetPiaoTip, function() + print("lingmeng witness EvnetPiaoTip") + end) + + _gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...) + print("lingmeng witness EvnetPiao") + end) + + _gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...) + print("lingmeng witness EventResidueCard") + end) +end + +function M:InitPlayerInfoView() + self._player_info = {} + local _player_info = self._player_info + for i = 1, self._room.room_config.people_num do + local tem = self._view:GetChild(string.format("player_info%d_2", i)) + _player_info[i] = PlayerInfoView.new(tem, self) + tem.visible = false + end +end + +function M:NewMJPlayerCardInfoView(view, index) + if index == 1 then + return MJPlayerSelfCardInfoView.new(view, self) + end + return MJPlayerCardInfoView.new(view, self) +end + +function M:RemoveCursor() + self._cursor:RemoveFromParent() +end + +function M:UpdateCardBox(seat) + local index = seat - 1 + local people_num = self._room.room_config.people_num + if people_num == 2 and seat == 2 then + index = 2 + end + self._ctr_cardbox.selectedIndex = index +end + +function M:OnFangziAction(...) + print("lingmeng OnFangziAction") + -- self:__CloseTip() + print("lingmeng OnFangziAction1") + + local arg = { ... } + local _player_card_info = self._player_card_info + local fz = arg[1] + local player = arg[2] + local index = arg[3] + printlog("OnFangziAction") + local info = _player_card_info[self:GetPos(player.seat)] + -- local pNode = info._mask_liangpai + + self:RemoveCursor() + if (player.seat ~= fz.from_seat) then + local fs_info = _player_card_info[self:GetPos(fz.from_seat)] + fs_info:UpdateOutCardList() + end + print("lingmeng OnFangziAction5") + + info:UpdateFzList(fz, index, true) + local getcard = fz.type == FZType.Peng or fz.type == FZType.Chi + printlog(getcard) + + print("lingmeng hand_left_count", info._player.hand_left_count) + info._player.hand_left_count = info._player.hand_left_count - 1 + info:UpdateHandCardWitness(true) + -- self:__CloseTip() +end + +function M:UpdateRound() + self._view:GetChild("text_round").text = string.format("当前局数:%d/%d", self._room.curren_round, + self._room.room_config.round) +end + +function M:OnUpdate() + if (self._popEvent) then + local func = self._gamectr:PopEvent() + if (func ~= nil) then + local success, result = pcall(func) + if success then + + else + print("witness error") + print(result) + -- self._gamectr = ControllerManager.GetController(GameController) + -- if self._gamectr then + -- self._gamectr:ResetConnect() + -- end + end + --func() + end + end +end + +function M:ResetConnect() + +end + +function M:GetPos(seat) + return ViewUtil.GetPos(self._room.self_player.seat, seat, self._room.room_config.people_num) +end + +function M.HandCardSortAndJing(a, b) + local jing = DataManager.CurrenRoom.jing + if a == jing or b == jing then + if a == b then + return a < b + end + return a == jing + else + if a < 200 then + a = a + 1000 + elseif a < 300 then + a = a + 3000 + elseif a < 400 then + a = a + 2000 + else + a = a + 4000 + end + if b < 200 then + b = b + 1000 + elseif b < 300 then + b = b + 3000 + elseif b < 400 then + b = b + 2000 + else + b = b + 4000 + end + return a < b + end +end + +return M diff --git a/lua_probject/extend_project/extend/majiang/jinxi/ExtendConfig.lua b/lua_probject/extend_project/extend/majiang/jinxi/ExtendConfig.lua index 21f02a97..a5e421cd 100644 --- a/lua_probject/extend_project/extend/majiang/jinxi/ExtendConfig.lua +++ b/lua_probject/extend_project/extend/majiang/jinxi/ExtendConfig.lua @@ -5,6 +5,7 @@ local EXMainView = import(".EXMainView") local EXGameController = import(".EXGameController") local EXRoomConfig = import(".EXRoomConfig") local EXPlayBackView = import(".EXPlayBackView") +local EXWitnessView = import(".EXWitnessView") local MJRoom = require("main.majiang.MJRoom") local ExtendConfig = {} @@ -20,6 +21,7 @@ function ExtendConfig.new() self._viewMap = {} self._viewMap[ViewManager.View_Main] = EXMainView self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView + self._viewMap[ViewManager.View_Witness] = EXWitnessView return self end @@ -79,18 +81,22 @@ function M:FillRoomData(s2croom) local _reloadInfo = s2croom["reloadInfo"] local _hand_card = _reloadInfo["hand_card"] room.self_player.card_list = _hand_card - table.sort(_hand_card, ViewUtil.HandCardSort) + table.sort(_hand_card, self.HandCardSortAndJing) local active_seat = _reloadInfo["active_seat"] local bank_seat = _reloadInfo["banker_seat"] local playing = _reloadInfo["playing"] local _info_list = _reloadInfo["info_list"] local last_outcard_seat = _reloadInfo["last_outcard_seat"] + local jing = _reloadInfo["jing"] room.left_count = _reloadInfo["left_card"] room.banker_seat = bank_seat room.curren_outcard_seat = _reloadInfo["curren_outcard_seat"] room.last_outcard_seat = last_outcard_seat room.playing = playing + if jing then + room.jing = jing + end for i = 1, #_info_list do local tem = _info_list[i] local playerid = tem["playerid"] @@ -106,6 +112,7 @@ function M:FillRoomData(s2croom) local fz = {} fz.type = op["type"] fz.card = op["card"] + fz.from_seat = op["from_seat"] p.fz_list[#p.fz_list + 1] = fz end if not playing and room.curren_round > 0 then @@ -157,7 +164,7 @@ function M:FillPlayBackData(pd_data) local _hand_card = _jp["hand_card"] p.card_list = _hand_card --room.self_player.card_list = _hand_card - table.sort(_hand_card, ViewUtil.HandCardSort) + table.sort(_hand_card, self.HandCardSortAndJing) p.total_score = _jp["score"] p.hand_left_count = #_hand_card if _jp.hp_info then @@ -170,4 +177,100 @@ function M:FillPlayBackData(pd_data) room.cmdList = pd_data["cmdList"] end +function M:FillWitnessData(pd_data) + print("==========================FillWitnessData1") + local room = DataManager.CurrenRoom + pt(room) + -- room.self_player = + local _tableInfo = pd_data["tableInfo"] + + local _config = _tableInfo["config"] + room.room_id = _tableInfo.roomid + room.room_config = EXRoomConfig.new(_config) + room.owner_id = _config["ownerid"] + local active_seat = _tableInfo["active_seat"] + local bank_seat = _tableInfo["banker_seat"] + room.left_count = _tableInfo["left_card"] + room.banker_seat = bank_seat + room.curren_turn_seat = active_seat + room.curren_round = _tableInfo["round"] + local _info_list = _tableInfo["playerData"] + for i = 1, #_info_list do + local _jp = _info_list[i] + local p = room:NewPlayer() + p.seat = _jp["seat"] + local online = _jp["online"] + p.line_state = online + p.ready = _jp["ready"] == 1 and true or false + local pid = _jp["aid"] + p.piao_niao = _jp["piao_niao"] + -- -- print(DataManager.SelfUser.account_id,pid) + -- if (278 == pid) then + -- room.self_player = p + -- p.self_user = DataManager.SelfUser + -- else + if p.seat == 1 then room.self_player = p end + local u = User.new() + u.account_id = pid + p.self_user = u + u.nick_name = _jp["nick"] + u.head_url = _jp["portrait"] + u.sex = _jp["sex"] + -- end + p.self_user.host_ip = p.self_user.host_ip + local _hand_card = {} + p.hand_left_count = _jp["card_count"] + p.card_list = _hand_card + --room.self_player.card_list = _hand_card + -- table.sort(_hand_card, self.HandCardSortAndJing) + p.total_score = _jp["score"] + p.outcard_list = _jp["outcard_list"] + local opcard = _jp["opcard"] + for k = 1, #opcard do + local op = opcard[k] + local fz = {} + fz.type = op["type"] + fz.card = op["card"] + fz.from_seat = op["from_seat"] + p.fz_list[#p.fz_list + 1] = fz + end + -- if _jp.hp_info then + -- room.room_config.isNonnegative = 1 + -- p.cur_hp = _jp.hp_info.cur_hp + -- end + + room:AddPlayer(p) + end +end + +function M.HandCardSortAndJing(a, b) + local jing = DataManager.CurrenRoom.jing + if a == jing or b == jing then + if a == b then + return a < b + end + return a == jing + else + if a < 200 then + a = a + 1000 + elseif a < 300 then + a = a + 3000 + elseif a < 400 then + a = a + 2000 + else + a = a + 4000 + end + if b < 200 then + b = b + 1000 + elseif b < 300 then + b = b + 3000 + elseif b < 400 then + b = b + 2000 + else + b = b + 4000 + end + return a < b + end +end + return M diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXSettingView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXSettingView.lua index 05dc7a7e..8d905bbe 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXSettingView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXSettingView.lua @@ -5,11 +5,12 @@ local EXSettingView = {} local M = EXSettingView setmetatable(M, { __index = BaseWindow }) -function EXSettingView.new(main_view) +function EXSettingView.new(main_view, flag_witness) local self = setmetatable({}, { __index = M }) self.class = 'EXSettingView' self._close_destroy = true self._mainView = main_view + self._flag_witness = flag_witness self:init('ui://Main_Majiang/Setting') return self end @@ -48,11 +49,16 @@ function M:init(url) local _btn_logout = self._view:GetChild('btn_closeRoom') _btn_logout.onClick:Set(function() - if self._mainView.dismiss_room_cd_time > 0 then - ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!") + if self._flag_witness then + self._mainView._gamectr:ExitWitnessGame() + ViewManager.ChangeView(ViewManager.View_Family) else - local _gamectr = ControllerManager.GetController(GameController) - _gamectr:AskDismissRoom() + if self._mainView.dismiss_room_cd_time > 0 then + ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!") + else + local _gamectr = ControllerManager.GetController(GameController) + _gamectr:AskDismissRoom() + end end end) end diff --git a/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua index c3f8c62a..000b123d 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/EXWitnessView.lua @@ -4,6 +4,7 @@ local TX_GameEvent = import(".GameEvent") local PlayerInfoView = import(".EXPlayerInfoView") local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView") local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView") +local SettingView = import(".EXSettingView") local TableBG = require("Game.Data.TableBG") @@ -126,6 +127,33 @@ function M:InitView(url) ViewManager.ChangeView(ViewManager.View_Family) end) end + + local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players') + viewList_witness:SetVirtual() + viewList_witness.itemRenderer = function(index, obj) + obj:GetChild('title').text = room.witness_player_list[index + 1].nick + ImageLoad.Load(room.witness_player_list[index + 1].portrait, obj:GetChild('btn_head')._iconObject) + end + + local btn_witness = self._view:GetChild('btn_pangGuang') + if btn_witness then + btn_witness.onClick:Set(function() + if room._flag_updateWitness then + room._flag_updateWitness = false + if viewList_witness.numItems == #room.witness_player_list then + viewList_witness:RefreshVirtualList() + else + viewList_witness.numItems = #room.witness_player_list + end + end + self._view:GetController('witness').selectedIndex = 1 + end) + end + + self._view:GetChild('btn_setting').onClick:Add(handler(self, function() + local settingView = SettingView.new(self, 1) + settingView:Show() + end)) ------------------------------------------------------- self._ctr_state.selectedIndex = 4 @@ -216,8 +244,8 @@ function M:EventInit() info:UpdateOutCardList(nil, nil, self._cursor) print("ling 2zhihouq") - self:PlaySound("LiChuan_MJ", p.self_user.sex, tostring(card)) - self:PlayMJSound("chupai.mp3") + -- self:PlaySound("LiChuan_MJ", p.self_user.sex, tostring(card)) + -- self:PlayMJSound("chupai.mp3") print("ling 2zhihou") if seat == _room.self_player.seat then _room.curren_outcard_seat = -1 diff --git a/lua_probject/extend_project/extend/majiang/lichuan/ExtendConfig.lua b/lua_probject/extend_project/extend/majiang/lichuan/ExtendConfig.lua index c980a76c..90f548d8 100644 --- a/lua_probject/extend_project/extend/majiang/lichuan/ExtendConfig.lua +++ b/lua_probject/extend_project/extend/majiang/lichuan/ExtendConfig.lua @@ -77,6 +77,8 @@ function M:FillRoomData(s2croom) local playerList = _tableInfo["playerData"] room.curren_round = _tableInfo["round"] + room.witness_player_list = _tableInfo["playerSpectatorData"] + room._flag_updateWitness = true self:FillPlayerData(playerList) if (reload) then diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua index ff2752af..115c3171 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXMainView.lua @@ -40,7 +40,7 @@ function M:InitView(url) -- end local use_custom_bg = true MJMainView.InitView(self, string.format("ui://Main_Majiang/Main_new_%d_jiangxi", room.room_config.people_num), - use_custom_bg) + use_custom_bg, bg_config) if use_custom_bg then TableBG.LoadTableBG(1, self._room.game_id, self._root_view, bg_config) end diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXPlayBackView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXPlayBackView.lua index f9ca7cc8..4baac57c 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXPlayBackView.lua @@ -55,14 +55,14 @@ function M:FillRoomData(data) roominfo_panel:GetChild("tex_roomid").text = room.room_id roominfo_panel:GetChild("tex_gametype").text = room.room_config:GetGameName() - for i = 1, #room.player_list do - local p = room.player_list[i] - local card_info = _player_card_info[self:GetPos(p.seat)] - card_info:Clear() - table.sort(p.card_list, self.HandCardSortAndJing) - card_info:UpdateHandCard(false, true) - self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 - end + for i = 1, #room.player_list do + local p = room.player_list[i] + local card_info = _player_card_info[self:GetPos(p.seat)] + -- card_info:Clear() + table.sort(p.card_list, self.HandCardSortAndJing) + card_info:UpdateHandCard(false, true) + self._player_info[i]._view:GetController("piao_niao").selectedIndex = 0 + end self:GenerateAllStepData(data) self:UpdateStep(1) @@ -109,8 +109,8 @@ function M:ShowStep(index) end if step.cmd == Record_Event.Evt_Win then self._win_pic = UIPackage.CreateObjectFromURL("ui://Main_Majiang/胡") - local info = self._player_card_info[self:GetPos(step.win)] - info._mask_liangpai:AddChild(self._win_pic) + local info = self._player_card_info[self:GetPos(step.win)] + info._view:AddChild(self._win_pic) self._win_pic:Center() else if self._win_pic then @@ -286,8 +286,9 @@ function M:UpdateCardBox(seat) self._ctr_cardbox.selectedIndex = index end -function M:UpdateRound(round) - self._tex_round.text = "第 " .. round .. "/" .. self._room.room_config.round .. " 局" +function M:UpdateRound() + self._view:GetChild("text_round").text = string.format("当前局数:%d/%d", self._room.curren_round, + self._room.room_config.round) end function M:UpdateStep(step) diff --git a/lua_probject/extend_project/extend/majiang/nancheng/EXWitnessView.lua b/lua_probject/extend_project/extend/majiang/nancheng/EXWitnessView.lua new file mode 100644 index 00000000..592e6d69 --- /dev/null +++ b/lua_probject/extend_project/extend/majiang/nancheng/EXWitnessView.lua @@ -0,0 +1,474 @@ +local EXRoomConfig = import(".EXRoomConfig") +local EXClearingView = import(".EXClearingView") +local TX_GameEvent = import(".GameEvent") +local PlayerInfoView = import(".EXPlayerInfoView") +local MJPlayerSelfCardInfoView = import(".MJPlayerSelfCardInfoView") +local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView") +local TableBG = require("Game.Data.TableBG") + + +local Record_Event = import(".RecordEvent") + +local bg_config = { + { id = 1, url = "base/main_majiang/bg/bg1", thumb = "ui://Main_Majiang/b01" }, + { id = 2, url = "base/main_majiang/bg/bg2", thumb = "ui://Main_Majiang/b02" }, + { id = 3, url = "base/main_majiang/bg/bg3", thumb = "ui://Main_Majiang/b03" } +} + +local M = {} + +--- Create a new +function M.new() + setmetatable(M, { __index = BaseView }) + local self = setmetatable({}, { __index = M }) + self.class = "EXMJWitness" + self:init() + + return self +end + +function M:init() + self._gamectr = ControllerManager.GetController(GameController) + self._room = DataManager.CurrenRoom + self._room.Witness = true + UIPackage.AddPackage('base/chat/ui/Chat') + UIPackage.AddPackage("base/main_majiang/ui/Main_Majiang") + self._eventmap = {} + -- self._full = true + self._put_map = false + self._new_hide = false + self._queue = false + self._style = 1 + self._popEvent = true + self:InitView() +end + +function M:InitView(url) + local room = self._room + UIPackage.AddPackage("extend/majiang/nancheng/ui/Extend_MJ_NanCheng") + BaseView.InitView(self, string.format("ui://Main_Majiang/Main_new_%d_jiangxi", room.room_config.people_num)) + self:EventInit() + UpdateBeat:Add(self.OnUpdate, self) + + local centerBox = self._view:GetChild("Comp_ConterBox") + self._ctr_cardbox = centerBox:GetController("seat") + self._tex_leftTime = centerBox:GetChild("Text_Time") + self._tex_round = self._view:GetChild("tex_round") + self._tex_LeftCard = self._view:GetChild("remaining_card") + self._anchor = self._view:GetChild("mask_tips") + + ------------------渲染桌面信息-------------------------- + + local use_custom_bg = true + local default_bg = 1 + if use_custom_bg then + TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config) + end + + local config = ExtendManager.GetExtendConfig(room.game_id) + local mode = config:GetGameInfo() + local gamePlay = mode:LoadConfigToDetail(json.encode(room.room_config.config)) + + self._view:GetChild('text_time').text = os.date("%H:%M", os.time()) + self._view:GetChild('text_roomId').text = room.room_id + self._view:GetChild('wanfa_text').text = gamePlay + self._ctr_state = self._view:GetController("state") + + self._text_remined = self._view:GetChild('remaining_card') + self._text_round = self._view:GetChild('text_round') + self._cursor = UIPackage.CreateObjectFromURL("ui://Main_Majiang/Ani_play_bj") + + self:UpdateRound() + self:InitPlayerInfoView() + self._player_card_info = {} + local _player_card_info = self._player_card_info + for i = 1, #room.player_list do + local p = room.player_list[i] + local index = self:GetPos(p.seat) + print("lingmeng index", index) + local info = self._player_info[index] + local tem = self._view:GetChild("player_card_info" .. index) + _player_card_info[index] = self:NewMJPlayerCardInfoView(tem, index) + local cardInfo = _player_card_info[index] + cardInfo:SetPlayer(p) + cardInfo:UpdateHandCardWitness(false) + cardInfo:UpdateOutCardList(nil, nil, self._cursor) + for i = 1, #p.fz_list do + cardInfo:UpdateFzList(p.fz_list[i], -1) + end + info:FillData(p) + info._view.visible = true + end + + -------------按钮初始化------------------------------ + local changeTable = self._view:GetChild('btn_change') + if changeTable then + changeTable.onClick:Set(function() + default_bg = default_bg + 1 > #bg_config and 1 or default_bg + 1 + TableBG.LoadTableBG(default_bg, self._room.game_id, self._root_view, bg_config) + end) + end + + local btn_rule = self._view:GetChild('btn_rule') + if btn_rule ~= nil then + btn_rule.onClick:Set(function() + if self.RuleView == nil or self.RuleView._is_destroy then + self.RuleView = RoomInfoView.new(self._room) + end + self.RuleView:Show() + end) + end + + local btn_exit = self._view:GetChild('btn_exitWitness') + if btn_exit ~= nil then + btn_exit.onClick:Set(function() + self._gamectr:ExitWitnessGame() + ViewManager.ChangeView(ViewManager.View_Family) + end) + end + ------------------------------------------------------- + + self._ctr_state.selectedIndex = 4 +end + +function M:EventInit() + -- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong") + MainView.EventInit(self) + local _room = self._room + local _view = self._view + local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard") + local _player_info = self._player_info + local _gamectr = self._gamectr + + _gamectr:AddEventListener(GameEvent.PlayerEnter, function(...) + local arg = { ... } + print("lingmeng witness PlayerEnter") + end) + + _gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...) + local arg = { ... } + print("lingmeng witness SendLaiZi") + end) + + _gamectr:AddEventListener(TX_GameEvent.SendGangZi, function(...) + local arg = { ... } + print("lingmeng witness SendGangZi") + end) + + _gamectr:AddEventListener(TX_GameEvent.EventBuGang, function(...) + local arg = { ... } + print("lingmeng witness EventBuGang") + end) + + _gamectr:AddEventListener(TX_GameEvent.SendCards, function(...) + print("lingmeng witness SendCards") + -- self:ShowJing() + if self._clearingView then + self._clearingView:Destroy() + self._clearingView = nil + end + self:UpdateRound() + self._ctr_state.selectedIndex = 4 + local list = _room.player_list + for i = 1, #list do + local p = list[i] + local info = self._player_info[self:GetPos(p.seat)] + info:FillData(p) + info:MarkBank(p.seat == _room.banker_seat) + info:Ready(false) + local card_info = self._player_card_info[self:GetPos(p.seat)] + card_info:UpdateHandCardWitness() + end + end) + _gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...) + print("lingmeng witness EventTurn") + local arg = { ... } + self._left_time = 15 + local seat = arg[1] + self:UpdateCardBox(self:GetPos(seat)) + local playerInfo = self._player_info[self:GetPos(seat)] + local info = self._player_card_info[self:GetPos(seat)] + print("lingmeng hand_left_count", info._player.hand_left_count) + info._player.hand_left_count = info._player.hand_left_count + 1 + info:UpdateHandCardWitness(true) + end) + + _gamectr:AddEventListener(TX_GameEvent.OutHint, function(...) + print("lingmeng witness OutHint") + end) + + local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard" + _gamectr:AddEventListener(TX_GameEvent.OutCard, function(...) + print("lingmeng witness OutCard") + self._left_time = 0 + local arg = { ... } + local p = arg[1] + local card = arg[2] + local seat = p.seat + local info = self._player_card_info[self:GetPos(seat)] + print("lingmeng witness OutCard1", self:GetPos(seat), info) + + self:RemoveCursor() + print("lingmeng witness OutCard1-2") + + info:UpdateHandCardWitness(false) + print("lingmeng witness OutCard2") + + info:UpdateOutCardList(nil, nil, self._cursor) + print("ling 2zhihouq") + self:PlaySound("NanCheng_MJ", p.self_user.sex, tostring(card)) + self:PlayMJSound("chupai.mp3") + print("ling 2zhihou") + if seat == _room.self_player.seat then + _room.curren_outcard_seat = -1 + end + print("ling 2zhihou2") + end) + _gamectr:AddEventListener(TX_GameEvent.GetCard, function(...) + print("lingmeng witness GetCard") + end) + + _gamectr:AddEventListener(TX_GameEvent.FZTips, function(...) + print("lingmeng witness FZTips") + end) + + _gamectr:AddEventListener(TX_GameEvent.FangziAction, handler(self, self.OnFangziAction)) + + _gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...) + print("lingmeng witness ZPHuCard") + end) + + _gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...) + print("lingmeng witness EventNiao") + end) + + _gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...) + print("lingmeng witness ZPResult1") + self._popEvent = false + self._left_time = 0 + self:UpdateCardBox(0) + self._ctr_cardbox.selectedIndex = 0 + local arg = { ... } + local result = arg[1] + local liuju = result.liuju + local data = result.info_list + local niao = result.niao + -- if liuju then + -- local le = UIPackage.CreateObjectFromURL("ui://Main_Majiang/LiuJu") + -- self._view:AddChild(le) + -- le:Center() + -- le:GetTransition("t0"):Play() + -- coroutine.start(function() + -- coroutine.wait(1) + -- le:Dispose() + -- end) + -- end + self:RemoveCursor() + if self._clearingView == nil then + self._clearingView = EXClearingView.new(self._root_view) + coroutine.start(function() + coroutine.wait(0.5) + self._clearingView:Show() + self._popEvent = true + end) + end + print("lingmeng witness ZPResult2") + + if _room.curren_round ~= _room.room_config.round then + -- if #niao == 0 then self._view:GetChild("n13").visible = false end + for i = 1, #data do + local p = _room:GetPlayerBySeat(data[i].seat) + if p then + p.total_score = data[i].total_score + local card_info = self._player_card_info[self:GetPos(p.seat)] + local info = self._player_info[self:GetPos(p.seat)] + card_info:Clear() + card_info:ResetCardType() + if _room:checkHpNonnegative() then + p.cur_hp = data[i].hp_info.cur_hp + end + -- info:UpdateScore() + info._view:GetChild("zhanji").visible = true + local num = data[i].hp_info.total_hp + if num >= 0 then + info._view:GetController("text_color").selectedIndex = 0 + info._view:GetChild("text_jifen").text = "+" .. d2ad(num) + else + info._view:GetController("text_color").selectedIndex = 1 + info._view:GetChild("text_jifen").text = d2ad(num) + end + + info._view:GetChild("mask_piao").title = "" + info._view:GetController("piao_niao").selectedIndex = 0 + p.fz_list = {} + end + end + + self._clearingView:InitData(0, _room, result, nil, function(...) + DataManager.CurrenRoom.self_player.card_list = {} + self._ctr_state.selectedIndex = 2 + self._clearingView = nil + end, 1) + end + print("lingmeng witness ZPResult3") + + -- self._player_card_info[1]:ShowHuTip() + end) + + _gamectr:AddEventListener(TX_GameEvent.ZPResult2, function(...) + print("lingmeng witness ZPResult2") + -- self:UnmarkSelfTuoguan() + self._left_time = 0 + self:UpdateCardBox(0) + self._ctr_cardbox.selectedIndex = 0 + local arg = { ... } + local total_result = arg[2] + local result = arg[1] + local over = arg[3] + self._clearingView = EXClearingView.new() + coroutine.start(function() + coroutine.wait(0.5) + self._clearingView:Show() + end) + self._clearingView:InitData(over, _room, result, total_result) + ControllerManager.ChangeController(LoddyController) + end) + + _gamectr:AddEventListener(TX_GameEvent.EvnetPiaoTip, function() + print("lingmeng witness EvnetPiaoTip") + end) + + _gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...) + print("lingmeng witness EvnetPiao") + end) + + _gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...) + print("lingmeng witness EventResidueCard") + end) +end + +function M:InitPlayerInfoView() + self._player_info = {} + local _player_info = self._player_info + for i = 1, self._room.room_config.people_num do + local tem = self._view:GetChild(string.format("player_info%d_2", i)) + _player_info[i] = PlayerInfoView.new(tem, self) + tem.visible = false + end +end + +function M:NewMJPlayerCardInfoView(view, index) + if index == 1 then + return MJPlayerSelfCardInfoView.new(view, self) + end + return MJPlayerCardInfoView.new(view, self) +end + +function M:RemoveCursor() + self._cursor:RemoveFromParent() +end + +function M:UpdateCardBox(seat) + local index = seat - 1 + local people_num = self._room.room_config.people_num + if people_num == 2 and seat == 2 then + index = 2 + end + self._ctr_cardbox.selectedIndex = index +end + +function M:OnFangziAction(...) + print("lingmeng OnFangziAction") + -- self:__CloseTip() + print("lingmeng OnFangziAction1") + + local arg = { ... } + local _player_card_info = self._player_card_info + local fz = arg[1] + local player = arg[2] + local index = arg[3] + printlog("OnFangziAction") + local info = _player_card_info[self:GetPos(player.seat)] + -- local pNode = info._mask_liangpai + + self:RemoveCursor() + if (player.seat ~= fz.from_seat) then + local fs_info = _player_card_info[self:GetPos(fz.from_seat)] + fs_info:UpdateOutCardList() + end + print("lingmeng OnFangziAction5") + + info:UpdateFzList(fz, index, true) + local getcard = fz.type == FZType.Peng or fz.type == FZType.Chi + printlog(getcard) + + print("lingmeng hand_left_count", info._player.hand_left_count) + info._player.hand_left_count = info._player.hand_left_count - 1 + info:UpdateHandCardWitness(true) + -- self:__CloseTip() +end + +function M:UpdateRound() + self._view:GetChild("text_round").text = string.format("当前局数:%d/%d", self._room.curren_round, + self._room.room_config.round) +end + +function M:OnUpdate() + if (self._popEvent) then + local func = self._gamectr:PopEvent() + if (func ~= nil) then + local success, result = pcall(func) + if success then + + else + print("witness error") + print(result) + -- self._gamectr = ControllerManager.GetController(GameController) + -- if self._gamectr then + -- self._gamectr:ResetConnect() + -- end + end + --func() + end + end +end + +function M:ResetConnect() + +end + +function M:GetPos(seat) + return ViewUtil.GetPos(self._room.self_player.seat, seat, self._room.room_config.people_num) +end + +function M.HandCardSortAndJing(a, b) + local jing = DataManager.CurrenRoom.jing + if a == jing or b == jing then + if a == b then + return a < b + end + return a == jing + else + if a < 200 then + a = a + 1000 + elseif a < 300 then + a = a + 3000 + elseif a < 400 then + a = a + 2000 + else + a = a + 4000 + end + if b < 200 then + b = b + 1000 + elseif b < 300 then + b = b + 3000 + elseif b < 400 then + b = b + 2000 + else + b = b + 4000 + end + return a < b + end +end + +return M diff --git a/lua_probject/extend_project/extend/majiang/nancheng/ExtendConfig.lua b/lua_probject/extend_project/extend/majiang/nancheng/ExtendConfig.lua index 09a9329c..f92fe103 100644 --- a/lua_probject/extend_project/extend/majiang/nancheng/ExtendConfig.lua +++ b/lua_probject/extend_project/extend/majiang/nancheng/ExtendConfig.lua @@ -5,6 +5,7 @@ local EXMainView = import(".EXMainView") local EXGameController = import(".EXGameController") local EXRoomConfig = import(".EXRoomConfig") local EXPlayBackView = import(".EXPlayBackView") +local EXWitnessView = import(".EXWitnessView") local MJRoom = require("main.majiang.MJRoom") local ExtendConfig = {} @@ -20,6 +21,7 @@ function ExtendConfig.new() self._viewMap = {} self._viewMap[ViewManager.View_Main] = EXMainView self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView + self._viewMap[ViewManager.View_Witness] = EXWitnessView return self end @@ -106,6 +108,7 @@ function M:FillRoomData(s2croom) local fz = {} fz.type = op["type"] fz.card = op["card"] + fz.from_seat = op["from_seat"] p.fz_list[#p.fz_list + 1] = fz end if not playing and room.curren_round > 0 then @@ -170,4 +173,69 @@ function M:FillPlayBackData(pd_data) room.cmdList = pd_data["cmdList"] end +function M:FillWitnessData(pd_data) + print("==========================FillWitnessData1") + local room = DataManager.CurrenRoom + pt(room) + -- room.self_player = + local _tableInfo = pd_data["tableInfo"] + + local _config = _tableInfo["config"] + room.room_id = _tableInfo.roomid + room.room_config = EXRoomConfig.new(_config) + room.owner_id = _config["ownerid"] + local active_seat = _tableInfo["active_seat"] + local bank_seat = _tableInfo["banker_seat"] + room.left_count = _tableInfo["left_card"] + room.banker_seat = bank_seat + room.curren_turn_seat = active_seat + room.curren_round = _tableInfo["round"] + local _info_list = _tableInfo["playerData"] + for i = 1, #_info_list do + local _jp = _info_list[i] + local p = room:NewPlayer() + p.seat = _jp["seat"] + local online = _jp["online"] + p.line_state = online + p.ready = _jp["ready"] == 1 and true or false + local pid = _jp["aid"] + p.piao_niao = _jp["piao_niao"] + -- -- print(DataManager.SelfUser.account_id,pid) + -- if (278 == pid) then + -- room.self_player = p + -- p.self_user = DataManager.SelfUser + -- else + if p.seat == 1 then room.self_player = p end + local u = User.new() + u.account_id = pid + p.self_user = u + u.nick_name = _jp["nick"] + u.head_url = _jp["portrait"] + u.sex = _jp["sex"] + -- end + p.self_user.host_ip = p.self_user.host_ip + local _hand_card = {} + p.hand_left_count = _jp["card_count"] + p.card_list = _hand_card + --room.self_player.card_list = _hand_card + -- table.sort(_hand_card, self.HandCardSortAndJing) + p.total_score = _jp["score"] + p.outcard_list = _jp["outcard_list"] + local opcard = _jp["opcard"] + for k = 1, #opcard do + local op = opcard[k] + local fz = {} + fz.type = op["type"] + fz.card = op["card"] + fz.from_seat = op["from_seat"] + p.fz_list[#p.fz_list + 1] = fz + end + -- if _jp.hp_info then + -- room.room_config.isNonnegative = 1 + -- p.cur_hp = _jp.hp_info.cur_hp + -- end + + room:AddPlayer(p) + end +end return M diff --git a/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerBackView.lua b/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerBackView.lua index 36a281e6..35f7d78e 100644 --- a/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerBackView.lua +++ b/lua_probject/extend_project/extend/poker/runfast/RunFast_PlayerBackView.lua @@ -42,7 +42,7 @@ function M:InitView(url) end self._gamectr = ControllerManager.GetController(GameController) UIPackage.AddPackage('extend/poker/runfast/ui/Extend_Poker_RunFastNew') - PKPlayBackView.InitView(self, 'ui://Extend_Poker_RunFastNew/RunFast_Main_' .. self._room.room_config.people_num, + PKPlayBackView.InitView(self, "ui://Extend_Poker_RunFastNew/RunFast_Main_New_" .. room.room_config.people_num, default_bg, bg_config) self._tex_round = self._view:GetChild('round') self._player_card_info = {} diff --git a/lua_probject/main_project/main/majiang/MJMainView.lua b/lua_probject/main_project/main/majiang/MJMainView.lua index 6ae87893..67b39ee7 100644 --- a/lua_probject/main_project/main/majiang/MJMainView.lua +++ b/lua_probject/main_project/main/majiang/MJMainView.lua @@ -151,6 +151,29 @@ function M:InitView(url, use_custom_bg, custom_bg_config) end) end + local viewList_witness = self._view:GetChild('comp_witness'):GetChild('list_players') + viewList_witness:SetVirtual() + viewList_witness.itemRenderer = function(index, obj) + obj:GetChild('title').text = _room.witness_player_list[index + 1].nick + ImageLoad.Load(_room.witness_player_list[index + 1].portrait, obj:GetChild('btn_head')._iconObject) + end + + local btn_witness = self._view:GetChild('btn_pangGuang') + if btn_witness then + btn_witness.onClick:Set(function() + if _room._flag_updateWitness then + print("linemng", _room._flag_updateWitness, #_room.witness_player_list, viewList_witness.numItems) + _room._flag_updateWitness = false + if viewList_witness.numItems == #_room.witness_player_list then + viewList_witness:RefreshVirtualList() + else + viewList_witness.numItems = #_room.witness_player_list + end + end + self._view:GetController('witness').selectedIndex = 1 + end) + end + self:InitXiPai() self:InitXiPai1() end diff --git a/lua_probject/main_project/main/majiang/MJPlayBackView.lua b/lua_probject/main_project/main/majiang/MJPlayBackView.lua index dba8c333..d904fb87 100644 --- a/lua_probject/main_project/main/majiang/MJPlayBackView.lua +++ b/lua_probject/main_project/main/majiang/MJPlayBackView.lua @@ -61,7 +61,7 @@ function M:SetCardBoxPosition() end function M:NewMJPlayerCardInfoView(view, index) - return MJPlayerCardInfoView.new(view, self) + return MJPlayerCardInfoView.new(view, self, 1) end function M:NextRecordPlay() diff --git a/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua b/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua index 99193a48..6716face 100644 --- a/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua +++ b/lua_probject/main_project/main/majiang/MJPlayerCardInfoView.lua @@ -36,11 +36,12 @@ end local M = PlayerCardInfoView --- Create a new PlayerCardInfoView -function M.new(view, mainView) +function M.new(view, mainView, record) local self = {} setmetatable(self, { __index = M }) self._view = view self._mainView = mainView + self._flag_record = record self:init() return self end @@ -54,8 +55,14 @@ function M:init() self._view_outCardList = self._view:GetChild('List_OutCard') self._view_getCard = self._view:GetChild('Btn_HandCard') - self._ctr_getCard = self._view:GetController('getCard') + + self._ctr_record = self._view:GetController('record') + if self._flag_record and self._flag_record == 1 and self._ctr_record then + self._ctr_record.selectedIndex = self._flag_record or 0 + self._view_handCardList = self._view:GetChild('List_HandCard2') + self._view_getCard = self._view:GetChild('Btn_HandCard2') + end end function M:SetPlayer(p) diff --git a/wb_new_ui/assets/Common/package.xml b/wb_new_ui/assets/Common/package.xml index 309200a3..4e3af7a1 100644 --- a/wb_new_ui/assets/Common/package.xml +++ b/wb_new_ui/assets/Common/package.xml @@ -1211,6 +1211,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wb_new_ui/assets/Extend_Poker_RunFastNew/RunFast_Main_New_2.xml b/wb_new_ui/assets/Extend_Poker_RunFastNew/RunFast_Main_New_2.xml index bc837cd8..101a5f3f 100644 --- a/wb_new_ui/assets/Extend_Poker_RunFastNew/RunFast_Main_New_2.xml +++ b/wb_new_ui/assets/Extend_Poker_RunFastNew/RunFast_Main_New_2.xml @@ -1,12 +1,12 @@ - + - + @@ -57,30 +57,31 @@ - - - - + - + - - + + + + + + + - - - - + + +