Пример #1
0
 public GameFinishedEventArgs(string name, int score, int level, EndReason reason)
 {
     _name   = name;
     _score  = score;
     _reason = reason;
     _level  = level;
 }
Пример #2
0
 public void Update(EndReason reason, float score)
 {
     Reason      = reason;
     Score       = score;
     TotalScore += score;
     MaxScore    = Math.Max(MaxScore, score);
 }
Пример #3
0
 public GrepStatistics EndRun(EndReason endReason)
 {
     EndReason = endReason;
     if (!Enabled)
     {
         return(this);
     }
     _stopwatch?.Stop();
     return(this);
 }
Пример #4
0
        public static KeyValuePair <string, int> Stop(string Winner = "", EndReason Reason = EndReason.Manual, bool Announce = false)
        {
            KeyValuePair <string, int> WinningOption = new KeyValuePair <string, int>();

            lock (Options)
            {
                if (Options.Count > 1)
                {
                    IsOpen = false;

                    Dictionary <string, int> Votes = new Dictionary <string, int>();
                    foreach (string voter in Voters.Keys)
                    {
                        if (!Votes.ContainsKey(Voters[voter]))
                        {
                            Votes.Add(Voters[voter], 0);
                        }

                        Votes[Voters[voter]]++;
                    }

                    if (Winner == "")
                    {
                        Votes.OrderByDescending(vote => vote.Value);

                        Winner = Votes.ElementAt(0).Key;
                    }

                    WinningOption = new KeyValuePair <string, int>(Winner, Votes[Winner]);

                    OnPollEnd(WinningOption.Key, WinningOption.Value, Reason);

                    if (Announce)
                    {
                        Chat.SendMessage("The poll has ended! Winning option: " + WinningOption.Key + " with " + WinningOption.Value + " votes.");
                    }

                    VoteCost       = 5;
                    VotesGoal      = 0;
                    TotalVotesGoal = 0;
                    Options.Clear();
                    Voters.Clear();
                    Winner = "";
                }
                else
                {
                    if (Announce)
                    {
                        Chat.SendMessage("A poll must be started first.");
                    }
                }
            }

            return(WinningOption);
        }
Пример #5
0
        private void DisplayEndAndPlaySound(Player player, EndReason reason)
        {
            var score = Score(player);

            // play sound
            switch (reason)
            {
            case EndReason.AtFinish:
                World.Play(WinSoundPath);
                break;

            case EndReason.DeathByFalling:
            case EndReason.DeathBySpider:
            case EndReason.DeathBySpike:
                World.Play(DeathSoundPath);
                break;

            default: throw new Exception("Invalid end reason : " + reason);
            }

            // show the menu
            EndMenu.Update(reason, score);
            World.ShowMenu(EndMenu);

            // TODO! wait for Stickario to finish its current move

            // take action
            if (reason == EndReason.AtFinish)
            {
                // remove the player and show the menu
                player.ReduceHealth(player.Health);
                World.RemoveItem(player);
            }
            else
            {
                // teleport the player back to the begining
                World.Teleport(player, StartingX + (PlatformThickness * 2), StartingY - (PlatformThickness * 2));

                // start death sequence for all active spiders
                lock (ActiveSpiders)
                {
                    foreach (var spider in ActiveSpiders)
                    {
                        spider.StartDeathSequence();
                    }
                    ActiveSpiders.Clear();
                }
            }
        }
Пример #6
0
    void EndGame(EndReason reason)
    {
        switch (reason)
        {
        case EndReason.mutiny:
            print("Mutiny ended your journey");
            Application.LoadLevel("Mainmenu");
            break;

        case EndReason.noMoreCrew:
            print("You have no more crew members :/");
            Application.LoadLevel("Mainmenu");
            break;
        }
    }
Пример #7
0
    public void EndGame(EndReason endReason = EndReason.Escape)
    {
        IsGameStarted = false;
        UIController.Instance.EndGame();
        Maze.Instance.DestroyMaze();

        TempResult.lifetime       = (int)TimeSpan.FromTicks(DateTime.Now.Ticks - TempResult.startDate.Ticks).TotalSeconds;
        TempResult.endReason      = endReason.ToString();
        TempResult.coinsCollected = CoinsCollected;
        XmlController.UpdateResults(TempResult);

        CoinsCollected  = 0;
        CurCoinsAmmount = 0;
        zombiesAmmount  = 0;
        isMummySpawned  = false;
    }
Пример #8
0
        private void Complete(EndReason reason)
        {
            if (_timer is { } timer)
            {
                timer.Stop();                 // Safety only, should already have been stopped!
                timer.State = null;
                timer.Tick -= RunNextFrame;

                _timer = null;
            }

            _watch.Stop();
            _frameSubscription?.Dispose();

            if (Interlocked.Exchange(ref _state, States.Ended) != States.Ended)
            {
                _onCompleted(reason);
            }
        }
Пример #9
0
        public static void Postfix1(AmongUsClient __instance, ClientData MLPPNIKICPC, GABADEGMIHF AMGCOJNIHLM)
        {
            MLPPNIKICPC.Character.FIMGDJOCIGD.IAGJEKLJCCI = true;

            if (PlayerController.players != null)
            {
                if (AmongUsClient.Instance.ClientId == AmongUsClient.Instance.HostId)
                {
                    EndReason reason = Love.CheckWin();

                    if (reason == EndReason.LoveWin)
                    {
                        MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(InnerPlayerControl.LocalPlayer.NetId, (byte)CustomRPC.LoveWin, Hazel.SendOption.Reliable, -1);
                        writer.Write((byte)reason);
                        AmongUsClient.Instance.FinishRpcImmediately(writer);

                        PlayerControlPatch.LoveCoupleWins();
                        ShipStatus.EABBNOODFGL(AMGMAKBHCMN.ImpostorByVote, false);
                    }
                }
            }
        }
Пример #10
0
 public EndGameEvent(Player winner, EndReason rationale)
 {
     this.winner    = winner;
     this.rationale = rationale;
 }
Пример #11
0
        public static Dictionary <string, object> BuildCreateTemplateWithProcessRequest(PrivateApiResponse <List <OptionSearchResponse> > optionPhaseProcess, PrivateApiResponse <List <OptionSearchResponse> > optionEndReason, PhaseType phaseType, CommonEnums phaseMemo, EndFlag endFlag, EndReason endReason)
        {
            var request = new Dictionary <string, object>(DefaultCreateRequest);
            var phases  = new Dictionary <string, object>
            {
                [Phase.Resource.GetEnumStringValue()]  = ResourceId.Process,
                [Phase.Phase.GetEnumStringValue()]     = optionPhaseProcess.Result.First()?.Children?.LastOrDefault()?.Alias,
                [Phase.PhaseDate.GetEnumStringValue()] = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"),
            };

            PhaseTypeMapperValue[phaseType](phases);
            CommonMapperValue[phaseMemo.ToString()](Phase.PhaseMemo.GetEnumStringValue(), phases);
            EndFlagMapperValue[endFlag](phases);
            EndReasonMapperValue[endReason](new List <string> {
                optionEndReason.Result.First().Alias, optionEndReason.Result.Last().Alias
            }, phases);
            request[Parameters.Phase.GetEnumStringValue()] = phases;
            return(request);
        }
Пример #12
0
 public static void AddReason(FlatBufferBuilder builder, EndReason reason)
 {
     builder.AddByte(10, (byte)reason, 0);
 }
        public static bool Prefix(ShipStatus __instance)
        {
            if (__instance.CheckTaskCompletion())
            {
                return(true);
            }
            if (__instance.Systems.ContainsKey(SystemType.Reactor))
            {
                if (__instance.GetIl2CppType() == AirshipStatus.Il2CppType)
                {
                    HeliSabotageSystem Reactor = __instance.Systems[SystemType.Reactor].Cast <HeliSabotageSystem>();
                    if (Reactor.LEJABJDEHPE & Reactor.GPBBPGOINOF <= 0)
                    {
                        return(true);
                    }
                }
                else
                {
                    ReactorSystem Reactor = __instance.Systems[SystemType.Reactor].Cast <ReactorSystem>();
                    if (Reactor.LEJABJDEHPE & Reactor.GPBBPGOINOF <= 0)
                    {
                        return(true);
                    }
                }
            }
            if (__instance.Systems.ContainsKey(SystemType.LifeSupp))
            {
                OxygenSystem oxygen = __instance.Systems[SystemType.LifeSupp].Cast <OxygenSystem>();
                if (oxygen.LEJABJDEHPE & oxygen.GPBBPGOINOF <= 0)
                {
                    return(true);
                }
            }
            if (__instance.Systems.ContainsKey(SystemType.Laboratory))
            {
                ReactorSystem Reactor = __instance.Systems[SystemType.Laboratory].Cast <ReactorSystem>();
                if (Reactor.LEJABJDEHPE & Reactor.GPBBPGOINOF <= 0)
                {
                    return(true);
                }
            }

            EndReason reason = Love.CheckWin();

            if (reason == EndReason.IgnoreEndReason)
            {
                return(true);
            }
            if (reason == EndReason.NoWin)
            {
                return(false);
            }


            if (reason == EndReason.LoveWin)
            {
                MessageWriter writer = AmongUsClient.Instance.StartRpc(InnerPlayerControl.LocalPlayer.NetId, (byte)CustomRPC.LoveWin, Hazel.SendOption.Reliable);
                writer.Write((byte)reason);
                writer.EndMessage();

                PlayerControlPatch.LoveCoupleWins();
                ShipStatus.EABBNOODFGL(AMGMAKBHCMN.ImpostorByVote, true);
                return(false);
            }
            return(true);
        }
        public void TestCreateTemplateWithProcess(PhaseType phaseType, PhaseDate phaseDate, CommonEnums phaseMemo, EndFlag endFlag, EndReason endReason)
        {
            var handler  = new DefaultManager();
            var request  = BuildCreateTemplateWithProcessRequest(OptionPhaseProcess, OptionEndReason, phaseType, phaseMemo, endFlag, endReason);
            var response = handler.Send <CreateTemplateResponse>(TemplateEndPoint, JsonConvert.SerializeObject(request), HttpMethod.POST);

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK));
            request[IdParam] = response.Result.Id;
            ReadAndVerifyData(request);
        }
Пример #15
0
        public void CheckVictoryCondition()
        {
            bool noInjured = Characters.All(ch => !ch.Wounded || ch.Dead);
            bool noFires   = TilesOnFire == 0;
            bool noEnemies = Characters.All(ch => !ch.Hostile || ch.Dead);

            if (noInjured && noFires && noEnemies)
            {
                Victory     = true;
                VictoryText =
                    "All injured civilians are evacuated, all fires are extinguished and all hostiles are taken care of!\n\nWell done!\n\n";
                if (LevelId == MonasteryTags.MonasteryLevelId)
                {
                    if (Characters.Count(ch => ch.Dead && !ch.Hostile) == 0)
                    {
                        VictoryText +=
                            "You passed the final challenge with the unexpected exploding trap without loss of life. That is still commendable. You are now ready to take on an actual emergency, where your decisions save lives, or end them.";
                    }
                    else
                    {
                        VictoryText +=
                            "You passed the challenge, but life was lost along the way. Perhaps you were not fast enough or overextended when fighting ghouls or fires.\n\nEither way, the loss of life is on your conscience. Had you made a better decision, decades of life of innocent people would not have been cut away.\n\nLearn from this and do better in an actual emergency.";
                    }
                }
                else
                {
                    int paladinsLost  = Characters.Count(ch => !ch.IsNPC && ch.Dead);
                    int civiliansLost = Characters.Count(ch => ch.Dead && ch.IsNPC && !ch.Hostile);
                    if (paladinsLost == 0 && civiliansLost == 0)
                    {
                        VictoryText +=
                            "{b}Congratulations!{/b} This is the best you could hope for! No deaths among the paladins, and no deaths among civilians either! It may seem just like 'doing your job' to you, but every life saved means a family kept intact or a paladin still working in defense of the realm. Too often in our job, we must make a decision on who to save and who     to let die. You proved that it does not always have to be that way.";
                    }
                    else if (paladinsLost == 0)
                    {
                        VictoryText +=
                            "You chose to proceed cautiously and not let your people die. That is a reasonable decision and earns you the respect of your paladins. However, standing by while horror happens to civilians is not what the Paladin Rescue Team is about. If you made a better decision somewhere along the way, you wonder, could you have saved more?";
                    }
                    else if (civiliansLost == 0)
                    {
                        VictoryText +=
                            "You made the decision to sacrifice paladins to save civilians. Of course, such a decision is never easy but you likely made the right choice. After all, the paladin did sign up for this and will receive a well-deserved reward in the Seven Heavens. You wonder, though, how their family will feel about your decision...";
                    }
                    else
                    {
                        VictoryText +=
                            "The mission was a success, technically, but your decisions could have been better. They led to the death of both a paladin and a civilian, both of which you are supposed to protect. Yes, in an emergency, time flies fast and it is difficult to think. But we must do so nonetheless. That is, after all, a decision we made a long time ago when we joined the Team.";
                    }

                    if (ChosenDifficulty != Difficulty.Meaningful)
                    {
                        VictoryText +=
                            "\n\nThat said, you're not playing at the {b}meaningful difficulty level{/b}. All difficulty levels except 'meaningful' do not accurately represent reality. It is possible that your strategy would not have worked without the crutch of easy difficulty.";
                    }
                }

                return;
            }
            bool noPaladins = Characters.All(ch => ch.IsNPC || ch.Dead);

            if (noPaladins)
            {
                Victory          = false;
                VictoryEndReason = EndReason.PaladinDeath;
                return;
            }

            if (ChosenDifficulty != Difficulty.Easy)
            {
                int numDead = Characters.Count(cnt => !cnt.Hostile && cnt.Dead);
                if (numDead >= 3)
                {
                    Victory          = false;
                    VictoryEndReason = EndReason.CivilianDeath;
                }

                int fires = TilesOnFire + TilesBurntOut;
                if (fires >= 300)
                {
                    Victory          = false;
                    VictoryEndReason = EndReason.FireOutOfControl;
                }
            }
        }
Пример #16
0
 public static KeyValuePair <string, int> Stop(string Winner = "", EndReason Reason = EndReason.Manual, bool Announce = false)
 {
     return(Poll.Stop(Winner, Reason, Announce));
 }
Пример #17
0
        public static KeyValuePair<string, int> Stop(string Winner = "", EndReason Reason = EndReason.Manual, bool Announce = false)
        {
            KeyValuePair<string, int> WinningOption = new KeyValuePair<string,int>();

            lock (Options)
            {
                if (Options.Count > 1)
                {
                    IsOpen = false;

                    Dictionary<string, int> Votes = new Dictionary<string, int>();
                    foreach (string voter in Voters.Keys)
                    {
                        if (!Votes.ContainsKey(Voters[voter])) Votes.Add(Voters[voter], 0);

                        Votes[Voters[voter]]++;
                    }

                    if (Winner == "")
                    {
                        Votes.OrderByDescending(vote => vote.Value);

                        Winner = Votes.ElementAt(0).Key;
                    }

                    WinningOption = new KeyValuePair<string, int>(Winner, Votes[Winner]);

                    OnPollEnd(WinningOption.Key, WinningOption.Value, Reason);

                    if (Announce) Chat.SendMessage("The poll has ended! Winning option: " + WinningOption.Key + " with " + WinningOption.Value + " votes.");

                    VoteCost = 5;
                    VotesGoal = 0;
                    TotalVotesGoal = 0;
                    Options.Clear();
                    Voters.Clear();
                    Winner = "";
                }
                else
                {
                    if (Announce) Chat.SendMessage("A poll must be started first.");
                }
            }

            return WinningOption;
        }
Пример #18
0
        void EndScene(EndReason endReason)
        {
            if (_gameOver) return;
            _gameOver = true;

            var label = GetLabel(endReason == EndReason.Win ? "You win!" : "You lose!");
            label.Scale = 0.1f;
            label.Position = new CCPoint(wSize.Width / 2, wSize.Height * 0.6f);
            InformationLayer.AddChild(label);

            //var restartItem = GetLabel("Restart");
            //var menu = GetMenu(0.1f, new CCMenuItemLabel(restartItem, restartTapped));
            //menu.Position = new CCPoint(wSize.Width / 2, wSize.Height * 0.4f);

            //restartItem.RunAction(new CCScaleTo(0.5f, 1.0f));
            label.RunAction(new CCScaleTo(0.5f, 1.0f));
        }
Пример #19
0
 public static KeyValuePair<string, int> Stop(string Winner = "", EndReason Reason = EndReason.Manual, bool Announce = false) { return Poll.Stop(Winner, Reason, Announce); }