mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
Update
Update
This commit is contained in:
2142
Assets/AssetRaw/UI/NetWorkDemoUI.prefab
Normal file
2142
Assets/AssetRaw/UI/NetWorkDemoUI.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/AssetRaw/UI/NetWorkDemoUI.prefab.meta
Normal file
7
Assets/AssetRaw/UI/NetWorkDemoUI.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ed92f6b6b24543747bc10eba9141feb1
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
Assets/GameScripts/HotFix/GameLogic/DataCenter.meta
Normal file
8
Assets/GameScripts/HotFix/GameLogic/DataCenter.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7de46f8a9c58a584289bbc481e85271a
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@@ -0,0 +1,58 @@
|
|||||||
|
using TEngine;
|
||||||
|
|
||||||
|
namespace GameLogic
|
||||||
|
{
|
||||||
|
public interface IDataCenterModule
|
||||||
|
{
|
||||||
|
void Init();
|
||||||
|
|
||||||
|
void OnRoleLogin();
|
||||||
|
|
||||||
|
void OnRoleLogout();
|
||||||
|
|
||||||
|
void OnUpdate();
|
||||||
|
|
||||||
|
void OnMainPlayerMapChange();
|
||||||
|
}
|
||||||
|
public class DataCenterModule<T> : IDataCenterModule where T : new()
|
||||||
|
{
|
||||||
|
private static T _instance;
|
||||||
|
public static T Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (null == _instance)
|
||||||
|
{
|
||||||
|
_instance = new T();
|
||||||
|
Log.Assert(_instance != null);
|
||||||
|
}
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Init()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnRoleLogin()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnRoleLogout()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnUpdate()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnMainPlayerMapChange()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1ef4b9e7ceb44a37b83ee7bca1726d93
|
||||||
|
timeCreated: 1689248879
|
@@ -0,0 +1,72 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using TEngine;
|
||||||
|
|
||||||
|
namespace GameLogic
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 数据中心模块。
|
||||||
|
/// </summary>
|
||||||
|
public class DataCenterSys : BaseLogicSys<DataCenterSys>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 子模块集合。
|
||||||
|
/// </summary>
|
||||||
|
private readonly List<IDataCenterModule> _listModule = new List<IDataCenterModule>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化数据中心。
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override bool OnInit()
|
||||||
|
{
|
||||||
|
InitModule();
|
||||||
|
InitOtherModule();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化数据中心接口。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="module"></param>
|
||||||
|
public void InitModule(IDataCenterModule module)
|
||||||
|
{
|
||||||
|
if (_listModule.Contains(module))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
module.Init();
|
||||||
|
_listModule.Add(module);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化数据中心模块。
|
||||||
|
/// </summary>
|
||||||
|
void InitModule()
|
||||||
|
{
|
||||||
|
InitModule(PlayerNetSys.Instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化数据中心其他模块。
|
||||||
|
/// <remarks>优先级低于InitModule。</remarks>
|
||||||
|
/// </summary>
|
||||||
|
void InitOtherModule()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 帧更新驱动。
|
||||||
|
/// </summary>
|
||||||
|
public override void OnUpdate()
|
||||||
|
{
|
||||||
|
var listModule = _listModule;
|
||||||
|
foreach (var module in listModule)
|
||||||
|
{
|
||||||
|
TProfiler.BeginSample(module.GetType().FullName);
|
||||||
|
module.OnUpdate();
|
||||||
|
TProfiler.EndSample();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 11af3015e673484a89ea388dbb2dc2cb
|
||||||
|
timeCreated: 1689248848
|
120
Assets/GameScripts/HotFix/GameLogic/DataCenter/GameClient.cs
Normal file
120
Assets/GameScripts/HotFix/GameLogic/DataCenter/GameClient.cs
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
using System.IO;
|
||||||
|
using GameBase;
|
||||||
|
using TEngine;
|
||||||
|
using TEngine.Core.Network;
|
||||||
|
|
||||||
|
namespace GameLogic
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 网络客户端状态。
|
||||||
|
/// </summary>
|
||||||
|
public enum GameClientStatus
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化。
|
||||||
|
/// </summary>
|
||||||
|
StatusInit,
|
||||||
|
/// <summary>
|
||||||
|
/// 连接成功服务器。
|
||||||
|
/// </summary>
|
||||||
|
StatusConnected,
|
||||||
|
/// <summary>
|
||||||
|
/// 重新连接。
|
||||||
|
/// </summary>
|
||||||
|
StatusReconnect,
|
||||||
|
/// <summary>
|
||||||
|
/// 断开连接。
|
||||||
|
/// </summary>
|
||||||
|
StatusClose,
|
||||||
|
/// <summary>
|
||||||
|
/// 登录中。
|
||||||
|
/// </summary>
|
||||||
|
StatusLogin,
|
||||||
|
/// <summary>
|
||||||
|
/// AccountLogin成功,进入服务器了。
|
||||||
|
/// </summary>
|
||||||
|
StatusEnter,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 网络客户端。
|
||||||
|
/// </summary>
|
||||||
|
public class GameClient:Singleton<GameClient>
|
||||||
|
{
|
||||||
|
public readonly NetworkProtocolType ProtocolType = NetworkProtocolType.KCP;
|
||||||
|
public GameClientStatus Status { get; set; } = GameClientStatus.StatusInit;
|
||||||
|
public Scene Scene { private set; get; }
|
||||||
|
|
||||||
|
private string _lastAddress = null;
|
||||||
|
|
||||||
|
public GameClient()
|
||||||
|
{
|
||||||
|
Scene = GameApp.Instance.Scene;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Connect(string address, bool reconnect = false)
|
||||||
|
{
|
||||||
|
if (!reconnect)
|
||||||
|
{
|
||||||
|
// SetWatchReconnect(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reconnect)
|
||||||
|
{
|
||||||
|
// GameEvent.Get<ICommUI>().ShowWaitUITip(WaitUISeq.LOGINWORLD_SEQID, G.R(TextDefine.ID_TIPS_RECONNECTING));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// GameEvent.Get<ICommUI>().ShowWaitUI(WaitUISeq.LOGINWORLD_SEQID);
|
||||||
|
}
|
||||||
|
|
||||||
|
_lastAddress = address;
|
||||||
|
|
||||||
|
Status = reconnect ? GameClientStatus.StatusReconnect : GameClientStatus.StatusInit;
|
||||||
|
|
||||||
|
Scene.CreateSession(address, ProtocolType, OnConnectComplete, OnConnectFail);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnConnectComplete()
|
||||||
|
{
|
||||||
|
Status = GameClientStatus.StatusConnected;
|
||||||
|
Log.Info("Connect to server success");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnConnectFail()
|
||||||
|
{
|
||||||
|
Status = GameClientStatus.StatusClose;
|
||||||
|
Log.Warning("Could not connect to server");
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Send(object message, uint rpcId = 0, long routeId = 0)
|
||||||
|
{
|
||||||
|
if (Scene.Session == null)
|
||||||
|
{
|
||||||
|
Log.Error("Send Message Failed Because Session Is Null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Scene.Session.Send(message,rpcId,routeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Send(IRouteMessage routeMessage, uint rpcId = 0, long routeId = 0)
|
||||||
|
{
|
||||||
|
if (Scene.Session == null)
|
||||||
|
{
|
||||||
|
Log.Error("Send Message Failed Because Session Is Null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Scene.Session.Send(routeMessage,rpcId,routeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Send(MemoryStream memoryStream, uint rpcId = 0, long routeTypeOpCode = 0, long routeId = 0)
|
||||||
|
{
|
||||||
|
if (Scene.Session == null)
|
||||||
|
{
|
||||||
|
Log.Error("Send Message Failed Because Session Is Null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Scene.Session.Send(memoryStream,rpcId,routeTypeOpCode,routeId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 346da02ec1b54ce7938cabd8511d4404
|
||||||
|
timeCreated: 1689250782
|
@@ -7,6 +7,8 @@ public partial class GameApp:Singleton<GameApp>
|
|||||||
{
|
{
|
||||||
private static List<Assembly> _hotfixAssembly;
|
private static List<Assembly> _hotfixAssembly;
|
||||||
|
|
||||||
|
public Scene Scene { private set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 热更域App主入口。
|
/// 热更域App主入口。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -33,7 +35,7 @@ public partial class GameApp:Singleton<GameApp>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void StartGameLogic()
|
private void StartGameLogic()
|
||||||
{
|
{
|
||||||
|
GameModule.UI.ShowUIAsync<NetWorkDemoUI>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using GameLogic;
|
||||||
using TEngine;
|
using TEngine;
|
||||||
using TEngine.Core;
|
using TEngine.Core;
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ public partial class GameApp
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void RegisterAllSystem()
|
private void RegisterAllSystem()
|
||||||
{
|
{
|
||||||
|
Scene = GameSystem.Init();
|
||||||
if (_hotfixAssembly != null)
|
if (_hotfixAssembly != null)
|
||||||
{
|
{
|
||||||
AssemblyManager.Load(AssemblyName.GameBase, _hotfixAssembly.Find(t=>t.FullName.Contains("GameBase")));
|
AssemblyManager.Load(AssemblyName.GameBase, _hotfixAssembly.Find(t=>t.FullName.Contains("GameBase")));
|
||||||
@@ -35,6 +37,7 @@ public partial class GameApp
|
|||||||
|
|
||||||
//带生命周期的单例系统。
|
//带生命周期的单例系统。
|
||||||
AddLogicSys(BehaviourSingleSystem.Instance);
|
AddLogicSys(BehaviourSingleSystem.Instance);
|
||||||
|
AddLogicSys(DataCenterSys.Instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
101
Assets/GameScripts/HotFix/GameLogic/NetWorkDemo/NetWorkDemoUI.cs
Normal file
101
Assets/GameScripts/HotFix/GameLogic/NetWorkDemo/NetWorkDemoUI.cs
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
using GameLogic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using TEngine;
|
||||||
|
|
||||||
|
[Window(UILayer.UI)]
|
||||||
|
class NetWorkDemoUI : UIWindow
|
||||||
|
{
|
||||||
|
#region 脚本工具生成的代码
|
||||||
|
|
||||||
|
private GameObject m_goScrollView;
|
||||||
|
private Transform m_tfContent;
|
||||||
|
private GameObject m_itemNetLog;
|
||||||
|
private GameObject m_goConnect;
|
||||||
|
private Button m_btnConnect;
|
||||||
|
private GameObject m_goLogin;
|
||||||
|
private InputField m_inputPassWord;
|
||||||
|
private InputField m_inputName;
|
||||||
|
private Button m_btnLogin;
|
||||||
|
private Button m_btnRegister;
|
||||||
|
|
||||||
|
public override void ScriptGenerator()
|
||||||
|
{
|
||||||
|
m_goScrollView = FindChild("Panel/m_goScrollView").gameObject;
|
||||||
|
m_tfContent = FindChild("Panel/m_goScrollView/Viewport/m_tfContent");
|
||||||
|
m_itemNetLog = FindChild("Panel/m_goScrollView/Viewport/m_tfContent/m_itemNetLog").gameObject;
|
||||||
|
m_goConnect = FindChild("Panel/m_goConnect").gameObject;
|
||||||
|
m_btnConnect = FindChildComponent<Button>("Panel/m_goConnect/m_btnConnect");
|
||||||
|
m_goLogin = FindChild("Panel/m_goLogin").gameObject;
|
||||||
|
m_inputPassWord = FindChildComponent<InputField>("Panel/m_goLogin/m_inputPassWord");
|
||||||
|
m_inputName = FindChildComponent<InputField>("Panel/m_goLogin/m_inputName");
|
||||||
|
m_btnLogin = FindChildComponent<Button>("Panel/m_goLogin/m_btnLogin");
|
||||||
|
m_btnRegister = FindChildComponent<Button>("Panel/m_goLogin/m_btnRegister");
|
||||||
|
m_btnConnect.onClick.AddListener(OnClickConnectBtn);
|
||||||
|
m_btnLogin.onClick.AddListener(OnClickLoginBtn);
|
||||||
|
m_btnRegister.onClick.AddListener(OnClickRegisterBtn);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 事件
|
||||||
|
|
||||||
|
private void OnClickConnectBtn()
|
||||||
|
{
|
||||||
|
GameClient.Instance.Connect("127.0.0.1:20000");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnClickLoginBtn()
|
||||||
|
{
|
||||||
|
if (GameClient.Instance.Status == GameClientStatus.StatusInit)
|
||||||
|
{
|
||||||
|
Log.Info("没有连接到服务器、请先点击连接到服务器按钮在进行此操作");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(m_inputName.text) || string.IsNullOrEmpty(m_inputPassWord.text))
|
||||||
|
{
|
||||||
|
Log.Info("请输入账号和密码");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameClient.Instance.Send(new H_C2G_LoginRequest()
|
||||||
|
{
|
||||||
|
UserName = m_inputName.text,
|
||||||
|
Password = m_inputPassWord.text
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnClickRegisterBtn()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private void RefreshLog()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace GameLogic
|
||||||
|
{
|
||||||
|
[Window(UILayer.UI)]
|
||||||
|
class NetWorkDemoLog : UIWindow
|
||||||
|
{
|
||||||
|
#region 脚本工具生成的代码
|
||||||
|
|
||||||
|
private Text m_textInfo;
|
||||||
|
|
||||||
|
public override void ScriptGenerator()
|
||||||
|
{
|
||||||
|
m_textInfo = FindChildComponent<Text>("m_textInfo");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public void SetText(string value)
|
||||||
|
{
|
||||||
|
m_textInfo.text = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8079c660ac3636e45a2de14f5dbcc940
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
using TEngine;
|
||||||
|
using TEngine.Core;
|
||||||
|
using TEngine.Core.Network;
|
||||||
|
|
||||||
|
namespace GameLogic
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 玩家信息网络模块。
|
||||||
|
/// </summary>
|
||||||
|
public class PlayerNetSys:DataCenterModule<PlayerNetSys>
|
||||||
|
{
|
||||||
|
public override void Init()
|
||||||
|
{
|
||||||
|
base.Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public class H_C2G_LoginRequestHandler : MessageRPC<H_C2G_LoginRequest,H_G2C_LoginResponse>
|
||||||
|
{
|
||||||
|
protected override async FTask Run(Session session, H_C2G_LoginRequest request, H_G2C_LoginResponse response, Action reply)
|
||||||
|
{
|
||||||
|
Log.Debug($"收到请求登录的消息 request:{request.ToJson()}");
|
||||||
|
response.Text = "登录成功";
|
||||||
|
await FTask.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a16f1c71dea04c5a890b75eda47df16a
|
||||||
|
timeCreated: 1689248961
|
157
Assets/GameScripts/HotFix/GameProto/GameProtocol/OuterMessage.cs
Normal file
157
Assets/GameScripts/HotFix/GameProto/GameProtocol/OuterMessage.cs
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
using ProtoBuf;
|
||||||
|
using Unity.Mathematics;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using TEngine.Core.Network;
|
||||||
|
#pragma warning disable CS8618
|
||||||
|
|
||||||
|
namespace TEngine
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 发送一个消息到Gate服务器
|
||||||
|
/// </summary>
|
||||||
|
[ProtoContract]
|
||||||
|
public partial class H_C2G_Message : AProto, IMessage
|
||||||
|
{
|
||||||
|
public uint OpCode() { return OuterOpcode.H_C2G_Message; }
|
||||||
|
[ProtoMember(1)]
|
||||||
|
public string Message { get; set; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 发送一个RPC消息到Gate服务器
|
||||||
|
/// </summary>
|
||||||
|
[ProtoContract]
|
||||||
|
public partial class H_C2G_MessageRequest : AProto, IRequest
|
||||||
|
{
|
||||||
|
[ProtoIgnore]
|
||||||
|
public H_G2C_MessageResponse ResponseType { get; set; }
|
||||||
|
public uint OpCode() { return OuterOpcode.H_C2G_MessageRequest; }
|
||||||
|
[ProtoMember(1)]
|
||||||
|
public string Message { get; set; }
|
||||||
|
}
|
||||||
|
[ProtoContract]
|
||||||
|
public partial class H_G2C_MessageResponse : AProto, IResponse
|
||||||
|
{
|
||||||
|
public uint OpCode() { return OuterOpcode.H_G2C_MessageResponse; }
|
||||||
|
[ProtoMember(91, IsRequired = true)]
|
||||||
|
public int ErrorCode { get; set; }
|
||||||
|
[ProtoMember(1)]
|
||||||
|
public string Message { get; set; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 发送一个消息通知服务器给客户端推送一个消息
|
||||||
|
/// </summary>
|
||||||
|
[ProtoContract]
|
||||||
|
public partial class H_C2G_PushMessageToClient : AProto, IMessage
|
||||||
|
{
|
||||||
|
public uint OpCode() { return OuterOpcode.H_C2G_PushMessageToClient; }
|
||||||
|
[ProtoMember(1)]
|
||||||
|
public string Message { get; set; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 客户端接收服务器推送的一条消息
|
||||||
|
/// </summary>
|
||||||
|
[ProtoContract]
|
||||||
|
public partial class H_G2C_ReceiveMessageToServer : AProto, IMessage
|
||||||
|
{
|
||||||
|
public uint OpCode() { return OuterOpcode.H_G2C_ReceiveMessageToServer; }
|
||||||
|
[ProtoMember(1)]
|
||||||
|
public string Message { get; set; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 注册Address消息
|
||||||
|
/// </summary>
|
||||||
|
[ProtoContract]
|
||||||
|
public partial class H_C2G_LoginAddressRequest : AProto, IRequest
|
||||||
|
{
|
||||||
|
[ProtoIgnore]
|
||||||
|
public H_G2C_LoginAddressResponse ResponseType { get; set; }
|
||||||
|
public uint OpCode() { return OuterOpcode.H_C2G_LoginAddressRequest; }
|
||||||
|
[ProtoMember(1)]
|
||||||
|
public string Message { get; set; }
|
||||||
|
}
|
||||||
|
[ProtoContract]
|
||||||
|
public partial class H_G2C_LoginAddressResponse : AProto, IResponse
|
||||||
|
{
|
||||||
|
public uint OpCode() { return OuterOpcode.H_G2C_LoginAddressResponse; }
|
||||||
|
[ProtoMember(91, IsRequired = true)]
|
||||||
|
public int ErrorCode { get; set; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 发送一个Address消息给Map
|
||||||
|
/// </summary>
|
||||||
|
[ProtoContract]
|
||||||
|
public partial class H_C2M_Message : AProto, IAddressableRouteMessage
|
||||||
|
{
|
||||||
|
public uint OpCode() { return OuterOpcode.H_C2M_Message; }
|
||||||
|
public long RouteTypeOpCode() { return CoreRouteType.Addressable; }
|
||||||
|
[ProtoMember(1)]
|
||||||
|
public string Message { get; set; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 发送一个AddressRPC消息给Map
|
||||||
|
/// </summary>
|
||||||
|
[ProtoContract]
|
||||||
|
public partial class H_C2M_MessageRequest : AProto, IAddressableRouteRequest
|
||||||
|
{
|
||||||
|
[ProtoIgnore]
|
||||||
|
public H_M2C_MessageResponse ResponseType { get; set; }
|
||||||
|
public uint OpCode() { return OuterOpcode.H_C2M_MessageRequest; }
|
||||||
|
public long RouteTypeOpCode() { return CoreRouteType.Addressable; }
|
||||||
|
[ProtoMember(1)]
|
||||||
|
public string Message { get; set; }
|
||||||
|
}
|
||||||
|
[ProtoContract]
|
||||||
|
public partial class H_M2C_MessageResponse : AProto, IAddressableRouteResponse
|
||||||
|
{
|
||||||
|
public uint OpCode() { return OuterOpcode.H_M2C_MessageResponse; }
|
||||||
|
[ProtoMember(91, IsRequired = true)]
|
||||||
|
public int ErrorCode { get; set; }
|
||||||
|
[ProtoMember(1)]
|
||||||
|
public string Message { get; set; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 发送一个消息通知服务器给客户端推送一个Address消息
|
||||||
|
/// </summary>
|
||||||
|
[ProtoContract]
|
||||||
|
public partial class H_C2M_PushAddressMessageToClient : AProto, IAddressableRouteMessage
|
||||||
|
{
|
||||||
|
public uint OpCode() { return OuterOpcode.H_C2M_PushAddressMessageToClient; }
|
||||||
|
public long RouteTypeOpCode() { return CoreRouteType.Addressable; }
|
||||||
|
[ProtoMember(1)]
|
||||||
|
public string Message { get; set; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 客户端接收服务器推送的一条Address消息
|
||||||
|
/// </summary>
|
||||||
|
[ProtoContract]
|
||||||
|
public partial class H_M2C_ReceiveAddressMessageToServer : AProto, IAddressableRouteMessage
|
||||||
|
{
|
||||||
|
public uint OpCode() { return OuterOpcode.H_M2C_ReceiveAddressMessageToServer; }
|
||||||
|
public long RouteTypeOpCode() { return CoreRouteType.Addressable; }
|
||||||
|
[ProtoMember(1)]
|
||||||
|
public string Message { get; set; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 客户端发送消息请求登录服务器
|
||||||
|
/// </summary>
|
||||||
|
[ProtoContract]
|
||||||
|
public partial class H_C2G_LoginRequest : AProto, IRequest
|
||||||
|
{
|
||||||
|
[ProtoIgnore]
|
||||||
|
public H_G2C_LoginResponse ResponseType { get; set; }
|
||||||
|
public uint OpCode() { return OuterOpcode.H_C2G_LoginRequest; }
|
||||||
|
[ProtoMember(1)]
|
||||||
|
public string UserName { get; set; }
|
||||||
|
[ProtoMember(2)]
|
||||||
|
public string Password { get; set; }
|
||||||
|
}
|
||||||
|
[ProtoContract]
|
||||||
|
public partial class H_G2C_LoginResponse : AProto, IResponse
|
||||||
|
{
|
||||||
|
public uint OpCode() { return OuterOpcode.H_G2C_LoginResponse; }
|
||||||
|
[ProtoMember(91, IsRequired = true)]
|
||||||
|
public int ErrorCode { get; set; }
|
||||||
|
[ProtoMember(1)]
|
||||||
|
public string Text { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5b1b62e3a467f384ab288e354631af67
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@@ -0,0 +1,20 @@
|
|||||||
|
namespace TEngine
|
||||||
|
{
|
||||||
|
public static partial class OuterOpcode
|
||||||
|
{
|
||||||
|
public const int H_C2G_Message = 100000001;
|
||||||
|
public const int H_C2G_MessageRequest = 110000001;
|
||||||
|
public const int H_G2C_MessageResponse = 160000001;
|
||||||
|
public const int H_C2G_PushMessageToClient = 100000002;
|
||||||
|
public const int H_G2C_ReceiveMessageToServer = 100000003;
|
||||||
|
public const int H_C2G_LoginAddressRequest = 110000002;
|
||||||
|
public const int H_G2C_LoginAddressResponse = 160000002;
|
||||||
|
public const int H_C2M_Message = 190000001;
|
||||||
|
public const int H_C2M_MessageRequest = 200000001;
|
||||||
|
public const int H_M2C_MessageResponse = 250000001;
|
||||||
|
public const int H_C2M_PushAddressMessageToClient = 190000002;
|
||||||
|
public const int H_M2C_ReceiveAddressMessageToServer = 190000003;
|
||||||
|
public const int H_C2G_LoginRequest = 110000003;
|
||||||
|
public const int H_G2C_LoginResponse = 160000003;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4d6b4f93610543d4aba550a41e62c38c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
|||||||
|
namespace TEngine.Core.Network
|
||||||
|
{
|
||||||
|
// Route协议定义(需要定义1000以上、因为1000以内的框架预留)
|
||||||
|
public enum RouteType : long
|
||||||
|
{
|
||||||
|
ChatRoute = 1001, // 聊天服协议
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: de1af2c2a2178fe4bbaa8bc911ca5e51
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Reference in New Issue
Block a user