Compare commits
No commits in common. "f04c7e543d00daec3799d7c1cbc0c89101815c2f" and "54516d9482d1a568d0d7625f490ce6e7c31153dd" have entirely different histories.
f04c7e543d
...
54516d9482
@ -707,13 +707,13 @@ namespace AxibugEmuOnline.Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool GetSlotDataByUID(long uid, out Dictionary<uint, uint> slotIdx2JoyIdx)
|
public Dictionary<uint, uint> GetSlotDataByUID(long uid)
|
||||||
{
|
{
|
||||||
slotIdx2JoyIdx = new Dictionary<uint, uint>();
|
Dictionary<uint, uint> slotIdx2JoyIdx = new Dictionary<uint, uint>();
|
||||||
var dataarr = PlayerSlot.Where(w => w.UID == uid).ToArray();
|
var dataarr = PlayerSlot.Where(w => w.UID == uid).ToArray();
|
||||||
foreach (var slot in dataarr)
|
foreach (var slot in dataarr)
|
||||||
slotIdx2JoyIdx[slot.SlotIdx] = slot.LocalJoyIdx;
|
slotIdx2JoyIdx[slot.SlotIdx] = slot.LocalJoyIdx;
|
||||||
return slotIdx2JoyIdx.Count > 0;
|
return slotIdx2JoyIdx;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 按照SlotIdx设置Input
|
/// 按照SlotIdx设置Input
|
||||||
@ -738,7 +738,7 @@ namespace AxibugEmuOnline.Server
|
|||||||
var dataarr = PlayerSlot.Where(w => w.UID == uid).ToArray();
|
var dataarr = PlayerSlot.Where(w => w.UID == uid).ToArray();
|
||||||
foreach (var slot in dataarr)
|
foreach (var slot in dataarr)
|
||||||
{
|
{
|
||||||
slot.Init(slot.SlotIdx);
|
dataarr[slot.SlotIdx].Init(slot.SlotIdx);
|
||||||
ClearInputDataBySlotIdx(slot.SlotIdx);
|
ClearInputDataBySlotIdx(slot.SlotIdx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -832,7 +832,7 @@ namespace AxibugEmuOnline.Server
|
|||||||
|
|
||||||
public void SetPlayerSlotData(ClientInfo _c, ref readonly Dictionary<uint, uint> newSlotIdx2JoyIdx)
|
public void SetPlayerSlotData(ClientInfo _c, ref readonly Dictionary<uint, uint> newSlotIdx2JoyIdx)
|
||||||
{
|
{
|
||||||
GetSlotDataByUID(_c.UID, out Dictionary<uint, uint> oldSlotIdx2JoyIdx);
|
Dictionary<uint, uint> oldSlotIdx2JoyIdx = GetSlotDataByUID(_c.UID);
|
||||||
HashSet<uint> diffSlotIdxs = ObjectPoolAuto.AcquireSet<uint>();// new HashSet<uint>();
|
HashSet<uint> diffSlotIdxs = ObjectPoolAuto.AcquireSet<uint>();// new HashSet<uint>();
|
||||||
foreach (var old in oldSlotIdx2JoyIdx)
|
foreach (var old in oldSlotIdx2JoyIdx)
|
||||||
{
|
{
|
||||||
@ -1132,32 +1132,6 @@ namespace AxibugEmuOnline.Server
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//房主离线,自动选择延迟最低另一名玩家做房主
|
|
||||||
if (!GetSlotDataByUID(this.HostUID, out Dictionary<uint, uint> slotIdx2JoyIdx))
|
|
||||||
{
|
|
||||||
List<ClientInfo> userlist = ObjectPoolAuto.AcquireList<ClientInfo>();
|
|
||||||
GetAllPlayerClientList(ref userlist);
|
|
||||||
if (userlist.Count > 0)
|
|
||||||
{
|
|
||||||
ClientInfo? client = userlist.OrderBy(w => w.AveNetDelay).FirstOrDefault();
|
|
||||||
this.HostUID = client.UID;
|
|
||||||
AppSrv.g_Log.DebugCmd($"更换房主为{this.HostUID}");
|
|
||||||
bChanged = true;
|
|
||||||
}
|
|
||||||
ObjectPoolAuto.Release(userlist);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.GameState > RoomGameState.OnlyHost && newPlayerCount == 1)
|
|
||||||
{
|
|
||||||
this.GameState = RoomGameState.OnlyHost;
|
|
||||||
AppSrv.g_Log.DebugCmd("回到OnlyHost状态");
|
|
||||||
bChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return bChanged;
|
return bChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user