Commit db508261 authored by Yumekaki's avatar Yumekaki

update

parent 8b057a54
...@@ -276,18 +276,29 @@ public bool OpenScript(bool openinthis, string addrequire) ...@@ -276,18 +276,29 @@ public bool OpenScript(bool openinthis, string addrequire)
FileMode.OpenOrCreate,FileAccess.Write)) FileMode.OpenOrCreate,FileAccess.Write))
{ {
StreamWriter sw = new StreamWriter(fs, new UTF8Encoding(false)); StreamWriter sw = new StreamWriter(fs, new UTF8Encoding(false));
if (c.id > 0) { //card script if (string.IsNullOrEmpty(addrequire))
{
// OCG script
sw.WriteLine("--" + c.name);
sw.WriteLine("function c" + id.ToString() + ".initial_effect(c)");
sw.WriteLine("\t");
sw.WriteLine("end");
}
else
{
// DIY script
sw.WriteLine("--" + c.name); sw.WriteLine("--" + c.name);
sw.WriteLine("local m=" + id.ToString()); sw.WriteLine("local m=" + id.ToString());
sw.WriteLine("local cm=_G[\"c\"..m]"); sw.WriteLine("local cm=_G[\"c\"..m]");
if (addrequire.Length > 0)
sw.WriteLine("xpcall(function() require(\"expansions/script/" + addrequire + "\") end,function() require(\"script/" + addrequire + "\") end)"); sw.WriteLine("xpcall(function() require(\"expansions/script/" + addrequire + "\") end,function() require(\"script/" + addrequire + "\") end)");
sw.WriteLine("function cm.initial_effect(c)"); sw.WriteLine("function cm.initial_effect(c)");
sw.WriteLine("\t"); sw.WriteLine("\t");
sw.WriteLine("end"); sw.WriteLine("end");
} else { //module script
sw.WriteLine("--Module script \"" + addrequire + "\"");
} }
/*else
{ //module script
sw.WriteLine("--Module script \"" + addrequire + "\"");
}*/
sw.Close(); sw.Close();
fs.Close(); fs.Close();
} }
......
...@@ -23,7 +23,28 @@ namespace DataEditorX ...@@ -23,7 +23,28 @@ namespace DataEditorX
{ {
public partial class DataEditForm : DockContent, IDataForm public partial class DataEditForm : DockContent, IDataForm
{ {
public string addrequire; private string addrequire_str;
public string addrequire
{
get
{
if (!string.IsNullOrEmpty(addrequire_str))
return addrequire_str;
else
{
string cdbName = Path.GetFileNameWithoutExtension(nowCdbFile);
if (cdbName.Length > 0 && File.Exists(GetPath().GetModuleScript(cdbName)))
return cdbName;
}
return "";
}
set
{
addrequire_str = value;
}
}
#region 成员变量/构造 #region 成员变量/构造
TaskHelper tasker = null; TaskHelper tasker = null;
string taskname; string taskname;
......
This diff is collapsed.
This diff is collapsed.
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