TA -> TextAction

This commit is contained in:
2026-06-14 01:16:53 +02:00
parent 46d2762569
commit 0d7986325f
2 changed files with 31 additions and 32 deletions

View File

@@ -5,14 +5,13 @@ using _2DGAMELIB;
namespace SlaveMatrix namespace SlaveMatrix
{ {
//Text Actions public struct TextAction
public struct TA
{ {
public string Text; public string Text;
public Action<ButtonBase> act; public Action<ButtonBase> act;
public TA(string Text, Action<ButtonBase> act) public TextAction(string Text, Action<ButtonBase> act)
{ {
this.Text = Text; this.Text = Text;
this.act = act; this.act = act;
@@ -35,12 +34,12 @@ namespace SlaveMatrix
private Vector2D p; private Vector2D p;
public IEnumerable<TA> Acts public IEnumerable<TextAction> Acts
{ {
set set
{ {
int num = 0; int num = 0;
foreach (TA item in value) foreach (TextAction item in value)
{ {
pt[num].Text = item.Text; pt[num].Text = item.Text;
bs[num.ToString()].Action = item.act; bs[num.ToString()].Action = item.act;
@@ -70,7 +69,7 @@ namespace SlaveMatrix
} }
} }
public ListView(RenderArea Are, Vector2D Position, double Space, Font Font, double TextSize, Color TextColor, Color ShadColor, Color BackColor, Color FramColor, params TA[] acts) public ListView(RenderArea Are, Vector2D Position, double Space, Font Font, double TextSize, Color TextColor, Color ShadColor, Color BackColor, Color FramColor, params TextAction[] acts)
{ {
this.Are = Are; this.Are = Are;
this.Space = Space; this.Space = Space;

View File

@@ -96,7 +96,7 @@ namespace SlaveMatrix
return new Button(shapePartT, on_click); return new Button(shapePartT, on_click);
} }
public static ListView Select(RenderArea buffer, Vector2D pos, params TA[] acts) { public static ListView Select(RenderArea buffer, Vector2D pos, params TextAction[] acts) {
return new ListView( return new ListView(
buffer, buffer,
buffer.GetPosition(pos), buffer.GetPosition(pos),
@@ -231,7 +231,7 @@ namespace SlaveMatrix
ColorHelper.Empty, ColorHelper.Empty,
ColorHelper.Black, ColorHelper.Black,
ColorHelper.Empty, ColorHelper.Empty,
Enumerable.Repeat(new TA(new string('A', 15), delegate{}), 10).ToArray() Enumerable.Repeat(new TextAction(new string('A', 15), delegate{}), 10).ToArray()
); );
SaveData.SetHitColor(Med); SaveData.SetHitColor(Med);
@@ -601,7 +601,7 @@ namespace SlaveMatrix
SaveData.Acts = sllv(Med); SaveData.Acts = sllv(Med);
} }
private static IEnumerable<TA> sllv(ModeEventDispatcher Med) private static IEnumerable<TextAction> sllv(ModeEventDispatcher Med)
{ {
int j = 0; int j = 0;
string[] array = GlobalState.SDPaths(); string[] array = GlobalState.SDPaths();
@@ -610,7 +610,7 @@ namespace SlaveMatrix
string path = text; string path = text;
int i = j; int i = j;
bool f = path == null; bool f = path == null;
yield return new TA(f ? (i + ": No data") : Path.GetFileNameWithoutExtension(path).Replace("", ":").Replace("_", "/"), delegate yield return new TextAction(f ? (i + ": No data") : Path.GetFileNameWithoutExtension(path).Replace("", ":").Replace("_", "/"), delegate
{ {
//////Sounds.操作.Play(); //////Sounds.操作.Play();
if (save) if (save)
@@ -699,7 +699,7 @@ namespace SlaveMatrix
SaveData.Acts = jsllv(med); SaveData.Acts = jsllv(med);
} }
private static IEnumerable<TA> jsllv(ModeEventDispatcher med) private static IEnumerable<TextAction> jsllv(ModeEventDispatcher med)
{ {
int k = 0; int k = 0;
string[] array = GlobalState.JSDPaths(); string[] array = GlobalState.JSDPaths();
@@ -708,7 +708,7 @@ namespace SlaveMatrix
string path = text; string path = text;
int i = k; int i = k;
bool f = path == null; bool f = path == null;
yield return new TA(f ? (i + ": No data") : Path.GetFileNameWithoutExtension(path).Replace("", ":").Replace("_", "/"), delegate yield return new TextAction(f ? (i + ": No data") : Path.GetFileNameWithoutExtension(path).Replace("", ":").Replace("_", "/"), delegate
{ {
//Sounds.操作.Play(); //Sounds.操作.Play();
if (save) if (save)
@@ -1252,7 +1252,7 @@ namespace SlaveMatrix
ListView listView = MyUI.Select( ListView listView = MyUI.Select(
DrawBuffer, DrawBuffer,
new Vector2D(0.45, 0.5), new Vector2D(0.45, 0.5),
new TA("Start", delegate new TextAction("Start", delegate
{ {
////Sounds.操作.Play(); ////Sounds.操作.Play();
GlobalState.GameData.SetDefault(); GlobalState.GameData.SetDefault();
@@ -1266,7 +1266,7 @@ namespace SlaveMatrix
SetDemandMaximum(); SetDemandMaximum();
Med.SwitchMode("PlayerInformation", DrawBuffer, PlayerInformationSliders); Med.SwitchMode("PlayerInformation", DrawBuffer, PlayerInformationSliders);
}), }),
new TA("Load", delegate new TextAction("Load", delegate
{ {
////Sounds.操作.Play(); ////Sounds.操作.Play();
SaveData.bs["0"].Dra = true; SaveData.bs["0"].Dra = true;
@@ -2007,7 +2007,7 @@ namespace SlaveMatrix
int f = 0; int f = 0;
ListView lv = MyUI.Select(DrawBuffer, new Vector2D(0.01, 0.08), ListView lv = MyUI.Select(DrawBuffer, new Vector2D(0.01, 0.08),
Enumerable.Repeat(new TA("No Slave".PadLeft(15, ' '), delegate { }), 15).ToArray() Enumerable.Repeat(new TextAction("No Slave".PadLeft(15, ' '), delegate { }), 15).ToArray()
); );
Color lv初期縁色 = ColorHelper.Black; Color lv初期縁色 = ColorHelper.Black;
@@ -2066,9 +2066,9 @@ namespace SlaveMatrix
Action<int> set = delegate(int n) Action<int> set = delegate(int n)
{ {
i = 0; i = 0;
lv.Acts = Enumerable.Repeat(new TA("", delegate lv.Acts = Enumerable.Repeat(new TextAction("", delegate
{ {
}), 15).Select(delegate(TA e) }), 15).Select(delegate(TextAction e)
{ {
Unit u = GlobalState.GameData.Slaves[n + i]; Unit u = GlobalState.GameData.Slaves[n + i];
if (u == null) if (u == null)
@@ -5157,49 +5157,49 @@ namespace SlaveMatrix
}; };
lv = new ListView(DrawBuffer, DrawBuffer.GetPosition(0.01, 0.03), 0.5, new Font("MS Gothic", 1f), 0.07, ColorHelper.White, ColorHelper.Empty, Color.FromArgb(160, ColorHelper.Black), ColorHelper.Black, new TA(GameText. + " 35,000,000", delegate(ButtonBase b) lv = new ListView(DrawBuffer, DrawBuffer.GetPosition(0.01, 0.03), 0.5, new Font("MS Gothic", 1f), 0.07, ColorHelper.White, ColorHelper.Empty, Color.FromArgb(160, ColorHelper.Black), ColorHelper.Black, new TextAction(GameText. + " 35,000,000", delegate(ButtonBase b)
{ {
buy(b, 0, 35000000uL); buy(b, 0, 35000000uL);
}), new TA(GameText. + " 40,000,000", delegate(ButtonBase b) }), new TextAction(GameText. + " 40,000,000", delegate(ButtonBase b)
{ {
buy(b, 1, 40000000uL); buy(b, 1, 40000000uL);
}), new TA(GameText. + " 60,000,000", delegate(ButtonBase b) }), new TextAction(GameText. + " 60,000,000", delegate(ButtonBase b)
{ {
buy(b, 2, 60000000uL); buy(b, 2, 60000000uL);
}), new TA(GameText. + " 50,000,000", delegate(ButtonBase b) }), new TextAction(GameText. + " 50,000,000", delegate(ButtonBase b)
{ {
buy(b, 3, 50000000uL); buy(b, 3, 50000000uL);
}), new TA(GameText. + " 45,000,000", delegate(ButtonBase b) }), new TextAction(GameText. + " 45,000,000", delegate(ButtonBase b)
{ {
buy(b, 4, 45000000uL); buy(b, 4, 45000000uL);
}), new TA(GameText.調 + " 30,000,000", delegate(ButtonBase b) }), new TextAction(GameText.調 + " 30,000,000", delegate(ButtonBase b)
{ {
buy(b, 5, 30000000uL); buy(b, 5, 30000000uL);
}), new TA(GameText. + " 20,000,000", delegate(ButtonBase b) }), new TextAction(GameText. + " 20,000,000", delegate(ButtonBase b)
{ {
buy(b, 6, 20000000uL); buy(b, 6, 20000000uL);
}), new TA(GameText.T字剃刀 + " 20,000,000", delegate(ButtonBase b) }), new TextAction(GameText.T字剃刀 + " 20,000,000", delegate(ButtonBase b)
{ {
buy(b, 7, 20000000uL); buy(b, 7, 20000000uL);
}), new TA(GameText. + " 30,000,000", delegate(ButtonBase b) }), new TextAction(GameText. + " 30,000,000", delegate(ButtonBase b)
{ {
buy(b, 8, 30000000uL); buy(b, 8, 30000000uL);
}), new TA(GameText. + " 20,000,000", delegate(ButtonBase b) }), new TextAction(GameText. + " 20,000,000", delegate(ButtonBase b)
{ {
buy(b, 9, 20000000uL); buy(b, 9, 20000000uL);
}), new TA(GameText. + " 20,000,000", delegate(ButtonBase b) }), new TextAction(GameText. + " 20,000,000", delegate(ButtonBase b)
{ {
buy(b, 10, 20000000uL); buy(b, 10, 20000000uL);
}), new TA(GameText. + " 25,000,000", delegate(ButtonBase b) }), new TextAction(GameText. + " 25,000,000", delegate(ButtonBase b)
{ {
buy(b, 11, 25000000uL); buy(b, 11, 25000000uL);
}), new TA(GameText. + " 20,000,000", delegate(ButtonBase b) }), new TextAction(GameText. + " 20,000,000", delegate(ButtonBase b)
{ {
buy(b, 12, 20000000uL); buy(b, 12, 20000000uL);
}), new TA(GameText. + " 100,000,000", delegate(ButtonBase b) }), new TextAction(GameText. + " 100,000,000", delegate(ButtonBase b)
{ {
buy(b, 13, 100000000uL); buy(b, 13, 100000000uL);
}), new TA(GameText. + " 300,000,000", delegate(ButtonBase b) }), new TextAction(GameText. + " 300,000,000", delegate(ButtonBase b)
{ {
ulong num = 300000000uL; ulong num = 300000000uL;
if (GlobalState.GameData. >= num) if (GlobalState.GameData. >= num)