版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/iceSony/article/details/83382868
实习第17-20天
实现集字功能=.=
第一步:新建excel表
Do出(注意wps最好先关闭再do)主要方法
local jz_data_c = io.open("..\\client_data\\jz_data.lua", "w")
if not jz_data_c then
print("Failed to open output file: jz_data.lua")
else
jz_data_c:write([[
if not (type(gdjzData)=="table") then
gdjzData = {}
end
]])
end
local gdjzData={}
local isshow=false
function handle_JzData(o)
local id = tonumber(o["id"])
if gdjzData[id] then
if id==0 and not isshow then
isshow=true
print("表有好多的0 还在运行请勿关闭")
elseif id~=0 then
print(string.format("表有重复的id=%d", id))
end
else
local temp={}
temp[1] = tonumber(o["字1"])
temp[2] = tonumber(o["字2"])
if not (tonumber(o["字3"])==0) then
temp[3] = tonumber(o["字3"])
end
if not (tonumber(o["字4"])==0) then
temp[4] = tonumber(o["字4"])
end
gdjzData[id] = {}
local reward={}
reward.item = tonumber(o["奖励物品"])
reward.count = tonumber(o["奖励数量"])
gdjzData[id].icount = tonumber(o["兑换次数"])
gdjzData[id].itemList=temp
gdjzData[id].rewards=reward
end
end
export_csv("..\\design\\Y_运营活动.xlsx")
handle_file("tmp\\集字兑换.csv", handle_JzData)
jz_data_c:write("gdjzData = ")
output_table(gdjzData,jz_data_c)
clear_csv()
Do出内容
在代码中还要修改三个地方(预制体创建)
D:\fire3d\Client_lua_logic\Manager\other_data\ui_data.lua
D:\fire3d\Client_lua_logic\ClientDefinition\table_path_dependence.lua
用id标识预制体,用于代码调用
["LuaData/jz_data"] = {"gdjzData"},
D:\fire3d\Client_lua_logic\ClientDefinition\ui_window_definition.lua
将全局表添加到项目中
在预制体中修改
预制体生成时候调用