Skip to content

Basic you are the traitor and the traitors have won UI #938#1505

Open
rohitkulkarni97 wants to merge 6 commits into
RE-SS3D:developfrom
rohitkulkarni97:Issues/Basic-You-are-the-Traitor-and-The-Traitors-have-won-UI-#938
Open

Basic you are the traitor and the traitors have won UI #938#1505
rohitkulkarni97 wants to merge 6 commits into
RE-SS3D:developfrom
rohitkulkarni97:Issues/Basic-You-are-the-Traitor-and-The-Traitors-have-won-UI-#938

Conversation

@rohitkulkarni97
Copy link
Copy Markdown
Contributor

@rohitkulkarni97 rohitkulkarni97 commented May 20, 2026

Summary

Adds the two basic gamemode UI cues called out in #938 for the nuke / traitor flow: a "You are the Traitor" indicator and a "The traitors have won!" round-result banner.

The traitor indicator fades in when the local player is assigned an antagonist objective and auto-hides after a few seconds. The round-result banner fades in when the nuke detonates and stays visible until RoundState.Stopped, then fades out. Both views resolve through ViewLocator and use a UiFade component for transitions.

Includes: local antagonist-assignment indicator, server-broadcast round-result banner, an EndsRoundWithAntagonistVictory marker on GamemodeObjective, and the missing AlignmentRequirement round-trip in the FishNet serializer. Does not include: a generic outcome-rule framework for other gamemodes, sound cues, or localization.

PR checklist

  • The game builds properly without errors.
  • No unrelated changes are present.
  • No "trash" files are committed.
  • Relevant code is documented.
  • Update the related GitBook document, or create a new one if needed.

Pictures/Videos

image image

Testing

  1. Start a round on the NukeGamemode.
  2. Once your antagonist objective is assigned, the "You are the Traitor" banner fades in and auto-hides after ~5s. If the round stops while it is still showing, it hides immediately.
  3. Detonate the nuke. The "The traitors have won!" banner fades in and stays visible until RoundState.Stopped, then fades out.
  4. Verify the traitor banner does not re-appear under the round-result banner when the antagonist objective transitions to Success at the end of the round.

Networking checklist

  • Works from host in host mode.
  • Works from server in server mode.
  • Works on server in client mode.
  • Works and is syncronized across different clients.
  • Is persistent.

Changes

The work is split into six atomic commits:

  1. Extend GamemodeObjective for client alignment and antagonist-win marker — adds SetAlignmentRequirement and round-trips the AlignmentRequirement field through GamemodeObjectiveSerializer (without it, client clones defaulted to Alignment.Any and the local traitor UI could never fire). Adds virtual bool EndsRoundWithAntagonistVictory (default false), overridden true on DetonateNukeObjective.
  2. Broadcast traitor victory announcement on antagonist win — adds GamemodeAnnouncementMessage and GamemodeSubSystem.TryAnnounceTraitorVictory, guarded by _traitorVictoryAnnounced (reset in InitializeGamemode), broadcast via ServerManager.Broadcast so every client receives it.
  3. Split gamemode UI into per-screen Views and NetworkViews — renames GamemodeObjectivesViewGamemodeObjectivesNetworkView (script GUID preserved); adds TraitorIndicatorView, RoundResultView, and GamemodeAnnouncementNetworkView; targets resolved via ViewLocator. GamemodeObjectivePanelView now extends View (was Actor).
  4. Wire new gamemode UI in prefabs and sceneGamemodeObjectiveCanvas.prefab gets a new ObjectiveList container (CanvasGroup + UiFade + GamemodeObjectivePanelView) and a PersistentMessages sibling holding TraitorIndicator and RoundResult; NetworkedView.prefab gets a GamemodeAnnouncementNetworkView sibling NetworkBehaviour.
  5. Suppress traitor banner re-show on objective end-state updates — gates the indicator on objective.InProgress so the Success update at round end does not re-trigger the 5s display under the round-result banner.
  6. Fade round-result banner in and out via UiFade — adds a UiFade on the RoundResult GameObject and routes both transitions through it.

The objective serializer change is the load-bearing fix for the traitor trigger — without round-tripping AlignmentRequirement, the client-side guard if (gamemodeObjective.AlignmentRequirement != Alignment.Antagonists) return; always returns. The round-result path is independent: a server-side ServerManager.Broadcast fires GamemodeAnnouncementMessage once when a qualifying objective Succeeds.

None known.

Related issues/PRs

Closes #938

The custom FishNet serializer only wrote Id/Title/Status/AssigneeCkey,
so client clones had AlignmentRequirement default to Alignment.Any,
which prevented the local traitor UI from gating on antagonist
objectives. Add SetAlignmentRequirement and round-trip the field
through the serializer so clients see the same alignment as the
server.

Add a virtual EndsRoundWithAntagonistVictory marker (default false),
overridden to true on DetonateNukeObjective. Keeps win detection in
the objective layer so the gamemode subsystem can announce a traitor
victory without coupling to concrete objective types.

For RE-SS3D#938.
Add GamemodeAnnouncementMessage (server -> all clients string
broadcast) and TryAnnounceTraitorVictory in GamemodeSubSystem, fired
when a successful objective is antagonist-aligned and reports
EndsRoundWithAntagonistVictory. Guarded with _traitorVictoryAnnounced
(reset in InitializeGamemode) so cooperative success propagation does
not send the message twice. Broadcast via ServerManager.Broadcast so
every client receives it, unlike the objective-owner-only update path.

For RE-SS3D#938.
Rename GamemodeObjectivesView -> GamemodeObjectivesNetworkView, keeping
the script GUID so existing prefab/scene component references resolve.
It now drives both the objective panel and the new traitor indicator
from the same objective broadcast, resolving target views through
ViewLocator instead of serialized cross-references.

Add three views:
- TraitorIndicatorView: "You are the Traitor" with UiFade-driven
  auto-hide after _displayDuration (default 5s). Also hides
  immediately if the round stops while still showing.
- RoundResultView: shows the announcement message; clears on
  RoundState.Stopped.
- GamemodeAnnouncementNetworkView: registers
  GamemodeAnnouncementMessage and forwards to RoundResultView.

GamemodeObjectivePanelView now extends View (was Actor) so ViewLocator
can resolve it.

For RE-SS3D#938.
GamemodeObjectiveCanvas.prefab restructure so persistent messages are
not faded with the objective list:
- New ObjectiveList container with CanvasGroup hosting UiFade and
  GamemodeObjectivePanelView; Panel reparented under it.
- New PersistentMessages sibling holding TraitorIndicator and
  RoundResult, each with a child Label TMP and (for TraitorIndicator)
  its own CanvasGroup + UiFade for auto-hide.
- Root canvas no longer hosts the fade controller or a CanvasGroup.

NetworkedView.prefab gets a GamemodeAnnouncementNetworkView as a
sibling NetworkBehaviour under the existing NetworkObject. Game.unity
picks up the prefab-instance propagation.

For RE-SS3D#938.
@rohitkulkarni97 rohitkulkarni97 marked this pull request as draft May 20, 2026 03:07
GamemodeObjectivesNetworkView called TraitorIndicatorView.Show() on
every antagonist objective update, so the success broadcast at round
end (e.g. nuke detonation) re-triggered the 5s display at the same
time as the round-result banner. Skip the show when the objective is
no longer InProgress so the indicator only appears while the player
is actively a traitor.

For RE-SS3D#938.
@
Fade round-result banner in and out via UiFade

The round-result banner used to pop in instantly and snap off when the
round stopped. Route both transitions through the shared UiFade so the
"The traitors have won!" message eases on screen, then fades out when
RoundState.Stopped fires. Behavior is otherwise unchanged: the banner
remains persistent for the rest of the round.
@
@rohitkulkarni97 rohitkulkarni97 marked this pull request as ready for review May 20, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Basic "You are the Traitor" and "The Traitors have won" UI

1 participant