|
- local MJFunction={}
-
- --字符分割转换手牌数组
- function MJFunction.convertToCards(str)
- str=string.ltrim(str)
- local tab=string.split(str," ")
- if str=="" then
- tab={}
- end
- return tab
- end
-
- function MJFunction.getTimeString()
- return os.date("%m-%d %X")
- end
-
- function MJFunction.get3dCardMd5ByName(name)
- local filemap = require("mj.luaScript.Common.3d.Mahjong3DMap")
- return filemap[name]
- end
-
- function MJFunction.getClubInviteWanFa( gameId, roomInfo )
- local data = json.decode(roomInfo.strGameInfo or "")
- if data == nil then
- return ""
- end
-
- local gamerule = data.gamerule or 1 -- 玩法
- local roundCount = roomInfo.nTotalGameNum or 0 -- 局数
- local gameConfig = getSubGameConfig(gameId) or {}
- local gameType = gameConfig.GameType or {}
- local content = string.format("%s局 %s", roundCount, gameType[gamerule] or gameConfig.gameName)
- return content
- end
- ---
- -- 检测互动道具是否可以使用
- -- 亲友圈配置
- -- @return
- --
- function MJFunction:isPropFobided ()
- if not app.room then
- return
- end
-
- local roomInfo = app.room.roomInfo or {}
- local strGameInfo = app.room.roomInfo.strGameInfo or ""
- local info = json.decode(strGameInfo) or {}
- local isFobided = info.forbidProp == 1
- return isFobided
- end
- ---
- -- 检测语音是否可以使用
- -- 亲友圈配置
- -- @return
- --
- function MJFunction:isVoiceFobided ()
- if not app.room then
- return
- end
-
- local roomInfo = app.room.roomInfo or {}
- local strGameInfo = app.room.roomInfo.strGameInfo or ""
- local info = json.decode(strGameInfo) or {}
- local isFobided = false
- if not info.forbidVoice then--此字段没有说明还没有分开控制
- return MJFunction:isPropFobided ()
- end
- isFobided = info.forbidVoice == 1
- return isFobided
- end
-
- return MJFunction
|