Git Product home page Git Product logo

luban_unity_tutorial's Introduction

Luban导表插件在Unity中的使用示例

基于 luban_examples 内的 Csharp_Unity_Json 实现

目录结构

考虑到源表格表格无需放在Unity工程内(工程内仅需已导出的数据),因此目录结构划分如下:

│─Client : Unity工程目录
│  └─Assets
│     ├─Plugins
│     │  └─LubanLib : Luban插件相关
│     ├─Scenes
│     │  └─SampleScene.unity : 示例场景
│     ├─Scripts
│     │  └─Main.cs : 入口脚本
│     │  └─TableManager.cs : 表格管理器类
│     └─TableData : 表格导出数据及脚本文件夹
│         └─Json : 表格导出Json数据文件夹
└─Public : 源表格工程目录
    ├─Tables : 源excel表格文件夹
    └─Tools : Luban插件相关

配置流程

表格导入

从官方源示例项目 luban_examples 内复制示例模板文件夹 MiniDesignerConfigsTemplate 到Public,重命名为Tables

插件导入

复制 luban_examples 中的Tools导表工具到 Public\Tools

复制 Csharp_Unity_Json 中的 Assets\LubanLib 到本项目的Client\Assets\Plugins 下,开启PlayerSetting的unsafe

复制 Csharp_Unity_Json 中的 gen_code_json.bat 到 Public

编写导表命令

用记事本或VSCode对 gen_code_json.bat 进行修改:

rem 不显示后续命令行及当前命令行
@echo off
chcp 65001

echo ----------------------------------------
echo 【TIME】%DATE%
echo 【OPERATION】Luban开始导表...
echo ----------------------------------------

cd..

rem 项目根目录
set PROJECT_HOME=%cd%
rem 表格工具根目录
set TABLE_ROOT=%PROJECT_HOME%\Public
rem Unity项目根目录
set UNITY_ROOT=%PROJECT_HOME%\Client
rem 源表目录
set CONF_ROOT=%TABLE_ROOT%\Tables
rem 导出表数据目录
set OUTPUT_ROOT=%UNITY_ROOT%\Assets\TableData
rem 导表工具路径(纯本地模型)
set GEN_CLIENT=%TABLE_ROOT%\Tools\Luban.ClientServer\Luban.ClientServer.exe
rem 导表dll
set Luban.ClientServer.dll=%TABLE_ROOT%\Tools\Luban.ClientServer\Luban.ClientServer.dll


echo 【OPERATION】清除Json文件夹
del /S /Q /F %OUTPUT_ROOT%\Json


%GEN_CLIENT%  -j cfg --^
 -d %CONF_ROOT%\Defines\__root__.xml ^
 --input_data_dir %CONF_ROOT%\Datas ^
 --output_code_dir %OUTPUT_ROOT% ^
 --output_data_dir %OUTPUT_ROOT%\Json ^
 --gen_types code_cs_unity_json,data_json ^
 -s all 

pause

执行导表命令

双击执行 gen_code_json.bat ,正常的话会显示成功日志

TODO

若 gen_code_json.bat 内不执行 del /S /Q /F %OUTPUT_ROOT%\Json 清除Json文件夹,会偶现导表失败(没导出数据),原因待查

luban_unity_tutorial's People

Contributors

southbegonia avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.