Commit c34b128b authored by nanahira's avatar nanahira

test

parent 1c7b883a
......@@ -73,6 +73,10 @@ public string GetScript(string id)
{
return MyPath.Combine(luapath, "c" + id + ".lua");
}
public string GetModuleScript(string modulescript)
{
return MyPath.Combine(luapath, modulescript + ".lua");
}
public string[] GetCardfiles(long id)
{
......
......@@ -258,10 +258,15 @@ public bool OpenScript(bool openinthis, string addrequire)
if (!dataform.CheckOpen())
return false;
Card c = dataform.GetCard();
if (c.id <= 0)//卡片密码不能小于等于0
return false;
long id = c.id;
string lua = dataform.GetPath().GetScript(id);
string lua;
if (c.id > 0) {
lua = dataform.GetPath().GetScript(id);
} else if (addrequire.Length > 0) {
lua = dataform.GetPath().GetModuleScript(addrequire);
} else {
return false;
}
if (!File.Exists(lua))
{
MyPath.CreateDirByFile(lua);
......@@ -271,6 +276,7 @@ public bool OpenScript(bool openinthis, string addrequire)
FileMode.OpenOrCreate,FileAccess.Write))
{
StreamWriter sw = new StreamWriter(fs, new UTF8Encoding(false));
if (c.id > 0) { //card script
sw.WriteLine("--" + c.name);
sw.WriteLine("local m=" + id.ToString());
sw.WriteLine("local cm=_G[\"c\"..m]");
......@@ -279,6 +285,9 @@ public bool OpenScript(bool openinthis, string addrequire)
sw.WriteLine("function cm.initial_effect(c)");
sw.WriteLine("\t");
sw.WriteLine("end");
} else { //module script
sw.WriteLine("--Module script \"" + addrequire + "\"");
}
sw.Close();
fs.Close();
}
......
......@@ -350,10 +350,9 @@ public void ExportData(string path, string zipname, string _cdbfile, string modu
//新卡ydk
string deckydk = ygopath.GetYdk(name);
//module scripts
string script_path = MyPath.Combine(path, "script");
string extra_script = "";
if (modulescript.Length > 0)
extra_script = MyPath.Combine(script_path, modulescript + ".lua");
extra_script = ygopath.GetModuleScript(modulescript);
File.Delete(cdbfile);
DataBase.Create(cdbfile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment