Skip to content

Commit f366e3e

Browse files
committed
rename LightBase -> LightDescriptor
1 parent 861862b commit f366e3e

File tree

10 files changed

+51
-42
lines changed

10 files changed

+51
-42
lines changed

Framework/Intersect.Framework.Core/GameObjects/Animations/AnimationLayer.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.ComponentModel.DataAnnotations.Schema;
2+
using Intersect.Framework.Core.GameObjects.Lighting;
23
using Intersect.GameObjects;
34
using Microsoft.EntityFrameworkCore;
45
using Newtonsoft.Json;
@@ -10,11 +11,11 @@ public partial class AnimationLayer
1011
{
1112
public AnimationLayer()
1213
{
13-
Lights = new LightBase[FrameCount];
14+
Lights = new LightDescriptor[FrameCount];
1415

1516
for (var frame = 0; frame < FrameCount; ++frame)
1617
{
17-
Lights[frame] = new LightBase();
18+
Lights[frame] = new LightDescriptor();
1819
}
1920
}
2021

@@ -38,9 +39,9 @@ public AnimationLayer()
3839
public string Light
3940
{
4041
get => JsonConvert.SerializeObject(Lights);
41-
set => Lights = JsonConvert.DeserializeObject<LightBase[]>(value);
42+
set => Lights = JsonConvert.DeserializeObject<LightDescriptor[]>(value);
4243
}
4344

4445
[NotMapped]
45-
public LightBase[] Lights { get; set; }
46+
public LightDescriptor[] Lights { get; set; }
4647
}

Framework/Intersect.Framework.Core/GameObjects/LightBase.cs renamed to Framework/Intersect.Framework.Core/GameObjects/Lighting/LightDescriptor.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
namespace Intersect.GameObjects;
1+
namespace Intersect.Framework.Core.GameObjects.Lighting;
22

3-
public partial class LightBase
3+
public partial class LightDescriptor
44
{
55

6-
public LightBase() : this(-1, -1) { }
6+
public LightDescriptor() : this(-1, -1) { }
77

8-
public LightBase(int x, int y)
8+
public LightDescriptor(int x, int y)
99
{
1010
TileX = x;
1111
TileY = y;
1212
Color = Color.White;
1313
Intensity = 255;
1414
}
1515

16-
public LightBase(LightBase copy)
16+
public LightDescriptor(LightDescriptor copy)
1717
{
1818
TileX = copy.TileX;
1919
TileY = copy.TileY;
@@ -25,7 +25,7 @@ public LightBase(LightBase copy)
2525
Color = Color.FromArgb(copy.Color.R, copy.Color.G, copy.Color.B);
2626
}
2727

28-
public LightBase(
28+
public LightDescriptor(
2929
int tileX,
3030
int tileY,
3131
int offsetX,
@@ -78,7 +78,7 @@ public override int GetHashCode()
7878
/// <returns></returns>
7979
public override bool Equals(object obj)
8080
{
81-
if (obj is LightBase light)
81+
if (obj is LightDescriptor light)
8282
{
8383
return Intensity == light.Intensity && Color == light.Color && Expand == light.Expand && TileX == light.TileX && TileY == light.TileY;
8484
}

Framework/Intersect.Framework.Core/GameObjects/Maps/MapDescriptor.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Intersect.Config;
55
using Intersect.Framework.Core.GameObjects.Animations;
66
using Intersect.Framework.Core.GameObjects.Events;
7+
using Intersect.Framework.Core.GameObjects.Lighting;
78
using Intersect.Framework.Core.Serialization;
89
using Intersect.GameObjects;
910
using Intersect.Models;
@@ -145,7 +146,7 @@ public MapDescriptor(MapDescriptor mapDescriptor) : base(mapDescriptor?.Id ?? Gu
145146

146147
for (var i = 0; i < mapDescriptor.Lights?.Count; i++)
147148
{
148-
Lights.Add(new LightBase(mapDescriptor.Lights[i]));
149+
Lights.Add(new LightDescriptor(mapDescriptor.Lights[i]));
149150
}
150151

151152
foreach (var record in mapDescriptor.LocalEvents)
@@ -220,7 +221,7 @@ public string LightsJson
220221
set
221222
{
222223
Lights.Clear();
223-
var lights = JsonConvert.DeserializeObject<List<LightBase>>(value);
224+
var lights = JsonConvert.DeserializeObject<List<LightDescriptor>>(value);
224225
if (lights != null)
225226
{
226227
Lights.AddRange(lights);
@@ -230,7 +231,7 @@ public string LightsJson
230231

231232
[NotMapped]
232233
[JsonProperty]
233-
public List<LightBase> Lights { get; private set; } = [];
234+
public List<LightDescriptor> Lights { get; private set; } = [];
234235

235236
[Column("Events")]
236237
[JsonIgnore]

Intersect.Client.Core/Core/Graphics.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Intersect.Enums;
1212
using Intersect.Framework;
1313
using Intersect.Framework.Core;
14+
using Intersect.Framework.Core.GameObjects.Lighting;
1415
using Intersect.Framework.Core.GameObjects.Maps;
1516
using Intersect.GameObjects;
1617
using Intersect.Utilities;
@@ -92,7 +93,7 @@ public static FloatRect CurrentView
9293

9394
private static IGameRenderTexture? sDarknessTexture;
9495

95-
private static readonly List<LightBase> sLightQueue = [];
96+
private static readonly List<LightDescriptor> sLightQueue = [];
9697

9798
//Player Spotlight Values
9899
private static long sLightUpdate;
@@ -1173,7 +1174,7 @@ public static void AddLight(int x, int y, int size, byte intensity, float expand
11731174
return;
11741175
}
11751176

1176-
sLightQueue.Add(new LightBase(0, 0, x, y, intensity, size, expand, color));
1177+
sLightQueue.Add(new LightDescriptor(0, 0, x, y, intensity, size, expand, color));
11771178
LightsDrawn++;
11781179
}
11791180

Intersect.Editor/Core/Graphics.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Intersect.Framework.Core;
1111
using Intersect.Framework.Core.GameObjects.Animations;
1212
using Intersect.Framework.Core.GameObjects.Events;
13+
using Intersect.Framework.Core.GameObjects.Lighting;
1314
using Intersect.Framework.Core.GameObjects.Mapping.Tilesets;
1415
using Intersect.Framework.Core.GameObjects.Maps;
1516
using Intersect.Framework.Core.GameObjects.Maps.Attributes;
@@ -76,8 +77,8 @@ public static partial class Graphics
7677
//MonoGame Setup/Device
7778
private static GraphicsDevice sGraphicsDevice;
7879

79-
private static List<KeyValuePair<Microsoft.Xna.Framework.Point, LightBase>> sLightQueue =
80-
new List<KeyValuePair<Microsoft.Xna.Framework.Point, LightBase>>();
80+
private static List<KeyValuePair<Microsoft.Xna.Framework.Point, LightDescriptor>> sLightQueue =
81+
new List<KeyValuePair<Microsoft.Xna.Framework.Point, LightDescriptor>>();
8182

8283
private static SwapChainRenderTarget sMapEditorChain;
8384

@@ -2086,7 +2087,7 @@ private static void DrawLights(RenderTarget2D target = null)
20862087
sLightQueue.Clear();
20872088
}
20882089

2089-
public static void DrawLight(int x, int y, LightBase light, RenderTarget2D target)
2090+
public static void DrawLight(int x, int y, LightDescriptor light, RenderTarget2D target)
20902091
{
20912092
var shader = GameContentManager.GetShader("radialgradient_editor.xnb");
20922093
var vec = new Vector4(
@@ -2103,15 +2104,15 @@ public static void DrawLight(int x, int y, LightBase light, RenderTarget2D targe
21032104
);
21042105
}
21052106

2106-
public static void AddLight(int x, int y, LightBase light, RenderTarget2D target = null)
2107+
public static void AddLight(int x, int y, LightDescriptor light, RenderTarget2D target = null)
21072108
{
21082109
if (target == null)
21092110
{
21102111
target = DarknessTexture;
21112112
}
21122113

21132114
sLightQueue.Add(
2114-
new KeyValuePair<Microsoft.Xna.Framework.Point, LightBase>(
2115+
new KeyValuePair<Microsoft.Xna.Framework.Point, LightDescriptor>(
21152116
new Microsoft.Xna.Framework.Point(x, y), light
21162117
)
21172118
);

Intersect.Editor/Forms/Controls/LightEditorCtrl.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Intersect.Editor.General;
22
using Intersect.Editor.Localization;
3+
using Intersect.Framework.Core.GameObjects.Lighting;
34
using Intersect.GameObjects;
45
using Graphics = Intersect.Editor.Core.Graphics;
56

@@ -11,9 +12,9 @@ public partial class LightEditorCtrl : UserControl
1112

1213
public bool CanClose = true;
1314

14-
private LightBase mBackupLight;
15+
private LightDescriptor mBackupLight;
1516

16-
private LightBase mEditingLight;
17+
private LightDescriptor mEditingLight;
1718

1819
private ToolTip _tooltip = new ToolTip();
1920

@@ -26,10 +27,10 @@ public LightEditorCtrl()
2627
}
2728
}
2829

29-
public void LoadEditor(LightBase tmpLight)
30+
public void LoadEditor(LightDescriptor tmpLight)
3031
{
3132
mEditingLight = tmpLight;
32-
mBackupLight = new LightBase(tmpLight);
33+
mBackupLight = new LightDescriptor(tmpLight);
3334
nudIntensity.Value = tmpLight.Intensity;
3435
nudSize.Value = tmpLight.Size;
3536
nudOffsetX.Value = tmpLight.OffsetX;

Intersect.Editor/Forms/DockingElements/frmMapEditor.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Intersect.Editor.Networking;
1212
using Intersect.Enums;
1313
using Intersect.Framework.Core.GameObjects.Events;
14+
using Intersect.Framework.Core.GameObjects.Lighting;
1415
using Intersect.Framework.Core.GameObjects.Mapping.Tilesets;
1516
using Intersect.Framework.Core.GameObjects.Maps;
1617
using Intersect.GameObjects;
@@ -459,7 +460,7 @@ private void picMap_MouseDown(object sender, MouseEventArgs e)
459460
}
460461
else if (Globals.CurrentLayer == LayerOptions.Lights)
461462
{
462-
LightBase tmpLight;
463+
LightDescriptor tmpLight;
463464
if ((tmpLight = Globals.CurrentMap.FindLightAt(Globals.CurTileX, Globals.CurTileY)) != null)
464465
{
465466
Globals.CurrentMap.Lights.Remove(tmpLight);
@@ -1188,10 +1189,10 @@ private void picMap_DoubleClick(object sender, EventArgs e)
11881189
//Lights
11891190
case LayerOptions.Lights:
11901191
{
1191-
LightBase tmpLight;
1192+
LightDescriptor tmpLight;
11921193
if ((tmpLight = Globals.CurrentMap.FindLightAt(Globals.CurTileX, Globals.CurTileY)) == null)
11931194
{
1194-
tmpLight = new LightBase(Globals.CurTileX, Globals.CurTileY)
1195+
tmpLight = new LightDescriptor(Globals.CurTileX, Globals.CurTileY)
11951196
{
11961197
Size = 50
11971198
};
@@ -1201,7 +1202,7 @@ private void picMap_DoubleClick(object sender, EventArgs e)
12011202

12021203
Globals.MapLayersWindow.btnLightsHeader_Click(null, null);
12031204
Globals.MapLayersWindow.lightEditor.Show();
1204-
Globals.BackupLight = new LightBase(tmpLight);
1205+
Globals.BackupLight = new LightDescriptor(tmpLight);
12051206
Globals.MapLayersWindow.lightEditor.LoadEditor(tmpLight);
12061207
Globals.EditingLight = tmpLight;
12071208
mMapChanged = true;
@@ -1882,7 +1883,7 @@ public void ProcessSelectionMovement(MapInstance tmpMap, bool ignoreMouse = fals
18821883
}
18831884

18841885
//Lights
1885-
LightBase lightCopy;
1886+
LightDescriptor lightCopy;
18861887
if (Globals.SelectionType != (int)SelectionTypes.CurrentLayer ||
18871888
Globals.CurrentLayer == LayerOptions.Lights)
18881889
{
@@ -1893,7 +1894,7 @@ public void ProcessSelectionMovement(MapInstance tmpMap, bool ignoreMouse = fals
18931894
tmpMap.Lights.Remove(tmpMap.FindLightAt(x0, y0));
18941895
}
18951896

1896-
lightCopy = new LightBase(Globals.SelectionSource.FindLightAt(x0 - dragxoffset, y0 - dragyoffset))
1897+
lightCopy = new LightDescriptor(Globals.SelectionSource.FindLightAt(x0 - dragxoffset, y0 - dragyoffset))
18971898
{
18981899
TileX = x0,
18991900
TileY = y0

Intersect.Editor/Forms/Editors/frmAnimation.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Intersect.Editor.Networking;
99
using Intersect.Enums;
1010
using Intersect.Framework.Core.GameObjects.Animations;
11+
using Intersect.Framework.Core.GameObjects.Lighting;
1112
using Intersect.GameObjects;
1213
using Intersect.Utilities;
1314
using Microsoft.Xna.Framework.Graphics;
@@ -335,11 +336,11 @@ private void tmrLowerAnimation_Tick(object sender, EventArgs e)
335336

336337
void UpdateLowerFrames()
337338
{
338-
LightBase[] newArray;
339+
LightDescriptor[] newArray;
339340
scrlLowerFrame.Maximum = (int)nudLowerFrameCount.Value;
340341
if (mEditorItem.Lower.Lights == null || mEditorItem.Lower.FrameCount != mEditorItem.Lower.Lights.Length)
341342
{
342-
newArray = new LightBase[mEditorItem.Lower.FrameCount];
343+
newArray = new LightDescriptor[mEditorItem.Lower.FrameCount];
343344
for (var i = 0; i < newArray.Length; i++)
344345
{
345346
if (mEditorItem.Lower.Lights != null && i < mEditorItem.Lower.Lights.Length)
@@ -348,7 +349,7 @@ void UpdateLowerFrames()
348349
}
349350
else
350351
{
351-
newArray[i] = new LightBase(-1, -1);
352+
newArray[i] = new LightDescriptor(-1, -1);
352353
}
353354
}
354355

@@ -358,11 +359,11 @@ void UpdateLowerFrames()
358359

359360
void UpdateUpperFrames()
360361
{
361-
LightBase[] newArray;
362+
LightDescriptor[] newArray;
362363
scrlUpperFrame.Maximum = (int)nudUpperFrameCount.Value;
363364
if (mEditorItem.Upper.Lights == null || mEditorItem.Upper.FrameCount != mEditorItem.Upper.Lights.Length)
364365
{
365-
newArray = new LightBase[mEditorItem.Upper.FrameCount];
366+
newArray = new LightDescriptor[mEditorItem.Upper.FrameCount];
366367
for (var i = 0; i < newArray.Length; i++)
367368
{
368369
if (mEditorItem.Upper.Lights != null && i < mEditorItem.Upper.Lights.Length)
@@ -371,7 +372,7 @@ void UpdateUpperFrames()
371372
}
372373
else
373374
{
374-
newArray[i] = new LightBase(-1, -1);
375+
newArray[i] = new LightDescriptor(-1, -1);
375376
}
376377
}
377378

@@ -576,7 +577,7 @@ private void btnLowerClone_Click(object sender, EventArgs e)
576577
if (scrlLowerFrame.Value > 1)
577578
{
578579
mEditorItem.Lower.Lights[scrlLowerFrame.Value - 1] =
579-
new LightBase(mEditorItem.Lower.Lights[scrlLowerFrame.Value - 2]);
580+
new LightDescriptor(mEditorItem.Lower.Lights[scrlLowerFrame.Value - 2]);
580581

581582
LoadLowerLight();
582583
DrawLowerFrame();
@@ -604,7 +605,7 @@ private void btnUpperClone_Click(object sender, EventArgs e)
604605
if (scrlUpperFrame.Value > 1)
605606
{
606607
mEditorItem.Upper.Lights[scrlUpperFrame.Value - 1] =
607-
new LightBase(mEditorItem.Upper.Lights[scrlUpperFrame.Value - 2]);
608+
new LightDescriptor(mEditorItem.Upper.Lights[scrlUpperFrame.Value - 2]);
608609

609610
LoadUpperLight();
610611
DrawUpperFrame();

Intersect.Editor/General/Globals.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Intersect.Editor.Localization;
55
using Intersect.Editor.Maps;
66
using Intersect.Enums;
7+
using Intersect.Framework.Core.GameObjects.Lighting;
78
using Intersect.Framework.Core.GameObjects.Mapping.Tilesets;
89
using Intersect.GameObjects;
910

@@ -18,7 +19,7 @@ public static partial class Globals
1819
//Animation Frame Variables
1920
public static int Autotilemode = 0;
2021

21-
public static LightBase BackupLight;
22+
public static LightDescriptor BackupLight;
2223

2324
public static bool ClosingEditor;
2425

@@ -81,7 +82,7 @@ static void OnToolChanged(EventArgs e)
8182

8283
public static bool Dragging = false;
8384

84-
public static LightBase EditingLight;
85+
public static LightDescriptor EditingLight;
8586

8687
//Editor Loop Variables
8788
public static Thread EditorThread;

Intersect.Editor/Maps/MapInstance.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Intersect.Editor.General;
77
using Intersect.Framework.Core.GameObjects.Animations;
88
using Intersect.Framework.Core.GameObjects.Events;
9+
using Intersect.Framework.Core.GameObjects.Lighting;
910
using Intersect.Framework.Core.GameObjects.Maps;
1011
using Intersect.GameObjects;
1112
using Newtonsoft.Json;
@@ -318,7 +319,7 @@ public void UpdateAdjacentAutotiles()
318319
return null;
319320
}
320321

321-
public LightBase FindLightAt(int x, int y)
322+
public LightDescriptor FindLightAt(int x, int y)
322323
{
323324
if (Lights.Count <= 0)
324325
{

0 commit comments

Comments
 (0)