public EnhancedHUDDifficultyButton(int depth, FractionDifficulty diff, Action a) { Depth = depth; icon = FractionDifficultyHelper.GetIcon(diff); action = a; }
public string GetCustomLevelTimeString(long onlineID, FractionDifficulty diff) { var dat = GetCustomLevelData(onlineID); if (dat == null) { return(string.Empty); } switch (diff) { case FractionDifficulty.DIFF_0: return(dat.Diff0_HasCompleted ? TimeExtension.FormatMilliseconds(dat.Diff0_BestTime, true) : string.Empty); case FractionDifficulty.DIFF_1: return(dat.Diff1_HasCompleted ? TimeExtension.FormatMilliseconds(dat.Diff1_BestTime, true) : string.Empty); case FractionDifficulty.DIFF_2: return(dat.Diff2_HasCompleted ? TimeExtension.FormatMilliseconds(dat.Diff2_BestTime, true) : string.Empty); case FractionDifficulty.DIFF_3: return(dat.Diff3_HasCompleted ? TimeExtension.FormatMilliseconds(dat.Diff3_BestTime, true) : string.Empty); case FractionDifficulty.NEUTRAL: case FractionDifficulty.PLAYER: default: SAMLog.Error("PP::EnumSwitch_GCLTS", "diff: " + diff); return("?"); } }
public HUDDifficultyButton(int depth, FractionDifficulty diff, HUDDifficultyButtonMode mode, Action a) { Depth = depth; difficulty = diff; icon = FractionDifficultyHelper.GetIcon(diff); action = a; switch (mode) { case HUDDifficultyButtonMode.DEACTIVATED: BackgroundColor = FlatColors.ButtonHUD; ForegroundColor = FlatColors.BackgroundHUD; break; case HUDDifficultyButtonMode.UNLOCKANIMATION: BackgroundColor = FlatColors.ButtonHUD; ForegroundColor = FlatColors.SunFlower; AddOperation(new HUDDifficultyButtonGainOperation()); AddOperation(new HUDDifficultyButtonBlinkingIconOperation()); break; case HUDDifficultyButtonMode.ACTIVATED: BackgroundColor = FlatColors.BackgroundHUD2; ForegroundColor = FlatColors.SunFlower; AddOperation(new HUDDifficultyButtonBlinkingIconOperation()); break; default: SAMLog.Error("HDB::EnumSwitch_CTR", "value: " + mode); break; } }
public static TextureRegion2D GetIcon(FractionDifficulty d) { switch (d) { case FractionDifficulty.KI_EASY: return(Textures.TexDifficultyLine0); case FractionDifficulty.KI_NORMAL: return(Textures.TexDifficultyLine1); case FractionDifficulty.KI_HARD: return(Textures.TexDifficultyLine2); case FractionDifficulty.KI_IMPOSSIBLE: return(Textures.TexDifficultyLine3); case FractionDifficulty.NEUTRAL: case FractionDifficulty.PLAYER: default: SAMLog.Error("FRACDIFF::EnumSwitch_GI", "value = " + d); break; } SAMLog.Error("EnumSwitch_GI", "GetScore()", "FractionDifficultyHelper.GetIcon -> " + d); return(null); }
private void CloseExtender(FractionDifficulty d) { if (State[(int)d] == BistateProgress.Open) { AddEntityOperation(new CloseNodeOperation(d)); } else if (State[(int)d] == BistateProgress.Opening) { float initProgress = 0f; var progress = FindFirstOperationProgress(p => p.Name == "LevelNode::Open::" + (int)d); AbortAllOperations(p => p.Name == "LevelNode::Open::" + (int)d); AbortAllOperations(p => p.Name == "LevelNode::Open::" + (int)d + "#delay"); if (progress != null) { initProgress = 1 - progress.Value; } else { initProgress = 0.9999f; } var o = AddEntityOperation(new CloseNodeOperation(d)); if (initProgress > 0f) { o.ForceSetProgress(initProgress); } } }
public static float GetLaserMultiplicator(FractionDifficulty d) { switch (d) { case FractionDifficulty.PLAYER: return(MULTIPLICATOR_L_PLAYER); case FractionDifficulty.NEUTRAL: return(MULTIPLICATOR_L_NEUTRAL); case FractionDifficulty.KI_EASY: return(MULTIPLICATOR_L_COMPUTER_0); case FractionDifficulty.KI_NORMAL: return(MULTIPLICATOR_L_COMPUTER_1); case FractionDifficulty.KI_HARD: return(MULTIPLICATOR_L_COMPUTER_2); case FractionDifficulty.KI_IMPOSSIBLE: return(MULTIPLICATOR_L_COMPUTER_3); default: SAMLog.Error("EnumSwitch_GLM", "GetBulletMultiplicator()", "FractionDifficultyHelper.GetMultiplicator -> " + d); throw new ArgumentOutOfRangeException(nameof(d), d, null); } }
public bool HasCustomLevelBeaten(long onlineID, FractionDifficulty diff) { var dat = GetCustomLevelData(onlineID); if (dat == null) { return(false); } switch (diff) { case FractionDifficulty.DIFF_0: return(dat.Diff0_HasCompleted); case FractionDifficulty.DIFF_1: return(dat.Diff1_HasCompleted); case FractionDifficulty.DIFF_2: return(dat.Diff2_HasCompleted); case FractionDifficulty.DIFF_3: return(dat.Diff3_HasCompleted); case FractionDifficulty.NEUTRAL: case FractionDifficulty.PLAYER: default: SAMLog.Error("PP::EnumSwitch_HCLB", "diff: " + diff); return(false); } }
public GDGameScreen(MainGame game, GraphicsDeviceManager gdm, LevelFile bp, FractionDifficulty diff) : base(game, gdm) { blueprint = bp; difficulty = diff; Initialize(); }
public void SetCustomLevelCompleted(long oid, FractionDifficulty diff, int time) // no save (!) { var dat = GetOrAddCustomLevelData(oid); switch (diff) { case FractionDifficulty.DIFF_0: dat.Diff0_BestTime = time; dat.Diff0_HasCompleted = true; break; case FractionDifficulty.DIFF_1: dat.Diff1_BestTime = time; dat.Diff1_HasCompleted = true; break; case FractionDifficulty.DIFF_2: dat.Diff2_BestTime = time; dat.Diff2_HasCompleted = true; break; case FractionDifficulty.DIFF_3: dat.Diff3_BestTime = time; dat.Diff3_HasCompleted = true; break; case FractionDifficulty.NEUTRAL: case FractionDifficulty.PLAYER: default: SAMLog.Error("PP::EnumSwitch_SCLC", "diff: " + diff); break; } }
public HUDDifficultyButton(int depth, FractionDifficulty diff, HUDDifficultyButtonMode mode) { Depth = depth; difficulty = diff; icon = FractionDifficultyHelper.GetIcon(diff); switch (mode) { case HUDDifficultyButtonMode.DEACTIVATED: BackgroundColor = FlatColors.ButtonHUD; ForegroundColor = FlatColors.BackgroundHUD; break; case HUDDifficultyButtonMode.UNLOCKANIMATION: BackgroundColor = FlatColors.ButtonHUD; ForegroundColor = GDColors.GetColorForDifficulty(diff); AddHUDOperation(new HUDDifficultyButtonGainOperation()); AddHUDOperation(new HUDBlinkingDifficultyButtonIconOperation()); break; case HUDDifficultyButtonMode.ACTIVATED: BackgroundColor = FlatColors.BackgroundHUD2; ForegroundColor = GDColors.GetColorForDifficulty(diff); AddHUDOperation(new HUDBlinkingDifficultyButtonIconOperation()); break; } }
private bool IsCellActive(FractionDifficulty d, int idx) { bool active; if (solvedPerc[d] < 0.5f) { active = idx < FloatMath.Ceiling(solvedPerc[d] * 15); } else { active = idx <= FloatMath.Floor(solvedPerc[d] * 15); } if (FlickerTime > COLLAPSE_TIME) { return(active); } else { if (active) { return(FloatMath.GetRandom() < (0.5f + FloatMath.FunctionEaseInOutCubic(FlickerTime / COLLAPSE_TIME) / 2f)); } else { return(FloatMath.GetRandom() < (0.5f - FloatMath.FunctionEaseInOutCubic(FlickerTime / COLLAPSE_TIME) / 2f)); } } }
public static string GetShortIdentifier(FractionDifficulty d) { switch (d) { case FractionDifficulty.PLAYER: return("P"); case FractionDifficulty.NEUTRAL: return("N"); case FractionDifficulty.KI_EASY: return("C0"); case FractionDifficulty.KI_NORMAL: return("C1"); case FractionDifficulty.KI_HARD: return("C2"); case FractionDifficulty.KI_IMPOSSIBLE: return("C3"); default: SAMLog.Error("EnumSwitch_GSI", "GetScore()", "FractionDifficultyHelper.GetShortIdentifier -> " + d); throw new ArgumentOutOfRangeException(nameof(d), d, null); } }
private void OpenExtender(FractionDifficulty d) { if (State[(int)d] == BistateProgress.Closed) { float initProgress = 0f; State[(int)d] = BistateProgress.Opening; var o = AddEntityOperationDelayed(new OpenNodeOperation(d), EXTENDER_DELAY * (int)d); if (initProgress > 0f) { o.ForceSetProgress(initProgress); } } else if (State[(int)d] == BistateProgress.Closing) { float initProgress = 0f; var progress = FindFirstOperationProgress(p => p.Name == "LevelNode::Close::" + (int)d); AbortAllOperations(p => p.Name == "LevelNode::Close::" + (int)d); AbortAllOperations(p => p.Name == "LevelNode::Close::" + (int)d + "#delay"); if (progress != null) { initProgress = 1 - progress.Value; } var o = AddEntityOperation(new OpenNodeOperation(d)); if (initProgress > 0f) { o.ForceSetProgress(initProgress); } } }
public int GetTime(FractionDifficulty d) { if (!Data[d].HasCompleted) { return(0); } return(Data[d].BestTime); }
private void SelectDiff(FractionDifficulty d) { SelectedDifficulty = d; _diffButton0.Selected = (FractionDifficulty.DIFF_0 == SelectedDifficulty); _diffButton1.Selected = (FractionDifficulty.DIFF_1 == SelectedDifficulty); _diffButton2.Selected = (FractionDifficulty.DIFF_2 == SelectedDifficulty); _diffButton3.Selected = (FractionDifficulty.DIFF_3 == SelectedDifficulty); }
private Fraction(Color c, Fraction nfrac, FractionType type, float mult, FractionDifficulty diff) { Color = c; Type = type; Difficulty = diff; neutralFraction = (Type == FractionType.NeutralFraction) ? this : nfrac; Multiplicator = mult; BackgroundColor = IsNeutral ? Color.Magenta : ColorMath.Blend(FlatColors.Background, c, 0.25f); }
public void SetCompleted(Guid levelid, FractionDifficulty d, int time, bool upload) { GetLevelData(levelid).SetBestTime(d, time); if (upload && OnlineUserID >= 0) { MainGame.Inst.Backend.SetScore(this, levelid, d, time).EnsureNoError(); } }
public void ShowScorePanel(PlayerProfile.PlayerProfile profile, FractionDifficulty? newDifficulty, bool playerHasWon) { btnPause.IsEnabled = false; btnSpeed.IsEnabled = false; GDOwner.GameSpeedMode = GameSpeedModes.NORMAL; AddElement(new HUDScorePanel(profile, newDifficulty, playerHasWon)); }
public HUDSCCMScorePanel_Lost(LevelBlueprint lvl, FractionDifficulty d) { _level = lvl; SelectedDifficulty = d; RelativePosition = FPoint.Zero; Size = new FSize(WIDTH, HEIGHT); Alignment = HUDAlignment.CENTER; Background = FlatColors.BackgroundHUD; }
public static Fraction CreateComputerFraction(Color c, Fraction neutral, FractionDifficulty diff, bool slow) { return(new Fraction( c, neutral, FractionType.ComputerFraction, FractionDifficultyHelper.GetBulletMultiplicator(diff, slow), FractionDifficultyHelper.GetLaserMultiplicator(diff), diff)); }
private Fraction(Color c, Fraction nfrac, FractionType type, float multBullet, float multLaser, FractionDifficulty diff) { Color = c; Type = type; Difficulty = diff; neutralFraction = (Type == FractionType.NeutralFraction) ? this : nfrac; BulletMultiplicator = multBullet; LaserMultiplicator = multLaser; BackgroundColor = IsNeutral ? Color.Magenta : ColorMath.Blend(FlatColors.Background, c, 0.25f); }
public static NodeBlueprint?FindNextNode(GraphBlueprint g, Guid idnode, FractionDifficulty d) { var snode = Get(g, idnode); if (snode == null) { return(null); } return(FindNextNode(g, snode, d)); }
public HUDSCCMScorePanel_Transmit(LevelBlueprint lvl, FractionDifficulty d, int time) { _level = lvl; _difficulty = d; _time = time; RelativePosition = FPoint.Zero; Size = new FSize(WIDTH, HEIGHT); Alignment = HUDAlignment.CENTER; Background = FlatColors.BackgroundHUD; }
public string GetTimeString(FractionDifficulty d, bool forceMinutes) { var v = Data[d]; if (!v.HasCompleted) { return(string.Empty); } return(TimeExtension.FormatMilliseconds(v.BestTime, forceMinutes)); }
public void SetLevelScreen(LevelBlueprint blueprint, FractionDifficulty d, GraphBlueprint source, GameSpeedModes?speed = null) { var scrn = new GDGameScreen_SP(this, Graphics, blueprint, d, source); if (speed != null) { scrn.GameSpeedMode = speed.Value; scrn.UpdateGameSpeed(); } SetCurrentScreen(scrn); }
public HUDScorePanel(PlayerProfile.PlayerProfile playerprofile, FractionDifficulty? newDifficulty, bool playerHasWon) { gainLevel = newDifficulty; successScreen = playerHasWon; profile = playerprofile; RelativePosition = FPoint.Zero; Size = new FSize(WIDTH, HEIGHT); Alignment = HUDAlignment.CENTER; Background = FlatColors.BackgroundHUD; }
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; }
protected GDGameScreen(MainGame game, GraphicsDeviceManager gdm, LevelBlueprint bp, FractionDifficulty diff, bool prev, bool netw, bool slow) : base(game, gdm) { Blueprint = bp; Difficulty = diff; IsPreview = prev; IsNetwork = netw; _superslow = slow; LaserNetwork = new LaserNetwork(GetPhysicsWorld(), this, (GameWrapMode)bp.WrapMode); Initialize(); }
public int TimeDisplayMode = 1; // (PB, WR, CURR) public HUDSCCMScorePanel_Won(LevelBlueprint lvl, SCCMLevelMeta meta, FractionDifficulty d, int scoreGain, int time) { _level = lvl; LevelMeta = meta; LevelDifficulty = d; SelectedDifficulty = d; _scoreGain = scoreGain; PersonalTimes = MainGame.Inst.Profile.GetCustomLevelTimes(meta.OnlineID); LevelTime = time; RelativePosition = FPoint.Zero; Size = new FSize(WIDTH, HEIGHT); Alignment = HUDAlignment.CENTER; Background = FlatColors.BackgroundHUD; }
public HUDScorePanel(LevelBlueprint lvl, PlayerProfile playerprofile, HashSet <FractionDifficulty> newDifficulties, FractionDifficulty d, bool playerHasWon, int pointInc, int time) { _gainLevel = newDifficulties; _successScreen = playerHasWon; _profile = playerprofile; _increasePoints = pointInc; _level = lvl; _levelDifficulty = d; _leveltime = time; RelativePosition = FPoint.Zero; Size = new FSize(WIDTH, HEIGHT); Alignment = HUDAlignment.CENTER; Background = FlatColors.BackgroundHUD; }
public static Color GetColorForDifficulty(FractionDifficulty d) { switch (d) { case FractionDifficulty.KI_EASY: return COLOR_DIFFICULTY_0; case FractionDifficulty.KI_NORMAL: return COLOR_DIFFICULTY_1; case FractionDifficulty.KI_HARD: return COLOR_DIFFICULTY_2; case FractionDifficulty.KI_IMPOSSIBLE: return COLOR_DIFFICULTY_3; default: throw new ArgumentOutOfRangeException(nameof(d), d, null); } }
public static TextureRegion2D GetIcon(FractionDifficulty d) { switch (d) { case FractionDifficulty.KI_EASY: return Textures.TexDifficulty0; case FractionDifficulty.KI_NORMAL: return Textures.TexDifficulty1; case FractionDifficulty.KI_HARD: return Textures.TexDifficulty2; case FractionDifficulty.KI_IMPOSSIBLE: return Textures.TexDifficulty3; } return null; }
public void SetBestTime(FractionDifficulty d, int?time) { if (time == null) { Data[d].HasCompleted = false; } else { if (Data[d].HasCompleted && Data[d].BestTime < time.Value) { time = Data[d].BestTime; } Data[d].HasCompleted = true; Data[d].BestTime = time.Value; } }
private void SelectDiff(FractionDifficulty d) { SelectedDifficulty = d; if (SelectedDifficulty == LevelDifficulty && TimeDisplayMode == 2) { TimeDisplayMode = 0; } UpdateTDMLabels(); _diffButton0.Selected = (FractionDifficulty.DIFF_0 == SelectedDifficulty); _diffButton1.Selected = (FractionDifficulty.DIFF_1 == SelectedDifficulty); _diffButton2.Selected = (FractionDifficulty.DIFF_2 == SelectedDifficulty); _diffButton3.Selected = (FractionDifficulty.DIFF_3 == SelectedDifficulty); _btnReplay.L10NText = (LevelDifficulty == SelectedDifficulty) ? L10NImpl.STR_HSP_AGAIN : L10NImpl.STR_LVLED_BTN_PLAY; _btnReplay.Icon = (LevelDifficulty == SelectedDifficulty) ? Textures.TexIconRedo : Textures.TexHUDIconPlay; }
private void SpawnOrb(LevelNode me, int cycle) { if (!NextLinkedNodes.Any()) { return; } if (!MainGame.Inst.Profile.EffectsEnabled) { return; } FractionDifficulty d = FractionDifficulty.NEUTRAL; switch (cycle % 4) { case 0: d = FractionDifficulty.DIFF_0; break; case 1: d = FractionDifficulty.DIFF_1; break; case 2: d = FractionDifficulty.DIFF_2; break; case 3: d = FractionDifficulty.DIFF_3; break; default: SAMLog.Error("LN::EnumSwitch_SO", "value: " + (cycle % 4)); break; } if (!LevelData.HasCompletedOrBetter(d)) { d = FractionDifficulty.NEUTRAL; } foreach (var t in OutgoingPipes) { if (!((GameEntity)t.NodeSource).IsInViewport && !((GameEntity)t.NodeSink).IsInViewport) { return; } var orb = new ConnectionOrb(Owner, t, d); Manager.AddEntity(orb); } }
public bool HasCompletedExact(FractionDifficulty d) { switch (d) { case FractionDifficulty.DIFF_0: return(Diff0_HasCompleted); case FractionDifficulty.DIFF_1: return(Diff1_HasCompleted); case FractionDifficulty.DIFF_2: return(Diff2_HasCompleted); case FractionDifficulty.DIFF_3: return(Diff3_HasCompleted); case FractionDifficulty.NEUTRAL: case FractionDifficulty.PLAYER: default: SAMLog.Error("CLD::HasCompletedExact", "Invalid value: " + d); return(false); } }
private void DrawInfoLine(IBatchRenderer sbatch, FractionDifficulty d, int idx, string strTime, bool colorize) { var p1 = Position + new Vector2(32, HEADER_HEIGHT + 40 + 56 * idx); var p2 = Position + new Vector2(64, HEADER_HEIGHT + 40 + 56 * idx); var p3 = Position + new Vector2(224, HEADER_HEIGHT + 40 + 56 * idx); var ic = (node.LevelData.HasCompletedOrBetter(d) ? FractionDifficultyHelper.GetColor(d) : FlatColors.Concrete) * progressDisplay; var tc = (node.LevelData.HasCompletedOrBetter(d) ? FlatColors.TextHUD : FlatColors.Asbestos) * progressDisplay; if (colorize && node.LevelData.Data[d].GlobalBestUserID >= 0 && node.LevelData.Data[d].GlobalBestUserID == MainGame.Inst.Profile.OnlineUserID) { tc = FlatColors.SunFlower * progressDisplay; } sbatch.DrawCentered(Textures.TexCircle, p1, 48, 48, FlatColors.WetAsphalt * progressDisplay); sbatch.DrawCentered(FractionDifficultyHelper.GetIcon(d), p1, 32, 32, ic); FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontRegular, 32, FractionDifficultyHelper.GetDescription(d), tc, p2); FontRenderHelper.DrawTextVerticallyCentered(sbatch, Textures.HUDFontRegular, 32, strTime, tc, p3); }
public const float MULTIPLICATOR_COMPUTER_3 = 1.000f; // Impossible public static float GetMultiplicator(FractionDifficulty d) { switch (d) { case FractionDifficulty.PLAYER: return MULTIPLICATOR_PLAYER; case FractionDifficulty.NEUTRAL: return MULTIPLICATOR_NEUTRAL; case FractionDifficulty.KI_EASY: return MULTIPLICATOR_COMPUTER_0; case FractionDifficulty.KI_NORMAL: return MULTIPLICATOR_COMPUTER_1; case FractionDifficulty.KI_HARD: return MULTIPLICATOR_COMPUTER_2; case FractionDifficulty.KI_IMPOSSIBLE: return MULTIPLICATOR_COMPUTER_3; default: throw new ArgumentOutOfRangeException(nameof(d), d, null); } }
public static string GetShortIdentifier(FractionDifficulty d) { switch (d) { case FractionDifficulty.PLAYER: return "P"; case FractionDifficulty.NEUTRAL: return "N"; case FractionDifficulty.KI_EASY: return "C0"; case FractionDifficulty.KI_NORMAL: return "C1"; case FractionDifficulty.KI_HARD: return "C2"; case FractionDifficulty.KI_IMPOSSIBLE: return "C3"; default: throw new ArgumentOutOfRangeException(nameof(d), d, null); } }
public bool HasCompleted(FractionDifficulty d) { return completedDifficulties.Contains(d); }
public void SetCompleted(FractionDifficulty d) { completedDifficulties.Add(d); }
public static Fraction CreateComputerFraction(Color c, Fraction neutral, FractionDifficulty diff) { return new Fraction(c, neutral, FractionType.ComputerFraction, FractionDifficultyHelper.GetMultiplicator(diff), diff); }