|
- ---
- -- ================================================================
- -- 文件名: zigong7zRoomToolView.lua
- -- 描述:
- -- 版权: Copyright © 2016-2019 公司名称 版权所有
- -- 作者: Administrator
- -- 创建日期: 2020-02-04
- -- 更新日期: 2020-02-04
- -- 备注:
- -- ================================================================
- --
- local MJWanFa=MJFramework.ImportWanFa("luaScript.SubGameDefine.MaJiang.MJWanFa")
-
-
- local MJRoomToolView = require("mj.luaScript.Views.Room.MJRoomToolView");
- local zigong7zRoomToolView = class("zigong7zRoomToolView", MJRoomToolView);
-
- function zigong7zRoomToolView:ctor ()
- zigong7zRoomToolView.super.ctor(self);
- end
-
- function zigong7zRoomToolView:onEnter()
- zigong7zRoomToolView.super.onEnter(self);
- if self.ui.Items.Layout_Rule then
- self.ui.Items.Layout_Rule:setVisible(false);
- end
-
- if self.ui.Items.Button_Rule then
- self.ui.Items.Button_Rule:setVisible(false);
- end
- end
-
- function zigong7zRoomToolView:loadUI()
- local ui = loadUI("mj_zigong7z/res/ui_fangjian/mj_zigong_toolView.ui");
- -- local ui = loadUI("mj/res/ui/ui_fangjian/mj_ui_new_tool.ui");
- self.ui = ui;
- self:addChild(ui);
- end
-
- function zigong7zRoomToolView:onClickRule ()
- -- 重写,不使用MJRoomToolView里面的规则弹框
- end
-
- function zigong7zRoomToolView:hideRule ()
- -- 重写,不使用MJRoomToolView里面的规则弹框
- end
-
- function zigong7zRoomToolView:setButtonFacePos(pos)
- self.ui.Items.Button_Face:setPosition(pos)
- end
-
- function zigong7zRoomToolView:setButtonVoicePos(pos)
- self.ui.Items.Button_Voice:setPosition(pos)
- end
-
- function zigong7zRoomToolView:setButtonLeaveEnable(bool)
- self.ui.Items.Button_Leave:setEnabled(bool)
- end
-
- function zigong7zRoomToolView:setButtonToolEnable(bool)
- self.ui.Items.Button_Dismiss:setEnabled(bool)
- end
-
- function zigong7zRoomToolView:addLayoutToChatLayer(layout)
- self.ui.Items.Layout_Chat:addChild(layout)
- end
-
- function zigong7zRoomToolView:getIsHaveButtonDismiss()
- return self.ui.Items.Button_Dismiss
- end
-
- function zigong7zRoomToolView:updateButton(isMove)
- zigong7zRoomToolView.super.updateButton(self, isMove)
-
- -- 更正为3人快开
- local roomInfo = app.room.roomInfo
- local curMemberNum = table.nums(roomInfo.memberList)
- local isNotSitFull = curMemberNum < roomInfo.nMaxPlayCount -- 没有坐满
- local info = json.decode(roomInfo.strGameInfo or "") or {}
-
- -- 更改资源
- local tempPath = {
- [3] = 'mj_zigong7z/res/zy_fangjian/btn/zigong_fastbtn_3.png',
- [4] = 'mj_zigong7z/res/zy_fangjian/btn/zigong_fastbtn_4.png',
- [5] = 'mj_zigong7z/res/zy_fangjian/btn/zigong_fastbtn_5.png',
- }
- if isNotSitFull and curMemberNum>=3 then
- self.ui.Items.Button_FastStart:loadTextureNormal(tempPath[curMemberNum])
- end
-
- if self.ui.Items.Button_FastStart then
- self.ui.Items.Button_FastStart:setVisible(isNotSitFull and curMemberNum>=3 and info.isfaststart == 1)
- end
- if roomInfo.nGameStartCount>0 then
- if self.ui.Items.Button_FastStart then
- self.ui.Items.Button_FastStart:setVisible(false)
- end
- end
- end
-
- function zigong7zRoomToolView:getInviteData()
- local tt =
- {
- [0] = "零缺六",
- [1] = "一缺五",
- [2] = "二缺四",
- [3] = "三缺三",
- [4] = "四缺二",
- [5] = "五缺一",
- [6] = "满座",
- }
-
- if app.room:getMaxPlayerCount()==5 then
- tt =
- {
- [0] = "零缺五",
- [1] = "一缺四",
- [2] = "二缺三",
- [3] = "三缺二",
- [4] = "四缺一",
- [5] = "满座",
- }
- end
-
- if app.room:getMaxPlayerCount()==4 then
- tt =
- {
- [0] = "零缺四",
- [1] = "一缺三",
- [2] = "二缺二",
- [3] = "三缺一",
- [4] = "满座",
- }
- end
-
- if app.room:getMaxPlayerCount()==3 then
- tt =
- {
- [0] = "零缺三",
- [1] = "一缺二",
- [2] = "二缺一",
- [3] = "满座",
- }
- end
-
- local num = table.nums(app.room.roomInfo.memberList)
- local strNum = tt[num]
- --根据游戏类型分享
- local roomInfo = app.room.roomInfo;
- local jsonInfo = json.decode(roomInfo.strGameInfo)
-
- local mjName=getSubGameConfig(app.room.roomInfo.gameId).gameName or "麻将"
-
- local title = string.format("%s 房号[%s] %s", mjName,app.room.roomInfo.nShowTableId,strNum)
-
- --添加俱乐部ID
- if app.club_php.clubID and app.club_php.clubID ~= 0 then
- title = string.format("%s %sID[%d]", title,(app.club_php:getCestIsOpen(app.club_php.clubID) and PLN.CLUB_CEST_NAME or PLN.CLUB_NAME), tonumber(app.club_php.clubID))
- end
-
- local strGameNum = string.format("%s局", app.room.roomInfo.nTotalGameNum)
-
- local strGameMode = MJWanFa.getWanFaInfo(app.room.roomInfo.strGameInfo)--getLHQRuleStr()
-
- local strNames = ""
- local index = 0
- for k,v in pairs(app.room.roomInfo.memberList) do
- index = index + 1
- local userInfo = json.decode(v.userInfo)
- local name = getSubStringNickname(userInfo.nickname)
- strNames = strNames..name
- if index < num then
- strNames = strNames..","
- end
- end
- local desc = string.format("%s,%s 玩家:%s", strGameNum, strGameMode, strNames)
- print(desc)
-
- return title,desc
- end
-
- return zigong7zRoomToolView;
|