internal void OnFlipFinished(FlipEventArgs args) { EffectsManager.Instance.PlayEvent(EffectsManager.AudioEvent.GameSolved); controller.FlipFinished -= OnFlipFinished; Advance(1); gui.HideText(); }
private void OnSolved(AfterSolvedInfo info) { LevelManager.Instance.Stars += info.newStars; effectsManager.PlayEvent((History.Count == puzzle.level.MinMoves) ? EffectsManager.AudioEvent.OptimallySolved : EffectsManager.AudioEvent.GameSolved); Statistics.Instance[Statistics.Stats.PuzzlesSolved]++; if (!PlayingTutorial) { HideCoins(); } if (info.state.PuzzleSolved || info.state.NoChanges || PlayingRandom) { Invoke("NextPuzzle", (CurrentLevel.type != Level.LevelType.image) ? puzzleSwitchTime : imageSwitchTime); } if (PlayingNormal) { Tracking.Track(Tracking.GAME_PUZZLE_SOLVED, 0); CallFlipEvent(PuzzleSolved, FlipEventArgs.PuzzleSolvedArgs(puzzle, state, mode, info)); } }
public void OnPuzzleSolved(FlipEventArgs args) { undoButton.Hide(); levelDetail.SetLevelStats(LevelManager.Instance.GetLevelStats(controller.CurrentLevel.Ref)); if (controller.PlayingRandom) { return; } StartCoroutine(ShowStars(args.info.newStars)); bool showSmallCongrats = true; var state = args.info.state; if (state.LevelUnlocked) { ShowMessageId("solved.LevelUnlocked"); showSmallCongrats = false; } if (state.LevelMastered) { nextPuzzleButton.Hide(); controller.CanProcessInput = false; Invoke("LevelMastered", 2); showSmallCongrats = false; } else if (state.LevelFinished) // else if, because both level finished and levelmastered might be triggered together { nextPuzzleButton.Hide(); controller.CanProcessInput = false; Invoke("LevelFinished", 2); showSmallCongrats = false; } if (state.AllLevelsFinished) { controller.CanProcessInput = false; showSmallCongrats = false; } if (showSmallCongrats && state.PuzzleSolved) { if (Random.Range(0, 2) == 0) { if (args.info.newStars == 2) { ShowMessageId("solved.Good"); } else if (args.info.newStars == 3) { ShowMessageId("solved.Perfect"); } } } }
internal void AdvanceIfMatches(FlipEventArgs args) { movesArrow.Hide(); if (args.isSolved) { controller.FlipFinished -= AdvanceIfMatches; Advance(1); gui.HideText(); } }
public void OnPuzzleSet(FlipEventArgs args) { ClearGUI(); movesDisplay.Init(0, args.puzzle.level.MinMoves, false); if (!controller.PlayingTutorial) { nextPuzzleButton.Show(); movesDisplay.Show(); } starsBase.SetActive(controller.PlayingNormal); }
public void OnNumMovesChanged(FlipEventArgs args) { if (args.Moves == 0 || args.isSolved) { undoButton.Hide(); } else { undoButton.Show(); } if (controller.CanHint) { hintButton.Show(); } else { hintButton.Hide(); } movesDisplay.SetValue(args.Moves, args.isSolved); }
public void OnLevelSet(FlipEventArgs args) { ClearGUI(); levelDetail.SetLevelStats(LevelManager.Instance.GetLevelStats(controller.CurrentLevel.Ref)); var level = args.puzzle.level; if (level != null) { if (controller.PlayingNormal) { var oneliner = string.Format("{0}\n({1} {2})", oneLiners[level.type.ToString()], level.MinMoves, tr["Moves"]); ShowText(oneliner); Invoke("HideText", 3); } if (!controller.PlayingTutorial) { movesDisplay.Init(0, args.puzzle.level.MinMoves, false); movesDisplay.Show(); } } }
internal void AdvanceIfSolved(FlipEventArgs args) { movesArrow.Hide(); int advanceTime = 1; if (args.isSolved) { controller.FlipFinished -= AdvanceIfSolved; bool solvedOptimal = gui.movesDisplay.Moves == 2; if (!solvedOptimal) { gui.ShowText(tr["NotInTwo"]); advanceTime = 2; } gui.levelDetail.SetLevelStats(new SolvedStats(0, 0, solvedOptimal ? 0 : 1, solvedOptimal ? 1 : 0)); Advance(advanceTime); gui.HideText(); } }
private void OnFinished(FlipEventArgs args) { EffectsManager.Instance.PlayEvent(EffectsManager.AudioEvent.GameSolved); generator.AnimateBigImage(bigImageDelay, bigImageRatio); Invoke("GotoMain", beforeMainDelay + bigImageDelay); }
// calls the specified flip event with args, or generates the current ones if needed private void CallFlipEvent(FlipEvent evt, FlipEventArgs args = null) { evt?.Invoke(args ?? CurrentArgs); }
// Hints finish with an OnReset event internal void OnResetFinished(FlipEventArgs args) { controller.ResetFinished -= OnResetFinished; controller.CanProcessInput = true; controller.FlipFinished += OnFlipFinished; }