Merge pull request #32 from ALEXTANGXIAO/TEngine_v_3.0.0

TEngine v 3.0.0     [+]HybridCLR
This commit is contained in:
ALEXTANG
2023-04-25 00:03:50 +08:00
committed by GitHub
31 changed files with 930 additions and 611 deletions

3
.gitignore vendored
View File

@@ -102,4 +102,5 @@ Sandbox/
#Luban #Luban
Luban/.cache.meta Luban/.cache.meta
GenerateDatas/ GenerateDatas/
Assets/HybridCLRData.meta

View File

@@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BattleCore.Runtime
{
public class Empty : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1fc394f8c6ad5304a82ff84b4263756f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@@ -0,0 +1,68 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using ProtoBuf;
using TEngine;
using System.Collections.Generic;
namespace GameProto
{
// 这个文件只放协议,和协议头
// 消息协议
[Serializable,global::ProtoBuf.ProtoContract(Name = @"CSPkg")]
public partial class CSPkg
{
[global::ProtoBuf.ProtoMember(1)]
public CSPkgHead Head { get; set; }
[global::ProtoBuf.ProtoMember(2)]
public CSPkgBody Body { get; set; }
}
// 消息协议头
[Serializable,global::ProtoBuf.ProtoContract(Name = @"CSPkgHead")]
public partial class CSPkgHead
{
[global::ProtoBuf.ProtoMember(1)]
public uint MsgId { get; set; }
[global::ProtoBuf.ProtoMember(2)]
public uint MsgLength { get; set; }
[global::ProtoBuf.ProtoMember(3)]
public uint MsgVersion { get; set; }
[global::ProtoBuf.ProtoMember(4)]
public uint Echo { get; set; }
[global::ProtoBuf.ProtoMember(5)]
public uint SvrTime { get; set; }
}
// 消息协议体
[Serializable,global::ProtoBuf.ProtoContract(Name = @"CSPkgBody")]
public partial class CSPkgBody
{
}
// 协议ID
[global::ProtoBuf.ProtoContract()]
public enum CSMsgID
{
CS_START = 0,
CS_HeartBeat = 10001,
CS_END = 10000,
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6d59eaaad20d9234ba941173b39361fc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,9 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
#if HybridCLR_Enable
using HybridCLR; using HybridCLR;
#endif
using UnityEngine; using UnityEngine;
using TEngine; using TEngine;
using System.Reflection; using System.Reflection;
@@ -21,287 +19,264 @@ namespace GameMain
/// </summary> /// </summary>
public bool NeedLoadDll => GameModule.Resource.playMode == EPlayMode.HostPlayMode || GameModule.Resource.playMode == EPlayMode.OfflinePlayMode; public bool NeedLoadDll => GameModule.Resource.playMode == EPlayMode.HostPlayMode || GameModule.Resource.playMode == EPlayMode.OfflinePlayMode;
public override bool UseNativeDialog => true; private bool m_enableAddressable = true;
// private int m_LoadAssetCount; public override bool UseNativeDialog => true;
// private int m_LoadMetadataAssetCount; private int m_LoadAssetCount;
// private int m_FailureAssetCount; private int m_LoadMetadataAssetCount;
// private int m_FailureMetadataAssetCount; private int m_FailureAssetCount;
// private bool m_LoadAssemblyComplete; private int m_FailureMetadataAssetCount;
// private bool m_LoadMetadataAssemblyComplete; private bool m_LoadAssemblyComplete;
// private bool m_LoadAssemblyWait; private bool m_LoadMetadataAssemblyComplete;
// private bool m_LoadMetadataAssemblyWait; private bool m_LoadAssemblyWait;
// private System.Reflection.Assembly m_MainLogicAssembly; private bool m_LoadMetadataAssemblyWait;
// private List<System.Reflection.Assembly> m_HotfixAssemblys; private Assembly m_MainLogicAssembly;
// private IFsm<IProcedureManager> m_procedureOwner; private List<Assembly> m_HotfixAssemblys;
// private IFsm<IProcedureManager> m_procedureOwner;
// protected override void OnEnter(IFsm<IProcedureManager> procedureOwner)
// { protected override void OnEnter(IFsm<IProcedureManager> procedureOwner)
// base.OnEnter(procedureOwner); {
// Log.Debug("HyBridCLR ProcedureLoadAssembly OnEnter"); base.OnEnter(procedureOwner);
// m_procedureOwner = procedureOwner; Log.Debug("HyBridCLR ProcedureLoadAssembly OnEnter");
// m_LoadAssemblyComplete = false; m_procedureOwner = procedureOwner;
// m_HotfixAssemblys = new List<Assembly>(); m_LoadAssemblyComplete = false;
// m_HotfixAssemblys = new List<Assembly>();
// if (!NeedLoadDll || GameModule.Resource.playMode == EPlayMode.EditorSimulateMode)
// { if (!NeedLoadDll || GameModule.Resource.playMode == EPlayMode.EditorSimulateMode)
// m_MainLogicAssembly = GetMainLogicAssembly(); {
// } m_MainLogicAssembly = GetMainLogicAssembly();
// else }
// { else
// if (SettingsUtils.HybridCLRCustomGlobalSettings.Enable) {
// { if (SettingsUtils.HybridCLRCustomGlobalSettings.Enable)
// m_LoadAssetCallbacks ??= new LoadAssetCallbacks(LoadAssetSuccess, LoadAssetFailure); {
// foreach (var hotUpdateDllName in SettingsUtils.HybridCLRCustomGlobalSettings.HotUpdateAssemblies) foreach (string hotUpdateDllName in SettingsUtils.HybridCLRCustomGlobalSettings.HotUpdateAssemblies)
// { {
// var assetPath = Utility.Path.GetRegularPath( var assetLocation = hotUpdateDllName;
// Path.Combine( if (!m_enableAddressable)
// "Assets", {
// SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetPath, assetLocation = Utility.Path.GetRegularPath(
// $"{hotUpdateDllName}{SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetExtension}")); Path.Combine(
// Log.Debug($"LoadAsset: [ {assetPath} ]"); "Assets",
// m_LoadAssetCount++; SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetPath,
// GameModule.Resource.LoadAssetAsync(assetPath,typeof(UnityEngine.TextAsset), m_LoadAssetCallbacks, hotUpdateDllName); $"{hotUpdateDllName}{SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetExtension}"));
// } }
//
// m_LoadAssemblyWait = true; Log.Debug($"LoadAsset: [ {assetLocation} ]");
// } m_LoadAssetCount++;
// else GameModule.Resource.LoadAssetAsync<TextAsset>(assetLocation,LoadAssetSuccess);
// { }
// m_MainLogicAssembly = GetMainLogicAssembly();
// } m_LoadAssemblyWait = true;
// } }
// else
// if (SettingsUtils.HybridCLRCustomGlobalSettings.Enable) {
// { m_MainLogicAssembly = GetMainLogicAssembly();
// #if !UNITY_EDITOR }
// m_LoadMetadataAssemblyComplete = false; }
// LoadMetadataForAOTAssembly();
// #else if (SettingsUtils.HybridCLRCustomGlobalSettings.Enable)
// m_LoadMetadataAssemblyComplete = true; {
// #endif #if UNITY_EDITOR
// } m_LoadMetadataAssemblyComplete = false;
// else LoadMetadataForAOTAssembly();
// { #else
// m_LoadMetadataAssemblyComplete = true; m_LoadMetadataAssemblyComplete = true;
// } #endif
// }
// if (m_LoadAssetCount == 0) else
// { {
// m_LoadAssemblyComplete = true; m_LoadMetadataAssemblyComplete = true;
// } }
// }
// if (m_LoadAssetCount == 0)
// protected override void OnUpdate(IFsm<IProcedureManager> procedureOwner, float elapseSeconds, float realElapseSeconds) {
// { m_LoadAssemblyComplete = true;
// base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds); }
// if (!m_LoadAssemblyComplete) }
// {
// return; protected override void OnUpdate(IFsm<IProcedureManager> procedureOwner, float elapseSeconds, float realElapseSeconds)
// } {
// if (!m_LoadMetadataAssemblyComplete) base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);
// { if (!m_LoadAssemblyComplete)
// return; {
// } return;
// AllAssemblyLoadComplete(); }
// } if (!m_LoadMetadataAssemblyComplete)
// {
// private void AllAssemblyLoadComplete() return;
// { }
// if (GameModule.Resource.playMode == EPlayMode.EditorSimulateMode) AllAssemblyLoadComplete();
// { }
// ChangeState<ProcedureStartGame>(m_procedureOwner);
// return; private void AllAssemblyLoadComplete()
// } {
// if (m_MainLogicAssembly == null) if (GameModule.Resource.playMode == EPlayMode.EditorSimulateMode)
// { {
// Log.Fatal($"Main logic assembly missing."); ChangeState<ProcedureStartGame>(m_procedureOwner);
// return; return;
// } }
// var appType = m_MainLogicAssembly.GetType("GameMain"); if (m_MainLogicAssembly == null)
// if (appType == null) {
// { Log.Fatal($"Main logic assembly missing.");
// Log.Fatal($"Main logic type 'GameMain' missing."); return;
// return; }
// } var appType = m_MainLogicAssembly.GetType("GameApp");
// var entryMethod = appType.GetMethod("Entrance"); if (appType == null)
// if (entryMethod == null) {
// { Log.Fatal($"Main logic type 'GameMain' missing.");
// Log.Fatal($"Main logic entry method 'Entrance' missing."); return;
// return; }
// } var entryMethod = appType.GetMethod("Entrance");
// object[] objects = new object[] { new object[] { m_HotfixAssemblys } }; if (entryMethod == null)
// entryMethod.Invoke(appType, objects); {
// ChangeState<ProcedureStartGame>(m_procedureOwner); Log.Fatal($"Main logic entry method 'Entrance' missing.");
// } return;
// }
// private Assembly GetMainLogicAssembly() object[] objects = new object[] { new object[] { m_HotfixAssemblys } };
// { entryMethod.Invoke(appType, objects);
// Assembly mainLogicAssembly = null; ChangeState<ProcedureStartGame>(m_procedureOwner);
// foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) }
// {
// if (string.Compare(SettingsUtils.HybridCLRCustomGlobalSettings.LogicMainDllName, $"{assembly.GetName().Name}.dll", private Assembly GetMainLogicAssembly()
// StringComparison.Ordinal) == 0) {
// { Assembly mainLogicAssembly = null;
// mainLogicAssembly = assembly; foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
// } {
// if (string.Compare(SettingsUtils.HybridCLRCustomGlobalSettings.LogicMainDllName, $"{assembly.GetName().Name}.dll",
// foreach (var hotUpdateDllName in SettingsUtils.HybridCLRCustomGlobalSettings.HotUpdateAssemblies) StringComparison.Ordinal) == 0)
// { {
// if (hotUpdateDllName == $"{assembly.GetName().Name}.dll") mainLogicAssembly = assembly;
// { }
// m_HotfixAssemblys.Add(assembly);
// } foreach (var hotUpdateDllName in SettingsUtils.HybridCLRCustomGlobalSettings.HotUpdateAssemblies)
// } {
// if (hotUpdateDllName == $"{assembly.GetName().Name}.dll")
// if (mainLogicAssembly != null && m_HotfixAssemblys.Count == SettingsUtils.HybridCLRCustomGlobalSettings.HotUpdateAssemblies.Count) {
// { m_HotfixAssemblys.Add(assembly);
// break; }
// } }
// }
// if (mainLogicAssembly != null && m_HotfixAssemblys.Count == SettingsUtils.HybridCLRCustomGlobalSettings.HotUpdateAssemblies.Count)
// return mainLogicAssembly; {
// } break;
// }
// /// <summary> }
// /// 加载代码资源成功回调。
// /// </summary> return mainLogicAssembly;
// /// <param name="assetName">资源名称。</param> }
// /// <param name="asset">资源实例。</param>
// /// <param name="duration">加载耗时。</param> /// <summary>
// /// <param name="userData">用户数据。</param> /// 加载代码资源成功回调。
// private void LoadAssetSuccess(string assetName, object asset, float duration, object userData) /// </summary>
// { /// <param name="assetOperationHandle">资源操作句柄。</param>
// m_LoadAssetCount--; private void LoadAssetSuccess(AssetOperationHandle assetOperationHandle)
// Log.Debug($"LoadAssetSuccess, assetName: [ {assetName} ], duration: [ {duration} ], userData: [ {userData} ]"); {
// var textAsset = asset as TextAsset; m_LoadAssetCount--;
// if (textAsset == null) var assetName = assetOperationHandle.AssetObject.name;
// { Log.Debug($"LoadAssetSuccess, assetName: [ {assetName} ]");
// Log.Warning($"Load text asset [ {assetName} ] failed.");
// return; var textAsset = assetOperationHandle.AssetObject as TextAsset;
// } if (textAsset == null)
// {
// try Log.Warning($"Load text asset [ {assetName} ] failed.");
// { return;
// var assembly = Assembly.Load(textAsset.bytes); }
// if (string.Compare(SettingsUtils.HybridCLRCustomGlobalSettings.LogicMainDllName, userData as string, StringComparison.Ordinal) == 0)
// { try
// m_MainLogicAssembly = assembly; {
// } var assembly = Assembly.Load(textAsset.bytes);
// m_HotfixAssemblys.Add(assembly); if (string.Compare(SettingsUtils.HybridCLRCustomGlobalSettings.LogicMainDllName, assetName, StringComparison.Ordinal) == 0)
// Log.Debug($"Assembly [ {assembly.GetName().Name} ] loaded"); {
// } m_MainLogicAssembly = assembly;
// catch (Exception e) }
// { m_HotfixAssemblys.Add(assembly);
// m_FailureAssetCount++; Log.Debug($"Assembly [ {assembly.GetName().Name} ] loaded");
// Log.Fatal(e); }
// throw; catch (Exception e)
// } {
// finally m_FailureAssetCount++;
// { Log.Fatal(e);
// m_LoadAssemblyComplete = m_LoadAssemblyWait && 0 == m_LoadAssetCount; throw;
// } }
// } finally
// {
// /// <summary> m_LoadAssemblyComplete = m_LoadAssemblyWait && 0 == m_LoadAssetCount;
// /// 加载代码资源失败回调。 }
// /// </summary> }
// /// <param name="assetName">资源名称。</param>
// /// <param name="status">加载状态。</param> /// <summary>
// /// <param name="errorMessage">错误信息。</param> /// 为Aot Assembly加载原始metadata 这个代码放Aot或者热更新都行。
// /// <param name="userData">自定义数据。</param> /// 一旦加载后如果AOT泛型函数对应native实现不存在则自动替换为解释模式执行。
// private void LoadAssetFailure(string assetName, LoadResourceStatus status, string errorMessage, object userData) /// </summary>
// { public void LoadMetadataForAOTAssembly()
// Log.Fatal($"LoadAssetFailure, assetName: [ {assetName} ], status: [ {status} ], errorMessage: [ {errorMessage} ], userData: [ {userData} ]"); {
// m_LoadAssetCount--; // 可以加载任意aot assembly的对应的dll。但要求dll必须与unity build过程中生成的裁剪后的dll一致而不能直接使用原始dll。
// m_FailureAssetCount++; // 我们在BuildProcessor_xxx里添加了处理代码这些裁剪后的dll在打包时自动被复制到 {项目目录}/HybridCLRData/AssembliesPostIl2CppStrip/{Target} 目录。
// }
// // 注意补充元数据是给AOT dll补充元数据而不是给热更新dll补充元数据。
// /// <summary> // 热更新dll不缺元数据不需要补充如果调用LoadMetadataForAOTAssembly会返回错误
// /// 为Aot Assembly加载原始metadata 这个代码放Aot或者热更新都行。 if (SettingsUtils.HybridCLRCustomGlobalSettings.AOTMetaAssemblies.Count == 0)
// /// 一旦加载后如果AOT泛型函数对应native实现不存在则自动替换为解释模式执行。 {
// /// </summary> m_LoadMetadataAssemblyComplete = true;
// public void LoadMetadataForAOTAssembly() return;
// { }
// // 可以加载任意aot assembly的对应的dll。但要求dll必须与unity build过程中生成的裁剪后的dll一致而不能直接使用原始dll。 foreach (string aotDllName in SettingsUtils.HybridCLRCustomGlobalSettings.AOTMetaAssemblies)
// // 我们在BuildProcessor_xxx里添加了处理代码这些裁剪后的dll在打包时自动被复制到 {项目目录}/HybridCLRData/AssembliesPostIl2CppStrip/{Target} 目录。 {
// var assetLocation = aotDllName;
// // 注意补充元数据是给AOT dll补充元数据而不是给热更新dll补充元数据。 if (!m_enableAddressable)
// // 热更新dll不缺元数据不需要补充如果调用LoadMetadataForAOTAssembly会返回错误 {
// if (SettingsUtils.HybridCLRCustomGlobalSettings.AOTMetaAssemblies.Count == 0) assetLocation = Utility.Path.GetRegularPath(
// { Path.Combine(
// m_LoadMetadataAssemblyComplete = true; "Assets",
// return; SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetPath,
// } $"{aotDllName}{SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetExtension}"));
// m_LoadMetadataAssetCallbacks ??= new LoadAssetCallbacks(LoadMetadataAssetSuccess, LoadMetadataAssetFailure); }
// foreach (var aotDllName in SettingsUtils.HybridCLRCustomGlobalSettings.AOTMetaAssemblies)
// {
// var assetPath = Utility.Path.GetRegularPath( Log.Debug($"LoadMetadataAsset: [ {assetLocation} ]");
// Path.Combine( m_LoadMetadataAssetCount++;
// "Assets", GameModule.Resource.LoadAssetAsync<TextAsset>(assetLocation,LoadMetadataAssetSuccess);
// SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetPath, }
// $"{aotDllName}{SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetExtension}")); m_LoadMetadataAssemblyWait = true;
// Log.Debug($"LoadMetadataAsset: [ {assetPath} ]"); }
// m_LoadMetadataAssetCount++;
// GameModule.Resource.LoadAssetAsync(assetPath,typeof(UnityEngine.TextAsset), m_LoadMetadataAssetCallbacks, aotDllName); /// <summary>
// } /// 加载元数据资源成功回调。
// m_LoadMetadataAssemblyWait = true; /// </summary>
// } /// <param name="assetOperationHandle">资源操作句柄。</param>
// private unsafe void LoadMetadataAssetSuccess(AssetOperationHandle assetOperationHandle)
// /// <summary> {
// /// 加载元数据资源成功回调。 m_LoadMetadataAssetCount--;
// /// </summary> string assetName = assetOperationHandle.AssetObject.name;
// /// <param name="assetName">资源名称。</param> Log.Debug($"LoadMetadataAssetSuccess, assetName: [ {assetName} ]");
// /// <param name="asset">资源实例。</param> var textAsset = assetOperationHandle.AssetObject as TextAsset;
// /// <param name="duration">加载耗时。</param> if (null == textAsset)
// /// <param name="userData">用户数据。</param> {
// private unsafe void LoadMetadataAssetSuccess(string assetName, object asset, float duration, object userData) Log.Debug($"LoadMetadataAssetSuccess:Load text asset [ {assetName} ] failed.");
// { return;
// m_LoadMetadataAssetCount--; }
// Log.Debug($"LoadMetadataAssetSuccess, assetName: [ {assetName} ], duration: [ {duration} ], userData: [ {userData} ]");
// var textAsset = asset as TextAsset; try
// if (null == textAsset) {
// { byte[] dllBytes = textAsset.bytes;
// Log.Debug($"LoadMetadataAssetSuccess:Load text asset [ {assetName} ] failed."); fixed (byte* ptr = dllBytes)
// return; {
// } // 加载assembly对应的dll会自动为它hook。一旦Aot泛型函数的native函数不存在用解释器版本代码
// HomologousImageMode mode = HomologousImageMode.SuperSet;
// try LoadImageErrorCode err = (LoadImageErrorCode)HybridCLR.RuntimeApi.LoadMetadataForAOTAssembly(dllBytes,mode);
// { Log.Warning($"LoadMetadataForAOTAssembly:{assetName}. mode:{mode} ret:{err}");
// byte[] dllBytes = textAsset.bytes; }
// fixed (byte* ptr = dllBytes) }
// { catch (Exception e)
// #if HybridCLR_Enable {
// // 加载assembly对应的dll会自动为它hook。一旦Aot泛型函数的native函数不存在用解释器版本代码 m_FailureMetadataAssetCount++;
// HomologousImageMode mode = HomologousImageMode.SuperSet; Log.Fatal(e.Message);
// LoadImageErrorCode err = (LoadImageErrorCode)HybridCLR.RuntimeApi.LoadMetadataForAOTAssembly(dllBytes,mode); throw;
// Log.Warning($"LoadMetadataForAOTAssembly:{userData as string}. mode:{mode} ret:{err}"); }
// #endif finally
// } {
// } m_LoadMetadataAssemblyComplete = m_LoadMetadataAssemblyWait && 0 == m_LoadMetadataAssetCount;
// catch (Exception e) }
// { }
// m_FailureMetadataAssetCount++;
// Log.Fatal(e.Message);
// throw;
// }
// finally
// {
// m_LoadMetadataAssemblyComplete = m_LoadMetadataAssemblyWait && 0 == m_LoadMetadataAssetCount;
// }
// }
//
// /// <summary>
// /// 加载元数据资源失败回调。
// /// </summary>
// /// <param name="assetName">资源名称。</param>
// /// <param name="status">加载状态。</param>
// /// <param name="errorMessage">错误信息。</param>
// /// <param name="userData">自定义数据。</param>
// private void LoadMetadataAssetFailure(string assetName, LoadResourceStatus status, string errorMessage, object userData)
// {
// Log.Warning($"LoadAssetFailure, assetName: [ {assetName} ], status: [ {status} ], errorMessage: [ {errorMessage} ], userData: [ {userData} ]");
// m_LoadMetadataAssetCount--;
// m_FailureMetadataAssetCount++;
// }
} }
} }

View File

@@ -1,4 +1,3 @@
/*
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using HybridCLR.Editor; using HybridCLR.Editor;
@@ -58,7 +57,4 @@ public static class BuildAssetsCommand
Debug.Log($"[CopyHotUpdateAssembliesToStreamingAssets] copy hotfix dll {dllPath} -> {dllBytesPath}"); Debug.Log($"[CopyHotUpdateAssembliesToStreamingAssets] copy hotfix dll {dllPath} -> {dllBytesPath}");
} }
} }
} }
*/

View File

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

View File

@@ -0,0 +1,291 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace TEngine.Editor
{
public static class ProtoGenTools
{
#if UNITY_EDITOR
[MenuItem("TEngine/生成Proto|Gen Proto", false, 10)]
#endif
public static void Export()
{
InnerProto2CS.Proto2CS();
Debug.Log("proto2cs succeed!");
}
}
public static class InnerProto2CS
{
private static string ProtoPath = UnityEngine.Application.dataPath + "/..\\Luban\\Proto\\pb_schemas\\";
private static string OutPutPath =
UnityEngine.Application.dataPath + "/..\\Luban\\Proto\\Gen\\";
private static readonly char[] splitChars = { ' ', '\t' };
public static void Proto2CS()
{
Proto2CS("GameProto", "ProtoBase.proto", OutPutPath,10001,false);
}
public static void Proto2CS(string nameSpace, string protoName, string outputPath, int startOpcode,bool useMemoryPool = false)
{
if (!Directory.Exists(outputPath))
{
Directory.CreateDirectory(outputPath);
}
string proto = Path.Combine(ProtoPath, protoName);
string csPath = Path.Combine(outputPath, Path.GetFileNameWithoutExtension(proto) + ".cs");
string s = File.ReadAllText(proto);
StringBuilder sb = new StringBuilder();
sb.Append("//------------------------------------------------------------------------------\n");
sb.Append("// <auto-generated>\n");
sb.Append("// This code was generated by a tool.\n");
sb.Append("// Changes to this file may cause incorrect behavior and will be lost if\n");
sb.Append("// the code is regenerated.\n");
sb.Append("// </auto-generated>\n");
sb.Append("//------------------------------------------------------------------------------\n");
sb.Append("\n");
sb.Append("using System;\n");
sb.Append("using ProtoBuf;\n");
sb.Append("using TEngine;\n");
sb.Append("using System.Collections.Generic;\n");
sb.Append("\n");
sb.Append($"namespace {nameSpace}\n");
sb.Append("{\n");
bool isMsgStart = false;
bool isEnumStart = false;
foreach (string line in s.Split('\n'))
{
string newline = line.Trim();
if (newline == "")
{
continue;
}
if (newline.StartsWith("//ResponseType"))
{
string responseType = line.Split(' ')[1].TrimEnd('\r', '\n');
sb.AppendLine($"\t[ResponseType(nameof({responseType}))]");
continue;
}
if (newline.StartsWith("//"))
{
sb.Append($"\t{newline}\n");
continue;
}
if (newline.StartsWith("message"))
{
string parentClass = "";
isMsgStart = true;
string msgName = newline.Split(splitChars, StringSplitOptions.RemoveEmptyEntries)[1];
string[] ss = newline.Split(new[] { "//" }, StringSplitOptions.RemoveEmptyEntries);
if (ss.Length == 2)
{
parentClass = ss[1].Trim();
}
sb.Append($"\t[Serializable,global::ProtoBuf.ProtoContract(Name = @\"{msgName}\")]\n");
if (useMemoryPool)
{
sb.Append($"\tpublic partial class {msgName}: IMemory");
}
else
{
sb.Append($"\tpublic partial class {msgName}");
}
if (parentClass != "")
{
sb.Append($", {parentClass}\n");
}
else
{
sb.Append("\n");
}
continue;
}
if (isMsgStart)
{
if (newline == "{")
{
sb.Append("\t{\n");
continue;
}
if (newline == "}")
{
isMsgStart = false;
sb.Append("\t}\n\n");
continue;
}
if (newline.Trim().StartsWith("//"))
{
sb.AppendLine(newline);
continue;
}
if (newline.Trim() != "" && newline != "}")
{
if (newline.StartsWith("repeated"))
{
Repeated(sb, nameSpace, newline);
}
else
{
Members(sb, newline, true);
}
}
}
if (newline.StartsWith("enum"))
{
isEnumStart = true;
string enumName = newline.Split(splitChars, StringSplitOptions.RemoveEmptyEntries)[1];
sb.Append($"\t[global::ProtoBuf.ProtoContract()]\n");
sb.Append($"\tpublic enum {enumName}");
sb.Append("\n");
continue;
}
if (isEnumStart)
{
if (newline == "{")
{
sb.Append("\t{\n");
continue;
}
if (newline == "}")
{
isEnumStart = false;
sb.Append("\t}\n\n");
continue;
}
if (newline.Trim().StartsWith("//"))
{
sb.AppendLine(newline);
continue;
}
int index = newline.IndexOf(";");
newline = newline.Remove(index);
sb.Append($"\t\t{newline},\n\n");
}
}
sb.Append("}\n");
using (FileStream txt = new FileStream(csPath, FileMode.Create, FileAccess.ReadWrite))
{
using (StreamWriter sw = new StreamWriter(txt))
{
Debug.Log(sb.ToString());
sw.Write(sb.ToString());
}
}
}
private static void Repeated(StringBuilder sb, string ns, string newline)
{
try
{
int index = newline.IndexOf(";");
newline = newline.Remove(index);
string[] ss = newline.Split(splitChars, StringSplitOptions.RemoveEmptyEntries);
string type = ss[1];
type = ConvertType(type);
string name = ss[2];
int n = int.Parse(ss[4]);
sb.Append($"\t\t[global::ProtoBuf.ProtoMember({n})]\n");
sb.Append($"\t\tpublic List<{type}> {name} = new List<{type}>();\n\n");
}
catch (Exception e)
{
Console.WriteLine($"{newline}\n {e}");
}
}
private static string ConvertType(string type)
{
string typeCs = "";
switch (type)
{
case "int16":
typeCs = "short";
break;
case "int32":
typeCs = "int";
break;
case "bytes":
typeCs = "byte[]";
break;
case "uint32":
typeCs = "uint";
break;
case "long":
typeCs = "long";
break;
case "int64":
typeCs = "long";
break;
case "uint64":
typeCs = "ulong";
break;
case "uint16":
typeCs = "ushort";
break;
default:
typeCs = type;
break;
}
return typeCs;
}
private static void Members(StringBuilder sb, string newline, bool isRequired)
{
try
{
int index = newline.IndexOf(";");
newline = newline.Remove(index);
string[] ss = newline.Split(splitChars, StringSplitOptions.RemoveEmptyEntries);
string type = ss[0];
string name = ss[1];
int n = int.Parse(ss[3]);
string typeCs = ConvertType(type);
sb.Append($"\t\t[global::ProtoBuf.ProtoMember({n})]\n");
if (string.Equals(type,"string"))
{
sb.Append($"\t\t[global::System.ComponentModel.DefaultValue(\"\")]\n");
}
sb.Append($"\t\tpublic {typeCs} {name} {{ get; set; }}\n\n");
}
catch (Exception e)
{
Console.WriteLine($"{newline}\n {e}");
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e505998676d79fb47bc6b4ed97148fa1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -3,7 +3,8 @@
"rootNamespace": "", "rootNamespace": "",
"references": [ "references": [
"TEngine.Runtime", "TEngine.Runtime",
"YooAsset.Editor" "YooAsset.Editor",
"HybridCLR.Editor"
], ],
"includePlatforms": [ "includePlatforms": [
"Editor" "Editor"

View File

@@ -27,6 +27,7 @@ MonoBehaviour:
m_FormalResourceSourceUrl: http://127.0.0.1:8088 m_FormalResourceSourceUrl: http://127.0.0.1:8088
m_AtlasFolder: Assets/AssetRaw/UIRaw m_AtlasFolder: Assets/AssetRaw/UIRaw
m_ResourceVersionFileName: ResourceVersion.txt m_ResourceVersionFileName: ResourceVersion.txt
HostServerURL: http://127.0.0.1:8081
CheckVersionUrl: http://127.0.0.1/Resources/{0}Version.txt CheckVersionUrl: http://127.0.0.1/Resources/{0}Version.txt
WindowsAppUrl: http://127.0.0.1 WindowsAppUrl: http://127.0.0.1
MacOSAppUrl: http://127.0.0.1 MacOSAppUrl: http://127.0.0.1
@@ -39,9 +40,16 @@ MonoBehaviour:
m_BybridCLRCustomGlobalSettings: m_BybridCLRCustomGlobalSettings:
m_Enable: 1 m_Enable: 1
m_Gitee: 1 m_Gitee: 1
HotUpdateAssemblies: [] HotUpdateAssemblies:
AOTMetaAssemblies: [] - GameLogic.dll
LogicMainDllName: xxx.dll - GameBase.dll
- GameProto.dll
- BattleCore.Runtime.dll
AOTMetaAssemblies:
- mscorlib.dll
- System.dll
- System.Core.dll
LogicMainDllName: GameLogic.dll
AssemblyTextAssetExtension: .bytes AssemblyTextAssetExtension: .bytes
AssemblyTextAssetPath: Assets/AssetRaw/DLL AssemblyTextAssetPath: AssetRaw/DLL
HybridCLRGlobalSettings: Settings/HybridCLRGlobalSettings HybridCLRGlobalSettings: Settings/HybridCLRGlobalSettings

View File

@@ -28,15 +28,16 @@ public class HybridCLRCustomGlobalSettings
set { m_Gitee = value; } set { m_Gitee = value; }
} }
[Header("Auto sync with [HybridCLRGlobalSettings]")] [Tooltip("You should modify the file form file path [Assets/CustomHybridCLR/Settings/HybridCLRGlobalSettings.asset]")] [Header("Auto sync with [HybridCLRGlobalSettings]")]
public List<string> HotUpdateAssemblies; [Tooltip("You should modify the file form file path [Assets/CustomHybridCLR/Settings/HybridCLRGlobalSettings.asset]")]
public List<string> HotUpdateAssemblies = new List<string>() { "GameLogic.dll","GameBase.dll","GameProto.dll","BattleCore.Runtime.dll"};
[Header("Need manual setting!")] public List<string> AOTMetaAssemblies; [Header("Need manual setting!")] public List<string> AOTMetaAssemblies= new List<string>() {"mscorlib.dll","System.dll","System.Core.dll" };
/// <summary> /// <summary>
/// Dll of main business logic assembly /// Dll of main business logic assembly
/// </summary> /// </summary>
public string LogicMainDllName = "xxx.dll"; public string LogicMainDllName = "GameLogic.dll";
/// <summary> /// <summary>
/// 程序集文本资产打包Asset后缀名 /// 程序集文本资产打包Asset后缀名
@@ -46,7 +47,7 @@ public class HybridCLRCustomGlobalSettings
/// <summary> /// <summary>
/// 程序集文本资产资源目录 /// 程序集文本资产资源目录
/// </summary> /// </summary>
public string AssemblyTextAssetPath = "Assets/AssetRaw/DLL"; public string AssemblyTextAssetPath = "AssetRaw/DLL";
/// <summary> /// <summary>
/// Resources HybridCLRGlobalSettings Dir /// Resources HybridCLRGlobalSettings Dir

View File

@@ -682,7 +682,9 @@ public sealed class BuglyAgent
#if UNITY_ANDROID #if UNITY_ANDROID
// The crash reporter package name, default is 'com.tencent.bugly' // The crash reporter package name, default is 'com.tencent.bugly'
#pragma warning disable CS0414
private static string _crashReporterPackage = "com.tencent.bugly"; private static string _crashReporterPackage = "com.tencent.bugly";
#pragma warning restore CS0414
#endif #endif
#if UNITY_IPHONE || UNITY_IOS #if UNITY_IPHONE || UNITY_IOS
private static int _crashReproterCustomizedLogLevel = 2; // Off=0,Error=1,Warn=2,Info=3,Debug=4 private static int _crashReproterCustomizedLogLevel = 2; // Off=0,Error=1,Warn=2,Info=3,Debug=4

View File

@@ -0,0 +1,68 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using ProtoBuf;
using TEngine;
using System.Collections.Generic;
namespace GameProto
{
// 这个文件只放协议,和协议头
// 消息协议
[Serializable,global::ProtoBuf.ProtoContract(Name = @"CSPkg")]
public partial class CSPkg
{
[global::ProtoBuf.ProtoMember(1)]
public CSPkgHead Head { get; set; }
[global::ProtoBuf.ProtoMember(2)]
public CSPkgBody Body { get; set; }
}
// 消息协议头
[Serializable,global::ProtoBuf.ProtoContract(Name = @"CSPkgHead")]
public partial class CSPkgHead
{
[global::ProtoBuf.ProtoMember(1)]
public uint MsgId { get; set; }
[global::ProtoBuf.ProtoMember(2)]
public uint MsgLength { get; set; }
[global::ProtoBuf.ProtoMember(3)]
public uint MsgVersion { get; set; }
[global::ProtoBuf.ProtoMember(4)]
public uint Echo { get; set; }
[global::ProtoBuf.ProtoMember(5)]
public uint SvrTime { get; set; }
}
// 消息协议体
[Serializable,global::ProtoBuf.ProtoContract(Name = @"CSPkgBody")]
public partial class CSPkgBody
{
}
// 协议ID
[global::ProtoBuf.ProtoContract()]
public enum CSMsgID
{
CS_START = 0,
CS_HeartBeat = 10001,
CS_END = 10000,
}
}

View File

@@ -1,5 +0,0 @@
Info_2023/1/13 11:33:15: By AlanDu Time:2023/1/13 11:33:15
Info_2023/1/13 11:33:15: Version 0.1
Info_2023/1/13 11:33:15: Function Protobuf Resolver
Info_2023/1/13 11:33:15: protoDirPathG:\WorkSpace\DinGameFrame\Luban\Proto\pb_message
Info_2023/1/13 11:33:15: ProtoOutputPath../../Assets\GameMain\HotFix\Scripts\Proto\Definition\Constant

Binary file not shown.

View File

@@ -1,18 +1,21 @@
@echo off & setlocal enabledelayedexpansion @REM @echo off & setlocal enabledelayedexpansion
cd %~dp0 @REM cd %~dp0
echo =================start gen proto code================= @REM echo =================start gen proto code=================
set pb_path=pb_message @REM set pb_path=pb_message
set out_path=..\..\Assets\GameMain\HotFix\Scripts\Proto @REM set out_path=..\..\Assets\GameMain\HotFix\Scripts\Proto
del /f /s /q %out_path%\*.* @REM del /f /s /q %out_path%\*.*
for /f "delims=" %%i in ('dir /b %pb_path%') do ( @REM for /f "delims=" %%i in ('dir /b %pb_path%') do (
echo ------------%%i start gen @REM echo ------------%%i start gen
protoc -I=pb_message --csharp_out=../../Assets/GameMain/HotFix/Scripts/Proto pb_message\%%i @REM protoc -I=pb_message --csharp_out=../../Assets/GameMain/HotFix/Scripts/Proto pb_message\%%i
echo ------------%%i gen success @REM echo ------------%%i gen success
) @REM )
echo =================end gen proto code================= @REM echo =================end gen proto code=================
set cur_path=%~dp0 @REM set cur_path=%~dp0
set outEventPath=../../Assets\GameMain\HotFix\Scripts\Proto\Definition\Constant @REM set outEventPath=../../Assets\GameMain\HotFix\Scripts\Proto\Definition\Constant
call ProtobufResolver.exe %cur_path%pb_message %outEventPath% @REM call ProtobufResolver.exe %cur_path%pb_message %outEventPath%
echo =================end gen proto event================= @REM echo =================end gen proto event=================
pause @REM pause
protoc -I=pb_schemas --csharp_out=Gen pb_schemas\ProtoBase.proto
pause

View File

@@ -1,191 +0,0 @@
syntax = "proto3";
import "GameBase.proto";
option java_package ="com.game.juhe.server.protobuf.proto";
package DPLogin;
// 客户端向服务端发送登录协议,发送账号和密码
// PTC_C2G_LOGININFO
message DPUserLoginInfoReq
{
string szAccount = 1; // 账号
string szPassword = 2; // 密码
string szMacAdress = 3; // mac地址
int32 nClientVersion = 4; // 客户端版本号
string szUserName = 5; // 用户名字
string extensionJson = 6; // 透传字段
}
// 登陆角色服返回验证结果
enum AccountLoginVerifyResult
{
ACC_VERIFY_RET_SUCCESS = 0; // 允许进入角色服务器
ACC_VERIFY_RET_FAILED = 1; // 未知错误
ACC_VERIFY_RET_ACCOUNT_OR_PASSWORD_ERROR = 2; // 账号或者密码错误
ACC_VERIFY_RET_MAINTENANCE = 3; // 服务器维护中
ACC_VERIFY_RET_IS_FULL = 4; // 服务器人数已满
ACC_VERIFY_RET_TIMEOUT = 5; // 验证超时
ACC_VERIFY_RET_PAYSYSHTTPERROR = 6; // http验证系统异常请联系客服
ACC_VERIFY_RET_FULLACCOUNT_INLIST = 7; // 因为人数过多在排队队列
ACC_VERIFY_RET_FULLACCOUNT_OUTLIST = 8; // 因为人数过多连排队队列都排不上
ACC_VERIFY_RET_FULLVERIFYACOUNT = 9; // 验证账号人数过多请耐心等待
ACC_VERIFY_RET_CLIENTVERSIONERROR = 10; // 客户端版本不对
}
// 玩家登陆,身份验证的结果
// PTC_G2C_ACC_VERIFY_RESULT
message DPAccountVerifyResultResp
{
string szAccount = 1; // 账号
AccountLoginVerifyResult nResult = 2; // 结果
string szLoginGuid = 3; // 登陆guid
string szServerIP = 4; // 服务器ip
int32 nPort = 5; // 端口
int32 nServerID = 6; // 服务器ID
int32 nWaitNum = 7; // 排队人数
int32 nMaxWaitNum = 8; // 最大排队人数
string szGatewayName = 9; // 服务器名
}
// 客户端发起登陆协议
// PTC_C2S_LOGICLOGIN
message DPGSLogicLoginReq
{
string szLoginGuid = 1; // 登陆guid
string szAccount = 2; // 账号
int32 nServerId = 3; // serverID
string szMacAdress = 4; // mac地址
}
// 登陆逻辑服失败
enum BEGSLogicLoginRet
{
GS_LOGIN_RET_FAILED = 0; // 未知错误
GS_LOGIN_RET_SUCCESS = 1; // 成功
GS_LOGIN_RET_FAILED_NEED_AUTH = 2; // 需要重新账号密码验证
GS_LOGIN_RET_FAILED_DIRECTLOGIN = 3; // 断线重连失败
GS_LOGIN_RET_FAILED_ACCOUNTLOGINPROXY = 4; // 登录代理服务器失败
GS_LOGIN_RET_FAILED_GSDIRECTLOGIN = 5; // 登录gs失败
GS_LOGIN_RET_FAILED_ACCOUNTLOGINBEGIN = 6; // account登录失败
GS_LOGIN_RET_FAILED_ASKGCROLEINFO = 7; // 登陆失败
GS_LOGIN_RET_FAILED_ROLELIST = 8; // 获取角色列表
GS_LOGIN_RET_FAILED_ASKGSPERMISSION = 9; // 询问gs登录失败
GS_LOGIN_RET_FAILED_ASKGSPERMISSIONRET = 10; // 询问gs登录失败
GS_LOGIN_RET_FAILED_SELECTROLEFAILED = 11; // 选择角色登录失败
}
// 客户端登陆逻辑服失败返回错误码
// PTC_S2C_LOGICLOIN_RET
message DPGSLogicLoginRetResp
{
string szAccount = 1; // 账号
BEGSLogicLoginRet eRet = 2; // 返回登陆结果
}
// 角色列表中的角色信息
message DPGSRoleItemInfo
{
GameBase.DPRoleBaseInfo stBaseInfo = 1;
int64 nCreateTime = 2; // 创建角色时间
int32 nPlatformId = 3; // 平台类型
int32 nCreateServerId = 4; // 创建角色的服务器ID
}
// 网关服务端把角色列表发回到客户端,里面有账号,角色数和角色列表
// PTC_G2C_ROLELIST_RESPONE
message DPRoleListResponeResp
{
string szAccount = 1; // 账号
int32 nRoleCount = 2; // 角色数
repeated DPGSRoleItemInfo arrayRoleList = 3; // 角色列表
}
// 玩家确定选取角色登录游戏
// PTC_C2G_GAMELOGIN_REQUEST
message DPGameLoginRequestReq
{
string szAccount = 1; // 账号
uint64 nRoleGuid = 2; // 玩家唯一标识id guid
string szRoleName = 3; // 玩家名
}
// 创建角色发送创建的角色名到网关服务器
// PTC_C2G_CREATE_ROLE
message DPCreateRoleReq
{
string szAccount = 1; // 账号
string szRoleName = 2; // 角色名
int32 nProfessionId = 3; // 角色ID
int32 nPortrait = 4; // 头像
int32 nClothId = 5; // 选择的时装
int32 nPlatformId = 6; // 平台ID
}
// 创建角色失败原因
enum RoleCreateFailedResult
{
ROLECREATE_FAIL_REASON_NONE = 0; // 角色创建成功
ROLECREATE_FAIL_REASON_UNKNOWN = 1; // 未知错误
ROLECREATE_FAIL_REASON_NAME_FILTER = 2; // 角色名非法
ROLECREATE_FAIL_REASON_NAME_EXIST = 3; // 角色名已存在
ROLECREATE_FAIL_REASON_OVER_MAX_ROLE_PER_GATEWAY = 4; // 创建角色超过本服上限
ROLECREATE_FAIL_REASON_OVER_MAX_ROLE_PER_ZONE = 5; // 创建角色超过整个大区上限
ROLECREATE_FAIL_MAX_NAME_LEN = 6; // 角色名长度超过上限
ROLECREATE_FAIL_MIN_NAME_LEN = 7; // 角色名长度低于下限
}
// 创建角色返回结果给客户端
// PTC_G2C_CREATEROLE_RESULT
message DPCreateRoleResultResp
{
string szAccount = 1; // 账号
string szRoleName = 2; // 角色名
uint64 nRoleGuid = 3; // 玩家唯一标识id guid
bool bSuccessed = 4; // 是否成功
RoleCreateFailedResult nFailedReason = 5; // 如果失败,返回原因
}
// 踢掉玩家的原因
enum KickOutClientResult
{
KICKOUT_REASON_NULL = 0; //默认踢掉角色
KICKOUT_REASON_SAMEACCOUNTLOGIN = 1; //账号重复登录
KICKOUT_REASON_KICKHANGUP = 2; //踢掉挂机的玩家
KICKOUT_REASON_LOGINFAILED = 3; //客户端登录失败
KICKOUT_REASON_CLIENTDISCONNECT = 4; //客户端断开连接
KICKOUT_REASON_CLIENTREQUESTEXIT = 5; //客户端请求退出
KICKOUT_REASON_SERVERKICK = 6; //服务器因错误挫人
KICKOUT_REASON_UNLEGALCLIENT = 7; //非法的客户端
KICKOUT_REASON_BACKENDKICK = 8; //后台踢人
KICKOUT_REASON_ONLINEGMKICK = 9; //GM在线踢人
KICKOUT_REASON_GSCRASH = 10; //GS宕机踢人
KICKOUT_REASON_GCCRASH = 11; //GC宕机踢人
KICKOUT_REASON_SCENECHANGE = 12; //场景切换失败
KICKOUT_REASON_BANPLAYER = 13; //封号
KICKOUT_REASON_SWITCHSERVER = 14; //切换gs的踢人
KICKOUT_REASON_EXITROLE = 15; //切换角色
KICKOUT_REASON_DIRECTLOGIN = 16; //断线重连失败
KICKOUT_REASON_BISHOPKICKOUT = 17; //bishop踢人
}
// 踢掉客户端
// PTC_G2C_KICKOUTCLIENT
message DPKickOutClientResp
{
KickOutClientResult eKickOut = 1; // 踢掉原因
}
// 退出账号,到账号登录界面
// PTC_C2S_EXITACCOUNT
message DPGSExitAccountReq
{
}
// 退出角色,到选择角色界面
// PTC_C2S_EXITROLE
message DPGSExitRoleReq
{
}

View File

@@ -1,45 +0,0 @@
syntax = "proto3";
option java_package ="com.game.juhe.server.protobuf.proto";
package GameBase;
// 游戏全局基础数据,和协议无关,就放结构
enum PacketType
{
Undefined = 0;
ClientToServer = 1;
ServerToClient = 2;
}
message PacketHeader
{
PacketType packetType = 1;
int64 id = 2;
int64 packetLength = 3;
bool isValid = 4;
}
// PTC_C2S_HeartBeat
message CSHeartBeat
{
int64 dwTime = 1;
}
// PTC_S2C_HeartBeat
message SCHeartBeat
{
int64 dwTime = 1;
}
// 玩家角色基础数据数据
message DPRoleBaseInfo
{
uint64 ullRoleGuid = 1; // guid
string szRoleName = 2; // 角色名
int32 nLevel = 3; // 角色等级
int32 nProfessionId = 4; // 角色ID
int32 nPortraitId = 5; // 头像
int32 nFightPower = 6; // 战斗力
int32 nClothId = 7; // 时装ID
}

View File

@@ -1,35 +0,0 @@
syntax = "proto3";
option java_package ="com.game.juhe.server.protobuf.proto";
package ProtoBase;
// 这个文件只放协议,和协议头
// 协议头
message BGProtocolHeader
{
int32 uProtocolId = 1; // 协议号
int32 uKeyLen = 2; // 验证码长度
bytes szSessionKey = 3; //[MAX_SESSIONKEY_LEN=64]
}
// 协议ID
enum ProtocolID
{
PTC_START = 0;
PTC_C2S_HeartBeat = 10001; // 客户端向网关服务器的协议id
PTC_S2C_HeartBeat = 10002; // 网关服务器向客户端的协议id
PTC_C2G_LOGININFO = 10003;
PTC_G2C_ACC_VERIFY_RESULT = 1004;
PTC_C2S_LOGICLOGIN = 10005;
PTC_S2C_LOGICLOIN_RET = 10006;
PTC_G2C_ROLELIST_RESPONE = 10007;
PTC_C2G_GAMELOGIN_REQUEST = 10008;
PTC_C2G_CREATE_ROLE = 1009;
PTC_G2C_CREATEROLE_RESULT = 10010;
PTC_G2C_KICKOUTCLIENT = 10011;
PTC_C2S_EXITACCOUNT = 10012;
PTC_C2S_EXITROLE = 10013;
PTC_END = 10000;
}

View File

@@ -1,5 +1,7 @@
syntax = "proto3"; syntax = "proto3";
package pb.message;
package GameProto;
// //
message ExternalMessage { message ExternalMessage {
// : 0 1 // : 0 1

View File

@@ -0,0 +1,8 @@
syntax = "proto3";
package GameProto;
// 游戏全局基础数据,和协议无关,就放结构
// 导入定义
import "ProtoBase";

View File

@@ -0,0 +1,36 @@
syntax = "proto3";
package GameProto;
// 这个文件只放协议,和协议头
// 消息协议
message CSPkg
{
CSPkgHead Head = 1; //消息协议头
CSPkgBody Body = 2; //消息协议体
}
// 消息协议头
message CSPkgHead
{
uint32 MsgId = 1; //协议号
uint32 MsgLength = 2; //协议长度
uint32 MsgVersion = 3; //协议版本
uint32 Echo = 4; //回带字段
uint32 SvrTime = 5; //服务器时间
}
// 消息协议体
message CSPkgBody
{
}
// 协议ID
enum CSMsgID
{
CS_START = 0;
CS_HeartBeat = 10001;
CS_END = 10000;
}

View File

@@ -1,5 +1,6 @@
{ {
"dependencies": { "dependencies": {
"com.focus-creative-games.hybridclr_unity": "https://gitee.com/focus-creative-games/hybridclr_unity.git",
"com.unity.2d.animation": "5.2.0", "com.unity.2d.animation": "5.2.0",
"com.unity.2d.pixel-perfect": "4.0.1", "com.unity.2d.pixel-perfect": "4.0.1",
"com.unity.2d.psdimporter": "4.3.0", "com.unity.2d.psdimporter": "4.3.0",
@@ -47,5 +48,14 @@
"com.unity.modules.vr": "1.0.0", "com.unity.modules.vr": "1.0.0",
"com.unity.modules.wind": "1.0.0", "com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0" "com.unity.modules.xr": "1.0.0"
} },
"scopedRegistries": [
{
"name": "hybridclr_unity",
"url": "https://package.openupm.cn",
"scopes": [
"com.focus-creative-games.hybridclr_unity"
]
}
]
} }

View File

@@ -1,5 +1,12 @@
{ {
"dependencies": { "dependencies": {
"com.focus-creative-games.hybridclr_unity": {
"version": "https://gitee.com/focus-creative-games/hybridclr_unity.git",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "bf6ae99dadfbc64e3a6f2dc7f63509a5b6b12621"
},
"com.unity.2d.animation": { "com.unity.2d.animation": {
"version": "5.2.0", "version": "5.2.0",
"depth": 0, "depth": 0,

View File

@@ -0,0 +1,36 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &1
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e189374413a3f00468e49d51d8b27a09, type: 3}
m_Name:
m_EditorClassIdentifier:
enable: 1
useGlobalIl2cpp: 0
hybridclrRepoURL: https://gitee.com/focus-creative-games/hybridclr
il2cppPlusRepoURL: https://gitee.com/focus-creative-games/il2cpp_plus
hotUpdateAssemblyDefinitions:
- {fileID: 5897886265953266890, guid: aa06d4cc755c979489c256c1bcca1dfb, type: 3}
- {fileID: 5897886265953266890, guid: 08c3762f54316454ca6b6fbcb22b40e5, type: 3}
- {fileID: 5897886265953266890, guid: acd6baa97ba40d3478c29cd9c76ff9e3, type: 3}
- {fileID: 5897886265953266890, guid: a90b2d3377c5e4a4db95cc44fb82045e, type: 3}
- {fileID: 5897886265953266890, guid: 641632c4f8079b94f963b5284d859a12, type: 3}
hotUpdateAssemblies:
- Assembly-CSharp
preserveHotUpdateAssemblies: []
hotUpdateDllCompileOutputRootDir: HybridCLRData/HotUpdateDlls
externalHotUpdateAssembliyDirs: []
strippedAOTDllOutputRootDir: HybridCLRData/AssembliesPostIl2CppStrip
patchAOTAssemblies: []
collectAssetReferenceTypes: 0
outputLinkFile: HybridCLRData/Generated/link.xml
outputAOTGenericReferenceFile: HybridCLRData/Generated/AOTGenericReferences.cs
maxGenericReferenceIteration: 10
maxMethodBridgeGenericIteration: 10

View File

@@ -12,8 +12,8 @@ MonoBehaviour:
m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_EnablePreviewPackages: 0 m_EnablePreviewPackages: 1
m_EnablePackageDependencies: 0 m_EnablePackageDependencies: 1
m_AdvancedSettingsExpanded: 1 m_AdvancedSettingsExpanded: 1
m_ScopedRegistriesSettingsExpanded: 1 m_ScopedRegistriesSettingsExpanded: 1
oneTimeWarningShown: 1 oneTimeWarningShown: 1
@@ -24,20 +24,28 @@ MonoBehaviour:
m_Scopes: [] m_Scopes: []
m_IsDefault: 1 m_IsDefault: 1
m_Capabilities: 7 m_Capabilities: 7
- m_Id: scoped:hybridclr_unity
m_Name: hybridclr_unity
m_Url: https://package.openupm.cn
m_Scopes:
- com.focus-creative-games.hybridclr_unity
m_IsDefault: 0
m_Capabilities: 0
m_UserSelectedRegistryName: m_UserSelectedRegistryName:
m_UserAddingNewScopedRegistry: 0 m_UserAddingNewScopedRegistry: 0
m_RegistryInfoDraft: m_RegistryInfoDraft:
m_ErrorMessage: m_ErrorMessage:
m_Original: m_Original:
m_Id: m_Id: scoped:hybridclr_unity
m_Name: m_Name: hybridclr_unity
m_Url: m_Url: https://package.openupm.cn
m_Scopes: [] m_Scopes:
- com.focus-creative-games.hybridclr_unity
m_IsDefault: 0 m_IsDefault: 0
m_Capabilities: 0 m_Capabilities: 0
m_Modified: 0 m_Modified: 0
m_Name: m_Name: hybridclr_unity
m_Url: m_Url: https://package.openupm.cn
m_Scopes: m_Scopes:
- - com.focus-creative-games.hybridclr_unity
m_SelectedScopeIndex: 0 m_SelectedScopeIndex: 0

View File

@@ -164,7 +164,9 @@ PlayerSettings:
androidSupportedAspectRatio: 1 androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1 androidMaxAspectRatio: 2.1
applicationIdentifier: applicationIdentifier:
Android: com.dinstudio.tengine
Standalone: com.DefaultCompany.2DProject Standalone: com.DefaultCompany.2DProject
iPhone: com.dinstudio.tengine
buildNumber: buildNumber:
Standalone: 0 Standalone: 0
iPhone: 0 iPhone: 0
@@ -253,7 +255,7 @@ PlayerSettings:
useCustomBaseGradleTemplate: 0 useCustomBaseGradleTemplate: 0
useCustomGradlePropertiesTemplate: 0 useCustomGradlePropertiesTemplate: 0
useCustomProguardFile: 0 useCustomProguardFile: 0
AndroidTargetArchitectures: 1 AndroidTargetArchitectures: 3
AndroidTargetDevices: 0 AndroidTargetDevices: 0
AndroidSplashScreenScale: 0 AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0} androidSplashScreen: {fileID: 0}
@@ -426,9 +428,9 @@ PlayerSettings:
enableInternalProfiler: 0 enableInternalProfiler: 0
logObjCUncaughtExceptions: 1 logObjCUncaughtExceptions: 1
enableCrashReportAPI: 0 enableCrashReportAPI: 0
cameraUsageDescription: cameraUsageDescription: "\u662F\u5426\u5141\u8BB8\u6253\u5F00\u6444\u50CF\u5934"
locationUsageDescription: locationUsageDescription: "\u662F\u5426\u5141\u8BB8\u8BBF\u95EE\u5B9A\u4F4D"
microphoneUsageDescription: microphoneUsageDescription: "\u662F\u5426\u5141\u8BB8\u8BBF\u95EE\u7535\u8BDD"
bluetoothUsageDescription: bluetoothUsageDescription:
switchNMETAOverride: switchNMETAOverride:
switchNetLibKey: switchNetLibKey:
@@ -674,7 +676,8 @@ PlayerSettings:
14: ENABLE_LOG 14: ENABLE_LOG
additionalCompilerArguments: {} additionalCompilerArguments: {}
platformArchitecture: {} platformArchitecture: {}
scriptingBackend: {} scriptingBackend:
Android: 1
il2cppCompilerConfiguration: {} il2cppCompilerConfiguration: {}
managedStrippingLevel: {} managedStrippingLevel: {}
incrementalIl2cppBuild: {} incrementalIl2cppBuild: {}
@@ -685,10 +688,11 @@ PlayerSettings:
enableRoslynAnalyzers: 1 enableRoslynAnalyzers: 1
additionalIl2CppArgs: additionalIl2CppArgs:
scriptingRuntimeVersion: 1 scriptingRuntimeVersion: 1
gcIncremental: 1 gcIncremental: 0
assemblyVersionValidation: 1 assemblyVersionValidation: 1
gcWBarrierValidation: 0 gcWBarrierValidation: 0
apiCompatibilityLevelPerPlatform: {} apiCompatibilityLevelPerPlatform:
Android: 3
m_RenderingPath: 1 m_RenderingPath: 1
m_MobileRenderingPath: 1 m_MobileRenderingPath: 1
metroPackageName: 2D_BuiltInRenderer metroPackageName: 2D_BuiltInRenderer

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB