Skip to content

Commit

Permalink
#235 Fix chore cancellation from the user menu
Browse files Browse the repository at this point in the history
  • Loading branch information
polycone committed Sep 26, 2023
1 parent f6d0e24 commit 7f0b2ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class ClickUserMenuButton : MultiplayerCommand {
private string actionName;

public ClickUserMenuButton(GameObject gameObject, System.Action action) {
reference = gameObject.GetMultiplayerReference();
reference = gameObject.GetReference();
actionDeclaringType = action.Method.DeclaringType!;
actionName = action.Method.Name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,13 @@ public static GameObjectReference GetMultiplayerReference(this GameObject gameOb
public static GameObjectReference GetGridReference(this GameObject gameObject) =>
new GridReference(gameObject);

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static GameObjectReference GetReference(this GameObject gameObject) {
var multiplayerId = gameObject.GetComponent<MultiplayerInstance>().Id;
if (multiplayerId != null)
return new MultiplayerIdReference(multiplayerId);

return new GridReference(gameObject);
}

}

0 comments on commit 7f0b2ca

Please sign in to comment.