增加房主创建房间成功后,将本地的手柄连接设置同步到服务器的机制
This commit is contained in:
parent
ecdfd507d9
commit
13cadd90a0
@ -63,39 +63,29 @@ namespace AxibugEmuOnline.Client.Manager
|
|||||||
|
|
||||||
m_emuCore.SetupScheme();
|
m_emuCore.SetupScheme();
|
||||||
|
|
||||||
m_controllerSetuper = Supporter.GetControllerSetuper();
|
m_controllerSetuper = Supporter.GetControllerSetuper();
|
||||||
|
|
||||||
SetupController();
|
//自动分配0号手柄到0号手柄位
|
||||||
|
m_controllerSetuper.SetConnect(con0ToSlot: 0);
|
||||||
|
Eventer.Instance.PostEvent(EEvent.OnControllerConnectChanged);
|
||||||
|
|
||||||
Eventer.Instance.RegisterEvent(EEvent.OnRoomSlotDataChanged, OnSlotDataChanged);
|
Eventer.Instance.RegisterEvent(EEvent.OnRoomSlotDataChanged, OnSlotDataChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSlotDataChanged()
|
private void OnSlotDataChanged()
|
||||||
{
|
{
|
||||||
SetupController();
|
long selfUID = App.user.userdata.UID;
|
||||||
}
|
uint? con0Slot;
|
||||||
|
uint? con1Slot;
|
||||||
private void SetupController()
|
uint? con2Slot;
|
||||||
{
|
uint? con3Slot;
|
||||||
if (!App.roomMgr.InRoom) //不在房间中,自动分配0号手柄到0号手柄位
|
|
||||||
{
|
App.roomMgr.mineRoomMiniInfo.GetPlayerSlotIdxByUid(selfUID, 0, out con0Slot);
|
||||||
m_controllerSetuper.SetConnect(con0ToSlot: 0);
|
App.roomMgr.mineRoomMiniInfo.GetPlayerSlotIdxByUid(selfUID, 1, out con1Slot);
|
||||||
}
|
App.roomMgr.mineRoomMiniInfo.GetPlayerSlotIdxByUid(selfUID, 2, out con2Slot);
|
||||||
else //在房间中则使用服务器下发的手柄槽位信息分配本地手柄
|
App.roomMgr.mineRoomMiniInfo.GetPlayerSlotIdxByUid(selfUID, 3, out con3Slot);
|
||||||
{
|
|
||||||
long selfUID = App.user.userdata.UID;
|
m_controllerSetuper.SetConnect(con0Slot, con1Slot, con2Slot, con3Slot);
|
||||||
uint? con0Slot;
|
|
||||||
uint? con1Slot;
|
|
||||||
uint? con2Slot;
|
|
||||||
uint? con3Slot;
|
|
||||||
|
|
||||||
App.roomMgr.mineRoomMiniInfo.GetPlayerSlotIdxByUid(selfUID, 0, out con0Slot);
|
|
||||||
App.roomMgr.mineRoomMiniInfo.GetPlayerSlotIdxByUid(selfUID, 1, out con1Slot);
|
|
||||||
App.roomMgr.mineRoomMiniInfo.GetPlayerSlotIdxByUid(selfUID, 2, out con2Slot);
|
|
||||||
App.roomMgr.mineRoomMiniInfo.GetPlayerSlotIdxByUid(selfUID, 3, out con3Slot);
|
|
||||||
|
|
||||||
m_controllerSetuper.SetConnect(con0Slot, con1Slot, con2Slot, con3Slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
Eventer.Instance.PostEvent(EEvent.OnControllerConnectChanged);
|
Eventer.Instance.PostEvent(EEvent.OnControllerConnectChanged);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using AxibugEmuOnline.Client.Event;
|
using AxibugEmuOnline.Client.Event;
|
||||||
using AxibugProtobuf;
|
using AxibugProtobuf;
|
||||||
|
using VirtualNes.Core;
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
namespace AxibugEmuOnline.Client
|
||||||
{
|
{
|
||||||
@ -111,7 +112,19 @@ namespace AxibugEmuOnline.Client
|
|||||||
|
|
||||||
private void OnRoomCreated()
|
private void OnRoomCreated()
|
||||||
{
|
{
|
||||||
m_delayCreateRoom = false;
|
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()
|
private void OnLoggedIn()
|
||||||
|
Loading…
Reference in New Issue
Block a user