Coder Social home page Coder Social logo

excel2unity's Introduction

Excel2Unity

  • 功能

    • 将Excel配表数据导入Unity中,生成二进制配表数据以及相应的读取代码
  • 安装须知

    • 1, 表格生成工具用的语言是python, 使用的是最新的python3,需要安装python3版本安装包

    • 2, IDE使用的是pycharm, 推荐使用pycharm开发python

    • 3, 导入xlrd包,用来读取Excel文件

  • 代码修改

    打开Config.py文件, 修改几个配置属性

    # Excel文件目录
    EXCEL_DIR = "./Excel"
    
    # 数据生成路径
    UnityDataDir = "./../ExcelTest/Assets/StreamingAssets/Config/"
    
    # 代码生成路径
    UnityCodeDir = "./../ExcelTest/Assets/Scripts/Config/"	

    Excel2Unity工程目录下,使用WinRun.bat批处理文件,执行生成数据和代码

  • Excel配表使用

    • Excel表头有5行

    • 第一行为字段注释,在生成代码中显示

    • 第二行有三个字段可以选择 C, S, CS , 分别用来代码这个字段是客户端所有,服务器所有,还是客户端服务器共有

    • 第三行是字段的类型, 目前有int,float,bool,string,list[int],list[float],list[string],map[int|int],map[int|float],map[int|string],map[string|int],map[string|float],map[string|string]这些类型可供选择, 涵盖了常用的类型

    • 第四行填写字段名

    • 第五行是指字段是否为key,这个表格工具支持多个字段key和没有key

      • 没有key的情况下,生成的表格的数据管理类的数据使用List管理

      • 有一个key的情况下,生成的表格的数据管理类的数据使用Dictionary管理

      • 多个key的情况下,也是使用List来管理,但是获取数据的函数会有不同可能会有多个形参

      • 打上key关键字的字段只能是int, string这几个基本类型

  • 特殊说明,在Excel中,对于数组类型字段,需要使用默认的分隔符

    • 对于List字段,分隔符是使用的;(分号)

    • 对于Map字段,一级分隔符是|(竖斜杠), 二级分隔符是;(分号)

这个工具的知乎文章

https://zhuanlan.zhihu.com/p/52591971

excel2unity's People

Contributors

xieliujian avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.