新增ping

This commit is contained in:
sin365 2024-09-13 10:07:24 +08:00
parent 9fcd5d3c3e
commit a4caf1d3ad
13 changed files with 621 additions and 203 deletions

View File

@ -1,8 +1,10 @@
using AxibugEmuOnline.Client.Manager; using AxibugEmuOnline.Client.Manager;
using AxibugEmuOnline.Client.Network; using AxibugEmuOnline.Client.Network;
using System;
using System.Collections; using System.Collections;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using UnityEngine.Networking;
using static AxibugEmuOnline.Client.HttpAPI;
namespace AxibugEmuOnline.Client.ClientCore namespace AxibugEmuOnline.Client.ClientCore
{ {
@ -24,7 +26,11 @@ namespace AxibugEmuOnline.Client.ClientCore
public static AppSceneLoader SceneLoader; public static AppSceneLoader SceneLoader;
public static AppRoom roomMgr; public static AppRoom roomMgr;
#region Mono
public static TickLoop tickLoop;
private static CoroutineRunner coRunner; private static CoroutineRunner coRunner;
#endregion
public static string PersistentDataPath => Application.persistentDataPath; public static string PersistentDataPath => Application.persistentDataPath;
@ -47,9 +53,11 @@ namespace AxibugEmuOnline.Client.ClientCore
var go = new GameObject("[AppAxibugEmuOnline]"); var go = new GameObject("[AppAxibugEmuOnline]");
GameObject.DontDestroyOnLoad(go); GameObject.DontDestroyOnLoad(go);
tickLoop = go.AddComponent<TickLoop>();
coRunner = go.AddComponent<CoroutineRunner>(); coRunner = go.AddComponent<CoroutineRunner>();
StartCoroutine(AppTickFlow()); StartCoroutine(AppTickFlow());
RePullNetInfo();
} }
private static IEnumerator AppTickFlow() private static IEnumerator AppTickFlow()
@ -61,6 +69,37 @@ namespace AxibugEmuOnline.Client.ClientCore
} }
} }
public static void RePullNetInfo()
{
StartCoroutine(StartNetInit());
}
static IEnumerator StartNetInit()
{
if (App.network.isConnected)
yield break;
int platform = 0;
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() private static void Tick()
{ {
nesRomLib.ExecuteFetchRomInfo(); nesRomLib.ExecuteFetchRomInfo();
@ -76,9 +115,13 @@ namespace AxibugEmuOnline.Client.ClientCore
coRunner.StopCoroutine(cor); coRunner.StopCoroutine(cor);
} }
public static bool Connect(string IP, int port) public static void Connect(string IP, int port)
{ {
return network.Init(IP, port); Task task = new Task(() =>
{
network.Init(IP, port);
});
task.Start();
} }
public static void Close() public static void Close()

View File

@ -3,12 +3,16 @@ using AxibugEmuOnline.Client.Common;
using AxibugEmuOnline.Client.Network; using AxibugEmuOnline.Client.Network;
using AxibugProtobuf; using AxibugProtobuf;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
namespace AxibugEmuOnline.Client.Manager namespace AxibugEmuOnline.Client.Manager
{ {
public class AppLogin public class AppLogin
{ {
static string LastLoginGuid = ""; static string LastLoginGuid = "";
public AppLogin() public AppLogin()
{ {
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdLogin, RecvLoginMsg); NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdLogin, RecvLoginMsg);
@ -42,5 +46,6 @@ namespace AxibugEmuOnline.Client.Manager
App.log.Info("登录失败"); App.log.Info("登录失败");
} }
} }
} }
} }

View File

@ -1,45 +0,0 @@
using AxibugEmuOnline.Client.ClientCore;
using AxibugEmuOnline.Client.Common;
using AxibugEmuOnline.Client.Network;
using AxibugProtobuf;
using Google.Protobuf;
using System.Linq;
namespace AxibugEmuOnline.Client.Manager
{
public class AppNetGame
{
int CurrRoomID;
int[] _palette;
public int[] _renderbuffer { private set; get; }
public AppNetGame()
{
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdScreen, OnScreen);
}
Protobuf_Screnn_Frame _Protobuf_Screnn_Frame = new Protobuf_Screnn_Frame();
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);
lock (_renderbuffer)
{
byte[] data = Helper.DecompressByteArray(msg.RawBitmap.ToArray());
for (int i = 0; i < data.Length; i++)
{
_renderbuffer[i] = _palette[data[i]];
}
}
}
}
}

View File

@ -6,6 +6,7 @@ using AxibugProtobuf;
using AxiReplay; using AxiReplay;
using Google.Protobuf; using Google.Protobuf;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using UnityEngine; using UnityEngine;
namespace AxibugEmuOnline.Client.Manager namespace AxibugEmuOnline.Client.Manager
@ -21,14 +22,21 @@ namespace AxibugEmuOnline.Client.Manager
public byte[] RawData { get; private set; } = null; public byte[] RawData { get; private set; } = null;
public NetReplay netReplay { get; private set; } public NetReplay netReplay { get; private set; }
Dictionary<int, Protobuf_Room_MiniInfo> dictRoomListID2Info = new Dictionary<int, Protobuf_Room_MiniInfo>(); Dictionary<int, Protobuf_Room_MiniInfo> dictRoomListID2Info = new Dictionary<int, Protobuf_Room_MiniInfo>();
static Protobuf_Room_List _Protobuf_Room_List = new Protobuf_Room_List();
static Protobuf_Room_Create _Protobuf_Room_Create = new Protobuf_Room_Create(); struct S_PlayerMiniInfo
static Protobuf_Room_Join _Protobuf_Room_Join = new Protobuf_Room_Join(); {
static Protobuf_Room_Leave _Protobuf_Room_Leave = new Protobuf_Room_Leave(); public long UID;
static Protobuf_Room_Player_Ready _Protobuf_Room_Player_Ready = new Protobuf_Room_Player_Ready(); public string NickName;
static Protobuf_Room_SinglePlayerInputData _Protobuf_Room_SinglePlayerInputData = new Protobuf_Room_SinglePlayerInputData(); }
Protobuf_Room_List _Protobuf_Room_List = new Protobuf_Room_List();
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() public AppRoom()
{ {
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomList, RecvGetRoomList); NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomList, RecvGetRoomList);
@ -40,6 +48,7 @@ namespace AxibugEmuOnline.Client.Manager
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomWaitStep, RecvRoom_WaitStep); NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomWaitStep, RecvRoom_WaitStep);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomHostPlayerUpdateStateRaw, RecvHostPlayer_UpdateStateRaw); NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomHostPlayerUpdateStateRaw, RecvHostPlayer_UpdateStateRaw);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomSynPlayerInput, RecvHostSyn_RoomFrameAllInputData); NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomSynPlayerInput, RecvHostSyn_RoomFrameAllInputData);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdScreen, OnScreen);
} }
#region #region
@ -90,7 +99,7 @@ namespace AxibugEmuOnline.Client.Manager
} }
public void ReleaseRePlay() public void ReleaseRePlay()
{ {
} }
#endregion #endregion
@ -107,17 +116,47 @@ namespace AxibugEmuOnline.Client.Manager
return -1; return -1;
} }
long[] GetRoom4Player() long[] GetRoom4PlayerUIDs()
{ {
if (mineRoomMiniInfo == null) if (mineRoomMiniInfo == null)
return null; return null;
long[] result = new long[4]; long[] result = new long[4];
if (mineRoomMiniInfo.Player1UID > 0) if (mineRoomMiniInfo.Player1UID > 0)
result[0] = mineRoomMiniInfo.Player1UID; result[0] = mineRoomMiniInfo.Player1UID;
if (mineRoomMiniInfo.Player2UID == App.user.userdata.UID) if (mineRoomMiniInfo.Player2UID > 0)
result[1] = mineRoomMiniInfo.Player2UID; 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; return result;
} }
@ -238,9 +277,9 @@ namespace AxibugEmuOnline.Client.Manager
void RecvRoomMyRoomStateChange(byte[] reqData) void RecvRoomMyRoomStateChange(byte[] reqData)
{ {
Protobuf_Room_MyRoom_State_Change msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_MyRoom_State_Change>(reqData); Protobuf_Room_MyRoom_State_Change msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_MyRoom_State_Change>(reqData);
long[] oldRoomPlayer = GetRoom4Player(); long[] oldRoomPlayer = GetRoom4PlayerUIDs();
mineRoomMiniInfo = msg.RoomMiniInfo; mineRoomMiniInfo = msg.RoomMiniInfo;
long[] newRoomPlayer = GetRoom4Player(); long[] newRoomPlayer = GetRoom4PlayerUIDs();
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
long OldPlayer = oldRoomPlayer[i]; long OldPlayer = oldRoomPlayer[i];
@ -309,7 +348,7 @@ namespace AxibugEmuOnline.Client.Manager
/// <summary> /// <summary>
/// 同步上行 /// 同步上行
/// </summary> /// </summary>
public void SendRoomSingelPlayerInput(uint FrameID,uint InputData) public void SendRoomSingelPlayerInput(uint FrameID, uint InputData)
{ {
_Protobuf_Room_SinglePlayerInputData.FrameID = FrameID; _Protobuf_Room_SinglePlayerInputData.FrameID = FrameID;
_Protobuf_Room_SinglePlayerInputData.InputData = InputData; _Protobuf_Room_SinglePlayerInputData.InputData = InputData;
@ -322,5 +361,21 @@ namespace AxibugEmuOnline.Client.Manager
Protobuf_Room_Syn_RoomFrameAllInputData msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Syn_RoomFrameAllInputData>(reqData); Protobuf_Room_Syn_RoomFrameAllInputData msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Syn_RoomFrameAllInputData>(reqData);
netReplay.InData(new ReplayStep() { FrameStartID = (int)msg.FrameID, InPut = msg.InputData }); netReplay.InData(new ReplayStep() { FrameStartID = (int)msg.FrameID, InPut = msg.InputData });
} }
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());
}
} }
} }

View File

@ -27,7 +27,7 @@ namespace AxibugEmuOnline.Client
IEnumerator DownloadFromURL(string url, string path, Action<byte[]> callback) IEnumerator DownloadFromURL(string url, string path, Action<byte[]> callback)
{ {
var request = UnityWebRequest.Get($"{App.httpAPI.DownSite}/{url}"); var request = UnityWebRequest.Get($"{App.httpAPI.WebHost}/{url}");
yield return request.SendWebRequest(); yield return request.SendWebRequest();
if (request.result == UnityWebRequest.Result.Success) if (request.result == UnityWebRequest.Result.Success)

View File

@ -9,8 +9,8 @@ namespace AxibugEmuOnline.Client
{ {
public class HttpAPI public class HttpAPI
{ {
public string WebSite = "http://emu.axibug.com/api"; public string WebHost = "http://emu.axibug.com";
public string DownSite = "http://emu.axibug.com"; public string WebSiteApi => WebHost + "/api";
public delegate void GetRomListAPI(Action<Resp_GameList> callback, int page, int pageSize = 10); public delegate void GetRomListAPI(Action<Resp_GameList> callback, int page, int pageSize = 10);
@ -21,7 +21,7 @@ namespace AxibugEmuOnline.Client
private IEnumerator GetNesRomListFlow(int page, int pageSize, Action<Resp_GameList> callback) private IEnumerator GetNesRomListFlow(int page, int pageSize, Action<Resp_GameList> callback)
{ {
UnityWebRequest request = UnityWebRequest.Get($"{WebSite}/NesRomList?Page={page}&PageSize={pageSize}"); UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}");
yield return request.SendWebRequest(); yield return request.SendWebRequest();
if (request.result != UnityWebRequest.Result.Success) if (request.result != UnityWebRequest.Result.Success)
@ -78,5 +78,14 @@ namespace AxibugEmuOnline.Client
public string hash; public string hash;
public int stars; public int stars;
} }
[Serializable]
public class Resp_CheckStandInfo
{
public int needUpdateClient;
public string serverIp;
public ushort serverPort;
public string clientVersion;
public string downLoadUrl;
}
} }
} }

View File

@ -106,7 +106,7 @@ namespace AxibugEmuOnline.Client
private IEnumerator DownloadRemoteRom(Action<byte[]> callback) private IEnumerator DownloadRemoteRom(Action<byte[]> callback)
{ {
downloadRequest = UnityWebRequest.Get($"{App.httpAPI.DownSite}/{webData.url}"); downloadRequest = UnityWebRequest.Get($"{App.httpAPI.WebHost}/{webData.url}");
yield return downloadRequest.SendWebRequest(); yield return downloadRequest.SendWebRequest();
if (downloadRequest.result != UnityWebRequest.Result.Success) if (downloadRequest.result != UnityWebRequest.Result.Success)

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d210d2c6168ca99488844ef0372050ff
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,111 @@
using AxibugEmuOnline.Client.ClientCore;
using AxibugEmuOnline.Client.Common;
using AxibugEmuOnline.Client.Network;
using AxibugProtobuf;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net.Sockets;
using UnityEngine;
namespace AxibugEmuOnline.Client
{
public class TickLoop : MonoBehaviour
{
Action LoopAction;
public Stopwatch sw = Stopwatch.StartNew();
public TimeSpan LastStartPingTime;
public int LastPingSeed;
public double AveNetDelay;
public double MinNetDelay;
public double MaxNetDelay;
public List<double> NetDelays = new List<double>();
public const int NetAveDelayCount = 3;
private void Awake()
{
Application.targetFrameRate = 60;
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdPing, OnCmdPing);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdPong, OnCmdPong);
}
float LastPingTime;
private void Update()
{
NetMsg.Instance.DequeueNesMsg();
LoopAction?.Invoke();
if (Time.time - LastPingTime > 3)
{
LastPingTime = Time.time;
Ping();
}
}
void OnApplicationQuit()
{
App.log.Debug("OnApplicationQuit");
App.network.bAutoReConnect = false;
if (App.network.isConnected)
{
App.network.CloseConntect();
}
App.network.CancelReConnect();
}
void Ping()
{
if (!App.network.isConnected)
return;
int randSeed = new System.Random().Next(0, int.MaxValue);
LastPingSeed = randSeed;
LastStartPingTime = App.tickLoop.sw.Elapsed;
Protobuf_Ping resp = new Protobuf_Ping()
{
Seed = randSeed,
};
App.network.SendToServer((int)CommandID.CmdPing, ProtoBufHelper.Serizlize(resp));
}
public void OnCmdPing(byte[] reqData)
{
App.log.Debug($"OnCmdPing");
Protobuf_Ping msg = ProtoBufHelper.DeSerizlize<Protobuf_Ping>(reqData);
Protobuf_Pong resp = new Protobuf_Pong()
{
Seed = msg.Seed,
};
App.network.SendToServer((int)CommandID.CmdPong, ProtoBufHelper.Serizlize(resp));
}
public void OnCmdPong(byte[] reqData)
{
App.log.Debug($"OnCmdPong");
Protobuf_Pong msg = ProtoBufHelper.DeSerizlize<Protobuf_Pong>(reqData);
if (LastPingSeed == msg.Seed)
{
TimeSpan current = App.tickLoop.sw.Elapsed;
TimeSpan delta = current - LastStartPingTime;
NetDelays.Add(delta.TotalSeconds);
while (NetDelays.Count > NetAveDelayCount)
NetDelays.RemoveAt(0);
double tempMin = double.MaxValue;
double tempMax = double.MinValue;
for (int i = 0; i < NetDelays.Count; i++)
{
tempMin = Math.Min(NetDelays[i], tempMin);
tempMax = Math.Max(NetDelays[i], tempMax);
}
MinNetDelay = tempMin;
MaxNetDelay = tempMax;
AveNetDelay = NetDelays.Average(w => w);
}
}
}
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 5f7ca4d4fcf6c0f41a6ead44beed31dd guid: 07b53eddba336d74dab08a8a037b0e73
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2

View File

@ -12,6 +12,8 @@ namespace AxibugEmuOnline.Client.Network
private Dictionary<int, List<Delegate>> netEventDic = new Dictionary<int, List<Delegate>>(128); private Dictionary<int, List<Delegate>> netEventDic = new Dictionary<int, List<Delegate>>(128);
private Queue<(int, int, byte[])> queueNetMsg = new Queue<(int, int, byte[])>();
private NetMsg() { } private NetMsg() { }
@ -57,7 +59,21 @@ namespace AxibugEmuOnline.Client.Network
#endregion #endregion
#region PostEvent #region PostEvent
public void PostNetMsgEvent(int cmd, byte[] arg) public void EnqueueNesMsg(int cmd, int ERRCODE, byte[] arg)
{
queueNetMsg.Enqueue((cmd, ERRCODE, arg));
}
public void DequeueNesMsg()
{
if (queueNetMsg.Count > 0)
{
(int, int, byte[]) msgData = queueNetMsg.Dequeue();
PostNetMsgEvent(msgData.Item1, msgData.Item2, msgData.Item3);
}
}
public void PostNetMsgEvent(int cmd, int ERRCODE, byte[] arg)
{ {
List<Delegate> eventList = GetNetEventDicList(cmd); List<Delegate> eventList = GetNetEventDicList(cmd);
if (eventList != null) if (eventList != null)

View File

@ -1,8 +1,10 @@
using AxibugEmuOnline.Client.ClientCore; using AxibugEmuOnline.Client.ClientCore;
using AxibugProtobuf;
using HaoYueNet.ClientNetworkNet.Standard2; using HaoYueNet.ClientNetworkNet.Standard2;
using System; using System;
using System.Net.Sockets; using System.Net.Sockets;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
namespace AxibugEmuOnline.Client.Network namespace AxibugEmuOnline.Client.Network
{ {
@ -31,7 +33,7 @@ namespace AxibugEmuOnline.Client.Network
/// <summary> /// <summary>
/// 是否自动重连 /// 是否自动重连
/// </summary> /// </summary>
public bool bAutoReConnect = false; public bool bAutoReConnect = true;
/// <summary> /// <summary>
/// 重连尝试时间 /// 重连尝试时间
/// </summary> /// </summary>
@ -80,7 +82,12 @@ namespace AxibugEmuOnline.Client.Network
try try
{ {
//抛出网络数据 //抛出网络数据
NetMsg.Instance.PostNetMsgEvent(CMDID, data);
//网络线程直接抛
if(CMDID == (int)CommandID.CmdPing || CMDID == (int)CommandID.CmdPong)
NetMsg.Instance.PostNetMsgEvent(CMDID,ERRCODE, data);
else//加入队列,主线程来取
NetMsg.Instance.EnqueueNesMsg(CMDID, ERRCODE, data);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -102,33 +109,44 @@ namespace AxibugEmuOnline.Client.Network
ReConnect(); ReConnect();
} }
CancellationTokenSource cts;
bool bInReConnecting = false; Task ReConnectTask;
public void CancelReConnect()
{
App.log.Debug("CancelReConnect");
cts?.Cancel();
cts = null;
ReConnectTask = null;
}
/// <summary> /// <summary>
/// 自动重连 /// 自动重连
/// </summary> /// </summary>
void ReConnect() void ReConnect()
{ {
if (bInReConnecting) if (ReConnectTask != null)
return; return;
bInReConnecting = true; cts = new CancellationTokenSource();
ReConnectTask = new Task(() =>
bool bflagDone = false;
do
{ {
//等待时间 bool bflagDone = false;
Thread.Sleep(ReConnectTryTime); do
App.log.Info($"尝试自动重连{LastConnectIP}:{LastConnectPort}……");
//第一步
if (Init(LastConnectIP, LastConnectPort))
{ {
App.log.Info($"自动重连成功!"); //等待时间
bflagDone = true; Thread.Sleep(ReConnectTryTime);
App.log.Info($"触发重连后的自动逻辑!"); App.log.Info($"尝试自动重连{LastConnectIP}:{LastConnectPort}……");
OnReConnected?.Invoke(); //第一步
} if (Init(LastConnectIP, LastConnectPort))
} while (!bflagDone); {
bInReConnecting = false; App.log.Info($"自动重连成功!");
bflagDone = true;
App.log.Info($"触发重连后的自动逻辑!");
OnReConnected?.Invoke();
}
} while (!bflagDone);
ReConnectTask = null;
cts = null;
}, cts.Token);
ReConnectTask.Start();
} }
bool CheckIsConnectd() bool CheckIsConnectd()

View File

@ -38,56 +38,59 @@ namespace AxibugProtobuf {
"b3RvYnVmLkxvZ2luUmVzdWx0U3RhdHVzEgsKA1VJRBgGIAEoAyIUChJQcm90", "b3RvYnVmLkxvZ2luUmVzdWx0U3RhdHVzEgsKA1VJRBgGIAEoAyIUChJQcm90",
"b2J1Zl9Sb29tX0xpc3QiWwoXUHJvdG9idWZfUm9vbV9MaXN0X1JFU1ASQAoQ", "b2J1Zl9Sb29tX0xpc3QiWwoXUHJvdG9idWZfUm9vbV9MaXN0X1JFU1ASQAoQ",
"Um9vbU1pbmlJbmZvTGlzdBgBIAMoCzImLkF4aWJ1Z1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"QmFzZURlZmF1bHQQABIGCgJPSxABEg4KCkFjY291bnRFcnIQAkICSAFiBnBy",
"b3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { }, new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::AxibugProtobuf.CommandID), typeof(global::AxibugProtobuf.ErrorCode), typeof(global::AxibugProtobuf.LoginType), typeof(global::AxibugProtobuf.DeviceType), typeof(global::AxibugProtobuf.RoomGameState), typeof(global::AxibugProtobuf.LoginResultStatus), }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(new[] {typeof(global::AxibugProtobuf.CommandID), typeof(global::AxibugProtobuf.ErrorCode), typeof(global::AxibugProtobuf.LoginType), typeof(global::AxibugProtobuf.DeviceType), typeof(global::AxibugProtobuf.RoomGameState), typeof(global::AxibugProtobuf.LoginResultStatus), }, null, new pbr::GeneratedClrTypeInfo[] {
@ -99,7 +102,7 @@ namespace AxibugProtobuf {
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login_RESP), global::AxibugProtobuf.Protobuf_Login_RESP.Parser, new[]{ "DeviceUUID", "Token", "LastLoginDate", "RegDate", "Status", "UID" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Login_RESP), global::AxibugProtobuf.Protobuf_Login_RESP.Parser, new[]{ "DeviceUUID", "Token", "LastLoginDate", "RegDate", "Status", "UID" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Room_List), global::AxibugProtobuf.Protobuf_Room_List.Parser, null, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Room_List), global::AxibugProtobuf.Protobuf_Room_List.Parser, null, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Room_List_RESP), global::AxibugProtobuf.Protobuf_Room_List_RESP.Parser, new[]{ "RoomMiniInfoList" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Room_List_RESP), global::AxibugProtobuf.Protobuf_Room_List_RESP.Parser, new[]{ "RoomMiniInfoList" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Room_MiniInfo), global::AxibugProtobuf.Protobuf_Room_MiniInfo.Parser, new[]{ "RoomID", "GameRomID", "GameRomHash", "GameState", "HostPlayerUID", "ObsUserCount", "Player1UID", "Player1NickName", "Player2UID", "Player2NickName" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Room_MiniInfo), global::AxibugProtobuf.Protobuf_Room_MiniInfo.Parser, new[]{ "RoomID", "GameRomID", "GameRomHash", "HostPlayerUID", "GameState", "ObsUserCount", "Player1UID", "Player1NickName", "Player2UID", "Player2NickName", "Player3UID", "Player3NickName", "Player4UID", "Player4NickName", "ScreenProviderUID" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Room_Update_RESP), global::AxibugProtobuf.Protobuf_Room_Update_RESP.Parser, new[]{ "UpdateType", "RoomMiniInfo" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Room_Update_RESP), global::AxibugProtobuf.Protobuf_Room_Update_RESP.Parser, new[]{ "UpdateType", "RoomMiniInfo" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Screnn_Frame), global::AxibugProtobuf.Protobuf_Screnn_Frame.Parser, new[]{ "RoomID", "FrameID", "RawBitmap" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Screnn_Frame), global::AxibugProtobuf.Protobuf_Screnn_Frame.Parser, new[]{ "RoomID", "FrameID", "RawBitmap" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Room_SinglePlayerInputData), global::AxibugProtobuf.Protobuf_Room_SinglePlayerInputData.Parser, new[]{ "FrameID", "InputData" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::AxibugProtobuf.Protobuf_Room_SinglePlayerInputData), global::AxibugProtobuf.Protobuf_Room_SinglePlayerInputData.Parser, new[]{ "FrameID", "InputData" }, null, null, null, null),
@ -201,7 +204,7 @@ namespace AxibugProtobuf {
/// </summary> /// </summary>
[pbr::OriginalName("CMD_Room_Singel_PlayerInput")] CmdRoomSingelPlayerInput = 6010, [pbr::OriginalName("CMD_Room_Singel_PlayerInput")] CmdRoomSingelPlayerInput = 6010,
/// <summary> /// <summary>
///单个玩家操作同步下行 对应 Protobuf_Room_Syn_RoomFrameAllInputData ///所有玩家操作同步下行 对应 Protobuf_Room_Syn_RoomFrameAllInputData
/// </summary> /// </summary>
[pbr::OriginalName("CMD_ROOM_SYN_PlayerInput")] CmdRoomSynPlayerInput = 6015, [pbr::OriginalName("CMD_ROOM_SYN_PlayerInput")] CmdRoomSynPlayerInput = 6015,
/// <summary> /// <summary>
@ -2071,13 +2074,18 @@ namespace AxibugProtobuf {
roomID_ = other.roomID_; roomID_ = other.roomID_;
gameRomID_ = other.gameRomID_; gameRomID_ = other.gameRomID_;
gameRomHash_ = other.gameRomHash_; gameRomHash_ = other.gameRomHash_;
gameState_ = other.gameState_;
hostPlayerUID_ = other.hostPlayerUID_; hostPlayerUID_ = other.hostPlayerUID_;
gameState_ = other.gameState_;
obsUserCount_ = other.obsUserCount_; obsUserCount_ = other.obsUserCount_;
player1UID_ = other.player1UID_; player1UID_ = other.player1UID_;
player1NickName_ = other.player1NickName_; player1NickName_ = other.player1NickName_;
player2UID_ = other.player2UID_; player2UID_ = other.player2UID_;
player2NickName_ = other.player2NickName_; player2NickName_ = other.player2NickName_;
player3UID_ = other.player3UID_;
player3NickName_ = other.player3NickName_;
player4UID_ = other.player4UID_;
player4NickName_ = other.player4NickName_;
screenProviderUID_ = other.screenProviderUID_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
} }
@ -2125,6 +2133,20 @@ namespace AxibugProtobuf {
} }
} }
/// <summary>Field number for the "HostPlayerUID" field.</summary>
public const int HostPlayerUIDFieldNumber = 4;
private long hostPlayerUID_;
/// <summary>
///主机玩家ID
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public long HostPlayerUID {
get { return hostPlayerUID_; }
set {
hostPlayerUID_ = value;
}
}
/// <summary>Field number for the "GameState" field.</summary> /// <summary>Field number for the "GameState" field.</summary>
public const int GameStateFieldNumber = 5; public const int GameStateFieldNumber = 5;
private global::AxibugProtobuf.RoomGameState gameState_ = global::AxibugProtobuf.RoomGameState.NoneGameState; private global::AxibugProtobuf.RoomGameState gameState_ = global::AxibugProtobuf.RoomGameState.NoneGameState;
@ -2139,22 +2161,8 @@ namespace AxibugProtobuf {
} }
} }
/// <summary>Field number for the "HostPlayerUID" field.</summary>
public const int HostPlayerUIDFieldNumber = 6;
private int hostPlayerUID_;
/// <summary>
///主机玩家ID
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int HostPlayerUID {
get { return hostPlayerUID_; }
set {
hostPlayerUID_ = value;
}
}
/// <summary>Field number for the "ObsUserCount" field.</summary> /// <summary>Field number for the "ObsUserCount" field.</summary>
public const int ObsUserCountFieldNumber = 7; public const int ObsUserCountFieldNumber = 6;
private int obsUserCount_; private int obsUserCount_;
/// <summary> /// <summary>
///观战用户数量 ///观战用户数量
@ -2168,7 +2176,7 @@ namespace AxibugProtobuf {
} }
/// <summary>Field number for the "Player1_UID" field.</summary> /// <summary>Field number for the "Player1_UID" field.</summary>
public const int Player1UIDFieldNumber = 8; public const int Player1UIDFieldNumber = 7;
private long player1UID_; private long player1UID_;
/// <summary> /// <summary>
///玩家1 UID ///玩家1 UID
@ -2182,7 +2190,7 @@ namespace AxibugProtobuf {
} }
/// <summary>Field number for the "Player1_NickName" field.</summary> /// <summary>Field number for the "Player1_NickName" field.</summary>
public const int Player1NickNameFieldNumber = 9; public const int Player1NickNameFieldNumber = 8;
private string player1NickName_ = ""; private string player1NickName_ = "";
/// <summary> /// <summary>
///玩家1 昵称 ///玩家1 昵称
@ -2196,7 +2204,7 @@ namespace AxibugProtobuf {
} }
/// <summary>Field number for the "Player2_UID" field.</summary> /// <summary>Field number for the "Player2_UID" field.</summary>
public const int Player2UIDFieldNumber = 10; public const int Player2UIDFieldNumber = 9;
private long player2UID_; private long player2UID_;
/// <summary> /// <summary>
///玩家2 UID ///玩家2 UID
@ -2210,7 +2218,7 @@ namespace AxibugProtobuf {
} }
/// <summary>Field number for the "Player2_NickName" field.</summary> /// <summary>Field number for the "Player2_NickName" field.</summary>
public const int Player2NickNameFieldNumber = 11; public const int Player2NickNameFieldNumber = 10;
private string player2NickName_ = ""; private string player2NickName_ = "";
/// <summary> /// <summary>
///玩家2 昵称 ///玩家2 昵称
@ -2223,6 +2231,76 @@ namespace AxibugProtobuf {
} }
} }
/// <summary>Field number for the "Player3_UID" field.</summary>
public const int Player3UIDFieldNumber = 11;
private long player3UID_;
/// <summary>
///玩家3 UID
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public long Player3UID {
get { return player3UID_; }
set {
player3UID_ = value;
}
}
/// <summary>Field number for the "Player3_NickName" field.</summary>
public const int Player3NickNameFieldNumber = 12;
private string player3NickName_ = "";
/// <summary>
///玩家3 昵称
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Player3NickName {
get { return player3NickName_; }
set {
player3NickName_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "Player4_UID" field.</summary>
public const int Player4UIDFieldNumber = 13;
private long player4UID_;
/// <summary>
///玩家4 UID
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public long Player4UID {
get { return player4UID_; }
set {
player4UID_ = value;
}
}
/// <summary>Field number for the "Player4_NickName" field.</summary>
public const int Player4NickNameFieldNumber = 14;
private string player4NickName_ = "";
/// <summary>
///玩家4 昵称
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string Player4NickName {
get { return player4NickName_; }
set {
player4NickName_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "ScreenProviderUID" field.</summary>
public const int ScreenProviderUIDFieldNumber = 15;
private long screenProviderUID_;
/// <summary>
///屏幕数据供应者
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public long ScreenProviderUID {
get { return screenProviderUID_; }
set {
screenProviderUID_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) { public override bool Equals(object other) {
return Equals(other as Protobuf_Room_MiniInfo); return Equals(other as Protobuf_Room_MiniInfo);
@ -2239,13 +2317,18 @@ namespace AxibugProtobuf {
if (RoomID != other.RoomID) return false; if (RoomID != other.RoomID) return false;
if (GameRomID != other.GameRomID) return false; if (GameRomID != other.GameRomID) return false;
if (GameRomHash != other.GameRomHash) return false; if (GameRomHash != other.GameRomHash) return false;
if (GameState != other.GameState) return false;
if (HostPlayerUID != other.HostPlayerUID) return false; if (HostPlayerUID != other.HostPlayerUID) return false;
if (GameState != other.GameState) return false;
if (ObsUserCount != other.ObsUserCount) return false; if (ObsUserCount != other.ObsUserCount) return false;
if (Player1UID != other.Player1UID) return false; if (Player1UID != other.Player1UID) return false;
if (Player1NickName != other.Player1NickName) return false; if (Player1NickName != other.Player1NickName) return false;
if (Player2UID != other.Player2UID) return false; if (Player2UID != other.Player2UID) return false;
if (Player2NickName != other.Player2NickName) return false; if (Player2NickName != other.Player2NickName) return false;
if (Player3UID != other.Player3UID) return false;
if (Player3NickName != other.Player3NickName) return false;
if (Player4UID != other.Player4UID) return false;
if (Player4NickName != other.Player4NickName) return false;
if (ScreenProviderUID != other.ScreenProviderUID) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
@ -2255,13 +2338,18 @@ namespace AxibugProtobuf {
if (RoomID != 0) hash ^= RoomID.GetHashCode(); if (RoomID != 0) hash ^= RoomID.GetHashCode();
if (GameRomID != 0) hash ^= GameRomID.GetHashCode(); if (GameRomID != 0) hash ^= GameRomID.GetHashCode();
if (GameRomHash.Length != 0) hash ^= GameRomHash.GetHashCode(); if (GameRomHash.Length != 0) hash ^= GameRomHash.GetHashCode();
if (HostPlayerUID != 0L) hash ^= HostPlayerUID.GetHashCode();
if (GameState != global::AxibugProtobuf.RoomGameState.NoneGameState) hash ^= GameState.GetHashCode(); if (GameState != global::AxibugProtobuf.RoomGameState.NoneGameState) hash ^= GameState.GetHashCode();
if (HostPlayerUID != 0) hash ^= HostPlayerUID.GetHashCode();
if (ObsUserCount != 0) hash ^= ObsUserCount.GetHashCode(); if (ObsUserCount != 0) hash ^= ObsUserCount.GetHashCode();
if (Player1UID != 0L) hash ^= Player1UID.GetHashCode(); if (Player1UID != 0L) hash ^= Player1UID.GetHashCode();
if (Player1NickName.Length != 0) hash ^= Player1NickName.GetHashCode(); if (Player1NickName.Length != 0) hash ^= Player1NickName.GetHashCode();
if (Player2UID != 0L) hash ^= Player2UID.GetHashCode(); if (Player2UID != 0L) hash ^= Player2UID.GetHashCode();
if (Player2NickName.Length != 0) hash ^= Player2NickName.GetHashCode(); if (Player2NickName.Length != 0) hash ^= Player2NickName.GetHashCode();
if (Player3UID != 0L) hash ^= Player3UID.GetHashCode();
if (Player3NickName.Length != 0) hash ^= Player3NickName.GetHashCode();
if (Player4UID != 0L) hash ^= Player4UID.GetHashCode();
if (Player4NickName.Length != 0) hash ^= Player4NickName.GetHashCode();
if (ScreenProviderUID != 0L) hash ^= ScreenProviderUID.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
} }
@ -2290,34 +2378,54 @@ namespace AxibugProtobuf {
output.WriteRawTag(26); output.WriteRawTag(26);
output.WriteString(GameRomHash); output.WriteString(GameRomHash);
} }
if (HostPlayerUID != 0L) {
output.WriteRawTag(32);
output.WriteInt64(HostPlayerUID);
}
if (GameState != global::AxibugProtobuf.RoomGameState.NoneGameState) { if (GameState != global::AxibugProtobuf.RoomGameState.NoneGameState) {
output.WriteRawTag(40); output.WriteRawTag(40);
output.WriteEnum((int) GameState); output.WriteEnum((int) GameState);
} }
if (HostPlayerUID != 0) {
output.WriteRawTag(48);
output.WriteInt32(HostPlayerUID);
}
if (ObsUserCount != 0) { if (ObsUserCount != 0) {
output.WriteRawTag(56); output.WriteRawTag(48);
output.WriteInt32(ObsUserCount); output.WriteInt32(ObsUserCount);
} }
if (Player1UID != 0L) { if (Player1UID != 0L) {
output.WriteRawTag(64); output.WriteRawTag(56);
output.WriteInt64(Player1UID); output.WriteInt64(Player1UID);
} }
if (Player1NickName.Length != 0) { if (Player1NickName.Length != 0) {
output.WriteRawTag(74); output.WriteRawTag(66);
output.WriteString(Player1NickName); output.WriteString(Player1NickName);
} }
if (Player2UID != 0L) { if (Player2UID != 0L) {
output.WriteRawTag(80); output.WriteRawTag(72);
output.WriteInt64(Player2UID); output.WriteInt64(Player2UID);
} }
if (Player2NickName.Length != 0) { if (Player2NickName.Length != 0) {
output.WriteRawTag(90); output.WriteRawTag(82);
output.WriteString(Player2NickName); output.WriteString(Player2NickName);
} }
if (Player3UID != 0L) {
output.WriteRawTag(88);
output.WriteInt64(Player3UID);
}
if (Player3NickName.Length != 0) {
output.WriteRawTag(98);
output.WriteString(Player3NickName);
}
if (Player4UID != 0L) {
output.WriteRawTag(104);
output.WriteInt64(Player4UID);
}
if (Player4NickName.Length != 0) {
output.WriteRawTag(114);
output.WriteString(Player4NickName);
}
if (ScreenProviderUID != 0L) {
output.WriteRawTag(120);
output.WriteInt64(ScreenProviderUID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
@ -2339,34 +2447,54 @@ namespace AxibugProtobuf {
output.WriteRawTag(26); output.WriteRawTag(26);
output.WriteString(GameRomHash); output.WriteString(GameRomHash);
} }
if (HostPlayerUID != 0L) {
output.WriteRawTag(32);
output.WriteInt64(HostPlayerUID);
}
if (GameState != global::AxibugProtobuf.RoomGameState.NoneGameState) { if (GameState != global::AxibugProtobuf.RoomGameState.NoneGameState) {
output.WriteRawTag(40); output.WriteRawTag(40);
output.WriteEnum((int) GameState); output.WriteEnum((int) GameState);
} }
if (HostPlayerUID != 0) {
output.WriteRawTag(48);
output.WriteInt32(HostPlayerUID);
}
if (ObsUserCount != 0) { if (ObsUserCount != 0) {
output.WriteRawTag(56); output.WriteRawTag(48);
output.WriteInt32(ObsUserCount); output.WriteInt32(ObsUserCount);
} }
if (Player1UID != 0L) { if (Player1UID != 0L) {
output.WriteRawTag(64); output.WriteRawTag(56);
output.WriteInt64(Player1UID); output.WriteInt64(Player1UID);
} }
if (Player1NickName.Length != 0) { if (Player1NickName.Length != 0) {
output.WriteRawTag(74); output.WriteRawTag(66);
output.WriteString(Player1NickName); output.WriteString(Player1NickName);
} }
if (Player2UID != 0L) { if (Player2UID != 0L) {
output.WriteRawTag(80); output.WriteRawTag(72);
output.WriteInt64(Player2UID); output.WriteInt64(Player2UID);
} }
if (Player2NickName.Length != 0) { if (Player2NickName.Length != 0) {
output.WriteRawTag(90); output.WriteRawTag(82);
output.WriteString(Player2NickName); output.WriteString(Player2NickName);
} }
if (Player3UID != 0L) {
output.WriteRawTag(88);
output.WriteInt64(Player3UID);
}
if (Player3NickName.Length != 0) {
output.WriteRawTag(98);
output.WriteString(Player3NickName);
}
if (Player4UID != 0L) {
output.WriteRawTag(104);
output.WriteInt64(Player4UID);
}
if (Player4NickName.Length != 0) {
output.WriteRawTag(114);
output.WriteString(Player4NickName);
}
if (ScreenProviderUID != 0L) {
output.WriteRawTag(120);
output.WriteInt64(ScreenProviderUID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
@ -2385,12 +2513,12 @@ namespace AxibugProtobuf {
if (GameRomHash.Length != 0) { if (GameRomHash.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(GameRomHash); size += 1 + pb::CodedOutputStream.ComputeStringSize(GameRomHash);
} }
if (HostPlayerUID != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(HostPlayerUID);
}
if (GameState != global::AxibugProtobuf.RoomGameState.NoneGameState) { if (GameState != global::AxibugProtobuf.RoomGameState.NoneGameState) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) GameState); size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) GameState);
} }
if (HostPlayerUID != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(HostPlayerUID);
}
if (ObsUserCount != 0) { if (ObsUserCount != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(ObsUserCount); size += 1 + pb::CodedOutputStream.ComputeInt32Size(ObsUserCount);
} }
@ -2406,6 +2534,21 @@ namespace AxibugProtobuf {
if (Player2NickName.Length != 0) { if (Player2NickName.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Player2NickName); size += 1 + pb::CodedOutputStream.ComputeStringSize(Player2NickName);
} }
if (Player3UID != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(Player3UID);
}
if (Player3NickName.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Player3NickName);
}
if (Player4UID != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(Player4UID);
}
if (Player4NickName.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Player4NickName);
}
if (ScreenProviderUID != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(ScreenProviderUID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
size += _unknownFields.CalculateSize(); size += _unknownFields.CalculateSize();
} }
@ -2426,12 +2569,12 @@ namespace AxibugProtobuf {
if (other.GameRomHash.Length != 0) { if (other.GameRomHash.Length != 0) {
GameRomHash = other.GameRomHash; GameRomHash = other.GameRomHash;
} }
if (other.HostPlayerUID != 0L) {
HostPlayerUID = other.HostPlayerUID;
}
if (other.GameState != global::AxibugProtobuf.RoomGameState.NoneGameState) { if (other.GameState != global::AxibugProtobuf.RoomGameState.NoneGameState) {
GameState = other.GameState; GameState = other.GameState;
} }
if (other.HostPlayerUID != 0) {
HostPlayerUID = other.HostPlayerUID;
}
if (other.ObsUserCount != 0) { if (other.ObsUserCount != 0) {
ObsUserCount = other.ObsUserCount; ObsUserCount = other.ObsUserCount;
} }
@ -2447,6 +2590,21 @@ namespace AxibugProtobuf {
if (other.Player2NickName.Length != 0) { if (other.Player2NickName.Length != 0) {
Player2NickName = other.Player2NickName; Player2NickName = other.Player2NickName;
} }
if (other.Player3UID != 0L) {
Player3UID = other.Player3UID;
}
if (other.Player3NickName.Length != 0) {
Player3NickName = other.Player3NickName;
}
if (other.Player4UID != 0L) {
Player4UID = other.Player4UID;
}
if (other.Player4NickName.Length != 0) {
Player4NickName = other.Player4NickName;
}
if (other.ScreenProviderUID != 0L) {
ScreenProviderUID = other.ScreenProviderUID;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
} }
@ -2473,34 +2631,54 @@ namespace AxibugProtobuf {
GameRomHash = input.ReadString(); GameRomHash = input.ReadString();
break; break;
} }
case 32: {
HostPlayerUID = input.ReadInt64();
break;
}
case 40: { case 40: {
GameState = (global::AxibugProtobuf.RoomGameState) input.ReadEnum(); GameState = (global::AxibugProtobuf.RoomGameState) input.ReadEnum();
break; break;
} }
case 48: { case 48: {
HostPlayerUID = input.ReadInt32();
break;
}
case 56: {
ObsUserCount = input.ReadInt32(); ObsUserCount = input.ReadInt32();
break; break;
} }
case 64: { case 56: {
Player1UID = input.ReadInt64(); Player1UID = input.ReadInt64();
break; break;
} }
case 74: { case 66: {
Player1NickName = input.ReadString(); Player1NickName = input.ReadString();
break; break;
} }
case 80: { case 72: {
Player2UID = input.ReadInt64(); Player2UID = input.ReadInt64();
break; break;
} }
case 90: { case 82: {
Player2NickName = input.ReadString(); Player2NickName = input.ReadString();
break; break;
} }
case 88: {
Player3UID = input.ReadInt64();
break;
}
case 98: {
Player3NickName = input.ReadString();
break;
}
case 104: {
Player4UID = input.ReadInt64();
break;
}
case 114: {
Player4NickName = input.ReadString();
break;
}
case 120: {
ScreenProviderUID = input.ReadInt64();
break;
}
} }
} }
#endif #endif
@ -2527,34 +2705,54 @@ namespace AxibugProtobuf {
GameRomHash = input.ReadString(); GameRomHash = input.ReadString();
break; break;
} }
case 32: {
HostPlayerUID = input.ReadInt64();
break;
}
case 40: { case 40: {
GameState = (global::AxibugProtobuf.RoomGameState) input.ReadEnum(); GameState = (global::AxibugProtobuf.RoomGameState) input.ReadEnum();
break; break;
} }
case 48: { case 48: {
HostPlayerUID = input.ReadInt32();
break;
}
case 56: {
ObsUserCount = input.ReadInt32(); ObsUserCount = input.ReadInt32();
break; break;
} }
case 64: { case 56: {
Player1UID = input.ReadInt64(); Player1UID = input.ReadInt64();
break; break;
} }
case 74: { case 66: {
Player1NickName = input.ReadString(); Player1NickName = input.ReadString();
break; break;
} }
case 80: { case 72: {
Player2UID = input.ReadInt64(); Player2UID = input.ReadInt64();
break; break;
} }
case 90: { case 82: {
Player2NickName = input.ReadString(); Player2NickName = input.ReadString();
break; break;
} }
case 88: {
Player3UID = input.ReadInt64();
break;
}
case 98: {
Player3NickName = input.ReadString();
break;
}
case 104: {
Player4UID = input.ReadInt64();
break;
}
case 114: {
Player4NickName = input.ReadString();
break;
}
case 120: {
ScreenProviderUID = input.ReadInt64();
break;
}
} }
} }
} }