Basic you are the traitor and the traitors have won UI #938#1505
Open
rohitkulkarni97 wants to merge 6 commits into
Open
Conversation
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.
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. @
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 throughViewLocatorand use aUiFadecomponent for transitions.Includes: local antagonist-assignment indicator, server-broadcast round-result banner, an
EndsRoundWithAntagonistVictorymarker onGamemodeObjective, and the missingAlignmentRequirementround-trip in the FishNet serializer. Does not include: a generic outcome-rule framework for other gamemodes, sound cues, or localization.PR checklist
Pictures/Videos
Testing
NukeGamemode.RoundState.Stopped, then fades out.Networking checklist
Changes
The work is split into six atomic commits:
GamemodeObjectivefor client alignment and antagonist-win marker — addsSetAlignmentRequirementand round-trips theAlignmentRequirementfield throughGamemodeObjectiveSerializer(without it, client clones defaulted toAlignment.Anyand the local traitor UI could never fire). Addsvirtual bool EndsRoundWithAntagonistVictory(defaultfalse), overriddentrueonDetonateNukeObjective.GamemodeAnnouncementMessageandGamemodeSubSystem.TryAnnounceTraitorVictory, guarded by_traitorVictoryAnnounced(reset inInitializeGamemode), broadcast viaServerManager.Broadcastso every client receives it.GamemodeObjectivesView→GamemodeObjectivesNetworkView(script GUID preserved); addsTraitorIndicatorView,RoundResultView, andGamemodeAnnouncementNetworkView; targets resolved viaViewLocator.GamemodeObjectivePanelViewnow extendsView(wasActor).GamemodeObjectiveCanvas.prefabgets a newObjectiveListcontainer (CanvasGroup+UiFade+GamemodeObjectivePanelView) and aPersistentMessagessibling holdingTraitorIndicatorandRoundResult;NetworkedView.prefabgets aGamemodeAnnouncementNetworkViewsibling NetworkBehaviour.objective.InProgressso the Success update at round end does not re-trigger the 5s display under the round-result banner.UiFadeon theRoundResultGameObject 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 guardif (gamemodeObjective.AlignmentRequirement != Alignment.Antagonists) return;always returns. The round-result path is independent: a server-sideServerManager.BroadcastfiresGamemodeAnnouncementMessageonce when a qualifying objective Succeeds.None known.
Related issues/PRs
Closes #938