Compare commits

...

8 Commits

25 changed files with 2095 additions and 24 deletions

Binary file not shown.

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 58793fbd79d5dc64fb809643ce24f665

Binary file not shown.

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b1e08ff72cdd6064883254a020cad051

Binary file not shown.

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c61f603b1eefa51489d220166ce921ba

Binary file not shown.

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 992230fc9ae81744aa9c6d6f1998273f

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b719d2506760e4e43954921863684f40

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 081ac1838dc3211419aad66a1ea6a883

View File

@ -479,6 +479,7 @@ Transform:
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10} m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@ -660,8 +661,9 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 1485465861} - component: {fileID: 1485465861}
- component: {fileID: 1485465862}
m_Layer: 0 m_Layer: 0
m_Name: CatGirl m_Name: Character
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -682,6 +684,18 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1485465862
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1485465860}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 757576bb4354ac54da09868e1be02eec, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1660057539 &9223372036854775807 --- !u!1660057539 &9223372036854775807
SceneRoots: SceneRoots:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -691,3 +705,4 @@ SceneRoots:
- {fileID: 613797070} - {fileID: 613797070}
- {fileID: 912467178} - {fileID: 912467178}
- {fileID: 1485465861} - {fileID: 1485465861}
- {fileID: 1485465861}

View File

@ -1,48 +1,134 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Xml.Linq; using System.Xml.Linq;
using UnityEngine;
namespace Data namespace Data
{ {
public enum Orientation
{
Down,
Left,
Right,
Up
}
public enum DrawNodeType
{
Image,
Animation
}
public class CharacterDef : Define public class CharacterDef : Define
{ {
public string texturePath = null;
public DrawingOrderDef public DrawingOrderDef
drawingOrder_down, drawingOrder_down,
drawingOrder_up, drawingOrder_up,
drawingOrder_left, drawingOrder_left,
drawingOrder_right; drawingOrder_right;
public DrawingOrderDef GetDrawingOrder(Orientation orientation)
{
// 定义一个临时变量用于存储结果
DrawingOrderDef result = null;
// 根据传入的 Orientation 获取对应的 DrawingOrderDef
switch (orientation)
{
case Orientation.Down:
result = drawingOrder_down;
break;
case Orientation.Up:
result = drawingOrder_up;
break;
case Orientation.Left:
result = drawingOrder_left;
break;
case Orientation.Right:
result = drawingOrder_right;
break;
default:
throw new ArgumentException("Invalid orientation value.");
}
// 如果当前方向的结果为空,则尝试用 drawingOrder_down 填充
if (result == null) result = drawingOrder_down;
// 如果 drawingOrder_down 仍然为空,则尝试用其他非空方向填充
if (result == null) result = drawingOrder_up ?? drawingOrder_left ?? drawingOrder_right;
return result;
}
} }
public class DrawingOrderDef : Define public class DrawingOrderDef : Define
{ {
public List<DrawNodeDef> DrawNodes { get; set; } = new List<DrawNodeDef>(); public List<DrawNodeDef> drawNodes = new();
public override bool Init(XElement xmlDef) public override bool Init(XElement xmlDef)
{ {
base.Init(xmlDef); base.Init(xmlDef);
foreach (var node in xmlDef.Elements("DrawNodes")) foreach (var node in xmlDef.Elements("DrawNodeDef"))
{ {
DrawNodeDef drawNode = new DrawNodeDef(); var drawNode = new DrawNodeDef();
drawNode.Init(node); drawNode.Init(node);
DrawNodes.Add(drawNode); drawNodes.Add(drawNode);
} }
return true; return true;
} }
} }
public partial class DrawNodeDef : Define
public class DrawNodeDef : Define
{ {
public string NodeName { get; set; } public List<DrawNodeDef> children = new();
public List<DrawNodeDef> Children { get; set; } = new(); public DrawNodeType drawNodeType = DrawNodeType.Image;
public string nodeName;
public Vector2 position = new(0, 0);
public float FPS = 1;
public override bool Init(XElement xmlDef) public override bool Init(XElement xmlDef)
{ {
base.Init(xmlDef); base.Init(xmlDef);
NodeName = xmlDef.Attribute("name")?.Value;
foreach (var childNode in xmlDef.Elements("DrawNode")) nodeName = xmlDef.Attribute("name")?.Value;
drawNodeType = Enum.TryParse(xmlDef.Attribute("type")?.Value, true, out DrawNodeType typeResult)
? typeResult
: DrawNodeType.Image;
position = StringToVector(xmlDef.Attribute("position")?.Value ?? "(0 0)");
FPS = float.TryParse(xmlDef.Attribute("FPS")?.Value, out float result) ? result : 1.0f;
foreach (var childNode in xmlDef.Elements("DrawNodeDef"))
{ {
DrawNodeDef child = new DrawNodeDef(); var child = new DrawNodeDef();
child.Init(childNode); child.Init(childNode);
Children.Add(child); children.Add(child);
} }
return true; return true;
} }
public Vector2 StringToVector(string vectorDef)
{
// 去掉可能存在的括号和多余的空格
string cleanedInput = vectorDef.Replace("(", "").Replace(")", "").Trim();
// 使用正则表达式匹配两个浮点数
Match match = Regex.Match(cleanedInput, @"\s*(-?\d+(\.\d*)?)\s*[, ]\s*(-?\d+(\.\d*)?)\s*");
if (match.Success)
{
// 提取匹配到的两个浮点数
float x = float.Parse(match.Groups[1].Value);
float y = float.Parse(match.Groups[3].Value);
// 返回 Vector2 对象
return new Vector2(x, y);
}
else
{
return Vector2.zero;
}
}
} }
} }

View File

@ -6,6 +6,7 @@ using System.Text;
using System.Xml.Linq; using System.Xml.Linq;
using Configs; using Configs;
using UnityEngine; using UnityEngine;
using Object = System.Object;
namespace Data namespace Data
{ {
@ -141,7 +142,7 @@ namespace Data
if (string.IsNullOrEmpty(className)) if (string.IsNullOrEmpty(className))
continue; continue;
// Debug.Log("1"); // Debug.Log("1");
var def = LoadDefineClass(element); var def = LoadDefineClass(element,element.Name.ToString());
if (def == null) if (def == null)
continue; continue;
// Debug.Log("2"); // Debug.Log("2");
@ -152,9 +153,8 @@ namespace Data
} }
} }
private Define LoadDefineClass(XElement defineDoc) private Define LoadDefineClass(XElement defineDoc,string className)
{ {
var className = defineDoc.Name.ToString();
var assembly = Assembly.GetExecutingAssembly(); var assembly = Assembly.GetExecutingAssembly();
Type type; Type type;
@ -206,8 +206,14 @@ namespace Data
} }
if (define.Init(defineDoc)) return define; if (define.Init(defineDoc)) return define;
// 获取类的所有字段(不包括私有字段) DefaultInitDefine(define,defineDoc, type);
var fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic);
return define;
}
public void DefaultInitDefine(Define define,XElement defineDoc,Type defineType)
{
var fields = defineType.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic);
// 遍历字段并尝试从 XElement 中赋值 // 遍历字段并尝试从 XElement 中赋值
foreach (var field in fields) foreach (var field in fields)
@ -217,8 +223,11 @@ namespace Data
if (element != null) if (element != null)
try try
{ {
// 将子元素的值转换为目标类型并赋值 Object value;
var value = Convert.ChangeType(element.Value, field.FieldType); if (IsFieldTypeInheritedFrom(field, typeof(Define)))
value = LoadDefineClass(element, field.FieldType.Name);
else
value = Convert.ChangeType(element.Value, field.FieldType);
field.SetValue(define, value); field.SetValue(define, value);
} }
catch (Exception ex) catch (Exception ex)
@ -226,8 +235,6 @@ namespace Data
Debug.LogWarning($"Error setting field {field.Name}: {ex.Message}"); Debug.LogWarning($"Error setting field {field.Name}: {ex.Message}");
} }
} }
return define;
} }
/// <summary> /// <summary>
@ -278,5 +285,23 @@ namespace Data
return sb.ToString(); return sb.ToString();
} }
/// <summary>
/// 检查字段的类型是否继承自指定的类
/// </summary>
/// <param name="field">字段信息</param>
/// <param name="baseType">要检查的基类类型</param>
/// <returns>如果字段的类型是基类或其派生类,则返回 true</returns>
public static bool IsFieldTypeInheritedFrom(FieldInfo field, Type baseType)
{
// 获取字段的类型
var fieldType = field.FieldType;
// 如果字段的类型为 null 或不是基类的派生类,则返回 false
if (!baseType.IsAssignableFrom(fieldType))
return false;
// 如果字段的类型直接是基类或其派生类,则返回 true
return fieldType != baseType && baseType.IsAssignableFrom(fieldType);
}
} }
} }

View File

@ -0,0 +1,96 @@
using System;
using System.Linq;
using Data;
using UnityEngine;
namespace Entity
{
public class Character : MonoBehaviour
{
private void Start()
{
if (Managers.DefineManager.Instance.defines.TryGetValue("DrawingOrderDef",out var typeDict))
{
GenerateDrawNode(typeDict.Values?.FirstOrDefault()as DrawingOrderDef);
}
}
public void Init(CharacterDef def)
{
if (def == null)
return;
GenerateDrawNode(def.GetDrawingOrder(Orientation.Down));
}
// 生成图片或动画节点
private void GenerateDrawNode(DrawingOrderDef def)
{
// Debug.Log(def);
// 删除现有子节点
DeleteAllChildren();
// 生成根节点下的所有节点
foreach (var nodeDef in def.drawNodes) GenerateNode(nodeDef, transform); // 在当前节点下生成
}
// 递归生成节点
private void GenerateNode(DrawNodeDef nodeDef, Transform parent)
{
// Debug.Log(nodeDef.nodeName);
// 创建新的 GameObject 表示节点
var nodeObject = new GameObject(nodeDef.nodeName);
// 设置父节点
nodeObject.transform.SetParent(parent, false);
// 根据节点类型生成不同的内容
switch (nodeDef.drawNodeType)
{
case DrawNodeType.Image:
CreateImageNode(nodeObject);
break;
case DrawNodeType.Animation:
CreateAnimationNode(nodeObject);
break;
default:
Debug.LogWarning($"Unsupported node type: {nodeDef.drawNodeType}");
break;
}
// 递归生成子节点
if (nodeDef.children != null && nodeDef.children.Count > 0)
foreach (var childNodeDef in nodeDef.children)
GenerateNode(childNodeDef, nodeObject.transform); // 在当前节点下生成子节点
}
// 创建图片节点
private void CreateImageNode(GameObject nodeObject)
{
// 添加 SpriteRenderer 组件表示图片
var spriteRenderer = nodeObject.AddComponent<SpriteRenderer>();
spriteRenderer.sprite = Resources.Load<Sprite>("DefaultImage"); // 加载默认图片
spriteRenderer.color = Color.white; // 设置默认颜色
}
// 创建动画节点
private void CreateAnimationNode(GameObject nodeObject)
{
// 添加 Animator 组件表示动画
var animator = nodeObject.AddComponent<Animator>();
animator.runtimeAnimatorController =
Resources.Load<RuntimeAnimatorController>("DefaultAnimation"); // 加载默认动画控制器
}
private void DeleteAllChildren()
{
// 获取当前对象的 Transform
var parentTransform = transform;
// 删除所有子对象
foreach (Transform child in parentTransform) Destroy(child.gameObject); // 使用 Destroy 方法删除子对象
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 757576bb4354ac54da09868e1be02eec

View File

@ -21,8 +21,39 @@ namespace Managers
var pack = new DefinePack(); var pack = new DefinePack();
if (pack.LoadPack(folder)) packs.Add(pack.packID, pack); if (pack.LoadPack(folder)) packs.Add(pack.packID, pack);
} }
}
foreach (var pack in packs)
{
foreach (var define in pack.Value.defines)
{
var typeName=define.Key;
var defList=define.Value;
if (!defines.ContainsKey(typeName))
defines[typeName] = new Dictionary<string, Define>();
foreach (var def in defList)
{
defines[typeName][def.defName] = def;
}
}
}
}
/// <summary>
/// 查找指定定义类型的定义名对应的 Define 对象。
/// </summary>
/// <param name="defineType">定义类型</param>
/// <param name="defineName">定义名</param>
/// <returns>如果找到,返回 Define 对象;否则返回 null。</returns>
public Define FindDefine(string defineType, string defineName)
{
if (defines.TryGetValue(defineType, out var typeDict))
{
if (typeDict.TryGetValue(defineName, out var define))
{
return define;
}
}
return null;
}
public override string ToString() public override string ToString()
{ {
if (packs == null || packs.Count == 0) if (packs == null || packs.Count == 0)

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8afd87f1b9f31bb44be8c224d8fc7270

View File

@ -0,0 +1,387 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: message.proto
// </auto-generated>
#pragma warning disable 0414, 1591, 8981, 0612
#region Designer generated code
using grpc = global::Grpc.Core;
namespace Protocol {
public static partial class GeneralService
{
static readonly string __ServiceName = "protocol.GeneralService";
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (message is global::Google.Protobuf.IBufferMessage)
{
context.SetPayloadLength(message.CalculateSize());
global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
context.Complete();
return;
}
#endif
context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static class __Helper_MessageCache<T>
{
public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (__Helper_MessageCache<T>.IsBufferMessage)
{
return parser.ParseFrom(context.PayloadAsReadOnlySequence());
}
#endif
return parser.ParseFrom(context.PayloadAsNewBuffer());
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::Protocol.Empty> __Marshaller_protocol_Empty = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Protocol.Empty.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::Protocol.ServerInfo> __Marshaller_protocol_ServerInfo = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Protocol.ServerInfo.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::Protocol.Empty, global::Protocol.ServerInfo> __Method_GetServerInfo = new grpc::Method<global::Protocol.Empty, global::Protocol.ServerInfo>(
grpc::MethodType.Unary,
__ServiceName,
"GetServerInfo",
__Marshaller_protocol_Empty,
__Marshaller_protocol_ServerInfo);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Protocol.MessageReflection.Descriptor.Services[0]; }
}
/// <summary>Base class for server-side implementations of GeneralService</summary>
[grpc::BindServiceMethod(typeof(GeneralService), "BindService")]
public abstract partial class GeneralServiceBase
{
/// <summary>
/// Get server info from server.
///
/// This parameter actually doesn't accept any arguments,
/// but it is still required owing to Protobuf grammar.
/// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::System.Threading.Tasks.Task<global::Protocol.ServerInfo> GetServerInfo(global::Protocol.Empty request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for GeneralService</summary>
public partial class GeneralServiceClient : grpc::ClientBase<GeneralServiceClient>
{
/// <summary>Creates a new client for GeneralService</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public GeneralServiceClient(grpc::ChannelBase channel) : base(channel)
{
}
/// <summary>Creates a new client for GeneralService that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public GeneralServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
protected GeneralServiceClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
protected GeneralServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
/// <summary>
/// Get server info from server.
///
/// This parameter actually doesn't accept any arguments,
/// but it is still required owing to Protobuf grammar.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::Protocol.ServerInfo GetServerInfo(global::Protocol.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetServerInfo(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Get server info from server.
///
/// This parameter actually doesn't accept any arguments,
/// but it is still required owing to Protobuf grammar.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::Protocol.ServerInfo GetServerInfo(global::Protocol.Empty request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_GetServerInfo, null, options, request);
}
/// <summary>
/// Get server info from server.
///
/// This parameter actually doesn't accept any arguments,
/// but it is still required owing to Protobuf grammar.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::Protocol.ServerInfo> GetServerInfoAsync(global::Protocol.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return GetServerInfoAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
/// <summary>
/// Get server info from server.
///
/// This parameter actually doesn't accept any arguments,
/// but it is still required owing to Protobuf grammar.
/// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::Protocol.ServerInfo> GetServerInfoAsync(global::Protocol.Empty request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_GetServerInfo, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
protected override GeneralServiceClient NewInstance(ClientBaseConfiguration configuration)
{
return new GeneralServiceClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public static grpc::ServerServiceDefinition BindService(GeneralServiceBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_GetServerInfo, serviceImpl.GetServerInfo).Build();
}
/// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic.
/// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
/// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public static void BindService(grpc::ServiceBinderBase serviceBinder, GeneralServiceBase serviceImpl)
{
serviceBinder.AddMethod(__Method_GetServerInfo, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Protocol.Empty, global::Protocol.ServerInfo>(serviceImpl.GetServerInfo));
}
}
public static partial class GameService
{
static readonly string __ServiceName = "protocol.GameService";
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (message is global::Google.Protobuf.IBufferMessage)
{
context.SetPayloadLength(message.CalculateSize());
global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
context.Complete();
return;
}
#endif
context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static class __Helper_MessageCache<T>
{
public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (__Helper_MessageCache<T>.IsBufferMessage)
{
return parser.ParseFrom(context.PayloadAsReadOnlySequence());
}
#endif
return parser.ParseFrom(context.PayloadAsNewBuffer());
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::Protocol.LoginRequest> __Marshaller_protocol_LoginRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Protocol.LoginRequest.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::Protocol.LoginResponse> __Marshaller_protocol_LoginResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Protocol.LoginResponse.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::Protocol.SignupRequest> __Marshaller_protocol_SignupRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Protocol.SignupRequest.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::Protocol.SignupResponse> __Marshaller_protocol_SignupResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Protocol.SignupResponse.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::Protocol.LoginRequest, global::Protocol.LoginResponse> __Method_Login = new grpc::Method<global::Protocol.LoginRequest, global::Protocol.LoginResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Login",
__Marshaller_protocol_LoginRequest,
__Marshaller_protocol_LoginResponse);
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::Protocol.SignupRequest, global::Protocol.SignupResponse> __Method_Signup = new grpc::Method<global::Protocol.SignupRequest, global::Protocol.SignupResponse>(
grpc::MethodType.Unary,
__ServiceName,
"Signup",
__Marshaller_protocol_SignupRequest,
__Marshaller_protocol_SignupResponse);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Protocol.MessageReflection.Descriptor.Services[1]; }
}
/// <summary>Base class for server-side implementations of GameService</summary>
[grpc::BindServiceMethod(typeof(GameService), "BindService")]
public abstract partial class GameServiceBase
{
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::System.Threading.Tasks.Task<global::Protocol.LoginResponse> Login(global::Protocol.LoginRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::System.Threading.Tasks.Task<global::Protocol.SignupResponse> Signup(global::Protocol.SignupRequest request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for GameService</summary>
public partial class GameServiceClient : grpc::ClientBase<GameServiceClient>
{
/// <summary>Creates a new client for GameService</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public GameServiceClient(grpc::ChannelBase channel) : base(channel)
{
}
/// <summary>Creates a new client for GameService that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public GameServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
protected GameServiceClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
protected GameServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::Protocol.LoginResponse Login(global::Protocol.LoginRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return Login(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::Protocol.LoginResponse Login(global::Protocol.LoginRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Login, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::Protocol.LoginResponse> LoginAsync(global::Protocol.LoginRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return LoginAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::Protocol.LoginResponse> LoginAsync(global::Protocol.LoginRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Login, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::Protocol.SignupResponse Signup(global::Protocol.SignupRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return Signup(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::Protocol.SignupResponse Signup(global::Protocol.SignupRequest request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Signup, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::Protocol.SignupResponse> SignupAsync(global::Protocol.SignupRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return SignupAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::Protocol.SignupResponse> SignupAsync(global::Protocol.SignupRequest request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Signup, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
protected override GameServiceClient NewInstance(ClientBaseConfiguration configuration)
{
return new GameServiceClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public static grpc::ServerServiceDefinition BindService(GameServiceBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_Login, serviceImpl.Login)
.AddMethod(__Method_Signup, serviceImpl.Signup).Build();
}
/// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic.
/// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
/// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public static void BindService(grpc::ServiceBinderBase serviceBinder, GameServiceBase serviceImpl)
{
serviceBinder.AddMethod(__Method_Login, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Protocol.LoginRequest, global::Protocol.LoginResponse>(serviceImpl.Login));
serviceBinder.AddMethod(__Method_Signup, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Protocol.SignupRequest, global::Protocol.SignupResponse>(serviceImpl.Signup));
}
}
}
#endregion

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f2f787a1d94a6ae48b5586f040f0cf1b

View File

@ -7,7 +7,7 @@ namespace Test
public class TestDefine : MonoBehaviour public class TestDefine : MonoBehaviour
{ {
// Start is called once before the first execution of Update after the MonoBehaviour is created // Start is called once before the first execution of Update after the MonoBehaviour is created
void Start() void Awake()
{ {
Managers.DefineManager.Instance.Init(); Managers.DefineManager.Instance.Init();
Debug.Log(Managers.DefineManager.Instance); Debug.Log(Managers.DefineManager.Instance);

View File

@ -24,7 +24,7 @@
<DrawNodeDef name="body"> <DrawNodeDef name="body">
<DrawNodeDef name="head"> <DrawNodeDef name="head">
<DrawNodeDef name="backHair"/> <DrawNodeDef name="backHair"/>
<DrawNodeDef name="ear"/> <DrawNodeDef name="ear" type="animation" FPS="1"/>
<DrawNodeDef name="face"/> <DrawNodeDef name="face"/>
<DrawNodeDef name="frontHair"/> <DrawNodeDef name="frontHair"/>
<DrawNodeDef name="hat"/> <DrawNodeDef name="hat"/>
@ -32,4 +32,5 @@
<DrawNodeDef name="clothes"/> <DrawNodeDef name="clothes"/>
</DrawNodeDef> </DrawNodeDef>
</DrawingOrderDef> </DrawingOrderDef>
</Define> </Define>