110 lines
3.4 KiB
Lua
110 lines
3.4 KiB
Lua
local Debug = require "Common.CustomLib.Utility.Debug"
|
|
------------------------------------------------
|
|
-- 作者: gzg
|
|
-- 日期: 2019-03-25
|
|
-- 文件: Main.lua
|
|
-- 模块: Main
|
|
-- 描述: Lua的脚本的启动文件
|
|
------------------------------------------------
|
|
-- Unity对象操作的函数模块
|
|
local CSGameCenter = CS.Thousandto.Code.Center.GameCenter
|
|
|
|
local TestToolEditor = {}
|
|
|
|
|
|
--这个方法被Unity的TestToolEditor组件调用,返回值是一对一对的,前面的是按钮文本,后面的是调用方法
|
|
function TestToolEditor.GetAllMethods()
|
|
Debug.Log("TestToolEditor.GetAllMethods");
|
|
|
|
--前面的是按钮文本,后面的是调用方法
|
|
return {
|
|
"重新加载","Test0",
|
|
"读取配置数据","Test1",
|
|
"测试2","Test2",
|
|
"测试3","Test3",
|
|
"测试4","Test4",
|
|
"测试5","Test5",
|
|
"断线重连","Test6",
|
|
} ;
|
|
end
|
|
|
|
function TestToolEditor.Test0()
|
|
GameCenter.LuckyDrawWeekSystem:UnInitialize()
|
|
GameCenter.LuckyDrawWeekSystem = nil
|
|
Utils.RemoveRequiredByName("Logic.LuckyDrawWeek.LuckyDrawWeekSystem")
|
|
GameCenter.LuckyDrawWeekSystem = require("Logic.LuckyDrawWeek.LuckyDrawWeekSystem");
|
|
GameCenter.LuckyDrawWeekSystem:Initialize();
|
|
|
|
end
|
|
|
|
function TestToolEditor.Test1()
|
|
Debug.LogError("do: TestToolEditor.Test1");
|
|
TestToolEditor.ReadConfigInfo("DataVip");
|
|
end
|
|
|
|
function TestToolEditor.Test2()
|
|
Debug.LogError("do: TestToolEditor.Test2");
|
|
GameCenter.PushFixEvent(UIEventDefine.UI_WAITING_LOCK_OPEN,"小天正在等待中...");
|
|
end
|
|
|
|
|
|
function TestToolEditor.Test3()
|
|
Debug.LogError("do: TestToolEditor.Test3");
|
|
GameCenter.LuckyDrawWeekSystem:ReqGetLuckyDrawVolume(3);
|
|
end
|
|
|
|
|
|
function TestToolEditor.Test4()
|
|
Debug.LogError("do: TestToolEditor.Test4");
|
|
GameCenter.LuckyDrawWeekSystem:ReqChangeAwardIndex({items = {{awardType=0,indexes={1}},{awardType = 1,indexes= {1,2}}}});
|
|
end
|
|
|
|
function TestToolEditor.Test5()
|
|
Debug.LogError("do: TestToolEditor.Test5");
|
|
GameCenter.LuckyDrawWeekSystem:ReqCloseLuckyDrawPanel();
|
|
end
|
|
|
|
function TestToolEditor.Test6()
|
|
Debug.LogError("断线重连");
|
|
CSGameCenter.Networker:Disconnect();
|
|
GameCenter.ReconnectSystem:Reconnect();
|
|
end
|
|
|
|
|
|
function TestToolEditor.ReadConfigInfo(cfgName)
|
|
Debug.Log("开始读取配置文件:" .. cfgName);
|
|
local _data = DataConfig[cfgName]
|
|
local str="";
|
|
if _data then
|
|
local _dict = Dictionary:New(_data._ColumnNameIndexs_);
|
|
_dict:SortValue(function (a,b)
|
|
return a < b
|
|
end)
|
|
_dict:Foreach(function (k,_)
|
|
str = str .. tostring(k).. ",";
|
|
end)
|
|
str = str .. "\n";
|
|
_data:Foreach(function (x,v)
|
|
_dict:Foreach(function(key,_)
|
|
str = str .. tostring(v[key]).. ",";
|
|
end)
|
|
str = str .. "\n";
|
|
end)
|
|
else
|
|
Debug.LogError("没有找到对应的配置表:" .. cfgName);
|
|
end
|
|
|
|
--把内容写到文件中去.
|
|
local file = io.open("d:\\" .. cfgName .. ".csv","w+");
|
|
io.output(file)
|
|
io.write(string.char(0xef));
|
|
io.write(string.char(0xbb));
|
|
io.write(string.char(0xbf));
|
|
io.write(str)
|
|
file:close();
|
|
Debug.Log(Debug.GetTableStr({a=1,b=2,c=3}));
|
|
Debug.Log("导出到当前目录(一般与Assets同目录)文件:" .. "d:\\" .. cfgName .. ".csv");
|
|
end
|
|
|
|
return TestToolEditor
|