yunque9/lua_probject/extend_project/extend/poker/runfast/ExtendConfig.lua

263 lines
8.0 KiB
Lua
Raw Permalink Normal View History

2025-05-24 14:29:14 +08:00
---
--- Created by 谌建军.
--- DateTime: 2017/12/13 10:57
---
local EXTEND_MODEL_NAME = ...
local EXGameInfo = import(".EXGameInfo")
local RunFast_MainView = import(".RunFast_MainView")
local RunFast_GameController = import(".RunFast_GameController")
local RunFast_RoomConfig = import(".RunFast_RoomConfig")
local RunFast_Player = import(".RunFast_Player")
local RunFast_Room = import(".RunFast_Room")
local RunFast_PlayerBackView = import(".RunFast_PlayerBackView")
local ExtendConfig = {}
local M = ExtendConfig
function ExtendConfig.new()
2025-06-05 18:56:24 +08:00
setmetatable(M, { __index = IExtendConfig })
local self = setmetatable({}, { __index = M })
2025-05-24 14:29:14 +08:00
self.class = "ExtendConfig"
self.extend_id = 14
self._viewMap = {}
self._viewMap[ViewManager.View_Main] = RunFast_MainView
self._viewMap[ViewManager.View_PlayBack] = RunFast_PlayerBackView
return self
end
--卸载资源
function M:UnAllAssets()
UIPackage.RemovePackage("extend/poker/runfast/ui/Info_Poker_RunFastNew")
self:UnAssets()
end
function M:UnAssets()
UIPackage.RemovePackage("extend/poker/runfast/ui/Extend_Poker_RunFastNew")
ResourcesManager.UnLoadGroup("RunFase_PK")
end
2025-06-05 18:56:24 +08:00
2025-05-24 14:29:14 +08:00
local _gameInfo = nil
function M:GetGameInfo()
2025-06-05 18:56:24 +08:00
if not _gameInfo then
_gameInfo = EXGameInfo.new()
end
return _gameInfo
2025-05-24 14:29:14 +08:00
end
local _ctr_game = nil
function M:GetGameController()
if _ctr_game == nil then
_ctr_game = RunFast_GameController.new()
end
return _ctr_game
end
function M:NewRoom()
return RunFast_Room.new()
end
function M:GetGameRule()
return RunFast_RuleView.new()
end
function M:GetIconUrl()
return "ui://Extend_Poker_RunFastNew/icon"
--
end
2025-06-05 18:56:24 +08:00
function M:FillRoomConfig(room, _config)
2025-05-24 14:29:14 +08:00
room.room_config = RunFast_RoomConfig.new(_config)
end
function M:FillRoomData(s2croom)
local room = DataManager.CurrenRoom
if _ctr_game == nil then
self:GetGameController()
end
local reload = s2croom["reload"]
local _tableInfo = s2croom["tableInfo"]
2025-06-05 18:56:24 +08:00
room.xipaiScore = _tableInfo["xipai_score"]
2025-05-24 14:29:14 +08:00
local _config = _tableInfo["config"]
room.room_config = RunFast_RoomConfig.new(_config)
room.curren_round = _tableInfo["round"]
2025-06-05 18:56:24 +08:00
if room.curren_round == 0 and reload then
room.curren_round = 1
2025-05-24 14:29:14 +08:00
end
local playerList = _tableInfo["playerData"]
2025-06-05 18:56:24 +08:00
for i = 1, #playerList do
2025-05-24 14:29:14 +08:00
local _jp = playerList[i]
local p = RunFast_Player.new()
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"]
if (DataManager.SelfUser.account_id == pid) then
room.self_player = p
p.self_user = DataManager.SelfUser
else
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.location = Location.new(_jp["pos"] or "")
p.self_user.host_ip = _jp["ip"]
p.total_score = _jp["score"] or 0
if _jp.hp_info then
p.cur_hp = _jp.hp_info.cur_hp
end
p.hp_info = _jp["hp_info"]
if _jp["entrust"] then
p.entrust = _jp.entrust
end
room:AddPlayer(p)
end
local owner = s2croom["owner"]
room.owner_id = owner
room.game_status = 0
if reload then
local reloadInfo = s2croom["reloadInfo"]
2025-06-05 18:56:24 +08:00
2025-05-24 14:29:14 +08:00
local playing = reloadInfo["playing"]
room.curren_turn_seat = reloadInfo["active_seat"]
local info_list = reloadInfo["info_list"]
if playing == true then
room.CurnrenState = StateType.Palying
2025-06-05 18:56:24 +08:00
room.game_status = 1
2025-05-24 14:29:14 +08:00
for i = 1, #info_list do
local p = room:GetPlayerById(info_list[i]["playerid"])
if p == room.self_player then
p.hand_list = reloadInfo["hand_card"]
2025-06-05 18:56:24 +08:00
p.open = reloadInfo["open"]
2025-05-24 14:29:14 +08:00
end
p.hand_count = info_list[i]["card_size"]
p.piao = info_list[i]["piao"]
2025-06-05 18:56:24 +08:00
p.niao = info_list[i]["niao"]
p.daNiao = info_list[i]["daNiao"]
2025-05-24 14:29:14 +08:00
p.handCards = info_list[i]["handCards"]
p.outCards = info_list[i]["outCards"]
local last_outcard = info_list[i]["last_outcard"]
if last_outcard ~= nil and last_outcard[1] ~= 0 then
2025-06-05 18:56:24 +08:00
local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list, true)
local card_type, number, length, plan_three_count = _ctr_game:GetCardListInfo(out_card_list)
p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list, card_type, number, plan_three_count)
2025-05-24 14:29:14 +08:00
else
2025-06-05 18:56:24 +08:00
p.out_card_list = { 0 }
2025-05-24 14:29:14 +08:00
end
end
else
2025-06-05 18:56:24 +08:00
-- print("aaaaaaaaaaaaaaaa1111111111111111111111111")
2025-05-24 14:29:14 +08:00
--pt(s2croom)
2025-06-05 18:56:24 +08:00
room.game_status = 1
2025-05-24 14:29:14 +08:00
room.CurnrenState = StateType.PalyingWait
room.winseat = reloadInfo["winseat"]
room.remaincards = reloadInfo["remaincards"]
for i = 1, #info_list do
local playerData = info_list[i]
local p = room:GetPlayerById(playerData["playerid"])
2025-06-05 18:56:24 +08:00
2025-05-24 14:29:14 +08:00
p.ready = playerData["certainseat"] == 1 and true or false
local last_outcard = info_list[i]["last_outcard"]
if last_outcard ~= nil and last_outcard[1] ~= 0 then
2025-06-05 18:56:24 +08:00
local out_card_list = _ctr_game:ChangeCodeByFrom(last_outcard.card_list, true)
local card_type, number, length, plan_three_count = _ctr_game:GetCardListInfo(out_card_list)
p.out_card_list = _ctr_game:GetSortOutCardList(out_card_list, card_type, number, plan_three_count)
2025-05-24 14:29:14 +08:00
else
2025-06-05 18:56:24 +08:00
p.out_card_list = { 0 }
2025-05-24 14:29:14 +08:00
end
2025-06-05 18:56:24 +08:00
2025-05-24 14:29:14 +08:00
p.hand_list = info_list[i]["cards"]
p.winscore = info_list[i]["winscore"]
p.piao = info_list[i]["piao"]
2025-06-05 18:56:24 +08:00
p.niao = info_list[i]["niao"]
p.daNiao = info_list[i]["daNiao"]
2025-05-24 14:29:14 +08:00
p.hand_count = info_list[i]["card_size"]
2025-06-05 18:56:24 +08:00
p.thisboomnum = info_list[i]["thisboomnum"]
p.open = info_list[i]["open"]
2025-05-24 14:29:14 +08:00
p.handCards = info_list[i]["handCards"]
p.outCards = info_list[i]["outCards"]
2025-06-05 18:56:24 +08:00
end
2025-05-24 14:29:14 +08:00
end
else
room.CurnrenState = StateType.Ready
end
end
function M:FillPlayBackData(pd_data)
local room = DataManager.CurrenRoom
local _tableInfo = pd_data["info"]
local _config = _tableInfo["config"]
room.room_id = _tableInfo.room_id
room.room_config = RunFast_RoomConfig.new(_config)
room.owner_id = _config["ownerid"]
local active_seat = _tableInfo["active_seat"]
local bank_seat = _tableInfo["banker_seat"]
room.banker_seat = bank_seat
room.curren_turn_seat = active_seat
room.curren_round = _tableInfo["round"]
local _info_list = _tableInfo["playerData"]
2025-06-05 18:56:24 +08:00
for i = 1, #_info_list do
2025-05-24 14:29:14 +08:00
local _jp = _info_list[i]
local p = RunFast_Player.new()
p.seat = _jp["seat"]
p.aid = _jp["aid"]
local pid = _jp["aid"]
if p.aid == DataManager.SelfUser.account_id 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 = _jp["hand_card"]
p.hand_list = _hand_card
p.hand_count = #_hand_card
p.total_score = _jp["score"]
p.piao = _jp["piao"]
2025-06-05 18:56:24 +08:00
p.open = _jp["open"]
2025-05-24 14:29:14 +08:00
p.hp_info = _jp["hp_info"]
if _jp['hp_info'] then
p.cur_hp = _jp.hp_info.cur_hp
p.total_hp = _jp.hp_info.total_hp
end
room:AddPlayer(p)
end
room.cmdList = pd_data["cmdList"]
end
2025-06-05 18:56:24 +08:00
return M