1 Star 4 Fork 2

wanwanfeng / unity.excel2table

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

unity.excel2table

应用于Unity的Excel导出文件插件,目前了正常导出xml,xmlattribute,json,csv,bytes,txt。加载模块已经预留接口。

使用步骤

  1. 进入Sample设定配表使用方式。 如:
public partial class Sample : MonoBehaviour
{
	//设定配表方式
	public static Excel.ImpHelper helper => new Excel.Helper.Json();
	//public static Excel.ImpHelper helper => new Excel.Helper.Xml();
	//public static Excel.ImpHelper helper => new Excel.Helper.XmlAtt();
	//public static Excel.ImpHelper helper => new Excel.Helper.Csv();
	//public static Excel.ImpHelper helper => new Excel.Helper.Txt();
	//public static Excel.ImpHelper helper => new Excel.Helper.Bytes();
	......
}
  1. 进入项目根目录Excel文件夹,按照模板文件新加配表或者修改已有配表数据。

  2. 进入unity项目,执行菜单“Tools/ExcelTools/Build”。

  3. 进入项目根目录Temp/Excel文件夹,查看生成的数据文件以及对应的类文件data.cs,若已知配表字段类型进行了修改或新增,则把data.cs更新至项目内并重新编译代码。Temp/Excel/data为生成的数据中间文件,这些文件会压缩并加密到“Assets/Resources/data.bin.bytes”文件内,此文件为实际使用文件。

  4. 文件使用方法见Sample.cs:

if (FileHelper.GZIP.Deserialize(path, out Dictionary<string, byte[]> dict))
{
	dict = dict.ToDictionary(p => Path.GetFileNameWithoutExtension(p.Key), p => p.Value);

	foreach (var pair in dictionary)
	{
		if (dict.TryGetValue(pair.Key.Name, out byte[] bytes))
		{
			Debug.Log("this table is now ! " + pair.Key.Name);
			yield return pair.Value.Load(helper, bytes);

			var info = GetType().GetProperty(pair.Key.Name, BindingFlags.Public | BindingFlags.Instance);
			if (info == null) continue;
			info.SetValue(this, pair.Value);
        }
        else
        {
			Debug.LogError("this table is not exist! " + pair.Key.Name);
        }
	}
}

空文件

简介

应用于Unity的Excel导出文件插件,目前了正常导出xml,xmlattribute,json,csv,bytes,txt。加载模块已经预留接口。 展开 收起
C#
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C#
1
https://gitee.com/wanwanfeng/unity.excel2table.git
git@gitee.com:wanwanfeng/unity.excel2table.git
wanwanfeng
unity.excel2table
unity.excel2table
dev

搜索帮助