public override void RestartLevel(bool updateSpeed) { if (updateSpeed) { MainGame.Inst.Profile.SingleplayerGameSpeed = GameSpeedMode; MainGame.Inst.SaveProfile(); } GDOwner.SetLevelScreen(Blueprint, Difficulty, WorldBlueprint); }
private void ChangeObstacleType() { ObstacleType = (ObstacleStubType)(((int)ObstacleType + 1) % 6); if (GDOwner.CanInsertObstacleStub(Position, ObstacleType, Width, Height, Rotation, this) == null) { Width = GDConstants.TILE_WIDTH / 2f; Height = GDConstants.TILE_WIDTH / 2f; Rotation = 0; } GDOwner.GDHUD.AttrPanel.Recreate(this); }
private void ChangeRot() { var idxCurr = ROTS.IndexOf(Normal); for (int i = 1; i < ROTS.Length; i++) { var idxTest = (idxCurr + i) % ROTS.Length; if (GDOwner.CanInsertPortalStub(Position, Length, ROTS[idxTest], this) != null) { Normal = ROTS[idxTest]; return; } } }
private void ChangeScale() { var idxCurr = SCALES.IndexOf(Scale); for (int i = 1; i < SCALES.Length; i++) { var idxTest = (idxCurr + i) % SCALES.Length; if (GDOwner.CanInsertCannonStub(Position, SCALES[idxTest], this) != null) { Scale = SCALES[idxTest]; return; } } }
private void ChangeRot() { var idxCurr = ROTS.IndexOf(Rotation); for (int i = 1; i < ROTS.Length; i++) { var idxTest = (idxCurr + i) % ROTS.Length; if (GDOwner.CanInsertObstacleStub(Position, ObstacleType, Width, Height, ROTS[idxTest], this) != null) { Rotation = ROTS[idxTest]; return; } } }
private void ChangeDiameter() { var newsize = ((FloatMath.Round(Width / (GDConstants.TILE_WIDTH / 2f))) % 16 + 1) * (GDConstants.TILE_WIDTH / 2f); if (GDOwner.CanInsertObstacleStub(Position, ObstacleType, newsize, newsize, Rotation, this) != null) { Width = Height = newsize; return; } else { Width = Height = (GDConstants.TILE_WIDTH / 2f); return; } }
private void ChangeHeight() { var newheight = FloatMath.Round(Height / (GDConstants.TILE_WIDTH / 2f)) * (GDConstants.TILE_WIDTH / 2f); newheight += (GDConstants.TILE_WIDTH / 2f); if (newheight > GDOwner.LevelData.Height * GDConstants.TILE_WIDTH + 4 * GDConstants.TILE_WIDTH) { newheight = (GDConstants.TILE_WIDTH / 2f); } if (GDOwner.CanInsertObstacleStub(Position, ObstacleType, Width, newheight, Rotation, this) == null) { newheight = (GDConstants.TILE_WIDTH / 2f); } Height = newheight; }
private void ChangeWidth() { var newwidth = FloatMath.Round(Width / (GDConstants.TILE_WIDTH / 2f)) * (GDConstants.TILE_WIDTH / 2f); newwidth += (GDConstants.TILE_WIDTH / 2f); if (newwidth > GDOwner.LevelData.Width * GDConstants.TILE_WIDTH + 4 * GDConstants.TILE_WIDTH) { newwidth = (GDConstants.TILE_WIDTH / 2f); } if (GDOwner.CanInsertObstacleStub(Position, ObstacleType, newwidth, Height, Rotation, this) == null) { newwidth = (GDConstants.TILE_WIDTH / 2f); } Width = newwidth; }
private void ChangeLen() { float nextlen = (GDConstants.TILE_WIDTH / 2f) * (FloatMath.Round(Length / (GDConstants.TILE_WIDTH / 2f)) + 1); if (nextlen > GDConstants.TILE_WIDTH * 4) { nextlen = (GDConstants.TILE_WIDTH / 2f); } if (GDOwner.CanInsertPortalStub(Position, nextlen, Normal, this) != null) { Length = nextlen; } else { Length = (GDConstants.TILE_WIDTH / 2f); } }
private void EndGame(bool playerWon, Fraction winner) { MainGame.Inst.Profile.SingleplayerGameSpeed = GameSpeedMode; MainGame.Inst.SaveProfile(); HasFinished = true; PlayerWon = playerWon; var ctime = (int)(LevelTime * 1000); if (playerWon) { if (!GDOwner.Profile.GetOrAddCustomLevelData(Blueprint.CustomMeta_LevelID).HasCompletedExact(Difficulty)) { GDOwner.Profile.SetCustomLevelCompleted(Blueprint.CustomMeta_LevelID, Difficulty, ctime); } GDOwner.SaveProfile(); ShowScorePanel(Blueprint, GDOwner.Profile, null, true, 0, ctime); MainGame.Inst.GDSound.PlayEffectGameWon(); EndGameConvert(winner); } else { ShowScorePanel(Blueprint, GDOwner.Profile, null, false, 0, ctime); MainGame.Inst.GDSound.PlayEffectGameOver(); EndGameConvert(winner); } foreach (var cannon in Entities.Enumerate().OfType <Cannon>()) { cannon.ForceUpdateController(); } }
private void EndGame(bool playerWon, Fraction winner) { MainGame.Inst.Profile.SingleplayerGameSpeed = GameSpeedMode; MainGame.Inst.SaveProfile(); HasFinished = true; PlayerWon = playerWon; var ctime = (int)(LevelTime * 1000); if (playerWon) { int scoreGain = 0; HashSet <FractionDifficulty> gains = new HashSet <FractionDifficulty>(); for (FractionDifficulty diff = FractionDifficulty.DIFF_0; diff <= Difficulty; diff++) { if (!GDOwner.Profile.GetLevelData(Blueprint.UniqueID).HasCompletedOrBetter(diff)) { scoreGain += FractionDifficultyHelper.GetScore(diff); gains.Add(diff); } } { if (!GDOwner.Profile.GetLevelData(Blueprint.UniqueID).HasCompletedExact(Difficulty)) { GDOwner.Profile.SetCompleted(Blueprint.UniqueID, Difficulty, ctime, true); } var localdata = GDOwner.Profile.LevelData[Blueprint.UniqueID].Data[Difficulty]; if (ctime < localdata.BestTime) { // update PB GDOwner.Profile.SetCompleted(Blueprint.UniqueID, Difficulty, ctime, true); } // Fake the online data until next sync localdata.GlobalCompletionCount++; if (ctime < localdata.GlobalBestTime || localdata.GlobalBestTime == -1) { if (localdata.GlobalBestTime != -1) { // WURLD RECARD !! // Dispatch is trick to put in infront of score panel ... MainGame.Inst.DispatchBeginInvoke(() => { AchievementPopup.Show(L10N.T(L10NImpl.STR_ACH_WORLDRECORD)); }); } localdata.GlobalBestTime = ctime; localdata.GlobalBestUserID = GDOwner.Profile.OnlineUserID; } } GDOwner.SaveProfile(); ShowScorePanel(Blueprint, GDOwner.Profile, gains, true, scoreGain, 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(); } }
private void EndGame(bool playerWon, Fraction winner) { HasFinished = true; PlayerWon = playerWon; var ctime = (int)(LevelTime * 1000); if (playerWon) { int scoreGain = 0; HashSet <FractionDifficulty> gains = new HashSet <FractionDifficulty>(); for (FractionDifficulty diff = FractionDifficulty.DIFF_0; diff <= Difficulty; diff++) { if (!GDOwner.Profile.GetLevelData(Blueprint.UniqueID).HasCompletedOrBetter(diff)) { scoreGain += FractionDifficultyHelper.GetScore(diff); gains.Add(diff); } } { if (!GDOwner.Profile.GetLevelData(Blueprint.UniqueID).HasCompletedExact(Difficulty)) { GDOwner.Profile.SetCompleted(Blueprint.UniqueID, Difficulty, ctime, true); } var localdata = GDOwner.Profile.LevelData[Blueprint.UniqueID].Data[Difficulty]; if (ctime < localdata.BestTime) { // update PB GDOwner.Profile.SetCompleted(Blueprint.UniqueID, Difficulty, ctime, true); } // Fake the online data until next sync localdata.GlobalCompletionCount++; if (ctime < localdata.GlobalBestTime || localdata.GlobalBestTime == -1) { localdata.GlobalBestTime = ctime; localdata.GlobalBestUserID = GDOwner.Profile.OnlineUserID; } } GDOwner.SaveProfile(); ShowScorePanel(Blueprint, GDOwner.Profile, gains, true, scoreGain, 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(); } }
public override void RestartLevel(bool updateSpeed) { GDOwner.SetEditorUploadLevel(Blueprint, SCCMData, false, updateSpeed ? GameSpeedMode : _lastSpeed); }
public override void ReplayLevel(FractionDifficulty diff) { GDOwner.SetTutorialLevelScreen(); }
public override void RestartLevel(bool updateSpeed) { GDOwner.SetTutorialLevelScreen(); }
public override void ReplayLevel(FractionDifficulty diff) { GDOwner.SetEditorUploadLevel(Blueprint, SCCMData, false, GameSpeedMode); }
public override void RestartLevel() { GDOwner.SetTutorialLevelScreen(); }
public override void RestartLevel(bool updateSpeed) { GDOwner.SetEditorTestLevel(Blueprint, Difficulty, SCCMData, updateSpeed ? GameSpeedMode : _lastSpeed); }
public override void ReplayLevel(FractionDifficulty diff) { GDOwner.SetLevelScreen(Blueprint, diff, WorldBlueprint); }
public override void ReplayLevel(FractionDifficulty diff) { GDOwner.SetCustomLevelScreen(Blueprint, diff); }
public override void ReplayLevel(FractionDifficulty diff) { GDOwner.SetEditorTestLevel(Blueprint, Difficulty, SCCMData, GameSpeedMode); }
public override void RestartLevel() { GDOwner.SetLevelScreen(Blueprint, Difficulty, WorldBlueprint, GameSpeedMode); }