少年修仙传客户端代码仓库
client_Wu Xijin
2018-10-23 6392cc9e80ebdd6c12308e99087a26b7beea0008
3335 更新lua库
2个文件已添加
93 ■■■■■ 已修改文件
Lua/LuaGameNetSystem.cs 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Lua/LuaGameNetSystem.cs.meta 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Lua/LuaGameNetSystem.cs
New file
@@ -0,0 +1,81 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public class LuaGameNetPackBase
{
    public ushort cmd = 0;
    List<byte> sendBytes = new List<byte>();
    Action writeBytesAction;
    public void RegistWriteToBytes(Action action)
    {
    }
    public void WriteIntsBytes(uint value, LuaGameNetSystem.NetDataType type)
    {
    }
    public void Send()
    {
        sendBytes.AddRange(BitConverter.GetBytes(cmd));
        if (writeBytesAction != null)
        {
            writeBytesAction();
        }
        GameNetSystem.Instance.SendInfo(sendBytes.ToArray());
    }
    int readIndex = 0;
    public uint TransUintBytes(byte[] value, LuaGameNetSystem.NetDataType type)
    {
        readIndex += 4;
        return BitConverter.ToUInt32(value, readIndex);
    }
    public ushort TransUshortBytes(byte[] value, LuaGameNetSystem.NetDataType type)
    {
        readIndex += 2;
        return BitConverter.ToUInt16(value, readIndex);
    }
    public byte TransByteBytes(byte[] value, LuaGameNetSystem.NetDataType type)
    {
        readIndex += 1;
        return value[readIndex];
    }
//     public uint[] TransVShortsBytes(byte[] value, LuaGameNetSystem.NetDataType type, int length)
//     {
//
//
//     }
}
public class LuaGameNetSystem
{
    public static LuaGameNetPackBase New()
    {
        return new LuaGameNetPackBase();
    }
    public enum NetDataType
    {
        BYTE,
        WORD,
        DWORD,
        Chars,
        Int,
        Double
    }
}
Lua/LuaGameNetSystem.cs.meta
New file
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 5e300c360f92a7a4a8f55568a5346e98
timeCreated: 1540260844
licenseType: Pro
MonoImporter:
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant: