在线状态刷新/扔番茄
parent
4c950a0d25
commit
12c663c183
|
|
@ -37,7 +37,10 @@ GameEvent = {
|
||||||
AddScore = "AddScore",
|
AddScore = "AddScore",
|
||||||
|
|
||||||
--推送道具互动
|
--推送道具互动
|
||||||
MISSILE = "MISSILE"
|
MISSILE = "MISSILE",
|
||||||
|
|
||||||
|
--Home状态推送
|
||||||
|
HOMESTATE = "HOMESTATE",
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Base GameController
|
--- Base GameController
|
||||||
|
|
@ -89,6 +92,8 @@ function M:init(name)
|
||||||
self._eventmap[Protocol.GAME_GANGFEN] = self.OnEvtGANGFEN
|
self._eventmap[Protocol.GAME_GANGFEN] = self.OnEvtGANGFEN
|
||||||
self._eventmap[Protocol.GAME_MISSILE] = self.OnEvtMISSILE
|
self._eventmap[Protocol.GAME_MISSILE] = self.OnEvtMISSILE
|
||||||
|
|
||||||
|
self._eventmap[Protocol.GAME_HOME_STATE] = self.OnEvtHomeState
|
||||||
|
|
||||||
--self._eventmap[Protocol.GAME_AUTO_CARD] = self.OnEvtOpenGameHuTuoGtips
|
--self._eventmap[Protocol.GAME_AUTO_CARD] = self.OnEvtOpenGameHuTuoGtips
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -657,6 +662,20 @@ function M:OnEvtMISSILE(msg)
|
||||||
DispatchEvent(self._dispatcher, GameEvent.MISSILE, nil, msg)
|
DispatchEvent(self._dispatcher, GameEvent.MISSILE, nil, msg)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 按home建 out在程序外 enter在程序内
|
||||||
|
function M:FG_Set_Home(gameStatus)
|
||||||
|
local _client = ControllerManager.GameNetClinet
|
||||||
|
if not _client then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local _data = {}
|
||||||
|
_data.uid = DataManager.SelfUser.account_id
|
||||||
|
_data.gameStatus = gameStatus
|
||||||
|
_client:send(Protocol.GAME_SET_HOME, _data, function(res)
|
||||||
|
callback(res)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
function M:DispatchEventTuoGuan(p, isShow, t)
|
function M:DispatchEventTuoGuan(p, isShow, t)
|
||||||
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, isShow, t)
|
DispatchEvent(self._dispatcher, GameEvent.TupGuanOpen, p, isShow, t)
|
||||||
end
|
end
|
||||||
|
|
@ -682,3 +701,7 @@ end
|
||||||
function M:OnEventFzAction(msg)
|
function M:OnEventFzAction(msg)
|
||||||
DispatchEvent(self._dispatcher, GameEvent.FangziAnimation, msg)
|
DispatchEvent(self._dispatcher, GameEvent.FangziAnimation, msg)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:OnEvtHomeState(msg)
|
||||||
|
DispatchEvent(self._dispatcher, GameEvent.HOMESTATE, msg)
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ DataManager= {
|
||||||
SelfUser = User.new(),
|
SelfUser = User.new(),
|
||||||
|
|
||||||
CurrenRoom = nil,
|
CurrenRoom = nil,
|
||||||
|
CurrenGroup = nil,
|
||||||
-- 互动表情时间,控制cd
|
-- 互动表情时间,控制cd
|
||||||
InteractTime = 0,
|
InteractTime = 0,
|
||||||
-- 记录各游戏使用牌型的列表,现暂时只保存了麻将的数据.
|
-- 记录各游戏使用牌型的列表,现暂时只保存了麻将的数据.
|
||||||
|
|
|
||||||
|
|
@ -510,4 +510,10 @@ Protocol = {
|
||||||
|
|
||||||
--发送道具互动
|
--发送道具互动
|
||||||
GAME_SENDMISSILE = "?",
|
GAME_SENDMISSILE = "?",
|
||||||
|
|
||||||
|
-- 按home建 在游戏里1 不在游戏里0
|
||||||
|
GAME_SET_HOME = "3009",
|
||||||
|
|
||||||
|
-- home状态推送
|
||||||
|
GAME_HOME_STATE = "3010",
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,6 @@ function M:FillData()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ReFalsh(...)
|
function M:ReFalsh(...)
|
||||||
|
|
||||||
local arg = { ... }
|
local arg = { ... }
|
||||||
local group = DataManager.groups:get(self.group_id)
|
local group = DataManager.groups:get(self.group_id)
|
||||||
|
|
||||||
|
|
@ -70,7 +69,7 @@ function M:ReFalsh(...)
|
||||||
local player = group.memberMap[player]
|
local player = group.memberMap[player]
|
||||||
|
|
||||||
if player then
|
if player then
|
||||||
player.online = 0
|
player.online = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -78,7 +77,7 @@ function M:ReFalsh(...)
|
||||||
local player = group.memberMap[player]
|
local player = group.memberMap[player]
|
||||||
|
|
||||||
if player then
|
if player then
|
||||||
player.online = 1
|
player.online = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -92,7 +91,11 @@ function M:PlayerRenderer(index, obj)
|
||||||
local btn_invite = obj:GetChild('btn_invite')
|
local btn_invite = obj:GetChild('btn_invite')
|
||||||
btn_invite:GetController('online').selectedIndex = self._data_number[i].uid ==
|
btn_invite:GetController('online').selectedIndex = self._data_number[i].uid ==
|
||||||
DataManager.SelfUser.account_id and 0 or self._data_number[i].online
|
DataManager.SelfUser.account_id and 0 or self._data_number[i].online
|
||||||
obj:GetController('type').selectedIndex = self._data_number[i].online
|
local state = self._data_number[i].online
|
||||||
|
if self._data_number[i].playing == "startPlaying" then
|
||||||
|
state = 2
|
||||||
|
end
|
||||||
|
obj:GetController('type').selectedIndex = state
|
||||||
local loader = obj:GetChild("btn_head"):GetChild("icon")
|
local loader = obj:GetChild("btn_head"):GetChild("icon")
|
||||||
ImageLoad.Load(self._data_number[i].portrait, loader)
|
ImageLoad.Load(self._data_number[i].portrait, loader)
|
||||||
btn_invite.onClick:Set(function()
|
btn_invite.onClick:Set(function()
|
||||||
|
|
|
||||||
|
|
@ -330,6 +330,9 @@ function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type)
|
||||||
obj:GetChild('title').emojies = EmojiDitc.EmojiesDitc
|
obj:GetChild('title').emojies = EmojiDitc.EmojiesDitc
|
||||||
obj:GetChild('title').text = members[index + 1].nick
|
obj:GetChild('title').text = members[index + 1].nick
|
||||||
obj:GetController('type').selectedIndex = members[index + 1].online and members[index + 1].online or 0
|
obj:GetController('type').selectedIndex = members[index + 1].online and members[index + 1].online or 0
|
||||||
|
if members[index + 1].playing == "startPlaying" then
|
||||||
|
obj:GetController('type').selectedIndex = 2
|
||||||
|
end
|
||||||
local loader_icon = obj:GetChild("btn_head"):GetChild("icon")
|
local loader_icon = obj:GetChild("btn_head"):GetChild("icon")
|
||||||
ImageLoad.Load(members[index + 1].portrait, loader_icon)
|
ImageLoad.Load(members[index + 1].portrait, loader_icon)
|
||||||
end
|
end
|
||||||
|
|
@ -570,6 +573,7 @@ function M:ConnetFamily(index, groups, isCreate)
|
||||||
local list_family = self._view:GetChild('list_family')
|
local list_family = self._view:GetChild('list_family')
|
||||||
list_family:SetVirtual()
|
list_family:SetVirtual()
|
||||||
self._group = DataManager.groups:get(groups[index].id)
|
self._group = DataManager.groups:get(groups[index].id)
|
||||||
|
DataManager.CurrenGroup = self._group
|
||||||
self._view:GetChild('text_familyId').text = self._group.id
|
self._view:GetChild('text_familyId').text = self._group.id
|
||||||
self._view:GetController('lev').selectedIndex = self._group.lev - 1
|
self._view:GetController('lev').selectedIndex = self._group.lev - 1
|
||||||
print("===================================self._group")
|
print("===================================self._group")
|
||||||
|
|
@ -673,13 +677,11 @@ function M:OnUpdate()
|
||||||
self:UpdateFamilyRoom(fgCtr, self._group.id)
|
self:UpdateFamilyRoom(fgCtr, self._group.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
local HeartbeatTime = 5
|
local HeartbeatTime = 30
|
||||||
if newTime - self.lastTime > HeartbeatTime then
|
if newTime - self.lastTime > HeartbeatTime then
|
||||||
fgCtr:FG_SetFamilyHeartbeat(self._group.id, DataManager.SelfUser.account_id, function(res)
|
fgCtr:FG_SetFamilyHeartbeat(self._group.id, DataManager.SelfUser.account_id, function(res)
|
||||||
print(res)
|
print(res)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
self:ChangeNumber(fgCtr, self._group.id, 0, self._group.total_member_num, false, 1)
|
|
||||||
--[[
|
--[[
|
||||||
fgCtr:FG_SetFamilyHeartbeat(self._group.id, DataManager.SelfUser.account_id, function(res)
|
fgCtr:FG_SetFamilyHeartbeat(self._group.id, DataManager.SelfUser.account_id, function(res)
|
||||||
self:ChangeNumber(fgCtr, self._group.id, 0, self._group.total_member_num, false,
|
self:ChangeNumber(fgCtr, self._group.id, 0, self._group.total_member_num, false,
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ local PlayerDistanceView = import('.PlayerDistanceView')
|
||||||
local FGAssistView = import('.FGAssistView')
|
local FGAssistView = import('.FGAssistView')
|
||||||
local MissileSender = import(".MissileSender")
|
local MissileSender = import(".MissileSender")
|
||||||
|
|
||||||
local function GetSeat(data, uId)
|
local function GetSeat(self, uId)
|
||||||
for _, player in pairs(data.player_list) do
|
for _, player in pairs(self._room.player_list) do
|
||||||
if player.self_user.account_id == uId then
|
if player.self_user.account_id == uId then
|
||||||
return player.seat
|
return player.seat
|
||||||
end
|
end
|
||||||
|
|
@ -873,6 +873,22 @@ function M:EventInit()
|
||||||
_room._flag_updateWitness = true
|
_room._flag_updateWitness = true
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(GameEvent.HOMESTATE, function(...)
|
||||||
|
local arg = {...}
|
||||||
|
local uid = arg[1].uid
|
||||||
|
local setHome = arg[1].setHome
|
||||||
|
local gameStatus = arg[1].gameStatus
|
||||||
|
|
||||||
|
local seat = GetSeat(self, uid)
|
||||||
|
local info = self._player_info[self:GetPos(seat)]
|
||||||
|
|
||||||
|
if gameStatus == "out" then
|
||||||
|
info:UpdateLineState(0)
|
||||||
|
elseif gameStatus == "enter" then
|
||||||
|
info:UpdateLineState(1)
|
||||||
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 设置能否互动,1允许,0禁止
|
-- 设置能否互动,1允许,0禁止
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,10 @@ function playerDetailView:Init()
|
||||||
self.loader_icon = self._view:GetChild("loader_icon")
|
self.loader_icon = self._view:GetChild("loader_icon")
|
||||||
|
|
||||||
self.btn_boom.onClick:Set(function()
|
self.btn_boom.onClick:Set(function()
|
||||||
|
|
||||||
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
|
_gamectr:SendInteraction(DataManager.SelfUser.account_id, 1, "")
|
||||||
|
|
||||||
local mainView = BaseView.FindView("MainView")
|
local mainView = BaseView.FindView("MainView")
|
||||||
if mainView then
|
if mainView then
|
||||||
mainView:Missile(1, self.player.seat, "ui://Common/boom", "ui://Main_Majiang/Missile_boom")
|
mainView:Missile(1, self.player.seat, "ui://Common/boom", "ui://Main_Majiang/Missile_boom")
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ require "Game.ExtendHotupdate"
|
||||||
require "TableData"
|
require "TableData"
|
||||||
|
|
||||||
local EmojiLuaHelper = import("Game.View.Common.EmojiLuaHelper")
|
local EmojiLuaHelper = import("Game.View.Common.EmojiLuaHelper")
|
||||||
|
import("Game.GroupUpdataHelper")
|
||||||
|
|
||||||
MsgParser = require("MsgParser")
|
MsgParser = require("MsgParser")
|
||||||
|
|
||||||
|
|
@ -64,17 +65,32 @@ function Main()
|
||||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("SIYUAN", "base/static/fonts/SIYUAN.TTF"), null)
|
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("SIYUAN", "base/static/fonts/SIYUAN.TTF"), null)
|
||||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("方正胖娃_GBK", "base/static/fonts/方正胖娃_GBK.ttf"), null)
|
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("方正胖娃_GBK", "base/static/fonts/方正胖娃_GBK.ttf"), null)
|
||||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("方正粗圆_GBK", "base/static/fonts/方正粗圆_GBK.ttf"), null)
|
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("方正粗圆_GBK", "base/static/fonts/方正粗圆_GBK.ttf"), null)
|
||||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("FZCuYuan-M03","base/static/fonts/FZCuYuan-M03.TTF"),null)
|
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("FZCuYuan-M03", "base/static/fonts/FZCuYuan-M03.TTF"),
|
||||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-35-Thin","base/static/fonts/AlibabaPuHuiTi-3-35-Thin.ttf"),null)
|
null)
|
||||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-45-Light","base/static/fonts/AlibabaPuHuiTi-3-45-Light.ttf"),null)
|
FairyGUI.FontManager.RegisterFont(
|
||||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-55-Regular","base/static/fonts/AlibabaPuHuiTi-3-55-Regular.ttf"),null)
|
FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-35-Thin", "base/static/fonts/AlibabaPuHuiTi-3-35-Thin.ttf"), null)
|
||||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-55-RegularL3","base/static/fonts/AlibabaPuHuiTi-3-55-RegularL3.ttf"),null)
|
FairyGUI.FontManager.RegisterFont(
|
||||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-65-Medium","base/static/fonts/AlibabaPuHuiTi-3-65-Medium.ttf"),null)
|
FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-45-Light", "base/static/fonts/AlibabaPuHuiTi-3-45-Light.ttf"), null)
|
||||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-75-SemiBold","base/static/fonts/AlibabaPuHuiTi-3-75-SemiBold.ttf"),null)
|
FairyGUI.FontManager.RegisterFont(
|
||||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-85-Bold","base/static/fonts/AlibabaPuHuiTi-3-85-Bold.ttf"),null)
|
FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-55-Regular", "base/static/fonts/AlibabaPuHuiTi-3-55-Regular.ttf"),
|
||||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-95-ExtraBold","base/static/fonts/AlibabaPuHuiTi-3-95-ExtraBold.ttf"),null)
|
null)
|
||||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-105-Heavy","base/static/fonts/AlibabaPuHuiTi-3-105-Heavy.ttf"),null)
|
FairyGUI.FontManager.RegisterFont(
|
||||||
FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-115-Black","base/static/fonts/AlibabaPuHuiTi-3-115-Black.ttf"),null)
|
FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-55-RegularL3", "base/static/fonts/AlibabaPuHuiTi-3-55-RegularL3.ttf"),
|
||||||
|
null)
|
||||||
|
FairyGUI.FontManager.RegisterFont(
|
||||||
|
FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-65-Medium", "base/static/fonts/AlibabaPuHuiTi-3-65-Medium.ttf"), null)
|
||||||
|
FairyGUI.FontManager.RegisterFont(
|
||||||
|
FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-75-SemiBold", "base/static/fonts/AlibabaPuHuiTi-3-75-SemiBold.ttf"),
|
||||||
|
null)
|
||||||
|
FairyGUI.FontManager.RegisterFont(
|
||||||
|
FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-85-Bold", "base/static/fonts/AlibabaPuHuiTi-3-85-Bold.ttf"), null)
|
||||||
|
FairyGUI.FontManager.RegisterFont(
|
||||||
|
FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-95-ExtraBold", "base/static/fonts/AlibabaPuHuiTi-3-95-ExtraBold.ttf"),
|
||||||
|
null)
|
||||||
|
FairyGUI.FontManager.RegisterFont(
|
||||||
|
FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-105-Heavy", "base/static/fonts/AlibabaPuHuiTi-3-105-Heavy.ttf"), null)
|
||||||
|
FairyGUI.FontManager.RegisterFont(
|
||||||
|
FairyGUI.DynamicFont.New("AlibabaPuHuiTi-3-115-Black", "base/static/fonts/AlibabaPuHuiTi-3-115-Black.ttf"), null)
|
||||||
--FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("HYFangLiJ","base/static/fonts/HYFangLiJ.ttf"),null)
|
--FairyGUI.FontManager.RegisterFont(FairyGUI.DynamicFont.New("HYFangLiJ","base/static/fonts/HYFangLiJ.ttf"),null)
|
||||||
_game_info = json.decode(GameApplication.Instance.GameInfo)
|
_game_info = json.decode(GameApplication.Instance.GameInfo)
|
||||||
--_game_info["login_url"]="http://8.134.59.224:8101/"
|
--_game_info["login_url"]="http://8.134.59.224:8101/"
|
||||||
|
|
@ -283,11 +299,21 @@ end
|
||||||
function OnApplicationPause()
|
function OnApplicationPause()
|
||||||
-- ViewUtil.CloseModalWait()
|
-- ViewUtil.CloseModalWait()
|
||||||
ViewManager.OnApplicationPause()
|
ViewManager.OnApplicationPause()
|
||||||
|
|
||||||
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
|
if _gamectr then
|
||||||
|
_gamectr:FG_Set_Home("out")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--程序从后台切回
|
--程序从后台切回
|
||||||
function OnApplicationActive()
|
function OnApplicationActive()
|
||||||
ViewManager.OnApplicationActive()
|
ViewManager.OnApplicationActive()
|
||||||
|
|
||||||
|
local _gamectr = ControllerManager.GetController(GameController)
|
||||||
|
if _gamectr then
|
||||||
|
_gamectr:FG_Set_Home("enter")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function pt(...)
|
function pt(...)
|
||||||
|
|
|
||||||
|
|
@ -460,6 +460,11 @@ function M:ResetCardType()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:ShowHand(cards)
|
function M:ShowHand(cards)
|
||||||
|
|
||||||
|
--local verticalList =
|
||||||
|
|
||||||
|
--if
|
||||||
|
|
||||||
self._view_handCardList:RemoveChildren()
|
self._view_handCardList:RemoveChildren()
|
||||||
for _,card in pairs(cards) do
|
for _,card in pairs(cards) do
|
||||||
local obj = self._view_handCardList:AddItemFromPool()
|
local obj = self._view_handCardList:AddItemFromPool()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue