net.dreditor.maps 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.attestation.p7m +0 -0
- package/CharacterMapMarkerUI.cs +94 -94
- package/CharacterMapMarkerUI.cs.meta +11 -11
- package/CharacterMapUITab.cs +171 -171
- package/CharacterMapUITab.cs.meta +11 -11
- package/ClearMapAreaData.cs +22 -22
- package/ClearMapAreaData.cs.meta +11 -11
- package/ClearMapInstanceData.cs +35 -35
- package/ClearMapInstanceData.cs.meta +11 -11
- package/ControlFastTravel.cs +56 -56
- package/ControlFastTravel.cs.meta +11 -11
- package/DREditor.Maps.asmdef +23 -23
- package/DREditor.Maps.asmdef.meta +7 -7
- package/DiscoverData.cs +22 -22
- package/DiscoverData.cs.meta +11 -11
- package/DiscoverableBase.cs +23 -23
- package/DiscoverableBase.cs.meta +11 -11
- package/FastTravelController.cs +35 -35
- package/FastTravelController.cs.meta +11 -11
- package/FastTravelData.cs +24 -24
- package/FastTravelData.cs.meta +11 -11
- package/FastTravelMarker.cs +106 -106
- package/FastTravelMarker.cs.meta +13 -13
- package/IDHolder.cs +46 -46
- package/IDHolder.cs.meta +11 -11
- package/IEntryLoader.cs +18 -18
- package/IEntryLoader.cs.meta +11 -11
- package/IMapManager.cs +26 -26
- package/IMapManager.cs.meta +11 -11
- package/IPlaceMarker.cs +25 -25
- package/IPlaceMarker.cs.meta +11 -11
- package/IPlaceOptionHolder.cs +52 -52
- package/IPlaceOptionHolder.cs.meta +11 -11
- package/MapAreaData.cs +52 -52
- package/MapAreaData.cs.meta +11 -11
- package/MapAreaEntry.cs +54 -54
- package/MapAreaEntry.cs.meta +11 -11
- package/MapAreaManager.cs +193 -193
- package/MapAreaManager.cs.meta +11 -11
- package/MapBaseData.cs +65 -65
- package/MapBaseData.cs.meta +11 -11
- package/MapData.cs +34 -34
- package/MapData.cs.meta +11 -11
- package/MapDatabase.cs +132 -132
- package/MapDatabase.cs.meta +11 -11
- package/MapEntry.cs +76 -76
- package/MapEntry.cs.meta +11 -11
- package/MapEntryChange.cs +320 -320
- package/MapEntryChange.cs.meta +11 -11
- package/MapEntryChanger.cs +44 -44
- package/MapEntryChanger.cs.meta +11 -11
- package/MapHoverSelector.cs +160 -160
- package/MapHoverSelector.cs.meta +11 -11
- package/MapManager.cs +287 -287
- package/MapManager.cs.meta +11 -11
- package/MapManagerBase.cs +259 -259
- package/MapManagerBase.cs.meta +11 -11
- package/MapMarkerSelectable.cs +70 -70
- package/MapMarkerSelectable.cs.meta +11 -11
- package/MapObjectiveData.cs +27 -27
- package/MapObjectiveData.cs.meta +11 -11
- package/MapSaveManager.cs +62 -62
- package/MapSaveManager.cs.meta +11 -11
- package/MapTabUIHandler.cs +97 -97
- package/MapTabUIHandler.cs.meta +11 -11
- package/MapUITab.cs +25 -25
- package/MapUITab.cs.meta +11 -11
- package/MapUtility.cs +182 -182
- package/MapUtility.cs.meta +11 -11
- package/MarkerData.cs +24 -24
- package/MarkerData.cs.meta +11 -11
- package/MarkerDatabase.cs +56 -56
- package/MarkerDatabase.cs.meta +11 -11
- package/MarkerUtility.cs +47 -47
- package/MarkerUtility.cs.meta +11 -11
- package/MarkerVessel.cs +37 -37
- package/MarkerVessel.cs.meta +11 -11
- package/PlaceData.cs +26 -26
- package/PlaceData.cs.meta +11 -11
- package/PlaceEntry.cs +82 -82
- package/PlaceEntry.cs.meta +11 -11
- package/PlaceManager.cs +292 -292
- package/PlaceManager.cs.meta +11 -11
- package/PlaceMapUITab.cs +202 -202
- package/PlaceMapUITab.cs.meta +11 -11
- package/{Samples → Samples~}/Clear_Map_Area_Data_Event.prefab +52 -52
- package/{Samples → Samples~}/Clear_Map_Area_Data_Event.prefab.meta +7 -7
- package/{Samples → Samples~}/Clear_Map_Instance_Data.prefab +56 -56
- package/{Samples → Samples~}/Clear_Map_Instance_Data.prefab.meta +7 -7
- package/{Samples → Samples~}/DRE_Map_UI.unity +461 -461
- package/{Samples → Samples~}/DRE_Map_UI.unity.meta +7 -7
- package/{Samples → Samples~}/Map_Entry_Changer.prefab +52 -52
- package/{Samples → Samples~}/Map_Entry_Changer.prefab.meta +7 -7
- package/{Samples → Samples~}/Map_Marker_Selectable_ETemplate.prefab +126 -126
- package/{Samples → Samples~}/Map_Marker_Selectable_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Map_Tab_UI_Handler_Shell.prefab +134 -134
- package/{Samples → Samples~}/Map_Tab_UI_Handler_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Map_Tab_UI_Handler_Template.prefab +404 -404
- package/{Samples → Samples~}/Map_Tab_UI_Handler_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Map_UI_Canvas_Shell.prefab +842 -842
- package/{Samples → Samples~}/Map_UI_Canvas_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Map_UI_Canvas_Template.prefab +996 -996
- package/{Samples → Samples~}/Map_UI_Canvas_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Map_UI_Controls_ETemplate.prefab +538 -538
- package/{Samples → Samples~}/Map_UI_Controls_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Map_UI_GO_FT_ETemplate.prefab +78 -78
- package/{Samples → Samples~}/Map_UI_GO_FT_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Map_UI_Place_Place_Name_ETemplate.prefab +181 -181
- package/{Samples → Samples~}/Map_UI_Place_Place_Name_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Map_UI_Place_Tab_Shell.prefab +57 -57
- package/{Samples → Samples~}/Map_UI_Place_Tab_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Map_UI_Place_Tab_Template.prefab +806 -806
- package/{Samples → Samples~}/Map_UI_Place_Tab_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Map_UI_Place_Tab_UI_ETemplate.prefab +1265 -1265
- package/{Samples → Samples~}/Map_UI_Place_Tab_UI_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Map_UI_Reticle_ETemplate.prefab +78 -78
- package/{Samples → Samples~}/Map_UI_Reticle_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Map_UI_Student_Tab_Shell.prefab +267 -267
- package/{Samples → Samples~}/Map_UI_Student_Tab_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Map_UI_Student_Tab_Template.prefab +544 -544
- package/{Samples → Samples~}/Map_UI_Student_Tab_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Map_UI_Student_Tab_UI_Shell.prefab +90 -90
- package/{Samples → Samples~}/Map_UI_Student_Tab_UI_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Map_UI_Student_Tab_UI_Template.prefab +2031 -2031
- package/{Samples → Samples~}/Map_UI_Student_Tab_UI_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Map_UI_Title_ETemplate.prefab +672 -672
- package/{Samples → Samples~}/Map_UI_Title_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Place_Template.prefab +200 -200
- package/{Samples → Samples~}/Place_Template.prefab.meta +7 -7
- package/package.json +45 -40
- package/package.json.meta +7 -7
- package/Samples.meta +0 -8
package/MapEntryChange.cs
CHANGED
|
@@ -1,321 +1,321 @@
|
|
|
1
|
-
// Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using DREditor.Dialogues.Events;
|
|
3
|
-
using UnityEngine;
|
|
4
|
-
using System;
|
|
5
|
-
|
|
6
|
-
#if UNITY_EDITOR
|
|
7
|
-
using UnityEditor;
|
|
8
|
-
using DREditor.Utility;
|
|
9
|
-
using DREditor.Editor.Utility;
|
|
10
|
-
#endif
|
|
11
|
-
|
|
12
|
-
namespace DREditor.Maps
|
|
13
|
-
{
|
|
14
|
-
/// <summary>
|
|
15
|
-
///
|
|
16
|
-
/// </summary>
|
|
17
|
-
/// <remarks></remarks>
|
|
18
|
-
[Serializable]
|
|
19
|
-
public class MapEntryChange : IDataCapsulate
|
|
20
|
-
{
|
|
21
|
-
/// <summary>
|
|
22
|
-
///
|
|
23
|
-
/// </summary>
|
|
24
|
-
public MapEntry Entry = new();
|
|
25
|
-
|
|
26
|
-
/// <summary>
|
|
27
|
-
///
|
|
28
|
-
/// </summary>
|
|
29
|
-
public string unlockArea = "";
|
|
30
|
-
|
|
31
|
-
#if UNITY_EDITOR
|
|
32
|
-
/// <summary>
|
|
33
|
-
///
|
|
34
|
-
/// </summary>
|
|
35
|
-
protected MarkerDatabase markerDB = null;
|
|
36
|
-
|
|
37
|
-
/// <summary>
|
|
38
|
-
///
|
|
39
|
-
/// </summary>
|
|
40
|
-
protected MapDatabase mapDB = null;
|
|
41
|
-
|
|
42
|
-
/// <summary>
|
|
43
|
-
///
|
|
44
|
-
/// </summary>
|
|
45
|
-
protected int areaNum = 0;
|
|
46
|
-
|
|
47
|
-
/// <summary>
|
|
48
|
-
///
|
|
49
|
-
/// </summary>
|
|
50
|
-
protected int placeNum = 0;
|
|
51
|
-
|
|
52
|
-
/// <summary>
|
|
53
|
-
///
|
|
54
|
-
/// </summary>
|
|
55
|
-
protected int markerNum = 0;
|
|
56
|
-
|
|
57
|
-
/// <summary>
|
|
58
|
-
///
|
|
59
|
-
/// </summary>
|
|
60
|
-
protected PlaceData placeData = null;
|
|
61
|
-
|
|
62
|
-
/// <summary>
|
|
63
|
-
///
|
|
64
|
-
/// </summary>
|
|
65
|
-
protected MarkerVessel selectedVessel = null;
|
|
66
|
-
#endif
|
|
67
|
-
|
|
68
|
-
/// <inheritdoc/>
|
|
69
|
-
public virtual void Display(object o)
|
|
70
|
-
{
|
|
71
|
-
#if UNITY_EDITOR
|
|
72
|
-
InitializeDatabases();
|
|
73
|
-
|
|
74
|
-
if (FailedToInitializeDatabases())
|
|
75
|
-
return;
|
|
76
|
-
|
|
77
|
-
if (GUILayout.Button("Add Fast Travel Places", GUILayout.Width(150)))
|
|
78
|
-
foreach (var place in mapDB.GetFastTravelablePlaces())
|
|
79
|
-
CreateAreaEntry(mapDB.GetAreaDataFromPlace(place), place);
|
|
80
|
-
|
|
81
|
-
GUILayout.Space(10);
|
|
82
|
-
|
|
83
|
-
unlockArea = HandyFields.StringField("Unlock Area: ", unlockArea);
|
|
84
|
-
|
|
85
|
-
GUILayout.Space(10);
|
|
86
|
-
|
|
87
|
-
DisplayAreasSection();
|
|
88
|
-
|
|
89
|
-
GUILayout.Space(10);
|
|
90
|
-
|
|
91
|
-
DisplayCreateEntrySection();
|
|
92
|
-
#endif
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
#if UNITY_EDITOR
|
|
96
|
-
|
|
97
|
-
/// <summary>
|
|
98
|
-
///
|
|
99
|
-
/// </summary>
|
|
100
|
-
protected virtual void InitializeDatabases()
|
|
101
|
-
{
|
|
102
|
-
if (markerDB == null)
|
|
103
|
-
markerDB = DatabaseUtility.LoadDatabase<MarkerDatabase>();
|
|
104
|
-
|
|
105
|
-
if (mapDB == null)
|
|
106
|
-
mapDB = DatabaseUtility.LoadDatabase<MapDatabase>();
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/// <summary>
|
|
110
|
-
///
|
|
111
|
-
/// </summary>
|
|
112
|
-
/// <returns></returns>
|
|
113
|
-
protected virtual bool FailedToInitializeDatabases()
|
|
114
|
-
{
|
|
115
|
-
if (markerDB == null || mapDB == null)
|
|
116
|
-
EditorGUILayout.LabelField("Could not find databases of type " + nameof(MarkerDatabase) +
|
|
117
|
-
" or of type " + nameof(MapDatabase) + ". \nPlease ensure that both of these databases exist in your project.");
|
|
118
|
-
|
|
119
|
-
return markerDB == null || mapDB == null;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/// <summary>
|
|
123
|
-
///
|
|
124
|
-
/// </summary>
|
|
125
|
-
protected virtual void DisplayAreasSection()
|
|
126
|
-
{
|
|
127
|
-
using (new GUILayout.VerticalScope(GUILayout.MaxWidth(EditorGUIUtility.currentViewWidth)))
|
|
128
|
-
for (int i = 0; i < Entry.AreaEntries.Count; i++)
|
|
129
|
-
DisplayArea(Entry.AreaEntries[i]);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/// <summary>
|
|
133
|
-
///
|
|
134
|
-
/// </summary>
|
|
135
|
-
/// <param name="area"></param>
|
|
136
|
-
protected virtual void DisplayArea(MapAreaEntry area)
|
|
137
|
-
{
|
|
138
|
-
EditorGUILayout.LabelField(area.Data.name);
|
|
139
|
-
|
|
140
|
-
using (new GUILayout.VerticalScope())
|
|
141
|
-
DisplayPlacesSection(area);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/// <summary>
|
|
145
|
-
///
|
|
146
|
-
/// </summary>
|
|
147
|
-
/// <param name="area"></param>
|
|
148
|
-
protected virtual void DisplayPlacesSection(MapAreaEntry area)
|
|
149
|
-
{
|
|
150
|
-
for (int i = 0; i < area.PlaceEntries.Count; i++)
|
|
151
|
-
{
|
|
152
|
-
GUILayout.Space(10);
|
|
153
|
-
|
|
154
|
-
PlaceEntry place = area.PlaceEntries[i];
|
|
155
|
-
|
|
156
|
-
using (new GUILayout.HorizontalScope())
|
|
157
|
-
DisplayPlace(place);
|
|
158
|
-
|
|
159
|
-
using (new GUILayout.VerticalScope())
|
|
160
|
-
DisplayMarkersSection(area, place);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/// <summary>
|
|
165
|
-
///
|
|
166
|
-
/// </summary>
|
|
167
|
-
/// <param name="place"></param>
|
|
168
|
-
protected virtual void DisplayPlace(PlaceEntry place)
|
|
169
|
-
{
|
|
170
|
-
GUILayout.Space(20);
|
|
171
|
-
|
|
172
|
-
EditorGUILayout.LabelField(place.name, GUILayout.MaxWidth(100));
|
|
173
|
-
|
|
174
|
-
if (mapDB.GetPlace(place.name, place.GetID()).fastTravelable)
|
|
175
|
-
place.SetFastTravel(HandyFields.BoolField(place.enableFastTravelForThisEntryInstance, "FT: "));
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/// <summary>
|
|
179
|
-
///
|
|
180
|
-
/// </summary>
|
|
181
|
-
/// <param name="area"></param>
|
|
182
|
-
/// <param name="place"></param>
|
|
183
|
-
protected virtual void DisplayMarkersSection(MapAreaEntry area, PlaceEntry place)
|
|
184
|
-
{
|
|
185
|
-
for (int i = 0; i < place.MarkerVessels.Count; i++)
|
|
186
|
-
{
|
|
187
|
-
using (new GUILayout.HorizontalScope())
|
|
188
|
-
{
|
|
189
|
-
GUILayout.Space(40);
|
|
190
|
-
|
|
191
|
-
if (place.MarkerVessels[i] != null)
|
|
192
|
-
{
|
|
193
|
-
place.Save();
|
|
194
|
-
|
|
195
|
-
EditorGUILayout.LabelField(place.MarkerDatas[i].name);
|
|
196
|
-
|
|
197
|
-
if (GUILayout.Button("Remove", GUILayout.Width(100)))
|
|
198
|
-
RemoveMarker(place.MarkerVessels[i], area, place);
|
|
199
|
-
}
|
|
200
|
-
else
|
|
201
|
-
place.MarkerVessels[i] = markerDB.GetVesselByData(place.MarkerDatas[i]);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/// <summary>
|
|
207
|
-
///
|
|
208
|
-
/// </summary>
|
|
209
|
-
/// <param name="markerVessel"></param>
|
|
210
|
-
/// <param name="area"></param>
|
|
211
|
-
/// <param name="place"></param>
|
|
212
|
-
protected virtual void RemoveMarker(MarkerVessel markerVessel, MapAreaEntry area, PlaceEntry place)
|
|
213
|
-
{
|
|
214
|
-
place.MarkerVessels.Remove(markerVessel);
|
|
215
|
-
|
|
216
|
-
if (place.MarkerVessels.Count == 0)
|
|
217
|
-
area.PlaceEntries.Remove(place);
|
|
218
|
-
|
|
219
|
-
if (area.PlaceEntries.Count == 0)
|
|
220
|
-
Entry.AreaEntries.Remove(area);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/// <summary>
|
|
224
|
-
///
|
|
225
|
-
/// </summary>
|
|
226
|
-
protected virtual void DisplayCreateEntrySection()
|
|
227
|
-
{
|
|
228
|
-
using (new GUILayout.HorizontalScope(GUILayout.MaxWidth(EditorGUIUtility.currentViewWidth)))
|
|
229
|
-
{
|
|
230
|
-
areaNum = EditorGUILayout.IntPopup(areaNum, mapDB.GetAreaNames(),
|
|
231
|
-
ContainerUtil.Iota(mapDB.GetAreaNames().Length, 0), GUILayout.MaxWidth(130));
|
|
232
|
-
|
|
233
|
-
MapAreaData areaData = mapDB.floors[areaNum];
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
if (placeNum > areaData.places.Count)
|
|
237
|
-
placeNum = 0;
|
|
238
|
-
|
|
239
|
-
placeNum = EditorGUILayout.IntPopup(placeNum, areaData.GetPlaceNames(),
|
|
240
|
-
ContainerUtil.Iota(areaData.GetPlaceNames().Length, 0), GUILayout.MaxWidth(130));
|
|
241
|
-
|
|
242
|
-
if (placeNum >= areaData.places.Count)
|
|
243
|
-
placeNum = 0;
|
|
244
|
-
|
|
245
|
-
placeData = areaData.places[placeNum];
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
markerNum = EditorGUILayout.IntPopup(markerNum, markerDB.GetVesselNames(),
|
|
249
|
-
ContainerUtil.Iota(markerDB.GetVesselNames().Length, 0), GUILayout.MaxWidth(130));
|
|
250
|
-
|
|
251
|
-
selectedVessel = markerDB.Entries[markerNum];
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
if (GUILayout.Button("Add"))
|
|
255
|
-
CreateValidEntry(areaData);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/// <summary>
|
|
260
|
-
///
|
|
261
|
-
/// </summary>
|
|
262
|
-
/// <param name="areaData"></param>
|
|
263
|
-
protected virtual void CreateValidEntry(MapAreaData areaData)
|
|
264
|
-
{
|
|
265
|
-
if (Entry.Contains(areaData) is MapAreaEntry existingAreaEntry)
|
|
266
|
-
AddEntryToExistingArea(existingAreaEntry);
|
|
267
|
-
else
|
|
268
|
-
CreateAreaEntry(areaData, placeData);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/// <summary>
|
|
272
|
-
///
|
|
273
|
-
/// </summary>
|
|
274
|
-
/// <param name="existingAreaEntry"></param>
|
|
275
|
-
protected virtual void AddEntryToExistingArea(MapAreaEntry existingAreaEntry)
|
|
276
|
-
{
|
|
277
|
-
if (existingAreaEntry.ContainsPlace(placeData.GetID()) is PlaceEntry existingPlaceEntry)
|
|
278
|
-
existingPlaceEntry.MarkerVessels.Add(selectedVessel);
|
|
279
|
-
else
|
|
280
|
-
CreatePlaceEntry(existingAreaEntry, placeData, "Had Area but not place entry, creating...");
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/// <summary>
|
|
284
|
-
///
|
|
285
|
-
/// </summary>
|
|
286
|
-
/// <param name="areaData"></param>
|
|
287
|
-
/// <param name="placeData"></param>
|
|
288
|
-
protected virtual void CreateAreaEntry(MapAreaData areaData, PlaceData placeData)
|
|
289
|
-
{
|
|
290
|
-
MapAreaEntry existingAreaEntry = new(areaData);
|
|
291
|
-
|
|
292
|
-
CreatePlaceEntry(existingAreaEntry, placeData, "Didn't have area entry, creating...");
|
|
293
|
-
|
|
294
|
-
Entry.AreaEntries.Add(existingAreaEntry);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/// <summary>
|
|
298
|
-
///
|
|
299
|
-
/// </summary>
|
|
300
|
-
/// <param name="existingAreaEntry"></param>
|
|
301
|
-
/// <param name="placeData"></param>
|
|
302
|
-
/// <param name="log"></param>
|
|
303
|
-
protected virtual void CreatePlaceEntry(MapAreaEntry existingAreaEntry, PlaceData placeData, string log)
|
|
304
|
-
{
|
|
305
|
-
PlaceEntry placeEntry = new();
|
|
306
|
-
|
|
307
|
-
placeEntry.SetData(placeData);
|
|
308
|
-
|
|
309
|
-
if (selectedVessel != null)
|
|
310
|
-
placeEntry.MarkerVessels.Add(selectedVessel);
|
|
311
|
-
|
|
312
|
-
existingAreaEntry.PlaceEntries.Add(placeEntry);
|
|
313
|
-
|
|
314
|
-
placeEntry.SetFastTravel(placeData.fastTravelable);
|
|
315
|
-
|
|
316
|
-
UnityEngine.Debug.Log(nameof(MapEntryChange) + ": " + log);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
#endif
|
|
320
|
-
}
|
|
1
|
+
// Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Dialogues.Events;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
using System;
|
|
5
|
+
|
|
6
|
+
#if UNITY_EDITOR
|
|
7
|
+
using UnityEditor;
|
|
8
|
+
using DREditor.Utility;
|
|
9
|
+
using DREditor.Editor.Utility;
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
namespace DREditor.Maps
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
///
|
|
16
|
+
/// </summary>
|
|
17
|
+
/// <remarks></remarks>
|
|
18
|
+
[Serializable]
|
|
19
|
+
public class MapEntryChange : IDataCapsulate
|
|
20
|
+
{
|
|
21
|
+
/// <summary>
|
|
22
|
+
///
|
|
23
|
+
/// </summary>
|
|
24
|
+
public MapEntry Entry = new();
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
///
|
|
28
|
+
/// </summary>
|
|
29
|
+
public string unlockArea = "";
|
|
30
|
+
|
|
31
|
+
#if UNITY_EDITOR
|
|
32
|
+
/// <summary>
|
|
33
|
+
///
|
|
34
|
+
/// </summary>
|
|
35
|
+
protected MarkerDatabase markerDB = null;
|
|
36
|
+
|
|
37
|
+
/// <summary>
|
|
38
|
+
///
|
|
39
|
+
/// </summary>
|
|
40
|
+
protected MapDatabase mapDB = null;
|
|
41
|
+
|
|
42
|
+
/// <summary>
|
|
43
|
+
///
|
|
44
|
+
/// </summary>
|
|
45
|
+
protected int areaNum = 0;
|
|
46
|
+
|
|
47
|
+
/// <summary>
|
|
48
|
+
///
|
|
49
|
+
/// </summary>
|
|
50
|
+
protected int placeNum = 0;
|
|
51
|
+
|
|
52
|
+
/// <summary>
|
|
53
|
+
///
|
|
54
|
+
/// </summary>
|
|
55
|
+
protected int markerNum = 0;
|
|
56
|
+
|
|
57
|
+
/// <summary>
|
|
58
|
+
///
|
|
59
|
+
/// </summary>
|
|
60
|
+
protected PlaceData placeData = null;
|
|
61
|
+
|
|
62
|
+
/// <summary>
|
|
63
|
+
///
|
|
64
|
+
/// </summary>
|
|
65
|
+
protected MarkerVessel selectedVessel = null;
|
|
66
|
+
#endif
|
|
67
|
+
|
|
68
|
+
/// <inheritdoc/>
|
|
69
|
+
public virtual void Display(object o)
|
|
70
|
+
{
|
|
71
|
+
#if UNITY_EDITOR
|
|
72
|
+
InitializeDatabases();
|
|
73
|
+
|
|
74
|
+
if (FailedToInitializeDatabases())
|
|
75
|
+
return;
|
|
76
|
+
|
|
77
|
+
if (GUILayout.Button("Add Fast Travel Places", GUILayout.Width(150)))
|
|
78
|
+
foreach (var place in mapDB.GetFastTravelablePlaces())
|
|
79
|
+
CreateAreaEntry(mapDB.GetAreaDataFromPlace(place), place);
|
|
80
|
+
|
|
81
|
+
GUILayout.Space(10);
|
|
82
|
+
|
|
83
|
+
unlockArea = HandyFields.StringField("Unlock Area: ", unlockArea);
|
|
84
|
+
|
|
85
|
+
GUILayout.Space(10);
|
|
86
|
+
|
|
87
|
+
DisplayAreasSection();
|
|
88
|
+
|
|
89
|
+
GUILayout.Space(10);
|
|
90
|
+
|
|
91
|
+
DisplayCreateEntrySection();
|
|
92
|
+
#endif
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
#if UNITY_EDITOR
|
|
96
|
+
|
|
97
|
+
/// <summary>
|
|
98
|
+
///
|
|
99
|
+
/// </summary>
|
|
100
|
+
protected virtual void InitializeDatabases()
|
|
101
|
+
{
|
|
102
|
+
if (markerDB == null)
|
|
103
|
+
markerDB = DatabaseUtility.LoadDatabase<MarkerDatabase>();
|
|
104
|
+
|
|
105
|
+
if (mapDB == null)
|
|
106
|
+
mapDB = DatabaseUtility.LoadDatabase<MapDatabase>();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/// <summary>
|
|
110
|
+
///
|
|
111
|
+
/// </summary>
|
|
112
|
+
/// <returns></returns>
|
|
113
|
+
protected virtual bool FailedToInitializeDatabases()
|
|
114
|
+
{
|
|
115
|
+
if (markerDB == null || mapDB == null)
|
|
116
|
+
EditorGUILayout.LabelField("Could not find databases of type " + nameof(MarkerDatabase) +
|
|
117
|
+
" or of type " + nameof(MapDatabase) + ". \nPlease ensure that both of these databases exist in your project.");
|
|
118
|
+
|
|
119
|
+
return markerDB == null || mapDB == null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/// <summary>
|
|
123
|
+
///
|
|
124
|
+
/// </summary>
|
|
125
|
+
protected virtual void DisplayAreasSection()
|
|
126
|
+
{
|
|
127
|
+
using (new GUILayout.VerticalScope(GUILayout.MaxWidth(EditorGUIUtility.currentViewWidth)))
|
|
128
|
+
for (int i = 0; i < Entry.AreaEntries.Count; i++)
|
|
129
|
+
DisplayArea(Entry.AreaEntries[i]);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/// <summary>
|
|
133
|
+
///
|
|
134
|
+
/// </summary>
|
|
135
|
+
/// <param name="area"></param>
|
|
136
|
+
protected virtual void DisplayArea(MapAreaEntry area)
|
|
137
|
+
{
|
|
138
|
+
EditorGUILayout.LabelField(area.Data.name);
|
|
139
|
+
|
|
140
|
+
using (new GUILayout.VerticalScope())
|
|
141
|
+
DisplayPlacesSection(area);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/// <summary>
|
|
145
|
+
///
|
|
146
|
+
/// </summary>
|
|
147
|
+
/// <param name="area"></param>
|
|
148
|
+
protected virtual void DisplayPlacesSection(MapAreaEntry area)
|
|
149
|
+
{
|
|
150
|
+
for (int i = 0; i < area.PlaceEntries.Count; i++)
|
|
151
|
+
{
|
|
152
|
+
GUILayout.Space(10);
|
|
153
|
+
|
|
154
|
+
PlaceEntry place = area.PlaceEntries[i];
|
|
155
|
+
|
|
156
|
+
using (new GUILayout.HorizontalScope())
|
|
157
|
+
DisplayPlace(place);
|
|
158
|
+
|
|
159
|
+
using (new GUILayout.VerticalScope())
|
|
160
|
+
DisplayMarkersSection(area, place);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/// <summary>
|
|
165
|
+
///
|
|
166
|
+
/// </summary>
|
|
167
|
+
/// <param name="place"></param>
|
|
168
|
+
protected virtual void DisplayPlace(PlaceEntry place)
|
|
169
|
+
{
|
|
170
|
+
GUILayout.Space(20);
|
|
171
|
+
|
|
172
|
+
EditorGUILayout.LabelField(place.name, GUILayout.MaxWidth(100));
|
|
173
|
+
|
|
174
|
+
if (mapDB.GetPlace(place.name, place.GetID()).fastTravelable)
|
|
175
|
+
place.SetFastTravel(HandyFields.BoolField(place.enableFastTravelForThisEntryInstance, "FT: "));
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/// <summary>
|
|
179
|
+
///
|
|
180
|
+
/// </summary>
|
|
181
|
+
/// <param name="area"></param>
|
|
182
|
+
/// <param name="place"></param>
|
|
183
|
+
protected virtual void DisplayMarkersSection(MapAreaEntry area, PlaceEntry place)
|
|
184
|
+
{
|
|
185
|
+
for (int i = 0; i < place.MarkerVessels.Count; i++)
|
|
186
|
+
{
|
|
187
|
+
using (new GUILayout.HorizontalScope())
|
|
188
|
+
{
|
|
189
|
+
GUILayout.Space(40);
|
|
190
|
+
|
|
191
|
+
if (place.MarkerVessels[i] != null)
|
|
192
|
+
{
|
|
193
|
+
place.Save();
|
|
194
|
+
|
|
195
|
+
EditorGUILayout.LabelField(place.MarkerDatas[i].name);
|
|
196
|
+
|
|
197
|
+
if (GUILayout.Button("Remove", GUILayout.Width(100)))
|
|
198
|
+
RemoveMarker(place.MarkerVessels[i], area, place);
|
|
199
|
+
}
|
|
200
|
+
else
|
|
201
|
+
place.MarkerVessels[i] = markerDB.GetVesselByData(place.MarkerDatas[i]);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/// <summary>
|
|
207
|
+
///
|
|
208
|
+
/// </summary>
|
|
209
|
+
/// <param name="markerVessel"></param>
|
|
210
|
+
/// <param name="area"></param>
|
|
211
|
+
/// <param name="place"></param>
|
|
212
|
+
protected virtual void RemoveMarker(MarkerVessel markerVessel, MapAreaEntry area, PlaceEntry place)
|
|
213
|
+
{
|
|
214
|
+
place.MarkerVessels.Remove(markerVessel);
|
|
215
|
+
|
|
216
|
+
if (place.MarkerVessels.Count == 0)
|
|
217
|
+
area.PlaceEntries.Remove(place);
|
|
218
|
+
|
|
219
|
+
if (area.PlaceEntries.Count == 0)
|
|
220
|
+
Entry.AreaEntries.Remove(area);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/// <summary>
|
|
224
|
+
///
|
|
225
|
+
/// </summary>
|
|
226
|
+
protected virtual void DisplayCreateEntrySection()
|
|
227
|
+
{
|
|
228
|
+
using (new GUILayout.HorizontalScope(GUILayout.MaxWidth(EditorGUIUtility.currentViewWidth)))
|
|
229
|
+
{
|
|
230
|
+
areaNum = EditorGUILayout.IntPopup(areaNum, mapDB.GetAreaNames(),
|
|
231
|
+
ContainerUtil.Iota(mapDB.GetAreaNames().Length, 0), GUILayout.MaxWidth(130));
|
|
232
|
+
|
|
233
|
+
MapAreaData areaData = mapDB.floors[areaNum];
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
if (placeNum > areaData.places.Count)
|
|
237
|
+
placeNum = 0;
|
|
238
|
+
|
|
239
|
+
placeNum = EditorGUILayout.IntPopup(placeNum, areaData.GetPlaceNames(),
|
|
240
|
+
ContainerUtil.Iota(areaData.GetPlaceNames().Length, 0), GUILayout.MaxWidth(130));
|
|
241
|
+
|
|
242
|
+
if (placeNum >= areaData.places.Count)
|
|
243
|
+
placeNum = 0;
|
|
244
|
+
|
|
245
|
+
placeData = areaData.places[placeNum];
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
markerNum = EditorGUILayout.IntPopup(markerNum, markerDB.GetVesselNames(),
|
|
249
|
+
ContainerUtil.Iota(markerDB.GetVesselNames().Length, 0), GUILayout.MaxWidth(130));
|
|
250
|
+
|
|
251
|
+
selectedVessel = markerDB.Entries[markerNum];
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
if (GUILayout.Button("Add"))
|
|
255
|
+
CreateValidEntry(areaData);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/// <summary>
|
|
260
|
+
///
|
|
261
|
+
/// </summary>
|
|
262
|
+
/// <param name="areaData"></param>
|
|
263
|
+
protected virtual void CreateValidEntry(MapAreaData areaData)
|
|
264
|
+
{
|
|
265
|
+
if (Entry.Contains(areaData) is MapAreaEntry existingAreaEntry)
|
|
266
|
+
AddEntryToExistingArea(existingAreaEntry);
|
|
267
|
+
else
|
|
268
|
+
CreateAreaEntry(areaData, placeData);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/// <summary>
|
|
272
|
+
///
|
|
273
|
+
/// </summary>
|
|
274
|
+
/// <param name="existingAreaEntry"></param>
|
|
275
|
+
protected virtual void AddEntryToExistingArea(MapAreaEntry existingAreaEntry)
|
|
276
|
+
{
|
|
277
|
+
if (existingAreaEntry.ContainsPlace(placeData.GetID()) is PlaceEntry existingPlaceEntry)
|
|
278
|
+
existingPlaceEntry.MarkerVessels.Add(selectedVessel);
|
|
279
|
+
else
|
|
280
|
+
CreatePlaceEntry(existingAreaEntry, placeData, "Had Area but not place entry, creating...");
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/// <summary>
|
|
284
|
+
///
|
|
285
|
+
/// </summary>
|
|
286
|
+
/// <param name="areaData"></param>
|
|
287
|
+
/// <param name="placeData"></param>
|
|
288
|
+
protected virtual void CreateAreaEntry(MapAreaData areaData, PlaceData placeData)
|
|
289
|
+
{
|
|
290
|
+
MapAreaEntry existingAreaEntry = new(areaData);
|
|
291
|
+
|
|
292
|
+
CreatePlaceEntry(existingAreaEntry, placeData, "Didn't have area entry, creating...");
|
|
293
|
+
|
|
294
|
+
Entry.AreaEntries.Add(existingAreaEntry);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/// <summary>
|
|
298
|
+
///
|
|
299
|
+
/// </summary>
|
|
300
|
+
/// <param name="existingAreaEntry"></param>
|
|
301
|
+
/// <param name="placeData"></param>
|
|
302
|
+
/// <param name="log"></param>
|
|
303
|
+
protected virtual void CreatePlaceEntry(MapAreaEntry existingAreaEntry, PlaceData placeData, string log)
|
|
304
|
+
{
|
|
305
|
+
PlaceEntry placeEntry = new();
|
|
306
|
+
|
|
307
|
+
placeEntry.SetData(placeData);
|
|
308
|
+
|
|
309
|
+
if (selectedVessel != null)
|
|
310
|
+
placeEntry.MarkerVessels.Add(selectedVessel);
|
|
311
|
+
|
|
312
|
+
existingAreaEntry.PlaceEntries.Add(placeEntry);
|
|
313
|
+
|
|
314
|
+
placeEntry.SetFastTravel(placeData.fastTravelable);
|
|
315
|
+
|
|
316
|
+
UnityEngine.Debug.Log(nameof(MapEntryChange) + ": " + log);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
#endif
|
|
320
|
+
}
|
|
321
321
|
}
|
package/MapEntryChange.cs.meta
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 9fff4b2eee3a4944eabcb52cf31c2338
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 9fff4b2eee3a4944eabcb52cf31c2338
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|