Commit a988acd8 authored by nanahira's avatar nanahira

btest

parent f26a6165
...@@ -92,10 +92,14 @@ public class MyConfig : XMLReader ...@@ -92,10 +92,14 @@ 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> /// </summary>
public const string TAG_CHECK_SYSLANG = "check_system_language"; public const string TAG_ADD_REQUIRE = "add_require";
/// <summary>
/// 检查系统语言
/// </summary>
public const string TAG_CHECK_SYSLANG = "check_system_language";
/// <summary> /// <summary>
/// 一般的裁剪 /// 一般的裁剪
/// </summary> /// </summary>
......
...@@ -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 source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -21,10 +21,11 @@ ...@@ -21,10 +21,11 @@
namespace DataEditorX namespace DataEditorX
{ {
public partial class DataEditForm : DockContent, IDataForm public partial class DataEditForm : DockContent, IDataForm
{ {
#region 成员变量/构造 public string addrequire;
TaskHelper tasker = null; #region 成员变量/构造
TaskHelper tasker = null;
string taskname; string taskname;
//目录 //目录
YgoPath ygopath; YgoPath ygopath;
...@@ -62,7 +63,7 @@ public partial class DataEditForm : DockContent, IDataForm ...@@ -62,7 +63,7 @@ public partial class DataEditForm : DockContent, IDataForm
string datapath, confcover; string datapath, confcover;
public DataEditForm(string datapath, string cdbfile) public DataEditForm(string datapath, string cdbfile)
{ {
Initialize(datapath); Initialize(datapath);
nowCdbFile = cdbfile; nowCdbFile = cdbfile;
...@@ -124,11 +125,11 @@ public bool Save() ...@@ -124,11 +125,11 @@ public bool Save()
{ {
return true; return true;
} }
#endregion #endregion
#region 窗体 #region 窗体
//窗体第一次加载 //窗体第一次加载
void DataEditFormLoad(object sender, EventArgs e) void DataEditFormLoad(object sender, EventArgs e)
{ {
//InitListRows();//调整卡片列表的函数 //InitListRows();//调整卡片列表的函数
HideMenu();//是否需要隐藏菜单 HideMenu();//是否需要隐藏菜单
...@@ -145,7 +146,10 @@ void DataEditFormLoad(object sender, EventArgs e) ...@@ -145,7 +146,10 @@ 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);
if (nowCdbFile != null && File.Exists(nowCdbFile)) //add require automatically
addrequire = MyConfig.readString(MyConfig.TAG_ADD_REQUIRE);
menuitem_addrequire.Checked = (addrequire.Length > 0);
if (nowCdbFile != null && File.Exists(nowCdbFile))
Open(nowCdbFile); Open(nowCdbFile);
//获取MSE配菜单 //获取MSE配菜单
AddMenuItemFormMSE(); AddMenuItemFormMSE();
...@@ -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,10 +1624,17 @@ private void menuitem_autocheckupdate_Click(object sender, EventArgs e) ...@@ -1622,10 +1624,17 @@ 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());
} }
#endregion //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 语言菜单 #region 语言菜单
void GetLanguageItem() void GetLanguageItem()
{ {
if (!Directory.Exists(datapath)) if (!Directory.Exists(datapath))
return; return;
...@@ -1766,8 +1775,8 @@ void Tb_linkTextChanged(object sender, EventArgs e) ...@@ -1766,8 +1775,8 @@ void Tb_linkTextChanged(object sender, EventArgs e)
{ {
text2LinkMarks(tb_link.Text); text2LinkMarks(tb_link.Text);
} }
void Tb_linkKeyPress(object sender, KeyPressEventArgs e) void Tb_linkKeyPress(object sender, KeyPressEventArgs e)
{ {
if(e.KeyChar != '0' && e.KeyChar != '1' && e.KeyChar != 1 && e.KeyChar!=22 && e.KeyChar!=3 && e.KeyChar != 8){ if(e.KeyChar != '0' && e.KeyChar != '1' && e.KeyChar != 1 && e.KeyChar!=22 && e.KeyChar!=3 && e.KeyChar != 8){
// MessageBox.Show("key="+(int)e.KeyChar); // MessageBox.Show("key="+(int)e.KeyChar);
......
...@@ -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