Skip to content

Commit

Permalink
Fixed warnings and string serializer.
Browse files Browse the repository at this point in the history
  • Loading branch information
isadorasophia committed Nov 21, 2023
1 parent 38bb642 commit 6fe19fc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
19 changes: 18 additions & 1 deletion src/Murder.Editor/CustomFields/StringField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,24 @@ internal class StringField : CustomField
public override (bool modified, object? result) ProcessInput(EditorMember member, object? fieldValue)
{
bool modified = false;
string text = fieldValue as string ?? string.Empty;
string? text = fieldValue as string;

if (text is null)
{
string buttonText = "Create Default";
if (AttributeExtensions.TryGetAttribute(member, out DefaultAttribute? defaultAttribute))
{
buttonText = defaultAttribute.Text;
}

if (ImGui.Button(buttonText))
{
modified = true;
text = string.Empty;
}

return (modified, text);
}

if (AttributeExtensions.IsDefined(member, typeof(AtlasCoordinatesAttribute)))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Bang.Components;
using Bang.Interactions;
using Murder.Attributes;
using Murder.Utilities.Attributes;
using System.Collections.Immutable;

namespace Murder.Components
Expand Down
2 changes: 1 addition & 1 deletion src/Murder/Core/Grid/GridConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public GridConfiguration(int cellSize)
public int FloorToGrid(float value) => value % CellSize == 0 ? Calculator.RoundToInt(value / CellSize) : Calculator.FloorToInt(value / CellSize);

/// <summary>
/// Find in which cell of the grid a value would land, with default <see cref="Calculator.RoundToInt"/> behavior.
/// Find in which cell of the grid a value would land, with default <see cref="Calculator.RoundToInt(float)"/> behavior.
/// </summary>
/// <param name="value">The point in the grid</param>
/// <returns>The cell this would land at.</returns>
Expand Down
1 change: 0 additions & 1 deletion src/Murder/Core/Particles/ParticleSystemTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public ParticleSystemTracker(Emitter emitter, Particle particle, int seed = 0)
/// <summary>
/// Makes a "step" throughout the particle system.
/// </summary>
/// <param name="dt">Delta time.</param>
/// <param name="allowSpawn">Whether spawning new entities is allowed, e.g. the entity is not deactivated.</param>
/// <param name="emitterPosition">Emitter position in game where the particles are fired from.</param>
/// <returns>Returns whether the emitter is still running.</returns>
Expand Down

0 comments on commit 6fe19fc

Please sign in to comment.