private bool HandleClientEventLobbyEquipmentUpdated(
            NetworkCommunicator peer,
            RequestTroopIndexChange message)
        {
            MissionPeer component = peer.GetComponent <MissionPeer>();

            if (component == null)
            {
                return(false);
            }
            SpawnComponent missionBehaviour = this.Mission.GetMissionBehaviour <SpawnComponent>();

            if (missionBehaviour == null)
            {
                return(false);
            }
            if (missionBehaviour.AreAgentsSpawning() && component.SelectedTroopIndex != message.SelectedTroopIndex)
            {
                component.SelectedTroopIndex = message.SelectedTroopIndex;
                GameNetwork.BeginBroadcastModuleEvent();
                GameNetwork.WriteMessage((GameNetworkMessage) new UpdateSelectedTroopIndex(peer, message.SelectedTroopIndex));
                GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.ExcludeOtherTeamPlayers, peer);
                if (this.OnEquipmentRefreshed != null)
                {
                    this.OnEquipmentRefreshed(component);
                }
            }
            return(true);
        }
コード例 #2
0
        public override void OnUdpNetworkHandlerTick(float dt)
        {
            if (!GameNetwork.IsServer)
            {
                return;
            }
            float time = MBCommon.GetTime(MBCommon.TimeType.Mission);

            if ((double)this._lastTestSendTime >= (double)time + 10.0)
            {
                return;
            }
            IReadOnlyList <Agent> agents = Mission.Current.Agents;
            int count = agents.Count;

            this._lastTestSendTime = time;
            Agent toTest = agents[(int)(new Random().NextDouble() * (double)count)];

            if (!toTest.IsActive())
            {
                return;
            }
            GameNetwork.BeginBroadcastModuleEvent();
            GameNetwork.WriteMessage((GameNetworkMessage) new DebugAgentScaleOnNetworkTest(toTest, toTest.AgentScale));
            GameNetwork.EndBroadcastModuleEventUnreliable(GameNetwork.EventBroadcastFlags.None);
        }
コード例 #3
0
 public static void ServerSendServerMessageToEveryone(string message)
 {
     ChatBox._chatBox.OnServerMessage(message);
     GameNetwork.BeginBroadcastModuleEvent();
     GameNetwork.WriteMessage((GameNetworkMessage) new NetworkMessages.FromServer.ServerMessage(message));
     GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None);
 }
コード例 #4
0
 public void OnApplySettings()
 {
     MultiplayerOptions.Instance.InitializeOptionsFromUi();
     GameNetwork.BeginBroadcastModuleEvent();
     GameNetwork.WriteMessage((GameNetworkMessage) new MultiplayerOptionsImmediate());
     GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None);
 }
コード例 #5
0
        private void CheckMorales()
        {
            if ((double)this._nextTimeToCheckForMorales < 0.0)
            {
                this._nextTimeToCheckForMorales = this.Mission.Time + 1f;
            }
            if ((double)this.Mission.Time < (double)this._nextTimeToCheckForMorales)
            {
                return;
            }
            ++this._nextTimeToCheckForMorales;
            float moraleGain;

            if (!this.GetMoraleGain(out moraleGain))
            {
                return;
            }
            this._morale += moraleGain;
            this._morale  = MBMath.ClampFloat(this._morale, -1f, 1f);
            GameNetwork.BeginBroadcastModuleEvent();
            GameNetwork.WriteMessage((GameNetworkMessage) new FlagDominationMoraleChangeMessage(this.MoraleRounded));
            GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None);
            this._gameModeFlagDominationClient?.OnMoraleChanged(this.MoraleRounded);
            MPPerkObject.RaiseEventForAllPeers(MPPerkCondition.PerkEventFlags.MoraleChange);
        }
 public void EquipmentUpdated()
 {
     if (GameNetwork.IsServer)
     {
         MissionPeer component = GameNetwork.MyPeer.GetComponent <MissionPeer>();
         if (component.SelectedTroopIndex == component.NextSelectedTroopIndex)
         {
             return;
         }
         component.SelectedTroopIndex = component.NextSelectedTroopIndex;
         GameNetwork.BeginBroadcastModuleEvent();
         GameNetwork.WriteMessage((GameNetworkMessage) new UpdateSelectedTroopIndex(GameNetwork.MyPeer, component.SelectedTroopIndex));
         GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.ExcludeOtherTeamPlayers, GameNetwork.MyPeer);
         if (this.OnEquipmentRefreshed == null)
         {
             return;
         }
         this.OnEquipmentRefreshed(component);
     }
     else
     {
         MissionPeer component = GameNetwork.MyPeer.GetComponent <MissionPeer>();
         GameNetwork.BeginModuleEventAsClient();
         GameNetwork.WriteMessage((GameNetworkMessage) new RequestTroopIndexChange(component.NextSelectedTroopIndex));
         GameNetwork.EndModuleEventAsClient();
     }
 }
コード例 #7
0
        public virtual void TeleportUserAgentsToMachine(List <Agent> agentList)
        {
            int  num1 = 0;
            bool flag;

            do
            {
                ++num1;
                flag = false;
                foreach (Agent agent in agentList)
                {
                    if (agent.AIMoveToGameObjectIsEnabled())
                    {
                        flag = true;
                        WorldFrame userFrameForAgent = this.UsableMachine.GetTargetStandingPointOfAIAgent(agent).GetUserFrameForAgent(agent);
                        userFrameForAgent.Rotation.f.z = 0.0f;
                        double num2 = (double)userFrameForAgent.Rotation.f.Normalize();
                        if ((double)(agent.Position.AsVec2 - userFrameForAgent.Origin.AsVec2).LengthSquared > 9.99999974737875E-05 || (double)(agent.GetMovementDirection() - userFrameForAgent.Rotation.f).LengthSquared > 9.99999974737875E-05)
                        {
                            agent.TeleportToPosition(userFrameForAgent.Origin.GetGroundVec3());
                            agent.SetMovementDirection(ref userFrameForAgent.Rotation.f);
                            if (GameNetwork.IsServerOrRecorder)
                            {
                                GameNetwork.BeginBroadcastModuleEvent();
                                GameNetwork.WriteMessage((GameNetworkMessage) new AgentTeleportToFrame(agent, userFrameForAgent.Origin.GetGroundVec3(), userFrameForAgent.Rotation.f.AsVec2));
                                GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.AddToMissionRecord);
                            }
                        }
                    }
                }
            }while (flag && num1 < 10);
        }
コード例 #8
0
        public override void HandleNewClientAfterLoadingFinished(NetworkCommunicator networkPeer)
        {
            VirtualPlayer virtualPlayer1 = networkPeer.VirtualPlayer;

            GameNetwork.BeginBroadcastModuleEvent();
            GameNetwork.WriteMessage((GameNetworkMessage) new InitializeLobbyPeer(networkPeer, virtualPlayer1.Id, virtualPlayer1.BannerCode, virtualPlayer1.BodyProperties, virtualPlayer1.ChosenBadgeIndex, -1));
            GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.AddToMissionRecord | GameNetwork.EventBroadcastFlags.DontSendToPeers);
            foreach (NetworkCommunicator networkPeer1 in GameNetwork.NetworkPeers)
            {
                if (networkPeer1.IsSynchronized || networkPeer1 == networkPeer)
                {
                    if (networkPeer1 != networkPeer && networkPeer1 != GameNetwork.MyPeer)
                    {
                        GameNetwork.BeginModuleEventAsServer(networkPeer1);
                        GameNetwork.WriteMessage((GameNetworkMessage) new InitializeLobbyPeer(networkPeer, virtualPlayer1.Id, virtualPlayer1.BannerCode, virtualPlayer1.BodyProperties, virtualPlayer1.ChosenBadgeIndex, -1));
                        GameNetwork.EndModuleEventAsServer();
                    }
                    VirtualPlayer virtualPlayer2 = networkPeer1.VirtualPlayer;
                    if (!networkPeer.IsServerPeer)
                    {
                        GameNetwork.BeginModuleEventAsServer(networkPeer);
                        GameNetwork.WriteMessage((GameNetworkMessage) new InitializeLobbyPeer(networkPeer1, virtualPlayer2.Id, virtualPlayer2.BannerCode, virtualPlayer2.BodyProperties, virtualPlayer2.ChosenBadgeIndex, -1));
                        GameNetwork.EndModuleEventAsServer();
                    }
                }
            }
        }
        public void HandleAgentVisualSpawning(
            NetworkCommunicator spawningNetworkPeer,
            AgentBuildData spawningAgentBuildData,
            int troopCountInFormation = 0)
        {
            MissionPeer component = spawningNetworkPeer.GetComponent <MissionPeer>();

            component.HasSpawnedAgentVisuals   = true;
            component.EquipmentUpdatingExpired = false;
            if (!this.IsGameModeHidingAllAgentVisuals)
            {
                GameNetwork.BeginBroadcastModuleEvent();
                GameNetwork.WriteMessage((GameNetworkMessage) new CreateAgentVisuals(spawningNetworkPeer, spawningAgentBuildData, component.SelectedTroopIndex, troopCountInFormation));
                GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.ExcludeOtherTeamPlayers, spawningNetworkPeer);
            }
            else
            {
                if (spawningNetworkPeer.IsServerPeer)
                {
                    return;
                }
                GameNetwork.BeginModuleEventAsServer(spawningNetworkPeer);
                GameNetwork.WriteMessage((GameNetworkMessage) new CreateAgentVisuals(spawningNetworkPeer, spawningAgentBuildData, component.SelectedTroopIndex, troopCountInFormation));
                GameNetwork.EndModuleEventAsServer();
            }
        }
コード例 #10
0
        private void UpdateRoundScores()
        {
            foreach (MissionScoreboardComponent.MissionScoreboardSide side in this._sides)
            {
                if (side != null && side.Side == this.RoundWinner)
                {
                    this._roundWinnerList.Add(this.RoundWinner);
                    if (this.RoundWinner != BattleSideEnum.None)
                    {
                        ++this._sides[(int)this.RoundWinner].SideScore;
                    }
                }
            }
            if (this.OnRoundPropertiesChanged != null)
            {
                this.OnRoundPropertiesChanged();
            }
            if (!GameNetwork.IsServer)
            {
                return;
            }
            int defenderTeamScore = this._scoreboardSides != MissionScoreboardComponent.ScoreboardSides.OneSide ? this._sides[0].SideScore : 0;

            GameNetwork.BeginBroadcastModuleEvent();
            GameNetwork.WriteMessage((GameNetworkMessage) new NetworkMessages.FromServer.UpdateRoundScores(this._sides[1].SideScore, defenderTeamScore));
            GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None);
        }
コード例 #11
0
 private void StartPlayerKickPollOnServer(
     NetworkCommunicator pollCreatorPeer,
     NetworkCommunicator peer,
     bool banPlayer)
 {
     if (this._runningPoll == null)
     {
         this._runningPoll = (object)new MultiplayerPollComponent.KickPlayer()
         {
             playerPeer = peer
         };
         this._runningPollStartTime = new int?(Environment.TickCount);
         if (!GameNetwork.IsDedicatedServer)
         {
             this.ShowPlayerKickPoll(peer, banPlayer);
         }
         GameNetwork.BeginBroadcastModuleEvent();
         GameNetwork.WriteMessage((GameNetworkMessage) new NetworkMessages.FromServer.KickPlayerPoll(peer, banPlayer));
         GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None);
     }
     else
     {
         this.RejectPollStartServer(pollCreatorPeer, MultiplayerPollComponent.PollRejectReason.APollIsAlreadyRunning);
     }
 }
コード例 #12
0
 private void StartGameChangePollOnServer(
     NetworkCommunicator pollCreatorPeer,
     string gameType,
     string scene)
 {
     if (this._runningPoll == null)
     {
         this._runningPoll = (object)new MultiplayerPollComponent.ChangeGame()
         {
             GameType = gameType,
             MapName  = scene
         };
         this._runningPollStartTime = new int?(Environment.TickCount);
         if (!GameNetwork.IsDedicatedServer)
         {
             this.ShowGameChangePoll(gameType, scene);
         }
         GameNetwork.BeginBroadcastModuleEvent();
         GameNetwork.WriteMessage((GameNetworkMessage) new NetworkMessages.FromServer.ChangeGamePoll(gameType, scene));
         GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None);
     }
     else
     {
         this.RejectPollStartServer(pollCreatorPeer, MultiplayerPollComponent.PollRejectReason.APollIsAlreadyRunning);
     }
 }
コード例 #13
0
        public void SetAnimationAtChannelSynched(
            string animationName,
            int channelNo,
            float animationSpeed = 1f)
        {
            int animationIndexWithName1 = MBAnimation.GetAnimationIndexWithName(animationName);

            if (GameNetwork.IsServerOrRecorder)
            {
                int  animationIndexWithName2 = MBAnimation.GetAnimationIndexWithName(this.GameEntity.Skeleton.GetAnimationAtChannel(channelNo));
                bool flag = true;
                int  num  = animationIndexWithName1;
                if (animationIndexWithName2 == num && this.GameEntity.Skeleton.GetAnimationSpeedAtChannel(channelNo).ApproximatelyEqualsTo(animationSpeed) && (double)this.GameEntity.Skeleton.GetAnimationParameterAtChannel(channelNo) < 0.0199999995529652)
                {
                    flag = false;
                }
                if (flag)
                {
                    GameNetwork.BeginBroadcastModuleEvent();
                    GameNetwork.WriteMessage((GameNetworkMessage) new SetMissionObjectAnimationAtChannel((MissionObject)this, channelNo, animationIndexWithName1, animationSpeed));
                    GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.AddToMissionRecord);
                    this._initialSynchFlags |= SynchedMissionObject.SynchFlags.SynchAnimation;
                }
            }
            this.GameEntity.Skeleton.SetAnimationAtChannel(animationIndexWithName1, channelNo, animationSpeed);
        }
コード例 #14
0
 public void SetGlobalFrameSynched(ref MatrixFrame frame, bool isClient = false)
 {
     this._duration = 0.0f;
     this._timer    = 0.0f;
     if (!(this.GameEntity.GetGlobalFrame() != frame))
     {
         return;
     }
     if (GameNetwork.IsClientOrReplay)
     {
         this._lastSynchedFrame = (NativeObject)this.GameEntity.Parent != (NativeObject)null ? this.GameEntity.Parent.GetGlobalFrame().TransformToLocalNonOrthogonal(ref frame) : frame;
         this.SetSynchState(SynchedMissionObject.SynchState.SynchronizeFrame);
     }
     else
     {
         if (GameNetwork.IsServerOrRecorder)
         {
             GameNetwork.BeginBroadcastModuleEvent();
             GameNetwork.WriteMessage((GameNetworkMessage) new SetMissionObjectGlobalFrame((MissionObject)this, ref frame));
             GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.AddToMissionRecord);
         }
         this.SetSynchState(SynchedMissionObject.SynchState.SynchronizeCompleted);
         this.GameEntity.SetGlobalFrame(frame);
         this._initialSynchFlags |= SynchedMissionObject.SynchFlags.SynchTransform;
     }
 }
コード例 #15
0
 private void SetStatePlayingAsServer()
 {
     this._warmupComponent        = (MultiplayerWarmupComponent)null;
     this.CurrentMultiplayerState = MissionLobbyComponent.MultiplayerGameState.Playing;
     this._timerComponent.StartTimerAsServer((float)(MultiplayerOptions.OptionType.MapTimeLimit.GetIntValue() * 60));
     GameNetwork.BeginBroadcastModuleEvent();
     GameNetwork.WriteMessage((GameNetworkMessage) new MissionStateChange(this.CurrentMultiplayerState, this._timerComponent.GetCurrentTimerStartTime().NumberOfTicks));
     GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None);
 }
コード例 #16
0
 public virtual void SetDisabledSynched()
 {
     if (GameNetwork.IsServerOrRecorder)
     {
         GameNetwork.BeginBroadcastModuleEvent();
         GameNetwork.WriteMessage((GameNetworkMessage) new SetMissionObjectDisabled((MissionObject)this));
         GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.AddToMissionRecord);
     }
     this.SetDisabledAndMakeInvisible();
 }
コード例 #17
0
 public void BurstParticlesSynched(bool doChildren = true)
 {
     if (GameNetwork.IsServerOrRecorder)
     {
         GameNetwork.BeginBroadcastModuleEvent();
         GameNetwork.WriteMessage((GameNetworkMessage) new BurstMissionObjectParticles((MissionObject)this, false));
         GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.AddToMissionRecord);
     }
     this.GameEntity.BurstEntityParticle(doChildren);
 }
コード例 #18
0
 protected void SpawnEquipmentUpdated(MissionPeer lobbyPeer, Equipment equipment)
 {
     if (!GameNetwork.IsServer || lobbyPeer == null || (!this.SpawningBehaviour.CanUpdateSpawnEquipment(lobbyPeer) || !lobbyPeer.HasSpawnedAgentVisuals))
     {
         return;
     }
     GameNetwork.BeginBroadcastModuleEvent();
     GameNetwork.WriteMessage((GameNetworkMessage) new EquipEquipmentToPeer(lobbyPeer.GetNetworkPeer(), equipment));
     GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None);
 }
 private void SendNotificationToEveryone(
     MultiplayerGameNotificationsComponent.MultiplayerNotificationEnum message,
     int param1 = -1,
     int param2 = -1)
 {
     this.ShowNotification(message, param1, param2);
     GameNetwork.BeginBroadcastModuleEvent();
     GameNetwork.WriteMessage((GameNetworkMessage) new NotificationMessage((int)message, param1, param2));
     GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None);
 }
コード例 #20
0
        private int RemoveCapturePoint(FlagCapturePoint capToRemove)
        {
            int flagIndex = capToRemove.FlagIndex;

            capToRemove.RemovePointAsServer();
            GameNetwork.BeginBroadcastModuleEvent();
            GameNetwork.WriteMessage((GameNetworkMessage) new FlagDominationCapturePointMessage(flagIndex, (Team)null));
            GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None);
            return(flagIndex);
        }
コード例 #21
0
 protected void ConsumeAmmo()
 {
     --this.AmmoCount;
     if (GameNetwork.IsServerOrRecorder)
     {
         GameNetwork.BeginBroadcastModuleEvent();
         GameNetwork.WriteMessage((GameNetworkMessage) new SetStonePileAmmo(this, this.AmmoCount));
         GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.AddToMissionRecord);
     }
     this.UpdateAmmoMesh();
     this.CheckAmmo();
 }
 public void ClearPeerCounts()
 {
     foreach (MissionPeer peer in VirtualPlayer.Peers <MissionPeer>())
     {
         peer.AssistCount = 0;
         peer.DeathCount  = 0;
         peer.KillCount   = 0;
         peer.Score       = 0;
         GameNetwork.BeginBroadcastModuleEvent();
         GameNetwork.WriteMessage((GameNetworkMessage) new KillDeathCountChange(peer.GetNetworkPeer(), (NetworkCommunicator)null, peer.KillCount, peer.AssistCount, peer.DeathCount, peer.Score));
         GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None);
     }
 }
コード例 #23
0
        public override void OnAgentRemoved(
            Agent affectedAgent,
            Agent affectorAgent,
            AgentState agentState,
            KillingBlow killingBlow)
        {
            base.OnAgentRemoved(affectedAgent, affectorAgent, agentState, killingBlow);
            if (!GameNetwork.IsServer || this.CurrentMultiplayerState == MissionLobbyComponent.MultiplayerGameState.Ending || agentState != AgentState.Killed && agentState != AgentState.Unconscious && agentState != AgentState.Routed || (affectedAgent == null || !affectedAgent.IsHuman))
            {
                return;
            }
            MissionPeer assistorPeer = affectorAgent?.MissionPeer != null?this.RemoveHittersAndGetAssistorPeer(affectorAgent.MissionPeer, affectedAgent) : (MissionPeer)null;

            if (affectedAgent.MissionPeer != null)
            {
                this.OnPlayerDies(affectedAgent.MissionPeer, assistorPeer);
            }
            else
            {
                this.OnBotDies(affectedAgent, assistorPeer);
            }
            if (affectorAgent == null || !affectorAgent.IsHuman)
            {
                return;
            }
            if (affectorAgent != affectedAgent)
            {
                if (affectorAgent.MissionPeer != null)
                {
                    this.OnPlayerKills(affectorAgent.MissionPeer, affectedAgent, assistorPeer);
                }
                else
                {
                    this.OnBotKills(affectorAgent, affectedAgent);
                }
            }
            else
            {
                if (affectorAgent.MissionPeer == null)
                {
                    return;
                }
                affectorAgent.MissionPeer.Score -= this._gameMode.GetScoreForKill(affectedAgent);
                this._missionScoreboardComponent.PlayerPropertiesChanged(affectorAgent.MissionPeer.GetNetworkPeer());
                GameNetwork.BeginBroadcastModuleEvent();
                GameNetwork.WriteMessage((GameNetworkMessage) new KillDeathCountChange(affectorAgent.MissionPeer.GetNetworkPeer(), affectedAgent.MissionPeer.GetNetworkPeer(), affectorAgent.MissionPeer.KillCount, affectorAgent.MissionPeer.AssistCount, affectorAgent.MissionPeer.DeathCount, affectorAgent.MissionPeer.Score));
                GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None);
            }
        }
コード例 #24
0
 public void SetAnimationChannelParameterSynched(int channelNo, float parameter)
 {
     if (this.GameEntity.Skeleton.GetAnimationParameterAtChannel(channelNo).ApproximatelyEqualsTo(parameter))
     {
         return;
     }
     if (GameNetwork.IsServerOrRecorder)
     {
         GameNetwork.BeginBroadcastModuleEvent();
         GameNetwork.WriteMessage((GameNetworkMessage) new SetMissionObjectAnimationChannelParameter((MissionObject)this, channelNo, parameter));
         GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.AddToMissionRecord);
     }
     this.GameEntity.Skeleton.SetAnimationParameterAtChannel(channelNo, parameter);
     this._initialSynchFlags |= SynchedMissionObject.SynchFlags.SynchAnimation;
 }
コード例 #25
0
 public void ResumeSkeletonAnimationSynched()
 {
     if (!this.GameEntity.IsSkeletonAnimationPaused())
     {
         return;
     }
     if (GameNetwork.IsServerOrRecorder)
     {
         GameNetwork.BeginBroadcastModuleEvent();
         GameNetwork.WriteMessage((GameNetworkMessage) new SetMissionObjectAnimationPaused((MissionObject)this, false));
         GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.AddToMissionRecord);
     }
     this.GameEntity.ResumeSkeletonAnimation();
     this._initialSynchFlags |= SynchedMissionObject.SynchFlags.SynchAnimation;
 }
コード例 #26
0
 public void ApplyImpulseSynched(Vec3 position, Vec3 impulse, bool localSpace)
 {
     if (GameNetwork.IsServerOrRecorder)
     {
         GameNetwork.BeginBroadcastModuleEvent();
         GameNetwork.WriteMessage((GameNetworkMessage) new SetMissionObjectImpulse((MissionObject)this, position, impulse, localSpace));
         GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.AddToMissionRecord);
     }
     if (localSpace)
     {
         position += this.GameEntity.GlobalPosition;
     }
     this.GameEntity.ApplyImpulseToDynamicBody(position, impulse);
     this._initialSynchFlags |= SynchedMissionObject.SynchFlags.SynchTransform;
 }
コード例 #27
0
 public void RemoveBodyFlagsSynched(BodyFlags flags, bool applyToChildren = true)
 {
     if ((this.GameEntity.BodyFlag & flags) == BodyFlags.None)
     {
         return;
     }
     if (GameNetwork.IsServerOrRecorder)
     {
         GameNetwork.BeginBroadcastModuleEvent();
         GameNetwork.WriteMessage((GameNetworkMessage) new RemoveMissionObjectBodyFlags((MissionObject)this, flags, applyToChildren));
         GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.AddToMissionRecord);
     }
     this.GameEntity.RemoveBodyFlags(flags, applyToChildren);
     this._initialSynchFlags |= SynchedMissionObject.SynchFlags.SynchBodyFlags;
 }
コード例 #28
0
 public virtual void SetTeamColorsSynched(uint color, uint color2)
 {
     if (!((NativeObject)this.GameEntity != (NativeObject)null))
     {
         return;
     }
     if (GameNetwork.IsServerOrRecorder)
     {
         GameNetwork.BeginBroadcastModuleEvent();
         GameNetwork.WriteMessage((GameNetworkMessage) new SetMissionObjectColors((MissionObject)this, color, color2));
         GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.AddToMissionRecord);
     }
     this.SetTeamColors(color, color2);
     this._initialSynchFlags |= SynchedMissionObject.SynchFlags.SyncColors;
 }
コード例 #29
0
 public void ChangeTeamScore(Team team, int scoreChange)
 {
     this._sides[(int)team.Side].SideScore += scoreChange;
     this._sides[(int)team.Side].SideScore  = MBMath.ClampInt(this._sides[(int)team.Side].SideScore, -120000, 120000);
     if (GameNetwork.IsServer)
     {
         GameNetwork.BeginBroadcastModuleEvent();
         GameNetwork.WriteMessage((GameNetworkMessage) new NetworkMessages.FromServer.UpdateRoundScores(this.GetRoundScore(BattleSideEnum.Attacker), this.GetRoundScore(BattleSideEnum.Defender)));
         GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None);
     }
     if (this.OnRoundPropertiesChanged == null)
     {
         return;
     }
     this.OnRoundPropertiesChanged();
 }
コード例 #30
0
        public virtual void SetStateEndingAsServer()
        {
            this.CurrentMultiplayerState = MissionLobbyComponent.MultiplayerGameState.Ending;
            MBDebug.Print("Multiplayer game mission ending");
            this._timerComponent.StartTimerAsServer(5f);
            GameNetwork.BeginBroadcastModuleEvent();
            GameNetwork.WriteMessage((GameNetworkMessage) new MissionStateChange(this.CurrentMultiplayerState, this._timerComponent.GetCurrentTimerStartTime().NumberOfTicks));
            GameNetwork.EndBroadcastModuleEvent(GameNetwork.EventBroadcastFlags.None);
            Action onPostMatchEnded = this.OnPostMatchEnded;

            if (onPostMatchEnded == null)
            {
                return;
            }
            onPostMatchEnded();
        }