Commit a499a399 authored by 247321453's avatar 247321453

GUI

parent 987dec0c
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 5月18 星期日
* 时间: 20:53
*
*/
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace DataEditorX.Core
{
/// <summary>
/// Description of CheckPanel.
/// </summary>
public class CheckPanel : FlowLayoutPanel
{
Dictionary<long, string> m_dic=null;
List<CheckBox> checkBoxList;
public CheckPanel()
{
checkBoxList=new List<CheckBox>();
m_dic=new Dictionary<long, string>();
}
public void SetDic(Dictionary<long, string> dic)
{
m_dic=dic;
}
public bool Init()
{
if(m_dic==null)
return false;
this.Controls.Clear();
checkBoxList.Clear();
this.SuspendLayout();
int i=0;
foreach(string str in m_dic.Values)
{
i++;
if(str=="N/A")
continue;
CheckBox cbox=new CheckBox();
cbox.Name = "cbox"+i.ToString();
cbox.TabIndex =i;
cbox.AutoSize = true;
cbox.Margin=new Padding(1,2,1,2);
cbox.Text=str;
checkBoxList.Add(cbox);
}
this.Controls.AddRange(checkBoxList.ToArray());
this.ResumeLayout(false);
this.PerformLayout();
return true;
}
public void SetNumber(long num)
{
}
public long GetNumber()
{
return 0;
}
}
}
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 5月18 星期日
* 时间: 18:08
*
*/
using System;
using System.IO;
using System.Text;
using System.Globalization;
using System.Collections.Generic;
namespace DataEditorX.Core
{
public class DataManager
{
#region 读取
/// <summary>
///
/// </summary>
/// <param name="strFile"></param>
/// <returns></returns>
public static Dictionary<long, string> Read(string strFile)
{
Dictionary<long, string> m_dic=new Dictionary<long, string>();
if(File.Exists(strFile))
{
using(FileStream fstream=new FileStream(
strFile,FileMode.Open, FileAccess.ReadWrite))
{
StreamReader sreader=new StreamReader(fstream, Encoding.UTF8);
string line , strkey, strword;
int l;
long lkey;
while((line = sreader.ReadLine()) !=null )
{
if(line.StartsWith("#"))
continue;
if((l = line.IndexOf(" ")) < 0)
continue;
strkey=line.Substring(0,l).Replace("0x","");
strword=line.Substring(l+1);
if(line.StartsWith("0x"))
long.TryParse(strkey, NumberStyles.HexNumber, null, out lkey);
else
long.TryParse(strkey, out lkey);
if(!m_dic.ContainsKey(lkey) && strword !="N/A")
m_dic.Add(lkey, strword);
}
sreader.Close();
fstream.Close();
}
}
return m_dic;
}
#endregion
#region 查找
/// <summary>
///
/// </summary>
/// <param name="dic"></param>
/// <param name="strValue"></param>
/// <param name="defaultKey"></param>
/// <returns></returns>
public static long GetKey(
Dictionary<long, string> dic,
string strValue,
long defaultKey
){
long lkey=defaultKey;
if(!dic.ContainsValue(strValue))
return lkey;
foreach(long key in dic.Keys)
{
if(dic[key]==strValue)
{
lkey=key;
break;
}
}
return lkey;
}
#endregion
public static string[] GetValues(Dictionary<long, string> dic)
{
int length=dic.Count;
string[] words=new string[1];
words[0]="N/A";
if(length > 0)
{
words=new string[length];
dic.Values.CopyTo(words,0);
}
return words;
}
}
}
0x1 地
0x0 卡片属性
0x1 地
0x2 水
0x4 炎
0x8 风
......
......@@ -10,21 +10,21 @@
0x200 卡组检索
0x400 卡片回收
0x800 表示变更
0x1000 控制权
0x1000 控制权
0x2000 攻守变化
0x4000 贯穿伤害
0x8000 多次攻击
0x10000 攻击限制
0x20000 直接攻击
0x40000 特殊召唤
0x80000 衍生物
0x80000 衍生物
0x100000 种族相关
0x200000 属性相关
0x400000 LP伤害
0x800000 LP回复
0x400000 LP伤害
0x800000 LP回复
0x1000000 破坏耐性
0x2000000 效果耐性
0x4000000 指示物
0x4000000 指示物
0x8000000 赌博相关
0x10000000 融合相关
0x20000000 同调相关
......
0x0 卡片等级/阶级
0x1 1★
0x2 2★
0x3 3★
0x4 4★
0x5 5★
0x6 6★
0x7 7★
0x8 8★
0x9 9★
0xa 10★
0xb 11★
0xc 12★
0xd 13★
\ No newline at end of file
0x1 战士
0x0 卡片种族
0x1 战士
0x2 魔法使
0x4 天使
0x8 恶魔
......
0x0 卡片规则
0x1 OCG专有
0x2 TCG专有
0x3 OCG&TCG
0x4 Anime/DIY
\ No newline at end of file
0x1 怪兽
0x2 魔法
0x4 陷阱
0x4 陷阱
0x8 N/A
0x10 通常
0x20 效果
0x40 融合
0x80 仪式
0x100 N/A
0x200 灵魂
0x200 灵魂
0x400 同盟
0x800 二重
0x1000 调整
......@@ -18,7 +18,7 @@
0x20000 永续
0x40000 装备
0x80000 场地
0x100000 反击
0x100000 反击
0x200000 反转
0x400000 卡通
0x800000 超量
......
1 1★
2 2★
3 3★
4 4★
5 5★
6 6★
7 7★
8 8★
9 9★
10 10★
11 11★
12 12★
13 13★
\ No newline at end of file
1 OCG专有
2 TCG专有
3 OCG&TCG
4 Anime/DIY
\ No newline at end of file
This diff is collapsed.
/*
* 由SharpDevelop创建。
* 用户: Acer
* 日期: 5月18 星期日
* 时间: 20:22
*
*/
using System;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Collections.Generic;
using DataEditorX.Core;
namespace DataEditorX
{
/// <summary>
/// Description of DataEditForm.
/// </summary>
public partial class DataEditForm : Form
{
string strSetname="卡片系列";
Dictionary<long, string> dicCardRules=null;
Dictionary<long, string> dicCardAttributes=null;
Dictionary<long, string> dicCardRaces=null;
Dictionary<long, string> dicCardLevels=null;
Dictionary<long, string> dicSetnames=null;
Dictionary<long, string> dicCardTypes=null;
Dictionary<long, string> dicCardcategorys=null;
public DataEditForm(string cdbfile)
{
InitializeComponent();
}
public DataEditForm()
{
InitializeComponent();
}
public bool InitForm(string directory)
{
dicCardRules=InitComboBox(
cb_cardrule,Path.Combine(directory, "card-rule.txt"));
dicCardAttributes=InitComboBox(
cb_cardattribute,Path.Combine(directory, "card-attribute.txt"));
dicCardRaces=InitComboBox(
cb_cardrace,Path.Combine(directory, "card-race.txt"));
dicCardLevels=InitComboBox(
cb_cardlevel,Path.Combine(directory, "card-level.txt"));
dicSetnames=DataManager.Read(
Path.Combine(directory, "card-setname.txt"));
string[] setnames=DataManager.GetValues(dicSetnames);
cb_setname1.Items.Add(strSetname+"1");
cb_setname2.Items.Add(strSetname+"2");
cb_setname3.Items.Add(strSetname+"3");
cb_setname4.Items.Add(strSetname+"4");
cb_setname1.Items.AddRange(setnames);
cb_setname2.Items.AddRange(setnames);
cb_setname3.Items.AddRange(setnames);
cb_setname4.Items.AddRange(setnames);
dicCardTypes=DataManager.Read(
Path.Combine(directory, "card-type.txt"));
pl_cardtype.SetDic(dicCardTypes);
pl_cardtype.Init();
dicCardcategorys=DataManager.Read(
Path.Combine(directory, "card-category.txt"));
pl_category.SetDic(dicCardcategorys);
pl_category.Init();
SetCard(new Card(0,""));
return true;
}
Dictionary<long, string> InitComboBox(ComboBox cb, string file)
{
Dictionary<long, string> tempdic=DataManager.Read(file);
cb.Items.Clear();
cb.Items.AddRange(DataManager.GetValues(tempdic));
cb.SelectedIndex=0;
return tempdic;
}
void SetCard(Card card)
{
cb_setname1.SelectedIndex=0;
cb_setname2.SelectedIndex=0;
cb_setname3.SelectedIndex=0;
cb_setname4.SelectedIndex=0;
}
void DataEditFormLoad(object sender, EventArgs e)
{
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
</root>
\ No newline at end of file
......@@ -42,6 +42,12 @@
<ItemGroup>
<Compile Include="Core\Card.cs" />
<Compile Include="Core\CDB.cs" />
<Compile Include="Core\CheckPanel.cs" />
<Compile Include="Core\DataManager.cs" />
<Compile Include="DataEditForm.cs" />
<Compile Include="DataEditForm.Designer.cs">
<DependentUpon>DataEditForm.cs</DependentUpon>
</Compile>
<Compile Include="Interface\ICardView.cs" />
<Compile Include="Interface\IEditor.cs" />
<Compile Include="MainForm.cs" />
......@@ -52,24 +58,43 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="DataEditForm.resx">
<DependentUpon>DataEditForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Data\ygopro" />
<Folder Include="Interface" />
<Folder Include="Data" />
<Folder Include="Core" />
</ItemGroup>
<ItemGroup>
<None Include="Data\ygopro\card-attribute.txt" />
<None Include="Data\ygopro\card-level.txt" />
<None Include="Data\ygopro\card-race.txt" />
<None Include="Data\ygopro\card-category.txt" />
<None Include="Data\ygopro\card-rule.txt" />
<None Include="Data\ygopro\card-type.txt" />
<None Include="Data\ygopro\card-setname.txt" />
<None Include="Data\card-attribute.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Data\card-category.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Data\card-level.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Data\card-race.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Data\card-rule.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Data\card-setname.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Data\card-type.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Data\cover.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
This diff is collapsed.
......@@ -17,27 +17,35 @@ namespace DataEditorX
/// </summary>
public partial class MainForm : Form
{
string m_filename;
string m_title;
DataEditForm editForm;
string datadir=".\\data\\";
public MainForm(string filename)
{
InitFromData();
OpenFile(filename);
Init(filename);
}
public MainForm()
{
InitFromData();
Init(null);
}
void InitFromData()
{
void Init(string filename)
{
if(filename==null)
editForm=new DataEditForm();
else
editForm=new DataEditForm(filename);
InitializeComponent();
m_title=this.Text;
}
void OpenFile(string filename)
timer1.Interval=2000;
timer1.Enabled=true;
editForm.InitForm(datadir);
}
void Timer1Tick(object sender, EventArgs e)
{
m_filename=filename;
this.Text=filename+" - "+m_title;
//
timer1.Enabled=false;
this.Hide();
editForm.ShowDialog();
this.Close();
}
}
}
......@@ -117,7 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ms_main.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
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