增加房主创建房间成功后,将本地的手柄连接设置同步到服务器的机制
This commit is contained in:
parent
ecdfd507d9
commit
13cadd90a0
@ -65,23 +65,14 @@ namespace AxibugEmuOnline.Client.Manager
|
||||
|
||||
m_controllerSetuper = Supporter.GetControllerSetuper();
|
||||
|
||||
SetupController();
|
||||
//自动分配0号手柄到0号手柄位
|
||||
m_controllerSetuper.SetConnect(con0ToSlot: 0);
|
||||
Eventer.Instance.PostEvent(EEvent.OnControllerConnectChanged);
|
||||
|
||||
Eventer.Instance.RegisterEvent(EEvent.OnRoomSlotDataChanged, OnSlotDataChanged);
|
||||
}
|
||||
|
||||
private void OnSlotDataChanged()
|
||||
{
|
||||
SetupController();
|
||||
}
|
||||
|
||||
private void SetupController()
|
||||
{
|
||||
if (!App.roomMgr.InRoom) //不在房间中,自动分配0号手柄到0号手柄位
|
||||
{
|
||||
m_controllerSetuper.SetConnect(con0ToSlot: 0);
|
||||
}
|
||||
else //在房间中则使用服务器下发的手柄槽位信息分配本地手柄
|
||||
{
|
||||
long selfUID = App.user.userdata.UID;
|
||||
uint? con0Slot;
|
||||
@ -95,7 +86,6 @@ namespace AxibugEmuOnline.Client.Manager
|
||||
App.roomMgr.mineRoomMiniInfo.GetPlayerSlotIdxByUid(selfUID, 3, out con3Slot);
|
||||
|
||||
m_controllerSetuper.SetConnect(con0Slot, con1Slot, con2Slot, con3Slot);
|
||||
}
|
||||
|
||||
Eventer.Instance.PostEvent(EEvent.OnControllerConnectChanged);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugEmuOnline.Client.Event;
|
||||
using AxibugProtobuf;
|
||||
using VirtualNes.Core;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
@ -110,8 +111,20 @@ namespace AxibugEmuOnline.Client
|
||||
}
|
||||
|
||||
private void OnRoomCreated()
|
||||
{
|
||||
if (m_delayCreateRoom)
|
||||
{
|
||||
m_delayCreateRoom = false;
|
||||
//延迟创建房间成功后,同步本地手柄连接状态
|
||||
Dictionary<uint, uint> temp = new Dictionary<uint, uint>();
|
||||
var setuper = Supporter.GetControllerSetuper();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
var joyIndex = setuper.GetSlotConnectingController(i);
|
||||
if (joyIndex != null) temp[(uint)i] = (uint)joyIndex.Value;
|
||||
}
|
||||
App.roomMgr.SendChangePlaySlotIdxWithJoyIdx(temp);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLoggedIn()
|
||||
|
Loading…
Reference in New Issue
Block a user