Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore cancellation from user menu #238

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}

}