Commit a988acd8 authored by nanahira's avatar nanahira

btest

parent f26a6165
......@@ -93,6 +93,10 @@ public class MyConfig : XMLReader
/// </summary>
public const string TAG_AUTO_CHECK_UPDATE = "auto_check_update";
/// <summary>
/// add require automatically
/// </summary>
public const string TAG_ADD_REQUIRE = "add_require";
/// <summary>
/// 检查系统语言
/// </summary>
public const string TAG_CHECK_SYSLANG = "check_system_language";
......
......@@ -253,20 +253,14 @@ public object Clone()
#region 打开脚本
//打开脚本
public bool OpenScript(bool openinthis)
public bool OpenScript(bool openinthis, string addrequire)
{
if (!dataform.CheckOpen())
return false;
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;
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);
if (!File.Exists(lua))
{
......@@ -278,7 +272,11 @@ public bool OpenScript(bool openinthis)
{
StreamWriter sw = new StreamWriter(fs, new UTF8Encoding(false));
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("end");
sw.Close();
......
......@@ -59,6 +59,7 @@ private void InitializeComponent()
this.menu_data = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_operacardsfile = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_openfileinthis = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_addrequire = new System.Windows.Forms.ToolStripMenuItem();
this.tsep2 = new System.Windows.Forms.ToolStripSeparator();
this.menuitem_readydk = new System.Windows.Forms.ToolStripMenuItem();
this.menuitem_readimages = new System.Windows.Forms.ToolStripMenuItem();
......@@ -129,8 +130,8 @@ private void InitializeComponent()
this.pl_cardtype = new DataEditorX.DFlowLayoutPanel();
this.lb_scripttext = new DataEditorX.DListBox();
this.lv_cardlist = new DataEditorX.DListView();
this.ch_cardcode = new System.Windows.Forms.ColumnHeader();
this.ch_cardname = new System.Windows.Forms.ColumnHeader();
this.ch_cardcode = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.ch_cardname = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lb_markers = new System.Windows.Forms.Label();
this.pl_markers = new DataEditorX.DFlowLayoutPanel();
this.tb_link = new System.Windows.Forms.TextBox();
......@@ -302,6 +303,7 @@ private void InitializeComponent()
this.menu_data.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuitem_operacardsfile,
this.menuitem_openfileinthis,
this.menuitem_addrequire,
this.tsep2,
this.menuitem_readydk,
this.menuitem_readimages,
......@@ -324,111 +326,118 @@ private void InitializeComponent()
// menuitem_operacardsfile
//
this.menuitem_operacardsfile.Name = "menuitem_operacardsfile";
this.menuitem_operacardsfile.Size = new System.Drawing.Size(212, 22);
this.menuitem_operacardsfile.Size = new System.Drawing.Size(228, 22);
this.menuitem_operacardsfile.Text = "Opera Card\'s Files";
this.menuitem_operacardsfile.Click += new System.EventHandler(this.menuitem_deletecardsfile_Click);
//
// menuitem_openfileinthis
//
this.menuitem_openfileinthis.Name = "menuitem_openfileinthis";
this.menuitem_openfileinthis.Size = new System.Drawing.Size(212, 22);
this.menuitem_openfileinthis.Size = new System.Drawing.Size(228, 22);
this.menuitem_openfileinthis.Text = "Open File in This";
this.menuitem_openfileinthis.Click += new System.EventHandler(this.menuitem_openfileinthis_Click);
//
// menuitem_addrequire
//
this.menuitem_addrequire.Name = "menuitem_addrequire";
this.menuitem_addrequire.Size = new System.Drawing.Size(238, 22);
this.menuitem_addrequire.Text = "Add REQUIRE Automatically";
this.menuitem_addrequire.Click += new System.EventHandler(this.menuitem_addrequire_Click);
//
// tsep2
//
this.tsep2.Name = "tsep2";
this.tsep2.Size = new System.Drawing.Size(209, 6);
this.tsep2.Size = new System.Drawing.Size(225, 6);
//
// menuitem_readydk
//
this.menuitem_readydk.Name = "menuitem_readydk";
this.menuitem_readydk.Size = new System.Drawing.Size(212, 22);
this.menuitem_readydk.Size = new System.Drawing.Size(228, 22);
this.menuitem_readydk.Text = "Cards Form ydk file(&Y)";
this.menuitem_readydk.Click += new System.EventHandler(this.Menuitem_readydkClick);
//
// menuitem_readimages
//
this.menuitem_readimages.Name = "menuitem_readimages";
this.menuitem_readimages.Size = new System.Drawing.Size(212, 22);
this.menuitem_readimages.Size = new System.Drawing.Size(228, 22);
this.menuitem_readimages.Text = "Cards From Images(&I)";
this.menuitem_readimages.Click += new System.EventHandler(this.Menuitem_readimagesClick);
//
// tsep6
//
this.tsep6.Name = "tsep6";
this.tsep6.Size = new System.Drawing.Size(209, 6);
this.tsep6.Size = new System.Drawing.Size(225, 6);
//
// menuitem_compdb
//
this.menuitem_compdb.Name = "menuitem_compdb";
this.menuitem_compdb.Size = new System.Drawing.Size(212, 22);
this.menuitem_compdb.Size = new System.Drawing.Size(228, 22);
this.menuitem_compdb.Text = "Compression DataBase";
this.menuitem_compdb.Click += new System.EventHandler(this.menuitem_compdb_Click);
//
// menuitem_export_select_sql
//
this.menuitem_export_select_sql.Name = "menuitem_export_select_sql";
this.menuitem_export_select_sql.Size = new System.Drawing.Size(212, 22);
this.menuitem_export_select_sql.Size = new System.Drawing.Size(228, 22);
this.menuitem_export_select_sql.Text = "Export select to Sql";
this.menuitem_export_select_sql.Click += new System.EventHandler(this.Menuitem_export_select_sqlClick);
//
// menuitem_export_all_sql
//
this.menuitem_export_all_sql.Name = "menuitem_export_all_sql";
this.menuitem_export_all_sql.Size = new System.Drawing.Size(212, 22);
this.menuitem_export_all_sql.Size = new System.Drawing.Size(228, 22);
this.menuitem_export_all_sql.Text = "Export all to Sql";
this.menuitem_export_all_sql.Click += new System.EventHandler(this.Menuitem_export_all_sqlClick);
//
// menuitem_findluafunc
//
this.menuitem_findluafunc.Name = "menuitem_findluafunc";
this.menuitem_findluafunc.Size = new System.Drawing.Size(212, 22);
this.menuitem_findluafunc.Size = new System.Drawing.Size(228, 22);
this.menuitem_findluafunc.Text = "Find Lua Function";
this.menuitem_findluafunc.Click += new System.EventHandler(this.menuitem_findluafunc_Click);
//
// menuitem_exportdata
//
this.menuitem_exportdata.Name = "menuitem_exportdata";
this.menuitem_exportdata.Size = new System.Drawing.Size(212, 22);
this.menuitem_exportdata.Size = new System.Drawing.Size(228, 22);
this.menuitem_exportdata.Text = "Export Data";
this.menuitem_exportdata.Click += new System.EventHandler(this.Menuitem_exportdataClick);
//
// tsep5
//
this.tsep5.Name = "tsep5";
this.tsep5.Size = new System.Drawing.Size(209, 6);
this.tsep5.Size = new System.Drawing.Size(225, 6);
//
// menuitem_cutimages
//
this.menuitem_cutimages.Name = "menuitem_cutimages";
this.menuitem_cutimages.Size = new System.Drawing.Size(212, 22);
this.menuitem_cutimages.Size = new System.Drawing.Size(228, 22);
this.menuitem_cutimages.Text = "Cut Images";
this.menuitem_cutimages.Click += new System.EventHandler(this.Menuitem_cutimagesClick);
//
// menuitem_convertimage
//
this.menuitem_convertimage.Name = "menuitem_convertimage";
this.menuitem_convertimage.Size = new System.Drawing.Size(212, 22);
this.menuitem_convertimage.Size = new System.Drawing.Size(228, 22);
this.menuitem_convertimage.Text = "Import Images";
this.menuitem_convertimage.Click += new System.EventHandler(this.Menuitem_convertimageClick);
//
// tsep1
//
this.tsep1.Name = "tsep1";
this.tsep1.Size = new System.Drawing.Size(209, 6);
this.tsep1.Size = new System.Drawing.Size(225, 6);
//
// menuitem_cancelTask
//
this.menuitem_cancelTask.Name = "menuitem_cancelTask";
this.menuitem_cancelTask.Size = new System.Drawing.Size(212, 22);
this.menuitem_cancelTask.Size = new System.Drawing.Size(228, 22);
this.menuitem_cancelTask.Text = "Cancel Task";
this.menuitem_cancelTask.Click += new System.EventHandler(this.Menuitem_cancelTaskClick);
//
// menuitem_autoreturn
//
this.menuitem_autoreturn.Name = "menuitem_autoreturn";
this.menuitem_autoreturn.Size = new System.Drawing.Size(212, 22);
this.menuitem_autoreturn.Size = new System.Drawing.Size(228, 22);
this.menuitem_autoreturn.Text = "*Auto return";
this.menuitem_autoreturn.Click += new System.EventHandler(this.Menuitem_autoreturnClick);
//
......@@ -631,7 +640,7 @@ private void InitializeComponent()
this.lb_pleft_right.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.lb_pleft_right.AutoSize = true;
this.lb_pleft_right.BackColor = System.Drawing.SystemColors.Control;
this.lb_pleft_right.Location = new System.Drawing.Point(226, 307);
this.lb_pleft_right.Location = new System.Drawing.Point(226, 304);
this.lb_pleft_right.Name = "lb_pleft_right";
this.lb_pleft_right.Size = new System.Drawing.Size(41, 12);
this.lb_pleft_right.TabIndex = 7;
......@@ -640,10 +649,10 @@ private void InitializeComponent()
// tb_pleft
//
this.tb_pleft.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.tb_pleft.Location = new System.Drawing.Point(297, 299);
this.tb_pleft.Location = new System.Drawing.Point(298, 301);
this.tb_pleft.MaxLength = 12;
this.tb_pleft.Name = "tb_pleft";
this.tb_pleft.Size = new System.Drawing.Size(39, 21);
this.tb_pleft.Size = new System.Drawing.Size(40, 21);
this.tb_pleft.TabIndex = 8;
this.tb_pleft.Text = "0";
this.tb_pleft.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
......@@ -651,10 +660,10 @@ private void InitializeComponent()
// tb_pright
//
this.tb_pright.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.tb_pright.Location = new System.Drawing.Point(353, 299);
this.tb_pright.Location = new System.Drawing.Point(354, 301);
this.tb_pright.MaxLength = 12;
this.tb_pright.Name = "tb_pright";
this.tb_pright.Size = new System.Drawing.Size(37, 21);
this.tb_pright.Size = new System.Drawing.Size(40, 21);
this.tb_pright.TabIndex = 8;
this.tb_pright.Text = "0";
this.tb_pright.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
......@@ -663,7 +672,7 @@ private void InitializeComponent()
//
this.lb_atkdef.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.lb_atkdef.AutoSize = true;
this.lb_atkdef.Location = new System.Drawing.Point(223, 331);
this.lb_atkdef.Location = new System.Drawing.Point(226, 328);
this.lb_atkdef.Name = "lb_atkdef";
this.lb_atkdef.Size = new System.Drawing.Size(47, 12);
this.lb_atkdef.TabIndex = 7;
......@@ -740,7 +749,7 @@ private void InitializeComponent()
//
this.lb5.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.lb5.AutoSize = true;
this.lb5.Location = new System.Drawing.Point(338, 330);
this.lb5.Location = new System.Drawing.Point(340, 328);
this.lb5.Name = "lb5";
this.lb5.Size = new System.Drawing.Size(11, 12);
this.lb5.TabIndex = 7;
......@@ -749,32 +758,32 @@ private void InitializeComponent()
// tb_atk
//
this.tb_atk.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.tb_atk.Location = new System.Drawing.Point(298, 326);
this.tb_atk.Location = new System.Drawing.Point(298, 325);
this.tb_atk.MaxLength = 12;
this.tb_atk.Name = "tb_atk";
this.tb_atk.Size = new System.Drawing.Size(38, 21);
this.tb_atk.Size = new System.Drawing.Size(40, 21);
this.tb_atk.TabIndex = 8;
this.tb_atk.Text = "0";
this.tb_atk.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.tb_atk.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// tb_def
//
this.tb_def.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.tb_def.Location = new System.Drawing.Point(352, 326);
this.tb_def.Location = new System.Drawing.Point(354, 325);
this.tb_def.MaxLength = 12;
this.tb_def.Name = "tb_def";
this.tb_def.Size = new System.Drawing.Size(38, 21);
this.tb_def.Size = new System.Drawing.Size(40, 21);
this.tb_def.TabIndex = 8;
this.tb_def.Text = "0";
this.tb_def.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.tb_def.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// tb_cardcode
//
this.tb_cardcode.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.tb_cardcode.Location = new System.Drawing.Point(484, 324);
this.tb_cardcode.Location = new System.Drawing.Point(484, 325);
this.tb_cardcode.MaxLength = 12;
this.tb_cardcode.Name = "tb_cardcode";
this.tb_cardcode.Size = new System.Drawing.Size(68, 21);
this.tb_cardcode.Size = new System.Drawing.Size(67, 21);
this.tb_cardcode.TabIndex = 8;
this.tb_cardcode.Text = "0";
this.tb_cardcode.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
......@@ -793,7 +802,7 @@ private void InitializeComponent()
// tb_cardalias
//
this.tb_cardalias.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.tb_cardalias.Location = new System.Drawing.Point(484, 300);
this.tb_cardalias.Location = new System.Drawing.Point(484, 301);
this.tb_cardalias.MaxLength = 12;
this.tb_cardalias.Name = "tb_cardalias";
this.tb_cardalias.Size = new System.Drawing.Size(67, 21);
......@@ -875,7 +884,7 @@ private void InitializeComponent()
//
this.lb2.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.lb2.AutoSize = true;
this.lb2.Location = new System.Drawing.Point(340, 303);
this.lb2.Location = new System.Drawing.Point(340, 304);
this.lb2.Name = "lb2";
this.lb2.Size = new System.Drawing.Size(11, 12);
this.lb2.TabIndex = 7;
......@@ -1005,7 +1014,7 @@ private void InitializeComponent()
//
this.lb_cardcode.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.lb_cardcode.AutoSize = true;
this.lb_cardcode.Location = new System.Drawing.Point(418, 329);
this.lb_cardcode.Location = new System.Drawing.Point(413, 328);
this.lb_cardcode.Name = "lb_cardcode";
this.lb_cardcode.Size = new System.Drawing.Size(59, 12);
this.lb_cardcode.TabIndex = 7;
......@@ -1320,5 +1329,6 @@ private void InitializeComponent()
private System.Windows.Forms.TextBox tb_link;
private System.Windows.Forms.Panel pl_bottom;
private System.Windows.Forms.Panel pl_main;
private System.Windows.Forms.ToolStripMenuItem menuitem_addrequire;
}
}
......@@ -23,6 +23,7 @@ namespace DataEditorX
{
public partial class DataEditForm : DockContent, IDataForm
{
public string addrequire;
#region 成员变量/构造
TaskHelper tasker = null;
string taskname;
......@@ -145,6 +146,9 @@ void DataEditFormLoad(object sender, EventArgs e)
menuitem_openfileinthis.Checked = MyConfig.readBoolean(MyConfig.TAG_OPEN_IN_THIS);
//自动检查更新
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))
Open(nowCdbFile);
//获取MSE配菜单
......@@ -354,23 +358,21 @@ void InitListRows()
item.Text = "Test";
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;
if (itemH > 0)
{
int n = lv_cardlist.Height/ itemH;
int n = (lv_cardlist.Height - headH) / itemH;
if (n > 0){
MaxRow = n;
}
//MessageBox.Show("height="+lv_cardlist.Height+",item="+itemH+",max="+MaxRow);
}
if(MaxRow < 1){
MaxRow = 1;
//MessageBox.Show("height="+lv_cardlist.Height+",item="+itemH+",head="+headH+",max="+MaxRow);
}
if(addTest){
lv_cardlist.Items.Clear();
}else{
Search(true);
}
if (MaxRow < 10)
MaxRow = 20;
}
//设置checkbox
void SetCheck(FlowLayoutPanel fpl, long number)
......@@ -740,7 +742,7 @@ public void SetCards(Card[] cards, bool isfresh)
tb_pagenum.Text = pageNum.ToString();
if (isfresh)//是否跳到之前页数
AddListView(Math.Min(page, pageNum));
AddListView(page);
else
AddListView(1);
}
......@@ -815,7 +817,7 @@ void Btn_modClick(object sender, EventArgs e)
void Btn_luaClick(object sender, EventArgs e)
{
if (cardedit != null)
cardedit.OpenScript(menuitem_openfileinthis.Checked);
cardedit.OpenScript(menuitem_openfileinthis.Checked, addrequire);
}
//删除
void Btn_delClick(object sender, EventArgs e)
......@@ -1622,6 +1624,13 @@ private void menuitem_autocheckupdate_Click(object sender, EventArgs e)
menuitem_autocheckupdate.Checked = !menuitem_autocheckupdate.Checked;
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
#region 语言菜单
......
......@@ -28,6 +28,8 @@
<add key="open_file_in_this" value="true" />
<!-- check update when opening application automatically -->
<add key="auto_check_update" value="true" />
<!-- add require automatically -->
<add key="add require" value="" />
<!-- Cut Images Setting -->
<add key="image_quilty" value="100" />
<add key="image" value="44,64,177,254" />
......
......@@ -46,6 +46,7 @@ DataEditForm.mainMenu.menuitem_mseconfig 设置MSE的配置文件
DataEditForm.mainMenu.menu_data 数据(&D)
DataEditForm.mainMenu.menuitem_operacardsfile 同步操作卡片图片和脚本
DataEditForm.mainMenu.menuitem_openfileinthis 用CodeEditor打开脚本
DataEditForm.mainMenu.menuitem_addrequire 创建脚本时自动添加require
DataEditForm.mainMenu.menuitem_findluafunc 从C++源码查找Lua函数
DataEditForm.mainMenu.menuitem_readydk 从卡组文件读取卡片(&Y)
DataEditForm.mainMenu.menuitem_readimages 从卡图文件夹读取卡片(&I)
......
......@@ -44,6 +44,7 @@ DataEditForm.mainMenu.menu_image MSE(&M)
DataEditForm.mainMenu.menu_data Data(&D)
DataEditForm.mainMenu.menuitem_operacardsfile Opera with Card's files
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_readimages Read From Images Path(&I)
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