Commit 4dba01be authored by 花桃白音's avatar 花桃白音

Color cards in listbox by LFStates

parent 860fc2f3
No preview for this file type
...@@ -54,7 +54,6 @@ namespace cardvisa ...@@ -54,7 +54,6 @@ namespace cardvisa
Brush myBrush = Brushes.Black; Brush myBrush = Brushes.Black;
SolidBrush mySBrush = new SolidBrush(Color.White); SolidBrush mySBrush = new SolidBrush(Color.White);
Rectangle myRect = new Rectangle(0,0,0,0); Rectangle myRect = new Rectangle(0,0,0,0);
int lockobj = 0;
List<string> filelist = new List<string> { "0禁止.jpg", "1限制.jpg", "2准限.jpg", "3通过.png", "4回退.jpg" }; List<string> filelist = new List<string> { "0禁止.jpg", "1限制.jpg", "2准限.jpg", "3通过.png", "4回退.jpg" };
public List<string> zipcdblist { get; set; } = new List<string>(); public List<string> zipcdblist { get; set; } = new List<string>();
public int cardindex = 0; public int cardindex = 0;
...@@ -346,6 +345,7 @@ namespace cardvisa ...@@ -346,6 +345,7 @@ namespace cardvisa
richTextBox1.ForeColor = ftc; richTextBox1.ForeColor = ftc;
listBox1.BackColor = bgc; listBox1.BackColor = bgc;
listBox1.ForeColor = ftc; listBox1.ForeColor = ftc;
mySBrush.Color = bgc;
BackColor = ColorTranslator.FromHtml("#333333"); BackColor = ColorTranslator.FromHtml("#333333");
} }
else else
...@@ -360,6 +360,7 @@ namespace cardvisa ...@@ -360,6 +360,7 @@ namespace cardvisa
richTextBox1.ForeColor = Color.Black; richTextBox1.ForeColor = Color.Black;
listBox1.BackColor = Color.White; listBox1.BackColor = Color.White;
listBox1.ForeColor = Color.Black; listBox1.ForeColor = Color.Black;
mySBrush.Color = Color.White;
BackColor = DefaultBackColor; BackColor = DefaultBackColor;
} }
/* /*
...@@ -435,7 +436,7 @@ namespace cardvisa ...@@ -435,7 +436,7 @@ namespace cardvisa
var code = cardd.id; var code = cardd.id;
var cti = new CardTypeInfo(cardd.type); var cti = new CardTypeInfo(cardd.type);
bool otbug = settings.packDIY ? (cardd.ot != 4) : false; bool otbug = settings.packDIY ? (cardd.ot != 4) : false;
bool lostcheck = (cardd.alias == 0 && cti.IsNeedScript()); bool lostcheck = (cardd.alias == 0 && cti.IsNeedScript()) && settings.checkfiles;
if (lostcheck || otbug)//非同名卡 if (lostcheck || otbug)//非同名卡
{ {
string parentpath = Path.GetDirectoryName(pathName); string parentpath = Path.GetDirectoryName(pathName);
...@@ -753,17 +754,22 @@ namespace cardvisa ...@@ -753,17 +754,22 @@ namespace cardvisa
} }
else else
{ {
string[] strsets = File.ReadAllLines(path); readLFList(path);
string reg = "(?<id>\\d{1,10})\\s(?<lf>\\d).*(?<=[-]{2})(?<name>.*)"; }
foreach (var str in strsets) }
public void readLFList(string path)
{
string[] strsets = File.ReadAllLines(path);
string reg = "(?<id>\\d{1,10})\\s(?<lf>\\d).*(?<=[-]{2})(?<name>.*)";
foreach (var str in strsets)
{
Match mt = Regex.Match(str, reg);
if (mt.Success)
{ {
Match mt = Regex.Match(str,reg); long cid = long.Parse(mt.Groups["id"].Value);
if (mt.Success) if (cdbh.cmds.ContainsKey(cid))
{ {
long cid = long.Parse(mt.Groups["id"].Value); cdbh.cmds[cid].LFState = (LFStates)Enum.Parse(typeof(LFStates), mt.Groups["lf"].Value);
if (cdbh.cmds.ContainsKey(cid)) {
cdbh.cmds[cid].LFState = (LFStates)Enum.Parse(typeof(LFStates), mt.Groups["lf"].Value);
}
} }
} }
} }
...@@ -968,43 +974,37 @@ namespace cardvisa ...@@ -968,43 +974,37 @@ namespace cardvisa
private void listBox1_DrawItem(object sender, DrawItemEventArgs e) private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
{ {
if (e.Index < 0) return; if (e.Index < 0) return;
if (lockobj == 1) return;
if (button7.Text == "开灯") if (button7.Text == "开灯")
{ {
myBrush = Brushes.White; myBrush = Brushes.White;
mySBrush.Color = Color.Black; mySBrush.Color = Color.Black;
} }
myRect.X = e.Bounds.X; myRect = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
myRect.Y = e.Bounds.Y; e.Graphics.FillRectangle(mySBrush,myRect);//罪魁祸首
myRect.Width = e.Bounds.Width;
myRect.Height = e.Bounds.Height;
e.Graphics.FillRectangle(mySBrush,myRect);//罪魁祸首
/*
if (cdbh.cmds.Count > 0) if (cdbh.cmds.Count > 0)
{ {
var id = e.Index > 0 ? (e.Index < 20 ? e.Index : 19) : 2; var id = e.Index > 0 ? (e.Index < 20 ? e.Index : 20) : 1;
sqldata sqd = cdbh.cmds[GetCardFromListID(id)]; switch ((e.Index == 21 || e.Index == 0)? cdbh.cmds[GetCardFromListID(id)].LFState : LFStates.other)
switch (sqd.LFState)
{ {
case LFStates.死刑: case LFStates.Forbidden:
myBrush = Brushes.Red; myBrush = Brushes.Red;
break; break;
case LFStates.Limited: case LFStates.Limited:
myBrush = Brushes.Orange; myBrush = Brushes.Orange;
break; break;
case LFStates.SubLimited: case LFStates.SubLimited:
myBrush = Brushes.Blue; myBrush = Brushes.ForestGreen;
break; break;
default: default:
myBrush = button7.Text == "关灯" ? Brushes.Black : Brushes.White; myBrush = button7.Text == "关灯" ? Brushes.Black : Brushes.White;
break; break;
} }
}*/ }
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
{ {
e.Graphics.FillRectangle(new SolidBrush(Color.LightBlue),myRect);//罪魁祸首 e.Graphics.FillRectangle(new SolidBrush(Color.LightBlue),myRect);//罪魁祸首
} }
e.Graphics.DrawString(listBox1.Items[e.Index].ToString(), listBox1.Font, myBrush,myRect, StringFormat.GenericDefault); e.Graphics.DrawString(listBox1.Items[e.Index].ToString(), listBox1.Font, myBrush, myRect, StringFormat.GenericDefault);
e.DrawFocusRectangle(); e.DrawFocusRectangle();
} }
private void listBox1_SelectedValueChanged(object sender, EventArgs e) private void listBox1_SelectedValueChanged(object sender, EventArgs e)
...@@ -1443,7 +1443,8 @@ namespace cardvisa ...@@ -1443,7 +1443,8 @@ namespace cardvisa
Limited = 1, Limited = 1,
SubLimited = 2, SubLimited = 2,
UnLimited = 3, UnLimited = 3,
死刑 = 4 死刑 = 4,
other = 5
} }
public class CommonHandler public class CommonHandler
{ {
...@@ -1538,6 +1539,7 @@ namespace cardvisa ...@@ -1538,6 +1539,7 @@ namespace cardvisa
public string ygopath { get; set; } = ""; public string ygopath { get; set; } = "";
public bool pathcheck { get; set; } = false; public bool pathcheck { get; set; } = false;
public bool packDIY { get; set; } = true; public bool packDIY { get; set; } = true;
public bool checkfiles { get; set; } = false;
public List<string> regs { get; set; } public List<string> regs { get; set; }
} }
public class sqldata public class sqldata
......
This diff is collapsed.
This diff is collapsed.
{"ygopath":"E:\\MyCardLibrary\\ygopro\\ygopro.exe","pathcheck":false,"packDIY":true,"regs":null} {"ygopath":"D:\\MyCardLibrary\\ygopro\\ygopro.exe","pathcheck":false,"packDIY":true,"regs":null,"checkfiles": false}
\ No newline at end of file \ No newline at end of file
6eed85acb0b2cbb3d5797a801f4b74efa08f41cf 82ee7007c2ed7a5765c90a144ea7ebd66d6b4faf830bf39b7baeaf603aeb3916
...@@ -55,3 +55,5 @@ E:\project\visa\cardvisa\cardvisa\obj\Debug\cardvisa.PicViewer.resources ...@@ -55,3 +55,5 @@ E:\project\visa\cardvisa\cardvisa\obj\Debug\cardvisa.PicViewer.resources
C:\Users\Administrator\source\repos\cardvisa\cardvisa\obj\Debug\cardvisa.PicViewer.resources C:\Users\Administrator\source\repos\cardvisa\cardvisa\obj\Debug\cardvisa.PicViewer.resources
E:\project\visa\cardvisa\cardvisa\obj\Debug\cardvisa.PuzzleGame.resources E:\project\visa\cardvisa\cardvisa\obj\Debug\cardvisa.PuzzleGame.resources
E:\project\visa\cardvisa\cardvisa\obj\Debug\cardvisa.MyListBox.resources E:\project\visa\cardvisa\cardvisa\obj\Debug\cardvisa.MyListBox.resources
C:\Users\Administrator\source\repos\cardvisa\cardvisa\obj\Debug\cardvisa.MyListBox.resources
C:\Users\Administrator\source\repos\cardvisa\cardvisa\obj\Debug\cardvisa.PuzzleGame.resources
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