BigRedButtonOfDeath.Library.Controller.connector_GamesMessagePacketReceived C# (CSharp) Method

connector_GamesMessagePacketReceived() public method

public connector_GamesMessagePacketReceived ( object sender, PackageEventArgs e ) : void
sender object
e ArtemisComm.PackageEventArgs
return void
        void connector_GamesMessagePacketReceived(object sender, PackageEventArgs e)
        {
            //GameStart and GameOver are all that matter.
            if (e != null && e.ReceivedPacket != null)
            {
                GameMessagePacket p = e.ReceivedPacket.Package as GameMessagePacket;
                if (p != null)
                {
                    if (p.SubPacketType == GameMessageSubPacketType.GameOverSubPacket)
                    {

                        GameInProgress = !GameInProgress;
                        if (GameInProgress)
                        {
                            View.GameStarted();
                            StartReady2Timer();
                        }
                        else
                        {
                            View.GameEnded();
                            StopReady2Timer();
                            
                        }

                    }
                    if (p.SubPacketType == GameMessageSubPacketType.SimulationEndSubPacket)
                    {
                        
                        GameInProgress = false;
                        View.SimulationEnded();
                    }
                    if (p.SubPacketType == GameMessageSubPacketType.AllShipSettingsSubPacket)
                    {
                        AllShipSettingsSubPacket allships = p.SubPacket as AllShipSettingsSubPacket;
                        if (allships != null && allships.Ships != null && !shipSelected)
                        {
                            View.GetShipSelection(allships.Ships.ToArray<PlayerShip>());
                            
                        }
                    }
                }
            }

        }
        void StopReady2Timer()