Commit a988acd8 authored by nanahira's avatar nanahira

btest

parent f26a6165
...@@ -93,6 +93,10 @@ public class MyConfig : XMLReader ...@@ -93,6 +93,10 @@ public class MyConfig : XMLReader
/// </summary> /// </summary>
public const string TAG_AUTO_CHECK_UPDATE = "auto_check_update"; public const string TAG_AUTO_CHECK_UPDATE = "auto_check_update";
/// <summary> /// <summary>
/// add require automatically
/// </summary>
public const string TAG_ADD_REQUIRE = "add_require";
/// <summary>
/// 检查系统语言 /// 检查系统语言
/// </summary> /// </summary>
public const string TAG_CHECK_SYSLANG = "check_system_language"; public const string TAG_CHECK_SYSLANG = "check_system_language";
......
...@@ -253,20 +253,14 @@ public object Clone() ...@@ -253,20 +253,14 @@ public object Clone()
#region 打开脚本 #region 打开脚本
//打开脚本 //打开脚本
public bool OpenScript(bool openinthis) public bool OpenScript(bool openinthis, string addrequire)
{ {
if (!dataform.CheckOpen()) if (!dataform.CheckOpen())
return false; return false;
Card c = dataform.GetCard(); Card c = dataform.GetCard();
if (c.id <= 0 || c.IsType(CardType.TYPE_NORMAL) && !c.IsType(CardType.TYPE_PENDULUM))//卡片密码不能小于等于0, 非灵摆的通常怪兽无需脚本 if (c.id <= 0)//卡片密码不能小于等于0
return false; return false;
long id = c.id; long id = c.id;
if(c.alias != 0)
{
long dif = c.id - c.alias;
if (dif > -10 && dif < 10)
id = c.alias;
}
string lua = dataform.GetPath().GetScript(id); string lua = dataform.GetPath().GetScript(id);
if (!File.Exists(lua)) if (!File.Exists(lua))
{ {
...@@ -278,7 +272,11 @@ public bool OpenScript(bool openinthis) ...@@ -278,7 +272,11 @@ public bool OpenScript(bool openinthis)
{ {
StreamWriter sw = new StreamWriter(fs, new UTF8Encoding(false)); StreamWriter sw = new StreamWriter(fs, new UTF8Encoding(false));
sw.WriteLine("--" + c.name); sw.WriteLine("--" + c.name);
sw.WriteLine("function c"+id.ToString()+".initial_effect(c)"); sw.WriteLine("local m=" + id.ToString());
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("function cm.initial_effect(c)");
sw.WriteLine("\t"); sw.WriteLine("\t");
sw.WriteLine("end"); sw.WriteLine("end");
sw.Close(); sw.Close();
......
This diff is collapsed.
...@@ -23,6 +23,7 @@ namespace DataEditorX ...@@ -23,6 +23,7 @@ namespace DataEditorX
{ {
public partial class DataEditForm : DockContent, IDataForm public partial class DataEditForm : DockContent, IDataForm
{ {
public string addrequire;
#region 成员变量/构造 #region 成员变量/构造
TaskHelper tasker = null; TaskHelper tasker = null;
string taskname; string taskname;
...@@ -145,6 +146,9 @@ void DataEditFormLoad(object sender, EventArgs e) ...@@ -145,6 +146,9 @@ void DataEditFormLoad(object sender, EventArgs e)
menuitem_openfileinthis.Checked = MyConfig.readBoolean(MyConfig.TAG_OPEN_IN_THIS); menuitem_openfileinthis.Checked = MyConfig.readBoolean(MyConfig.TAG_OPEN_IN_THIS);
//自动检查更新 //自动检查更新
menuitem_autocheckupdate.Checked = MyConfig.readBoolean(MyConfig.TAG_AUTO_CHECK_UPDATE); menuitem_autocheckupdate.Checked = MyConfig.readBoolean(MyConfig.TAG_AUTO_CHECK_UPDATE);
//add require automatically
addrequire = MyConfig.readString(MyConfig.TAG_ADD_REQUIRE);
menuitem_addrequire.Checked = (addrequire.Length > 0);
if (nowCdbFile != null && File.Exists(nowCdbFile)) if (nowCdbFile != null && File.Exists(nowCdbFile))
Open(nowCdbFile); Open(nowCdbFile);
//获取MSE配菜单 //获取MSE配菜单
...@@ -354,23 +358,21 @@ void InitListRows() ...@@ -354,23 +358,21 @@ void InitListRows()
item.Text = "Test"; item.Text = "Test";
lv_cardlist.Items.Add(item); lv_cardlist.Items.Add(item);
} }
int headH = lv_cardlist.Items[0].GetBounds(ItemBoundsPortion.ItemOnly).Y;
int itemH = lv_cardlist.Items[0].GetBounds(ItemBoundsPortion.ItemOnly).Height; int itemH = lv_cardlist.Items[0].GetBounds(ItemBoundsPortion.ItemOnly).Height;
if (itemH > 0) if (itemH > 0)
{ {
int n = lv_cardlist.Height/ itemH; int n = (lv_cardlist.Height - headH) / itemH;
if (n > 0){ if (n > 0){
MaxRow = n; MaxRow = n;
} }
//MessageBox.Show("height="+lv_cardlist.Height+",item="+itemH+",max="+MaxRow); //MessageBox.Show("height="+lv_cardlist.Height+",item="+itemH+",head="+headH+",max="+MaxRow);
}
if(MaxRow < 1){
MaxRow = 1;
} }
if(addTest){ if(addTest){
lv_cardlist.Items.Clear(); lv_cardlist.Items.Clear();
}else{
Search(true);
} }
if (MaxRow < 10)
MaxRow = 20;
} }
//设置checkbox //设置checkbox
void SetCheck(FlowLayoutPanel fpl, long number) void SetCheck(FlowLayoutPanel fpl, long number)
...@@ -740,7 +742,7 @@ public void SetCards(Card[] cards, bool isfresh) ...@@ -740,7 +742,7 @@ public void SetCards(Card[] cards, bool isfresh)
tb_pagenum.Text = pageNum.ToString(); tb_pagenum.Text = pageNum.ToString();
if (isfresh)//是否跳到之前页数 if (isfresh)//是否跳到之前页数
AddListView(Math.Min(page, pageNum)); AddListView(page);
else else
AddListView(1); AddListView(1);
} }
...@@ -815,7 +817,7 @@ void Btn_modClick(object sender, EventArgs e) ...@@ -815,7 +817,7 @@ void Btn_modClick(object sender, EventArgs e)
void Btn_luaClick(object sender, EventArgs e) void Btn_luaClick(object sender, EventArgs e)
{ {
if (cardedit != null) if (cardedit != null)
cardedit.OpenScript(menuitem_openfileinthis.Checked); cardedit.OpenScript(menuitem_openfileinthis.Checked, addrequire);
} }
//删除 //删除
void Btn_delClick(object sender, EventArgs e) void Btn_delClick(object sender, EventArgs e)
...@@ -1622,6 +1624,13 @@ private void menuitem_autocheckupdate_Click(object sender, EventArgs e) ...@@ -1622,6 +1624,13 @@ private void menuitem_autocheckupdate_Click(object sender, EventArgs e)
menuitem_autocheckupdate.Checked = !menuitem_autocheckupdate.Checked; menuitem_autocheckupdate.Checked = !menuitem_autocheckupdate.Checked;
MyConfig.Save(MyConfig.TAG_AUTO_CHECK_UPDATE, menuitem_autocheckupdate.Checked.ToString().ToLower()); MyConfig.Save(MyConfig.TAG_AUTO_CHECK_UPDATE, menuitem_autocheckupdate.Checked.ToString().ToLower());
} }
//add require automatically
private void menuitem_addrequire_Click(object sender, EventArgs e)
{
addrequire = Microsoft.VisualBasic.Interaction.InputBox("Module script?\n\nPress \"Cancel\" to remove module script.", "", addrequire);
menuitem_addrequire.Checked = (addrequire.Length>0);
MyConfig.Save(MyConfig.TAG_ADD_REQUIRE, addrequire);
}
#endregion #endregion
#region 语言菜单 #region 语言菜单
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
<add key="open_file_in_this" value="true" /> <add key="open_file_in_this" value="true" />
<!-- check update when opening application automatically --> <!-- check update when opening application automatically -->
<add key="auto_check_update" value="true" /> <add key="auto_check_update" value="true" />
<!-- add require automatically -->
<add key="add require" value="" />
<!-- Cut Images Setting --> <!-- Cut Images Setting -->
<add key="image_quilty" value="100" /> <add key="image_quilty" value="100" />
<add key="image" value="44,64,177,254" /> <add key="image" value="44,64,177,254" />
......
...@@ -46,6 +46,7 @@ DataEditForm.mainMenu.menuitem_mseconfig 设置MSE的配置文件 ...@@ -46,6 +46,7 @@ DataEditForm.mainMenu.menuitem_mseconfig 设置MSE的配置文件
DataEditForm.mainMenu.menu_data 数据(&D) DataEditForm.mainMenu.menu_data 数据(&D)
DataEditForm.mainMenu.menuitem_operacardsfile 同步操作卡片图片和脚本 DataEditForm.mainMenu.menuitem_operacardsfile 同步操作卡片图片和脚本
DataEditForm.mainMenu.menuitem_openfileinthis 用CodeEditor打开脚本 DataEditForm.mainMenu.menuitem_openfileinthis 用CodeEditor打开脚本
DataEditForm.mainMenu.menuitem_addrequire 创建脚本时自动添加require
DataEditForm.mainMenu.menuitem_findluafunc 从C++源码查找Lua函数 DataEditForm.mainMenu.menuitem_findluafunc 从C++源码查找Lua函数
DataEditForm.mainMenu.menuitem_readydk 从卡组文件读取卡片(&Y) DataEditForm.mainMenu.menuitem_readydk 从卡组文件读取卡片(&Y)
DataEditForm.mainMenu.menuitem_readimages 从卡图文件夹读取卡片(&I) DataEditForm.mainMenu.menuitem_readimages 从卡图文件夹读取卡片(&I)
......
...@@ -44,6 +44,7 @@ DataEditForm.mainMenu.menu_image MSE(&M) ...@@ -44,6 +44,7 @@ DataEditForm.mainMenu.menu_image MSE(&M)
DataEditForm.mainMenu.menu_data Data(&D) DataEditForm.mainMenu.menu_data Data(&D)
DataEditForm.mainMenu.menuitem_operacardsfile Opera with Card's files DataEditForm.mainMenu.menuitem_operacardsfile Opera with Card's files
DataEditForm.mainMenu.menuitem_openfileinthis Open Script With CodeEditor DataEditForm.mainMenu.menuitem_openfileinthis Open Script With CodeEditor
DataEditForm.mainMenu.menuitem_addrequire Add REQUIRE Automatically
DataEditForm.mainMenu.menuitem_readydk Read From ydk File(&Y) DataEditForm.mainMenu.menuitem_readydk Read From ydk File(&Y)
DataEditForm.mainMenu.menuitem_readimages Read From Images Path(&I) DataEditForm.mainMenu.menuitem_readimages Read From Images Path(&I)
DataEditForm.mainMenu.menuitem_compdb Compress DataBase DataEditForm.mainMenu.menuitem_compdb Compress DataBase
......
version: '{build}'
skip_tags: true
install:
configuration: Release
build:
project: DataEditorX.sln
parallel: true
after_build:
- 7z a DataEditorX-Koishi.7z win32/*
test: off
artifacts:
- path: DataEditorX-Koishi.7z
name: DataEditorX-Koishi
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