【遊戲公司日常——第17至20天】:從策劃到開發第一個類王者榮耀集字模組
阿新 • • 發佈:2018-12-17
實習第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
將全域性表新增到專案中
在預製體中修改
預製體生成時候呼叫