-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockPicker.cs
103 lines (98 loc) · 3.72 KB
/
DockPicker.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using System.Text.RegularExpressions;
namespace FFRMapEditorMono
{
public class DockPicker : OptionPicker
{
private Overworld overworld;
public DockPicker(Texture2D _window, Texture2D _selector, Texture2D _placedicons, SpriteFont _font, Overworld _overworld)
{
optionsWindow = _window;
optionSelector = _selector;
optionIcons = _placedicons;
optionFont = _font;
overworld = _overworld;
Position = new Vector2(64, 0);
zoom = 1.0f;
optionsRows = 2;
optionsColumns = 8;
optionsSize = 32;
options = OwTpIndexToName.Select(d => (d.Value,
new List<EditorTask>() {
new EditorTask() { Type = EditorTasks.DocksUpdate, Value = (int)d.Key } },
new List<EditorTask>() {
new EditorTask() { Type = EditorTasks.DocksRemove, Value = (int)d.Key } }
)).ToList();
Show = false;
lastSelection = 0x00;
placedOptions = new();
unplacedOptions = new();
SetOptionTextLength();
showPlaced = true;
}
public override void ProcessTasks(List<EditorTask> tasks)
{
var validtasks = tasks.ToList();
foreach (var task in validtasks)
{
if (task.Type == EditorTasks.UpdatePlacedDocksOverlay)
{
placedOptions = overworld.GetShipData().Select(d => (int)d.TeleporterIndex).ToList();
if (placedOptions.Contains((int)OverworldTeleportIndex.None))
{
placedOptions.RemoveAll(o => o == (int)OverworldTeleportIndex.None);
placedOptions.Add((int)OverworldTeleportIndex.DefaultLocation);
unplacedOptions = new();
}
else
{
unplacedOptions.Add((int)OverworldTeleportIndex.DefaultLocation);
}
tasks.Remove(task);
}
}
}
private Dictionary<OverworldTeleportIndex, string> OwTpIndexToName = new()
{
{ OverworldTeleportIndex.Cardia1, "Cardia North" },
{ OverworldTeleportIndex.Coneria, "Coneria" },
{ OverworldTeleportIndex.Pravoka, "Pravoka" },
{ OverworldTeleportIndex.Elfland, "Elfland" },
{ OverworldTeleportIndex.Melmond, "Melmond" },
{ OverworldTeleportIndex.CrescentLake, "Crescent Lake" },
{ OverworldTeleportIndex.Gaia, "Gaia" },
{ OverworldTeleportIndex.Onrac, "Onrac" },
{ OverworldTeleportIndex.Lefein, "Lefein" },
{ OverworldTeleportIndex.ConeriaCastle1, "Coneria Castle" },
{ OverworldTeleportIndex.ElflandCastle, "Elfland Castle" },
{ OverworldTeleportIndex.NorthwestCastle, "Northwest Castle" },
{ OverworldTeleportIndex.CastleOrdeals1, "Castle of Ordeals" },
{ OverworldTeleportIndex.TempleOfFiends1, "Temple Of Fiends" },
{ OverworldTeleportIndex.EarthCave1, "Earth Cave" },
{ OverworldTeleportIndex.GurguVolcano1, "Gurgu Volcano" },
{ OverworldTeleportIndex.IceCave1, "Ice Cave" },
{ OverworldTeleportIndex.Cardia2, "Cardia Grass" },
{ OverworldTeleportIndex.BahamutCave1, "Bahamut Cave" },
{ OverworldTeleportIndex.Waterfall, "Waterfall" },
{ OverworldTeleportIndex.DwarfCave, "Dwarf Cave" },
{ OverworldTeleportIndex.MatoyasCave, "Matoya's Cave" },
{ OverworldTeleportIndex.SardasCave, "Sarda's Cave" },
{ OverworldTeleportIndex.MarshCave1, "Marsh Cave" },
{ OverworldTeleportIndex.MirageTower1, "Mirage Tower" },
{ OverworldTeleportIndex.TitansTunnelEast, "Titan's Tunnel East" },
{ OverworldTeleportIndex.TitansTunnelWest, "Titan's Tunnel West" },
{ OverworldTeleportIndex.Cardia4, "Cardia Marsh" },
{ OverworldTeleportIndex.Cardia5, "Cardia Small" },
{ OverworldTeleportIndex.Cardia6, "Cardia Forest" },
{ OverworldTeleportIndex.DefaultLocation, "Default Location" },
{ OverworldTeleportIndex.Unused, "Unused" },
{ OverworldTeleportIndex.None, "None" },
};
}
}