【数据处理】使用xlua读取XlsxToLua生成的配置文件
来源:互联网 发布:淘宝商品视频内存大小 编辑:程序博客网 时间:2024/06/07 15:30
//LuaDataInfousing System.Collections;using System.Collections.Generic;using UnityEngine;using System.IO;using XLua;public class TableDataHeroPojo{ public int HeroId { get; set; } public string Name { get; set; } public int Rare { get; set; } public int Type { get; set; } public int DefaultStar { get; set; } public bool IsOpen { get; set; } //public LitJson.JsonData Attributes { get; set; }}public class LuaDataInfo : MonoBehaviour { string lua_hero = "DataConfig/Hero"; void Start() { LuaEnv luaEnv = new LuaEnv(); //luaEnv.AddLoader(LoadLuaByName); luaEnv.AddLoader(new LuaLoader((ref string filepath) => { filepath = string.Format(GameConfig.LuaLoaderPath, Application.streamingAssetsPath, filepath); if (File.Exists(filepath)) { return File.ReadAllBytes(filepath); } else { return null; } })); string path = string.Format(GameConfig.LuaPath, lua_hero); luaEnv.DoString(path); LuaTable tab = luaEnv.Global.GetInPath<LuaTable>("Hero"); LuaTable hero1 = tab.Get<int, LuaTable>(1); string Name = hero1.Get<string>("name"); int heroId = hero1.Get<int>("heroId"); LuaTable attr = hero1.Get<LuaTable>("attributes"); string desc = attr.Get<string>("petPhrase"); Debug.LogError(" heroId = " + heroId + " ,name = " + Name + " ,pet phrase = " + desc); } public byte[] LoadLuaByName(ref string filepath) { string tempPath = string.Format(GameConfig.LuaDataConfigPath,filepath); if (File.Exists(tempPath)) { return File.ReadAllBytes(tempPath); } else { return null; } }}
-- heroId int 英雄ID-- name lang 英雄名称(仅客户端用)-- rare int 稀有度(11-13)-- type int 英雄职业(1:法师,2:战士,3:牧师,4:勇士)-- defaultStar int 英雄初始星数-- isOpen bool 当前是否在游戏中开放(即可在英雄图鉴看到,可以被抽卡抽到)-- attributes json 战斗属性Hero ={[1] = {heroId = 1,name = "英雄法师",rare = 11,type = 1,defaultStar = 1,isOpen = true,attributes = {attack = {physical = 20,magic = 100,canCrit = true,hitRate = 0.9,ult = {[1] = {name = "CoupDeGrace",params = {[1] = "circle",[2] = 1,[3] = 0,[4] = true,},cd = 5,},},},defence = {physical = 10,magic = 60,},hp = 200,modelSize = {[1] = 4,[2] = 5,[3] = 10.5,},petPhrase = "I will kill you!",},},[2] = {heroId = 2,name = "英雄战士",rare = 11,type = 2,defaultStar = 1,isOpen = true,attributes = nil,},[3] = {heroId = 3,name = "英雄牧师",rare = 11,type = 3,defaultStar = 1,isOpen = false,attributes = nil,},[4] = {heroId = 4,name = "英雄勇士",rare = 11,type = 4,defaultStar = 1,isOpen = false,attributes = {attack = {physical = 140,magic = 0,canCrit = true,hitRate = 0.9,ult = {[1] = {name = "CoupDeGrace",params = {[1] = "sector",[2] = 150,[3] = 0,[4] = true,},cd = 5,},},},defence = {physical = 40,magic = 0,},hp = 150,modelSize = {[1] = 3.5,[2] = 4,[3] = 8,},petPhrase = "Death to all who oppose me!",},},}
阅读全文
0 0
- 【数据处理】使用xlua读取XlsxToLua生成的配置文件
- 配置文件读取的使用
- Unity 使用xLua遇到的坑
- UGUI的xlua例子
- xLua的学习笔记
- xLua的配置
- 基因数据处理68之avocado的配置文件默认无法从hdfs读取
- properties配置文件的读取和使用
- c++使用rapidxml读取cocos2dx的配置文件
- 读取和使用Spring的配置文件
- Xlua
- 使用rapidxml读取配置文件
- 使用ResourceBundle读取配置文件
- 使用ResourceBundle读取配置文件
- 使用PropertyPlaceholderConfigurer读取配置文件
- 使用properties读取配置文件
- 编译xlua容易遇到的问题,xlua编译不过
- xlua的util.createdelegate应用
- 实验:环形队列
- php 生命周期
- c语言四书五经
- qt 窗体全屏显示
- Nginx下Go的多种使用方式性能比较
- 【数据处理】使用xlua读取XlsxToLua生成的配置文件
- SSH网上商城2_环境配置
- spring security 启动报错
- pkg-config的用法
- Xshell通过ssh连接Android终端模拟器Termux
- CSDN博客——如何进入专栏并创建自己的专栏
- [django]前端for循环,数字自增,可完成评论的楼层数。
- 神经网络模型中的权重参数初始化问题
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile