更新了网络服务接口定义
This commit is contained in:
8
Packages/Plugins/GameDesigner.meta
Normal file
8
Packages/Plugins/GameDesigner.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e99b4cd34370a54fba68fe7b13b2096
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "BITKit.Plugins.GameDesigner",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:f263169dea78d2249ba035c363b9cb8e"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [
|
||||
"GameDesigner"
|
||||
],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": true
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d9e9ef799363801468795ccea8c02e28
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
55
Packages/Plugins/GameDesigner/BITSerializeAdapter.cs
Normal file
55
Packages/Plugins/GameDesigner/BITSerializeAdapter.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using BITKit;
|
||||
using Net.Serialize;
|
||||
using Net.Share;
|
||||
using Net.System;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
|
||||
public class BITSerializeAdapter : ISerializeAdapter
|
||||
{
|
||||
public bool IsEncrypt { get; set; }
|
||||
public int Password { get; set; }
|
||||
|
||||
public byte[] OnSerializeRpc(RPCModel model)
|
||||
{
|
||||
for (var i = 0; i < model.pars.Length; i++)
|
||||
{
|
||||
var obj = model.pars[i];
|
||||
if (!BITBinary.TryWrite(obj, out var buffer))
|
||||
{
|
||||
buffer = NetConvertFast2.SerializeObject(obj);
|
||||
}
|
||||
|
||||
model.pars[i] = buffer;
|
||||
}
|
||||
|
||||
return NetConvertFast2.SerializeModel(model);
|
||||
}
|
||||
|
||||
public FuncData OnDeserializeRpc(byte[] buffer, int index, int count)
|
||||
{
|
||||
var model = NetConvertFast2.DeserializeModel(buffer);
|
||||
for (var i = 0; i < model.pars.Length; i++)
|
||||
{
|
||||
var obj = model.pars[i];
|
||||
if (obj is not byte[] bytes) continue;
|
||||
var value = BITBinary.ReadAsValue(bytes);
|
||||
model.pars[i] = value;
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
public byte[] OnSerializeOpt(OperationList list)
|
||||
{
|
||||
return NetConvertFast2.SerializeObject(list).ToArray(true);
|
||||
}
|
||||
|
||||
public OperationList OnDeserializeOpt(byte[] buffer, int index, int count)
|
||||
{
|
||||
var segment = new Segment(buffer, index, count, false);
|
||||
return NetConvertFast2.DeserializeObject<OperationList>(segment);
|
||||
}
|
||||
}
|
||||
}
|
11
Packages/Plugins/GameDesigner/BITSerializeAdapter.cs.meta
Normal file
11
Packages/Plugins/GameDesigner/BITSerializeAdapter.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 38f2ffcf85efc8541916d326b1036ed5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user