Skip to content

Commit

Permalink
Always fully qualify ink runtime (#59)
Browse files Browse the repository at this point in the history
* Update .editorconfig

* Always fully qualify types from `Ink.Runtime`

[CHANGELOG]
Mitigate potential issues with class name collisions.
  • Loading branch information
paulloz authored Aug 1, 2023
1 parent 52ea239 commit 40a84b5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
2 changes: 0 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ csharp_style_expression_bodied_local_functions = when_on_single_line
csharp_style_expression_bodied_methods = false

# Analyzers
dotnet_analyzer_diagnostic.severity = suggestion

dotnet_diagnostic.IDE0001.severity = suggestion # Name can be simplified.
dotnet_diagnostic.IDE0005.severity = warning # Unused using directives.
Expand All @@ -86,7 +85,6 @@ dotnet_diagnostic.IDE0010.severity = silent # Incomplete switch statements.
dotnet_diagnostic.IDE0072.severity = silent # ^ Ditto.
dotnet_diagnostic.IDE0022.severity = warning # Use of expression body for methods.
dotnet_diagnostic.IDE0046.severity = silent # Use conditional expression for return.
dotnet_diagnostic.IDE0055.severity = silent # Formatting rule.
dotnet_diagnostic.IDE0059.severity = warning # Useless assignation.
dotnet_diagnostic.IDE1006.severity = default # Naming rule.
dotnet_diagnostic.CA1710.severity = silent # Meaningful names.
Expand Down
7 changes: 3 additions & 4 deletions addons/GodotInk/Src/InkChoice.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#nullable enable

using Godot;
using Ink.Runtime;
using System.Collections.Generic;

namespace GodotInk;
Expand All @@ -17,14 +16,14 @@ public partial class InkChoice : GodotObject
public int Index => inner.index;
public List<string> Tags => inner.tags;

private readonly Choice inner;
private readonly Ink.Runtime.Choice inner;

private InkChoice()
{
inner = new Choice();
inner = new Ink.Runtime.Choice();
}

public InkChoice(Choice inner)
public InkChoice(Ink.Runtime.Choice inner)
{
this.inner = inner;
}
Expand Down
13 changes: 6 additions & 7 deletions addons/GodotInk/Src/InkStory.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#nullable enable

using Godot;
using Ink.Runtime;
using System;
using System.Collections.Generic;

Expand Down Expand Up @@ -38,10 +37,10 @@ protected virtual string RawStory
}

private string rawStory = string.Empty;
private Story runtimeStory = null!;
private Ink.Runtime.Story runtimeStory = null!;

private readonly Dictionary<string, HashSet<Callable>> observers = new();
private readonly Dictionary<string, Story.VariableObserver> internalObservers = new();
private readonly Dictionary<string, Ink.Runtime.Story.VariableObserver> internalObservers = new();

public static InkStory Create(string rawStory)
{
Expand All @@ -59,7 +58,7 @@ private void InitializeRuntimeStory()
runtimeStory.onMakeChoice -= OnMadeChoice;
}

runtimeStory = new Story(rawStory);
runtimeStory = new Ink.Runtime.Story(rawStory);

runtimeStory.onDidContinue += OnContinued;
runtimeStory.onMakeChoice += OnMadeChoice;
Expand Down Expand Up @@ -229,7 +228,7 @@ public void ObserveVariable(string variableName, Callable observer)
{
if (!internalObservers.ContainsKey(variableName))
{
Story.VariableObserver internalObserver = BuildObserver();
Ink.Runtime.Story.VariableObserver internalObserver = BuildObserver();
runtimeStory.ObserveVariable(variableName, internalObserver);
internalObservers[variableName] = internalObserver;
}
Expand All @@ -251,7 +250,7 @@ public void ObserveVariable(string[] variableNames, Callable observer)
ObserveVariable(variableName, observer);
}

private Story.VariableObserver BuildObserver()
private Ink.Runtime.Story.VariableObserver BuildObserver()
{
return delegate (string name, object? value)
{
Expand Down Expand Up @@ -677,7 +676,7 @@ private void OnContinued()
_ = EmitSignal(SignalName.Continued);
}

private void OnMadeChoice(Choice choice)
private void OnMadeChoice(Ink.Runtime.Choice choice)
{
_ = EmitSignal(SignalName.MadeChoice, new InkChoice(choice));
}
Expand Down

0 comments on commit 40a84b5

Please sign in to comment.