forked from sin365/AxibugEmuOnline
代码目录结构调整
This commit is contained in:
parent
5b9cb9bc5e
commit
2dc84085eb
1
.gitignore
vendored
1
.gitignore
vendored
@ -17,3 +17,4 @@
|
|||||||
/virtuanessrc097-master
|
/virtuanessrc097-master
|
||||||
/AxibugEmuOnline.Server/config.cfg
|
/AxibugEmuOnline.Server/config.cfg
|
||||||
/AxibugEmuOnline.Server/bin/
|
/AxibugEmuOnline.Server/bin/
|
||||||
|
/AxibugEmuOnline.Client/.editorconfig
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1476,7 +1476,7 @@ MonoBehaviour:
|
|||||||
m_MinHeight: -1
|
m_MinHeight: -1
|
||||||
m_PreferredWidth: -1
|
m_PreferredWidth: -1
|
||||||
m_PreferredHeight: -1
|
m_PreferredHeight: -1
|
||||||
m_FlexibleWidth: 20
|
m_FlexibleWidth: 5
|
||||||
m_FlexibleHeight: -1
|
m_FlexibleHeight: -1
|
||||||
m_LayoutPriority: 1
|
m_LayoutPriority: 1
|
||||||
--- !u!1 &6998597834321643812
|
--- !u!1 &6998597834321643812
|
||||||
@ -1612,7 +1612,7 @@ RectTransform:
|
|||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 0}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 20, y: 0}
|
m_SizeDelta: {x: 20, y: -20}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!222 &2285457357903007277
|
--- !u!222 &2285457357903007277
|
||||||
CanvasRenderer:
|
CanvasRenderer:
|
||||||
@ -1642,8 +1642,8 @@ MonoBehaviour:
|
|||||||
m_OnCullStateChanged:
|
m_OnCullStateChanged:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0}
|
m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
m_Type: 0
|
m_Type: 1
|
||||||
m_PreserveAspect: 0
|
m_PreserveAspect: 0
|
||||||
m_FillCenter: 1
|
m_FillCenter: 1
|
||||||
m_FillMethod: 4
|
m_FillMethod: 4
|
||||||
@ -1936,16 +1936,16 @@ MonoBehaviour:
|
|||||||
m_Font: {fileID: 12800000, guid: 33a3bdf8f6bd1ec4eba7c4bc58183212, type: 3}
|
m_Font: {fileID: 12800000, guid: 33a3bdf8f6bd1ec4eba7c4bc58183212, type: 3}
|
||||||
m_FontSize: 20
|
m_FontSize: 20
|
||||||
m_FontStyle: 0
|
m_FontStyle: 0
|
||||||
m_BestFit: 0
|
m_BestFit: 1
|
||||||
m_MinSize: 2
|
m_MinSize: 2
|
||||||
m_MaxSize: 40
|
m_MaxSize: 20
|
||||||
m_Alignment: 3
|
m_Alignment: 4
|
||||||
m_AlignByGeometry: 0
|
m_AlignByGeometry: 0
|
||||||
m_RichText: 1
|
m_RichText: 1
|
||||||
m_HorizontalOverflow: 0
|
m_HorizontalOverflow: 0
|
||||||
m_VerticalOverflow: 1
|
m_VerticalOverflow: 1
|
||||||
m_LineSpacing: 1
|
m_LineSpacing: 1
|
||||||
m_Text: 99
|
m_Text: 0
|
||||||
--- !u!114 &5172613673109503612
|
--- !u!114 &5172613673109503612
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -1961,9 +1961,9 @@ MonoBehaviour:
|
|||||||
m_IgnoreLayout: 0
|
m_IgnoreLayout: 0
|
||||||
m_MinWidth: -1
|
m_MinWidth: -1
|
||||||
m_MinHeight: -1
|
m_MinHeight: -1
|
||||||
m_PreferredWidth: -1
|
m_PreferredWidth: 50
|
||||||
m_PreferredHeight: -1
|
m_PreferredHeight: -1
|
||||||
m_FlexibleWidth: 1
|
m_FlexibleWidth: -1
|
||||||
m_FlexibleHeight: -1
|
m_FlexibleHeight: -1
|
||||||
m_LayoutPriority: 1
|
m_LayoutPriority: 1
|
||||||
--- !u!1 &8884391103430529053
|
--- !u!1 &8884391103430529053
|
||||||
|
@ -15800,6 +15800,30 @@ PrefabInstance:
|
|||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_TransformParent: {fileID: 1599240741}
|
m_TransformParent: {fileID: 1599240741}
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
|
- target: {fileID: 231194784974113132, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 231194784974113132, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 231194784974113132, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 231194784974113132, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 231194784974113132, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 231194784974113132, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 321727879374672331, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
- target: {fileID: 321727879374672331, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||||
propertyPath: m_AnchorMax.y
|
propertyPath: m_AnchorMax.y
|
||||||
value: 0
|
value: 0
|
||||||
@ -15832,6 +15856,38 @@ PrefabInstance:
|
|||||||
propertyPath: m_AnchoredPosition.y
|
propertyPath: m_AnchoredPosition.y
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 391878975413806388, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 391878975413806388, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 391878975413806388, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 391878975413806388, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 391878975413806388, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 391878975413806388, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 391878975413806388, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 391878975413806388, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 736530578155193984, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
- target: {fileID: 736530578155193984, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||||
propertyPath: m_AnchorMax.x
|
propertyPath: m_AnchorMax.x
|
||||||
value: 0
|
value: 0
|
||||||
|
@ -1,11 +1,2 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 37a06c0960dd38d48a93b9642efa11f6
|
guid: d8c50df5df7b4834c84889fbdad9eb9b
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
8
AxibugEmuOnline.Client/Assets/Script/AppMain.meta
Normal file
8
AxibugEmuOnline.Client/Assets/Script/AppMain.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bad0f9bf28f67de428fed5977006db1a
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
180
AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs
Normal file
180
AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
using AxibugEmuOnline.Client.Manager;
|
||||||
|
using AxibugEmuOnline.Client.Network;
|
||||||
|
using System.Collections;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Networking;
|
||||||
|
using static AxibugEmuOnline.Client.HttpAPI;
|
||||||
|
using static AxibugEmuOnline.Client.Manager.LogManager;
|
||||||
|
|
||||||
|
namespace AxibugEmuOnline.Client.ClientCore
|
||||||
|
{
|
||||||
|
public static class App
|
||||||
|
{
|
||||||
|
public static string TokenStr;
|
||||||
|
public static string IP;
|
||||||
|
public static int Port;
|
||||||
|
public static LogManager log;
|
||||||
|
public static NetworkHelper network;
|
||||||
|
public static AppLogin login;
|
||||||
|
public static AppChat chat;
|
||||||
|
public static UserDataManager user;
|
||||||
|
//public static AppNetGame netgame;
|
||||||
|
public static AppEmu emu;
|
||||||
|
public static RomLib nesRomLib;
|
||||||
|
public static HttpAPI httpAPI;
|
||||||
|
public static CacheManager CacheMgr;
|
||||||
|
public static AppRoom roomMgr;
|
||||||
|
public static AppSettings settings;
|
||||||
|
public static FilterManager filter;
|
||||||
|
public static AppShare share;
|
||||||
|
#region Mono
|
||||||
|
public static TickLoop tickLoop;
|
||||||
|
private static CoroutineRunner coRunner;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#if UNITY_PSP2
|
||||||
|
public static string PersistentDataPath => "ux0:data/AxibugEmu";
|
||||||
|
#else
|
||||||
|
public static string PersistentDataPath => Application.persistentDataPath;
|
||||||
|
#endif
|
||||||
|
public static void Init(Initer initer)
|
||||||
|
{
|
||||||
|
settings = new AppSettings();
|
||||||
|
|
||||||
|
log = new LogManager();
|
||||||
|
LogManager.OnLog += OnNoSugarNetLog;
|
||||||
|
network = new NetworkHelper();
|
||||||
|
login = new AppLogin();
|
||||||
|
chat = new AppChat();
|
||||||
|
user = new UserDataManager();
|
||||||
|
emu = new AppEmu();
|
||||||
|
//netgame = new AppNetGame();
|
||||||
|
httpAPI = new HttpAPI();
|
||||||
|
nesRomLib = new RomLib(EnumPlatform.NES);
|
||||||
|
CacheMgr = new CacheManager();
|
||||||
|
roomMgr = new AppRoom();
|
||||||
|
share = new AppShare();
|
||||||
|
filter = new FilterManager(initer.m_filterVolume, initer.m_filterPreview, initer.m_xmbBg);
|
||||||
|
var go = new GameObject("[AppAxibugEmuOnline]");
|
||||||
|
GameObject.DontDestroyOnLoad(go);
|
||||||
|
tickLoop = go.AddComponent<TickLoop>();
|
||||||
|
coRunner = go.AddComponent<CoroutineRunner>();
|
||||||
|
|
||||||
|
if (UnityEngine.Application.platform == RuntimePlatform.PSP2)
|
||||||
|
{
|
||||||
|
//PSV 等平台需要手动创建目录
|
||||||
|
PersistentDataPathDir();
|
||||||
|
}
|
||||||
|
|
||||||
|
var importNode = GameObject.Find("IMPORTENT");
|
||||||
|
if (importNode != null) GameObject.DontDestroyOnLoad(importNode);
|
||||||
|
|
||||||
|
StartCoroutine(AppTickFlow());
|
||||||
|
RePullNetInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void PersistentDataPathDir()
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(PersistentDataPath))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(PersistentDataPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IEnumerator AppTickFlow()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
Tick();
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RePullNetInfo()
|
||||||
|
{
|
||||||
|
StartCoroutine(StartNetInit());
|
||||||
|
}
|
||||||
|
|
||||||
|
static IEnumerator StartNetInit()
|
||||||
|
{
|
||||||
|
if (App.network.isConnected)
|
||||||
|
yield break;
|
||||||
|
|
||||||
|
int platform = 0;
|
||||||
|
bool bTest = false;
|
||||||
|
if (bTest)
|
||||||
|
{
|
||||||
|
yield return null;
|
||||||
|
Connect("192.168.0.47", 10492);
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
|
||||||
|
UnityWebRequest request = UnityWebRequest.Get($"{App.httpAPI.WebSiteApi}/CheckStandInfo?platform={platform}&version={Application.version}");
|
||||||
|
yield return request.SendWebRequest();
|
||||||
|
|
||||||
|
if (request.result != UnityWebRequest.Result.Success)
|
||||||
|
yield break;
|
||||||
|
|
||||||
|
App.log.Debug($"ApiResp => {request.downloadHandler.text}");
|
||||||
|
Resp_CheckStandInfo resp = JsonUtility.FromJson<Resp_CheckStandInfo>(request.downloadHandler.text);
|
||||||
|
//需要更新
|
||||||
|
if (resp.needUpdateClient == 1)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return null;
|
||||||
|
//Connect("127.0.0.1", 10492);
|
||||||
|
Connect(resp.serverIp, resp.serverPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Tick()
|
||||||
|
{
|
||||||
|
nesRomLib.ExecuteFetchRomInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Coroutine StartCoroutine(IEnumerator itor)
|
||||||
|
{
|
||||||
|
return coRunner.StartCoroutine(itor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void StopCoroutine(Coroutine cor)
|
||||||
|
{
|
||||||
|
coRunner.StopCoroutine(cor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Connect(string IP, int port)
|
||||||
|
{
|
||||||
|
Task task = new Task(() =>
|
||||||
|
{
|
||||||
|
network.Init(IP, port);
|
||||||
|
});
|
||||||
|
task.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Close()
|
||||||
|
{
|
||||||
|
App.log.Info("停止");
|
||||||
|
}
|
||||||
|
static void OnNoSugarNetLog(int LogLevel, string msg)
|
||||||
|
{
|
||||||
|
E_LogType logType = (E_LogType)LogLevel;
|
||||||
|
switch (logType)
|
||||||
|
{
|
||||||
|
case E_LogType.Debug:
|
||||||
|
case E_LogType.Info:
|
||||||
|
Debug.Log("[AxiEmu]:" + msg);
|
||||||
|
break;
|
||||||
|
case E_LogType.Warning:
|
||||||
|
Debug.LogWarning("[AxiEmu]:" + msg);
|
||||||
|
break;
|
||||||
|
case E_LogType.Error:
|
||||||
|
Debug.LogError("[AxiEmu]:" + msg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
11
AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs.meta
Normal file
11
AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 37a06c0960dd38d48a93b9642efa11f6
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
20
AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs
Normal file
20
AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Rendering.PostProcessing;
|
||||||
|
|
||||||
|
namespace AxibugEmuOnline.Client
|
||||||
|
{
|
||||||
|
public class Initer : MonoBehaviour
|
||||||
|
{
|
||||||
|
public PostProcessVolume m_filterVolume;
|
||||||
|
public CanvasGroup m_filterPreview;
|
||||||
|
public CanvasGroup m_xmbBg;
|
||||||
|
public static string dev_UUID;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
App.Init(this);
|
||||||
|
dev_UUID = SystemInfo.deviceUniqueIdentifier;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs.meta
Normal file
11
AxibugEmuOnline.Client/Assets/Script/AppMain/Initer.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 980f937ad27ad8540afeb8b7f100997e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: -1100
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 437646a1943eaf34dbe1a56eb38494bb
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
456
AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs
Normal file
456
AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs
Normal file
@ -0,0 +1,456 @@
|
|||||||
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
|
using AxibugEmuOnline.Client.Common;
|
||||||
|
using AxibugEmuOnline.Client.Event;
|
||||||
|
using AxibugEmuOnline.Client.Network;
|
||||||
|
using AxibugProtobuf;
|
||||||
|
using AxiReplay;
|
||||||
|
using Google.Protobuf;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace AxibugEmuOnline.Client.Manager
|
||||||
|
{
|
||||||
|
public class AppRoom
|
||||||
|
{
|
||||||
|
public Protobuf_Room_MiniInfo mineRoomMiniInfo { get; private set; } = null;
|
||||||
|
public bool InRoom => mineRoomMiniInfo != null;
|
||||||
|
public bool IsHost => mineRoomMiniInfo?.HostPlayerUID == App.user.userdata.UID;
|
||||||
|
public bool IsScreenProviderUID => mineRoomMiniInfo?.ScreenProviderUID == App.user.userdata.UID;
|
||||||
|
public RoomGameState RoomState => mineRoomMiniInfo.GameState;
|
||||||
|
public int MinePlayerIdx => GetMinePlayerIndex();
|
||||||
|
public int WaitStep { get; private set; } = -1;
|
||||||
|
public byte[] RawData { get; private set; } = null;
|
||||||
|
public NetReplay netReplay { get; private set; }
|
||||||
|
|
||||||
|
Dictionary<int, Protobuf_Room_MiniInfo> dictRoomListID2Info = new Dictionary<int, Protobuf_Room_MiniInfo>();
|
||||||
|
|
||||||
|
struct S_PlayerMiniInfo
|
||||||
|
{
|
||||||
|
public long UID;
|
||||||
|
public string NickName;
|
||||||
|
}
|
||||||
|
|
||||||
|
Protobuf_Room_List _Protobuf_Room_List = new Protobuf_Room_List();
|
||||||
|
Protobuf_Room_Get_Screen _Protobuf_Room_Get_Screen = new Protobuf_Room_Get_Screen();
|
||||||
|
Protobuf_Room_Create _Protobuf_Room_Create = new Protobuf_Room_Create();
|
||||||
|
Protobuf_Room_Join _Protobuf_Room_Join = new Protobuf_Room_Join();
|
||||||
|
Protobuf_Room_Leave _Protobuf_Room_Leave = new Protobuf_Room_Leave();
|
||||||
|
Protobuf_Room_Player_Ready _Protobuf_Room_Player_Ready = new Protobuf_Room_Player_Ready();
|
||||||
|
Protobuf_Room_SinglePlayerInputData _Protobuf_Room_SinglePlayerInputData = new Protobuf_Room_SinglePlayerInputData();
|
||||||
|
Protobuf_Screnn_Frame _Protobuf_Screnn_Frame = new Protobuf_Screnn_Frame();
|
||||||
|
public AppRoom()
|
||||||
|
{
|
||||||
|
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomList, RecvGetRoomList);
|
||||||
|
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomListUpdate, RecvGetRoomListUpdate);
|
||||||
|
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomGetScreen, RecvRoomGetScreen);
|
||||||
|
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomCreate, RecvCreateRoom);
|
||||||
|
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomJoin, RecvJoinRoom);
|
||||||
|
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomLeave, RecvLeavnRoom);
|
||||||
|
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomMyRoomStateChanged, RecvRoomMyRoomStateChange);
|
||||||
|
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomWaitStep, RecvRoom_WaitStep);
|
||||||
|
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomHostPlayerUpdateStateRaw, RecvHostPlayer_UpdateStateRaw);
|
||||||
|
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomSynPlayerInput, RecvHostSyn_RoomFrameAllInputData);
|
||||||
|
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdScreen, OnScreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 房间列表管理
|
||||||
|
bool AddOrUpdateRoomList(Protobuf_Room_MiniInfo roomInfo)
|
||||||
|
{
|
||||||
|
bool bNew = !dictRoomListID2Info.ContainsKey(roomInfo.RoomID);
|
||||||
|
dictRoomListID2Info[roomInfo.RoomID] = roomInfo;
|
||||||
|
return bNew;
|
||||||
|
}
|
||||||
|
bool RemoveRoomList(int roomId)
|
||||||
|
{
|
||||||
|
if (dictRoomListID2Info.ContainsKey(roomId))
|
||||||
|
{
|
||||||
|
dictRoomListID2Info.Remove(roomId);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取单个房间MiniInfo
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="roomId"></param>
|
||||||
|
/// <param name="MiniInfo"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool GetRoomListMiniInfo(int roomId, out Protobuf_Room_MiniInfo MiniInfo)
|
||||||
|
{
|
||||||
|
if (dictRoomListID2Info.ContainsKey(roomId))
|
||||||
|
{
|
||||||
|
MiniInfo = dictRoomListID2Info[roomId];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
MiniInfo = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public List<Protobuf_Room_MiniInfo> GetRoomList()
|
||||||
|
{
|
||||||
|
List<Protobuf_Room_MiniInfo> result = new List<Protobuf_Room_MiniInfo>();
|
||||||
|
foreach (var item in dictRoomListID2Info)
|
||||||
|
{
|
||||||
|
result.Add(item.Value);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Replay
|
||||||
|
public void InitRePlay()
|
||||||
|
{
|
||||||
|
netReplay = new NetReplay();
|
||||||
|
netReplay.ResetData();
|
||||||
|
}
|
||||||
|
public void ReleaseRePlay()
|
||||||
|
{
|
||||||
|
netReplay.ResetData();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 房间管理
|
||||||
|
int GetMinePlayerIndex()
|
||||||
|
{
|
||||||
|
if (mineRoomMiniInfo == null)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (mineRoomMiniInfo.Player1UID == App.user.userdata.UID)
|
||||||
|
return 0;
|
||||||
|
if (mineRoomMiniInfo.Player2UID == App.user.userdata.UID)
|
||||||
|
return 1;
|
||||||
|
if (mineRoomMiniInfo.Player3UID == App.user.userdata.UID)
|
||||||
|
return 2;
|
||||||
|
if (mineRoomMiniInfo.Player4UID == App.user.userdata.UID)
|
||||||
|
return 3;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
long[] GetRoom4PlayerUIDs()
|
||||||
|
{
|
||||||
|
if (mineRoomMiniInfo == null)
|
||||||
|
return null;
|
||||||
|
long[] result = new long[4];
|
||||||
|
if (mineRoomMiniInfo.Player1UID > 0)
|
||||||
|
result[0] = mineRoomMiniInfo.Player1UID;
|
||||||
|
if (mineRoomMiniInfo.Player2UID > 0)
|
||||||
|
result[1] = mineRoomMiniInfo.Player2UID;
|
||||||
|
if (mineRoomMiniInfo.Player3UID > 0)
|
||||||
|
result[2] = mineRoomMiniInfo.Player3UID;
|
||||||
|
if (mineRoomMiniInfo.Player4UID > 0)
|
||||||
|
result[3] = mineRoomMiniInfo.Player4UID;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
S_PlayerMiniInfo[] GetRoom4PlayerMiniInfos()
|
||||||
|
{
|
||||||
|
if (mineRoomMiniInfo == null)
|
||||||
|
return null;
|
||||||
|
S_PlayerMiniInfo[] result = new S_PlayerMiniInfo[4];
|
||||||
|
if (mineRoomMiniInfo.Player1UID > 0)
|
||||||
|
{
|
||||||
|
result[0].UID = mineRoomMiniInfo.Player1UID;
|
||||||
|
result[0].NickName = mineRoomMiniInfo.Player1NickName;
|
||||||
|
}
|
||||||
|
if (mineRoomMiniInfo.Player2UID > 0)
|
||||||
|
{
|
||||||
|
result[1].UID = mineRoomMiniInfo.Player2UID;
|
||||||
|
result[1].NickName = mineRoomMiniInfo.Player2NickName;
|
||||||
|
}
|
||||||
|
if (mineRoomMiniInfo.Player3UID > 0)
|
||||||
|
{
|
||||||
|
result[2].UID = mineRoomMiniInfo.Player3UID;
|
||||||
|
result[2].NickName = mineRoomMiniInfo.Player3NickName;
|
||||||
|
}
|
||||||
|
if (mineRoomMiniInfo.Player4UID > 0)
|
||||||
|
{
|
||||||
|
result[3].UID = mineRoomMiniInfo.Player4UID;
|
||||||
|
result[3].NickName = mineRoomMiniInfo.Player4NickName;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取所有房间列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ChatMsg"></param>
|
||||||
|
public void SendGetRoomList()
|
||||||
|
{
|
||||||
|
App.log.Info("拉取房间列表");
|
||||||
|
App.network.SendToServer((int)CommandID.CmdRoomList, ProtoBufHelper.Serizlize(_Protobuf_Room_List));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取所有房间列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reqData"></param>
|
||||||
|
void RecvGetRoomList(byte[] reqData)
|
||||||
|
{
|
||||||
|
App.log.Info("取得完整房间列表");
|
||||||
|
Protobuf_Room_List_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_List_RESP>(reqData);
|
||||||
|
for (int i = 0; i < msg.RoomMiniInfoList.Count; i++)
|
||||||
|
AddOrUpdateRoomList(msg.RoomMiniInfoList[i]);
|
||||||
|
Eventer.Instance.PostEvent(EEvent.OnRoomListAllUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取单个列表更新
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reqData"></param>
|
||||||
|
void RecvGetRoomListUpdate(byte[] reqData)
|
||||||
|
{
|
||||||
|
App.log.Debug("单个房间状态更新");
|
||||||
|
Protobuf_Room_Update_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Update_RESP>(reqData);
|
||||||
|
if (msg.UpdateType == 0)
|
||||||
|
{
|
||||||
|
if (AddOrUpdateRoomList(msg.RoomMiniInfo))
|
||||||
|
{
|
||||||
|
Eventer.Instance.PostEvent(EEvent.OnRoomListSingleAdd, msg.RoomMiniInfo.RoomID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Eventer.Instance.PostEvent(EEvent.OnRoomListSingleUpdate, msg.RoomMiniInfo.RoomID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RemoveRoomList(msg.RoomMiniInfo.RoomID);
|
||||||
|
Eventer.Instance.PostEvent(EEvent.OnRoomListSingleClose, msg.RoomMiniInfo.RoomID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取房间画面快照
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="RoomID"></param>
|
||||||
|
public void SendGetRoomScreen(int RoomID)
|
||||||
|
{
|
||||||
|
_Protobuf_Room_Get_Screen.RoomID = RoomID;
|
||||||
|
App.log.Info($"获取房间画面快照");
|
||||||
|
App.network.SendToServer((int)CommandID.CmdRoomGetScreen, ProtoBufHelper.Serizlize(_Protobuf_Room_Get_Screen));
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取单个房间画面
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reqData"></param>
|
||||||
|
void RecvRoomGetScreen(byte[] reqData)
|
||||||
|
{
|
||||||
|
App.log.Debug("单个房间状态更新");
|
||||||
|
Protobuf_Room_Get_Screen_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Get_Screen_RESP>(reqData);
|
||||||
|
//解压
|
||||||
|
byte[] data = Helper.DecompressByteArray(msg.RawBitmap.ToArray());
|
||||||
|
Eventer.Instance.PostEvent(EEvent.OnRoomGetRoomScreen, msg.RoomID, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建房间
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="GameRomID"></param>
|
||||||
|
/// <param name="JoinPlayerIdx"></param>
|
||||||
|
/// <param name="GameRomHash"></param>
|
||||||
|
public void SendCreateRoom(int GameRomID, int JoinPlayerIdx, string GameRomHash = null)
|
||||||
|
{
|
||||||
|
_Protobuf_Room_Create.JoinPlayerIdx = JoinPlayerIdx;
|
||||||
|
_Protobuf_Room_Create.GameRomID = GameRomID;
|
||||||
|
_Protobuf_Room_Create.GameRomHash = GameRomHash;
|
||||||
|
App.log.Info($"创建房间");
|
||||||
|
App.network.SendToServer((int)CommandID.CmdRoomCreate, ProtoBufHelper.Serizlize(_Protobuf_Room_Create));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建房间成功
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reqData"></param>
|
||||||
|
void RecvCreateRoom(byte[] reqData)
|
||||||
|
{
|
||||||
|
App.log.Debug("创建房间成功");
|
||||||
|
Protobuf_Room_Create_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Create_RESP>(reqData);
|
||||||
|
mineRoomMiniInfo = msg.RoomMiniInfo;
|
||||||
|
InitRePlay();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建房间
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="GameRomID"></param>
|
||||||
|
/// <param name="JoinPlayerIdx"></param>
|
||||||
|
/// <param name="GameRomHash"></param>
|
||||||
|
public void SendJoinRoom(int RoomID, int JoinPlayerIdx)
|
||||||
|
{
|
||||||
|
_Protobuf_Room_Join.RoomID = RoomID;
|
||||||
|
_Protobuf_Room_Join.PlayerNum = JoinPlayerIdx;
|
||||||
|
App.log.Info($"创建房间");
|
||||||
|
App.network.SendToServer((int)CommandID.CmdRoomJoin, ProtoBufHelper.Serizlize(_Protobuf_Room_Join));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加入房间成功
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reqData"></param>
|
||||||
|
void RecvJoinRoom(byte[] reqData)
|
||||||
|
{
|
||||||
|
App.log.Debug("加入房间成功");
|
||||||
|
Protobuf_Room_Join_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Join_RESP>(reqData);
|
||||||
|
mineRoomMiniInfo = msg.RoomMiniInfo;
|
||||||
|
InitRePlay();
|
||||||
|
Eventer.Instance.PostEvent(EEvent.OnMineJoinRoom);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 离开房间
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="RoomID"></param>
|
||||||
|
public void SendLeavnRoom()
|
||||||
|
{
|
||||||
|
if (!InRoom)
|
||||||
|
return;
|
||||||
|
_Protobuf_Room_Leave.RoomID = mineRoomMiniInfo.RoomID;
|
||||||
|
App.log.Info($"LeavnRoom");
|
||||||
|
App.network.SendToServer((int)CommandID.CmdRoomLeave, ProtoBufHelper.Serizlize(_Protobuf_Room_Leave));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 离开房间成功
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reqData"></param>
|
||||||
|
void RecvLeavnRoom(byte[] reqData)
|
||||||
|
{
|
||||||
|
App.log.Debug("离开房间成功");
|
||||||
|
Protobuf_Room_Leave_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Leave_RESP>(reqData);
|
||||||
|
ReleaseRePlay();
|
||||||
|
mineRoomMiniInfo = null;
|
||||||
|
Eventer.Instance.PostEvent(EEvent.OnMineLeavnRoom);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RecvRoomMyRoomStateChange(byte[] reqData)
|
||||||
|
{
|
||||||
|
Protobuf_Room_MyRoom_State_Change msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_MyRoom_State_Change>(reqData);
|
||||||
|
long[] oldRoomPlayer = GetRoom4PlayerUIDs();
|
||||||
|
mineRoomMiniInfo = msg.RoomMiniInfo;
|
||||||
|
long[] newRoomPlayer = GetRoom4PlayerUIDs();
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
long OldPlayer = oldRoomPlayer[i];
|
||||||
|
long NewPlayer = newRoomPlayer[i];
|
||||||
|
if (OldPlayer == NewPlayer)
|
||||||
|
continue;
|
||||||
|
//位置之前有人,但是离开了
|
||||||
|
if (OldPlayer > 0)
|
||||||
|
{
|
||||||
|
Eventer.Instance.PostEvent(EEvent.OnOtherPlayerLeavnRoom, i, OldPlayer);
|
||||||
|
if (NewPlayer > 0)//而且害换了一个玩家
|
||||||
|
Eventer.Instance.PostEvent(EEvent.OnOtherPlayerJoinRoom, i, NewPlayer);
|
||||||
|
}
|
||||||
|
else //之前没人
|
||||||
|
Eventer.Instance.PostEvent(EEvent.OnOtherPlayerJoinRoom, i, NewPlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 上报即时存档
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="RoomID"></param>
|
||||||
|
public void SendHostRaw(byte[] RawData)
|
||||||
|
{
|
||||||
|
//压缩
|
||||||
|
byte[] compressRawData = Helper.CompressByteArray(RawData);
|
||||||
|
Protobuf_Room_HostPlayer_UpdateStateRaw msg = new Protobuf_Room_HostPlayer_UpdateStateRaw()
|
||||||
|
{
|
||||||
|
LoadStateRaw = Google.Protobuf.ByteString.CopyFrom(compressRawData)
|
||||||
|
};
|
||||||
|
App.log.Info($"上报即时存档数据 原数据大小:{RawData.Length},压缩后;{compressRawData.Length}");
|
||||||
|
App.network.SendToServer((int)CommandID.CmdRoomHostPlayerUpdateStateRaw, ProtoBufHelper.Serizlize(msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
void RecvRoom_WaitStep(byte[] reqData)
|
||||||
|
{
|
||||||
|
Protobuf_Room_WaitStep_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_WaitStep_RESP>(reqData);
|
||||||
|
if (WaitStep != msg.WaitStep)
|
||||||
|
{
|
||||||
|
WaitStep = msg.WaitStep;
|
||||||
|
if (WaitStep == 1)
|
||||||
|
{
|
||||||
|
byte[] decompressRawData = Helper.DecompressByteArray(msg.LoadStateRaw.ToByteArray());
|
||||||
|
App.log.Info($"收到即时存档数据 解压后;{decompressRawData.Length}");
|
||||||
|
RawData = decompressRawData;
|
||||||
|
ReleaseRePlay();
|
||||||
|
}
|
||||||
|
Eventer.Instance.PostEvent(EEvent.OnRoomWaitStepChange, WaitStep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RecvHostPlayer_UpdateStateRaw(byte[] reqData)
|
||||||
|
{
|
||||||
|
Protobuf_Room_HostPlayer_UpdateStateRaw_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_HostPlayer_UpdateStateRaw_RESP>(reqData);
|
||||||
|
App.log.Info($"鸡翅孙当上报成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 即时存档加载完毕
|
||||||
|
/// </summary>
|
||||||
|
public void SendRoomPlayerReady()
|
||||||
|
{
|
||||||
|
App.log.Debug("上报准备完毕");
|
||||||
|
App.network.SendToServer((int)CommandID.CmdRoomPlayerReady, ProtoBufHelper.Serizlize(_Protobuf_Room_Player_Ready));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 同步上行
|
||||||
|
/// </summary>
|
||||||
|
public void SendRoomSingelPlayerInput(uint FrameID, uint InputData)
|
||||||
|
{
|
||||||
|
_Protobuf_Room_SinglePlayerInputData.FrameID = FrameID;
|
||||||
|
_Protobuf_Room_SinglePlayerInputData.InputData = InputData;
|
||||||
|
App.network.SendToServer((int)CommandID.CmdRoomSingelPlayerInput, ProtoBufHelper.Serizlize(_Protobuf_Room_SinglePlayerInputData));
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong TestAllData = 0;
|
||||||
|
void RecvHostSyn_RoomFrameAllInputData(byte[] reqData)
|
||||||
|
{
|
||||||
|
Protobuf_Room_Syn_RoomFrameAllInputData msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Syn_RoomFrameAllInputData>(reqData);
|
||||||
|
if (TestAllData != msg.InputData)
|
||||||
|
{
|
||||||
|
TestAllData = msg.InputData;
|
||||||
|
App.log.Debug($"ServerFrameID->{msg.ServerFrameID} FrameID->{msg.FrameID} ClientFrame->{netReplay.mCurrClientFrameIdx} InputData->{msg.InputData}");
|
||||||
|
}
|
||||||
|
netReplay.InData(new ReplayStep() { FrameStartID = (int)msg.FrameID, InPut = msg.InputData }, (int)msg.ServerFrameID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendScreen(byte[] RenderBuffer)
|
||||||
|
{
|
||||||
|
//压缩
|
||||||
|
byte[] comData = Helper.CompressByteArray(RenderBuffer);
|
||||||
|
_Protobuf_Screnn_Frame.FrameID = 0;
|
||||||
|
_Protobuf_Screnn_Frame.RawBitmap = ByteString.CopyFrom(comData);
|
||||||
|
App.network.SendToServer((int)CommandID.CmdScreen, ProtoBufHelper.Serizlize(_Protobuf_Screnn_Frame));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnScreen(byte[] reqData)
|
||||||
|
{
|
||||||
|
Protobuf_Screnn_Frame msg = ProtoBufHelper.DeSerizlize<Protobuf_Screnn_Frame>(reqData);
|
||||||
|
//解压
|
||||||
|
byte[] data = Helper.DecompressByteArray(msg.RawBitmap.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class RoomEX
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取房间空闲席位下标 (返回True表示由余位)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="roomMiniInfo"></param>
|
||||||
|
/// <param name="freeSlots"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool GetFreeSlot(this Protobuf_Room_MiniInfo roomMiniInfo, out int[] freeSlots)
|
||||||
|
{
|
||||||
|
List<int> temp = new List<int>();
|
||||||
|
if (roomMiniInfo.Player1UID <= 0) temp.Add(0);
|
||||||
|
if (roomMiniInfo.Player2UID <= 0) temp.Add(1);
|
||||||
|
if (roomMiniInfo.Player3UID <= 0) temp.Add(2);
|
||||||
|
if (roomMiniInfo.Player4UID <= 0) temp.Add(3);
|
||||||
|
freeSlots = temp.ToArray();
|
||||||
|
return freeSlots.Length > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 32566452eb52f484d92619b539b1d70f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user