This commit is contained in:
ALIENJACK\alien 2024-12-25 20:48:37 +08:00
commit d9a5f40190
3 changed files with 1139 additions and 1124 deletions

View File

@ -34,6 +34,11 @@ namespace AxibugEmuOnline.Client.ClientCore
#region Mono #region Mono
public static TickLoop tickLoop; public static TickLoop tickLoop;
private static CoroutineRunner coRunner; private static CoroutineRunner coRunner;
#if UNITY_PSP2
public static SonyVitaCommonDialog sonyVitaCommonDialog;
#endif
#endregion #endregion
#if UNITY_PSP2 && !UNITY_EDITOR //PSV真机 #if UNITY_PSP2 && !UNITY_EDITOR //PSV真机
@ -43,9 +48,9 @@ namespace AxibugEmuOnline.Client.ClientCore
#endif #endif
public static void Init(Initer initer, bool isTest = false, string testSrvIP = "") public static void Init(Initer initer, bool isTest = false, string testSrvIP = "")
{ {
//其他平台必要的初始化
if (UnityEngine.Application.platform == RuntimePlatform.PSP2) if (UnityEngine.Application.platform == RuntimePlatform.PSP2)
{ {
//PSV 等平台需要手动创建目录
PSP2Init(); PSP2Init();
} }
@ -88,9 +93,12 @@ namespace AxibugEmuOnline.Client.ClientCore
Directory.CreateDirectory(PersistentDataPath); Directory.CreateDirectory(PersistentDataPath);
#if UNITY_PSP2 #if UNITY_PSP2
//创建PSV弹窗UI
sonyVitaCommonDialog = new GameObject().AddComponent<SonyVitaCommonDialog>();
//释放解码 FMV的26M内存一般游戏用不上PSP才用那破玩意儿 //释放解码 FMV的26M内存一般游戏用不上PSP才用那破玩意儿
UnityEngine.PSVita.PSVitaVideoPlayer.TransferMemToMonoHeap(); UnityEngine.PSVita.PSVitaVideoPlayer.TransferMemToMonoHeap();
#endif #endif
} }
private static IEnumerator AppTickFlow() private static IEnumerator AppTickFlow()

View File

@ -13,8 +13,8 @@ public class SonyVitaCommonDialog : MonoBehaviour
public void ShowPSVitaIME(Action<string> callback, string placeHolder, string defaultText) public void ShowPSVitaIME(Action<string> callback, string placeHolder, string defaultText)
{ {
resultAct = callback;
#if UNITY_PSP2 #if UNITY_PSP2
resultAct = callback;
Sony.Vita.Dialog.Ime.ImeDialogParams info = new Sony.Vita.Dialog.Ime.ImeDialogParams(); Sony.Vita.Dialog.Ime.ImeDialogParams info = new Sony.Vita.Dialog.Ime.ImeDialogParams();
// Set supported languages, 'or' flags together or set to 0 to support all languages. // Set supported languages, 'or' flags together or set to 0 to support all languages.
@ -45,6 +45,7 @@ public class SonyVitaCommonDialog : MonoBehaviour
if (result.result == Sony.Vita.Dialog.Ime.EnumImeDialogResult.RESULT_OK) if (result.result == Sony.Vita.Dialog.Ime.EnumImeDialogResult.RESULT_OK)
{ {
resultAct.Invoke(result); resultAct.Invoke(result);
resultAct = null;
} }
} }
#endif #endif

View File

@ -373,10 +373,12 @@ namespace AxibugEmuOnline.Server
ErrorCode errcode = ErrorCode.ErrorOk; ErrorCode errcode = ErrorCode.ErrorOk;
Data_RoomData room = GetRoomData(_c.RoomState.RoomID); Data_RoomData room = GetRoomData(_c.RoomState.RoomID);
if (room == null) if (room == null)
errcode = ErrorCode.ErrorRoomNotFound;
if (errcode == ErrorCode.ErrorOk)
{ {
errcode = ErrorCode.ErrorRoomNotFound;
AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomChangePlayerWithJoy, (int)errcode, ProtoBufHelper.Serizlize(resp));
return;
}
Dictionary<uint, uint> newSlotIdx2JoyIdx = new Dictionary<uint, uint>(); Dictionary<uint, uint> newSlotIdx2JoyIdx = new Dictionary<uint, uint>();
foreach (var slotinfo in msg.SlotWithJoy) foreach (var slotinfo in msg.SlotWithJoy)
{ {
@ -384,16 +386,20 @@ namespace AxibugEmuOnline.Server
if (room.GetPlayerUIDByIdx((uint)slotinfo.PlayerSlotIdx, out long UID)) if (room.GetPlayerUIDByIdx((uint)slotinfo.PlayerSlotIdx, out long UID))
{ {
//且人不是自己,则不允许换位 //且人不是自己,则不允许换位
if(UID != _c.UID) if (UID != _c.UID)
errcode = ErrorCode.ErrorRoomSlotAlreadlyHadPlayer; break; {
errcode = ErrorCode.ErrorRoomSlotAlreadlyHadPlayer;
AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomChangePlayerWithJoy, (int)errcode, ProtoBufHelper.Serizlize(resp));
return;
}
} }
newSlotIdx2JoyIdx[(uint)slotinfo.PlayerSlotIdx] = (uint)slotinfo.PlayerLocalJoyIdx; newSlotIdx2JoyIdx[(uint)slotinfo.PlayerSlotIdx] = (uint)slotinfo.PlayerLocalJoyIdx;
} }
room.SetPlayerSlotData(_c, ref newSlotIdx2JoyIdx);
room.SetPlayerSlotData(_c,ref newSlotIdx2JoyIdx); AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomChangePlayerWithJoy, (int)errcode, ProtoBufHelper.Serizlize(resp));
}
AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomMyRoomStateChanged, (int)errcode, ProtoBufHelper.Serizlize(resp)); Protobuf_Room_MyRoom_State_Change(room.RoomID);
} }
public void OnHostPlayerUpdateStateRaw(Socket sk, byte[] reqData) public void OnHostPlayerUpdateStateRaw(Socket sk, byte[] reqData)