private void EndGame(bool playerWon, Fraction winner)
        {
            _lastSpeed = GameSpeedMode;

            HasFinished = true;
            PlayerWon   = playerWon;

            var ctime = (int)(LevelTime * 1000);

            if (playerWon)
            {
                ShowScorePanel(Blueprint, GDOwner.Profile, new HashSet <FractionDifficulty>(), true, 0, ctime);
                MainGame.Inst.GDSound.PlayEffectGameWon();

                EndGameConvert(winner);
            }
            else
            {
                ShowScorePanel(Blueprint, GDOwner.Profile, new HashSet <FractionDifficulty>(), false, 0, ctime);
                MainGame.Inst.GDSound.PlayEffectGameOver();

                EndGameConvert(winner);
            }

            foreach (var cannon in Entities.Enumerate().OfType <Cannon>())
            {
                cannon.ForceUpdateController();
            }
        }
Exemple #2
0
        public void InitEmpty()
        {
            LevelData       = new Dictionary <Guid, LevelData>();
            PurchasedWorlds = new HashSet <Guid>();

            MultiplayerPoints = 0;

            AccountType        = AccountType.Local;
            OnlineUserID       = -1;
            OnlineUsername     = "******";
            OnlinePasswordHash = string.Empty;
            OnlineRevisionID   = -1;
            NeedsReupload      = false;

            SoundsEnabled  = true;
            EffectsEnabled = true;
            MusicEnabled   = true;

            LastMultiplayerHostedLevel = Levels.LEVELID_1_3;
            LastMultiplayerHostedSpeed = GameSpeedModes.NORMAL;

            SkipTutorial         = false;
            AccountReminderShown = false;

            Language = L10N.LANG_EN_US;
        }
Exemple #3
0
        public void InitEmpty()
        {
            LevelData       = new Dictionary <Guid, LevelData>();
            PurchasedWorlds = new HashSet <Guid>();
            CustomLevelData = new List <CustomLevelData>();

            MultiplayerPoints = 0;
            ScoreStars        = 0;
            ScoreSCCM         = 0;
            HasCreatedLevels  = false;

            AccountType        = AccountType.Local;
            OnlineUserID       = -1;
            OnlineUsername     = "******";
            OnlinePasswordHash = string.Empty;
            OnlineRevisionID   = -1;
            NeedsReupload      = false;

            UnacknowledgedAuthError = false;
            BackupOnlineUsername    = string.Empty;

            SoundsEnabled  = true;
            EffectsEnabled = true;
            MusicEnabled   = true;
            ColorblindMode = false;

            LastMultiplayerHostedLevel = Levels.LEVELID_1_3;
            LastMultiplayerHostedSpeed = GameSpeedModes.NORMAL;

            SkipTutorial         = false;
            AccountReminderShown = false;

            Language = L10N.LANG_EN_US;
            SingleplayerGameSpeed = GameSpeedModes.NORMAL;
        }
        public GDGameScreen_SCCMTest(MainGame game, GraphicsDeviceManager gdm, LevelBlueprint bp, FractionDifficulty diff, SCCMLevelData dat, GameSpeedModes speed)
            : base(game, gdm, bp, diff, false, false, false)
        {
            SCCMData = dat;

            GameSpeedMode = _lastSpeed = speed;
            UpdateGameSpeed();
        }
Exemple #5
0
        public GDGameScreen_SCCMUpload(MainGame game, GraphicsDeviceManager gdm, LevelBlueprint bp, SCCMLevelData dat, GameSpeedModes speed, bool toast)
            : base(game, gdm, bp, FractionDifficulty.DIFF_3, false, false, false)
        {
            SCCMData = dat;
            _toast   = toast;

            GameSpeedMode = _lastSpeed = speed;
            UpdateGameSpeed();
        }
        public HUDSpeedSetButton(HUDSpeedBaseButton baseBtn, GameSpeedModes buttonSpeed)
        {
            speed      = buttonSpeed;
            baseButton = baseBtn;

            RelativePosition = baseButton.RelativePosition;
            Size             = baseButton.Size;
            Alignment        = baseButton.Alignment;

            OverrideEllipseSize = new FSize(REAL_DIAMETER, REAL_DIAMETER);
        }
		public HUDSpeedSetButton(HUDSpeedBaseButton baseBtn, GameSpeedModes buttonSpeed)
		{
			speed = buttonSpeed;
			baseButton = baseBtn;

			RelativePosition = baseButton.RelativePosition;
			Size = baseButton.Size;
			Alignment = baseButton.Alignment;

			OverrideEllipseSize = new FSize(REAL_DIAMETER, REAL_DIAMETER);
		}
Exemple #8
0
        public HUDSCCMTestScorePanel(LevelBlueprint lvl, SCCMLevelData dat, FractionDifficulty d, GameSpeedModes s, int t)
        {
            Level    = lvl;
            SCCMData = dat;
            Diff     = d;
            Speed    = s;
            Time     = t;

            RelativePosition = FPoint.Zero;
            Size             = new FSize(WIDTH, HEIGHT);
            Alignment        = HUDAlignment.CENTER;
            Background       = FlatColors.BackgroundHUD;
        }
        public GDGameScreen_MPClient(MainGame game, GraphicsDeviceManager gdm, LevelBlueprint bp, GameSpeedModes speed, int music, GDMultiplayerClient server)
            : base(game, gdm, bp, FractionDifficulty.DIFF_3, false, true, false)
        {
            musicIdx      = music;
            GameSpeedMode = speed;
            _server       = server;
            CanPause      = false;

            _server.Screen = this;

            if (server.SessionUserID == 1)
            {
                _localPlayerFraction = GetFractionByID(2);
            }
            else if (server.SessionUserID == 2)
            {
                _localPlayerFraction = GetFractionByID(3);
            }
            else if (server.SessionUserID == 3)
            {
                _localPlayerFraction = GetFractionByID(4);
            }
            else if (server.SessionUserID == 4)
            {
                _localPlayerFraction = GetFractionByID(5);
            }
            else if (server.SessionUserID == 5)
            {
                _localPlayerFraction = GetFractionByID(6);
            }
            else
            {
                SAMLog.Error("GDGSMPC", "Client with SSID: " + server.SessionUserID);
            }

            foreach (var c in GetEntities <Cannon>())
            {
                c.ForceUpdateController();
            }

            GameHUD = new GDMultiplayerGameHUD(this, server);

#if DEBUG
            _server.AddDebugLine(this);
#endif
        }
Exemple #10
0
        protected override void OnAfterDeserialize()
        {
#if DEBUG
            if (NoAfterSerializeFixes)
            {
                return;
            }
#endif

            // In v1.0.1 there was a bug where an INVLOGIN would result in AccountType=Anonymous but UserID=-1
            if (AccountType == AccountType.Local || OnlineUserID == -1)
            {
                OnlineUserID       = -1;
                OnlineUsername     = "******";
                AccountType        = AccountType.Local;
                OnlinePasswordHash = "";
            }

            SingleplayerGameSpeed = GameSpeedModes.NORMAL;             // reset on each Gamestart
        }
Exemple #11
0
        public GDGameScreen_MPServer(MainGame game, GraphicsDeviceManager gdm, LevelBlueprint bp, GameSpeedModes speed, int music, GDMultiplayerServer server)
            : base(game, gdm, bp, FractionDifficulty.DIFF_3, false, true, false)
        {
            musicIdx      = music;
            GameSpeedMode = speed;
            _server       = server;
            CanPause      = false;

            _server.Screen = this;

            _localPlayerFraction = GetFractionByID(1);

            foreach (var c in GetEntities <Cannon>())
            {
                c.ForceUpdateController();
            }

            GameHUD = new GDMultiplayerGameHUD(this, server);

#if DEBUG
            _server.AddDebugLine(this);
#endif
        }
Exemple #12
0
        private string Fmt(GameSpeedModes s)
        {
            switch (s)
            {
            case GameSpeedModes.SUPERSLOW:
                return("-2");

            case GameSpeedModes.SLOW:
                return("-1");

            case GameSpeedModes.NORMAL:
                return("0");

            case GameSpeedModes.FAST:
                return("+1");

            case GameSpeedModes.SUPERFAST:
                return("+2");

            default:
                SAMLog.Error("MPCLP::EnumSwitch_FMT", "Value = " + s);
                return("?");
            }
        }
        public static byte ToByte(GameSpeedModes m)
        {
            switch (m)
            {
            case GameSpeedModes.SUPERSLOW:
                return(0x70);

            case GameSpeedModes.SLOW:
                return(0x78);

            case GameSpeedModes.NORMAL:
                return(0x80);

            case GameSpeedModes.FAST:
                return(0x88);

            case GameSpeedModes.SUPERFAST:
                return(0x90);

            default:
                SAMLog.Error("GSM::EnumSwitch_TB", "Unknown value " + m);
                return(0x00);
            }
        }
Exemple #14
0
        public void SetMultiplayerClientLevelScreen(LevelBlueprint level, GameSpeedModes speed, int music, GDMultiplayerClient server)
        {
            var scrn = new GDGameScreen_MPClient(this, Graphics, level, speed, music, server);

            SetCurrentScreen(scrn);
        }
Exemple #15
0
        public void SetEditorUploadLevel(LevelBlueprint blueprint, SCCMLevelData source, bool first, GameSpeedModes speed = GameSpeedModes.NORMAL)
        {
            var scrn = new GDGameScreen_SCCMUpload(this, Graphics, blueprint, source, speed, first);

            SetCurrentScreen(scrn);
        }
Exemple #16
0
        public void SetEditorTestLevel(LevelBlueprint blueprint, FractionDifficulty d, SCCMLevelData source, GameSpeedModes speed = GameSpeedModes.NORMAL)
        {
            var scrn = new GDGameScreen_SCCMTest(this, Graphics, blueprint, d, source, speed);

            SetCurrentScreen(scrn);
        }