153 lines
2.8 KiB
Lua
153 lines
2.8 KiB
Lua
|
|
---
|
||
|
|
local M = {}
|
||
|
|
|
||
|
|
|
||
|
|
--- Create a new RoomConfig
|
||
|
|
function M.new(config)
|
||
|
|
setmetatable(M, { __index = RoomConfig })
|
||
|
|
local self = setmetatable({}, { __index = M })
|
||
|
|
RoomConfig.init(self, config)
|
||
|
|
self.config = config
|
||
|
|
self.class = "RoomConfig"
|
||
|
|
self.round = config["times"]
|
||
|
|
self.maxPlayers = config["maxPlayers"]
|
||
|
|
self.fengding = config["fengding"]
|
||
|
|
self.wanfa = config["wanfa"]
|
||
|
|
self.qiduijiafan = config["qiduijiafan"]
|
||
|
|
self.shoudailongjiafan = config["shoudailongjiafan"]
|
||
|
|
self.loudilongjiafan = config["loudilongjiafan"]
|
||
|
|
self.bunengchi = config["bunengchi"]
|
||
|
|
|
||
|
|
return self
|
||
|
|
end
|
||
|
|
|
||
|
|
function M:GetDes(sp)
|
||
|
|
sp = sp or " "
|
||
|
|
local count = 0
|
||
|
|
local str = self.round and self.round .. "局" .. " " or ""
|
||
|
|
str = str .. RoomConfig.GetDes(self, sp) .. "\n"
|
||
|
|
|
||
|
|
|
||
|
|
if (self.fengding) then
|
||
|
|
str = str .. "封顶"
|
||
|
|
count = count + 1
|
||
|
|
if count % 2 == 0 then
|
||
|
|
str = str .. "\n"
|
||
|
|
else
|
||
|
|
sp1 = ""
|
||
|
|
local strL = 2
|
||
|
|
for i = 1, strL do
|
||
|
|
sp1 = sp1 .. " "
|
||
|
|
end
|
||
|
|
str = str .. sp1 .. sp
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
if (self.qiduijiafan) then
|
||
|
|
local strL = 2
|
||
|
|
str = str .. "可胡七对"
|
||
|
|
if self.qiduijiafan then
|
||
|
|
str = str .. "翻倍"
|
||
|
|
strL = 0
|
||
|
|
end
|
||
|
|
count = count + 1
|
||
|
|
if count % 2 == 0 then
|
||
|
|
str = str .. "\n"
|
||
|
|
else
|
||
|
|
sp1 = ""
|
||
|
|
for i = 1, strL do
|
||
|
|
sp1 = sp1 .. " "
|
||
|
|
end
|
||
|
|
str = str .. sp1 .. sp
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
|
||
|
|
if self.shoudailongjiafan then
|
||
|
|
str = str .. "手逮龙加番"
|
||
|
|
count = count + 1
|
||
|
|
if count % 2 == 0 then
|
||
|
|
str = str .. "\n"
|
||
|
|
else
|
||
|
|
sp1 = ""
|
||
|
|
local strL = 2
|
||
|
|
for i = 1, strL do
|
||
|
|
sp1 = sp1 .. " "
|
||
|
|
end
|
||
|
|
str = str .. sp1 .. sp
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
if self.loudilongjiafan then
|
||
|
|
str = str .. "落地龙"
|
||
|
|
count = count + 1
|
||
|
|
if count % 2 == 0 then
|
||
|
|
str = str .. "\n"
|
||
|
|
else
|
||
|
|
sp1 = ""
|
||
|
|
local strL = 3
|
||
|
|
for i = 1, strL do
|
||
|
|
sp1 = sp1 .. " "
|
||
|
|
end
|
||
|
|
str = str .. sp1 .. sp
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
if self.bunengchi then
|
||
|
|
str = str .. "不能吃"
|
||
|
|
count = count + 1
|
||
|
|
if count % 2 == 0 then
|
||
|
|
str = str .. "\n"
|
||
|
|
else
|
||
|
|
sp1 = ""
|
||
|
|
local strL = 3
|
||
|
|
for i = 1, strL do
|
||
|
|
sp1 = sp1 .. " "
|
||
|
|
end
|
||
|
|
str = str .. sp1 .. sp
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
|
||
|
|
str = str.sub(str, 1, string.len(str) - string.len(sp))
|
||
|
|
return str
|
||
|
|
end
|
||
|
|
|
||
|
|
function M:GetDes2(sp)
|
||
|
|
sp = sp or " "
|
||
|
|
local str = RoomConfig.GetDes(self, sp)
|
||
|
|
local str = self.round and self.round .. "局" .. sp or ""
|
||
|
|
str = str .. RoomConfig.GetDes(self, sp)
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
if (self.qiduijiafan) then
|
||
|
|
str = str .. "可胡七对"
|
||
|
|
if self.qiduijiafan then
|
||
|
|
str = str .. "-翻倍"
|
||
|
|
end
|
||
|
|
str = str .. sp
|
||
|
|
end
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
str = str.sub(str, 1, string.len(str) - string.len(sp))
|
||
|
|
return str
|
||
|
|
end
|
||
|
|
|
||
|
|
function M:GetGameJS()
|
||
|
|
local gamerulepanel = UIPackage.CreateObjectFromURL("ui://Extend_MJ_LiChuan/gamerule")
|
||
|
|
return gamerulepanel
|
||
|
|
end
|
||
|
|
|
||
|
|
function M:GetGameSMSize()
|
||
|
|
return 467, 500
|
||
|
|
end
|
||
|
|
|
||
|
|
function M:GetGameName()
|
||
|
|
return "黎川麻将"
|
||
|
|
end
|
||
|
|
|
||
|
|
return M
|