-
Notifications
You must be signed in to change notification settings - Fork 0
/
MapObjectPicker.cs
67 lines (59 loc) · 1.77 KB
/
MapObjectPicker.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
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;
namespace FFRMapEditorMono
{
public class MapObjectPicker : OptionPicker
{
private Overworld overworld;
public MapObjectPicker(Texture2D _window, Texture2D _selector, Texture2D _placingicons, SpriteFont _font, Overworld _overworld)
{
optionsWindow = _window;
optionSelector = _selector;
optionIcons = _placingicons;
optionFont = _font;
overworld = _overworld;
Position = new Vector2(64, 0);
zoom = 2.0f;
optionsRows = 1;
optionsColumns = 5;
optionsSize = 16;
options = mapObjectsNames.Select((o, i) => (o.Item1,
new List<EditorTask>() {
new EditorTask() { Type = EditorTasks.MapObjectsUpdate, Value = i } },
new List<EditorTask>() {
new EditorTask() { Type = EditorTasks.MapObjectsRemove, Value = i } }
)).ToList();
Show = false;
lastSelection = 0x00;
placedOptions = new();
unplacedOptions = new();
SetOptionTextLength();
showPlaced = true;
}
private List<(string, EditorTasks, EditorTasks)> mapObjectsNames = new()
{
("Starting Position", EditorTasks.None, EditorTasks.None),
("Bridge", EditorTasks.None, EditorTasks.None),
("Canal", EditorTasks.None, EditorTasks.None),
("Ship (Unused)", EditorTasks.None, EditorTasks.None),
("Airship", EditorTasks.None, EditorTasks.None),
};
public override void ProcessTasks(List<EditorTask> tasks)
{
var validtasks = tasks.ToList();
foreach (var task in validtasks)
{
if (task.Type == EditorTasks.UpdatePlacedObjectsOverlay)
{
placedOptions = overworld.GetPlacedMapObjects().Select(o => (int)o).ToList();
tasks.Remove(task);
}
}
}
}
}