未知
项目描述
IDLite是一个开发中的项目。可能会进行不兼容的更改,恕不另行通知。
背景
IDLite是一个工具,可以帮助解决在Unity中创建移动在线游戏时,使用Unity C#处理JSON感到不便的问题。
如果您想使用固定的协议,可以选择protocol buffer、thrift或msgpack idl,但这些工具在数据打包方面效率很高,使用时可能会牺牲一些Web系开发风格。
JSON schema也存在,但这也可能很复杂,难以学习。
虽然有一些C#库如LitJSON可以轻松处理JSON,但在反射和泛型受限的iOS环境中,它们可能无法运行。
IDLite就是为了满足这一需求而诞生的。
示例
IDL
// ドキュメントコメント
// 複数行書けます.
enum Color {
red = 1,
green = 2,
blue = 3
};
# 無視されるコメント
// ボール
class Ball {
// ボールの持ち主
string? owner;
// ボールの色
enum Color color;
// 座標
float x;
float y;
};
class Field {
List<Ball> balls;
};
生成的代码
// This code is automatically generated.
// Don't edit this file directly.
using System;
using System.Collections.Generic;
namespace IDLite
{
/// <summary>
/// ドキュメントコメント
/// 複数行書けます.
/// </summary>
public enum Color
{
red = 1,
green = 2,
blue = 3
}
/// <summary>
/// ボール
/// </summary>
[Serializable]
public partial class Ball : IDLiteBase
{
/// <summary>
/// ボールの持ち主
/// </summary>
public string owner;
/// <summary>
/// ボールの色
/// </summary>
public Color color;
/// <summary>
/// 座標
/// </summary>
public double x;
public double y;
public Ball(string owner, Color color, double x, double y)
{
this.owner = owner;
this.color = color;
this.x = x;
this.y = y;
}
public Ball(Dictionary<string, object> dict)
{
this.owner = ParseNullableString(GetItem(dict, "owner"));
this.color = (Color)ParseInt(GetItem(dict, "color"));
this.x = ParseDouble(GetItem(dict, "x"));
this.y = ParseDouble(GetItem(dict, "y"));
}
public override string ToString()
{
return "Ball(owner=" + owner + ", color=" + color + ", x=" + x + ", y=" + y + ")";
}
}
[Serializable]
public partial class Field : IDLiteBase
{
public List<Ball> balls;
public Field(List<Ball> balls)
{
this.balls = balls;
}
public Field(Dictionary<string, object> dict)
{
this.balls = GetList<Ball>(dict, "balls", (object o) => { return new Ball((Dictionary<string, object>)o); });
}
public override string ToString()
{
return "Field(balls=" + balls + ")";
}
}
}
项目详情
下载文件
下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。
源代码分发
idlite-0.0.11.tar.gz (7.4 kB 查看哈希值)
构建分发
idlite-0.0.11-py3-none-any.whl (10.9 kB 查看哈希值)
关闭
idlite-0.0.11.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 2915cf18bccabe8d51c287f87e0b9b43087c9f49267d5d4aa9707ae0bca49c6c |
|
MD5 | d4b396cc31cfa48d96d5247594a6b0f9 |
|
BLAKE2b-256 | face6b4e91e3ed5a36ceea868de5045f6888a7491ec12026ae50684a692179ac |