Example #1
0
    private void OnEnable()
    {
        Instance   = this;
        BombActive = true;
        EnableDisableInput();
        Leaderboard.Instance.ClearSolo();
        LogUploader.Instance.Clear();
        callsNeeded = 1;
        CallingPlayers.Clear();

        _bombStarted = false;
        ParentService.GetComponent <KMGameInfo>().OnLightsChange += OnLightsChange;

        StartCoroutine(CheckForBomb());
        try
        {
            string path = Path.Combine(Application.persistentDataPath, "TwitchPlaysLastClaimed.json");
            LastClaimedModule = SettingsConverter.Deserialize <Dictionary <string, Dictionary <string, double> > >(File.ReadAllText(path));
        }
        catch (Exception ex)
        {
            DebugHelper.LogException(ex, "Couldn't read TwitchPlaysLastClaimed.json:");
            LastClaimedModule = new Dictionary <string, Dictionary <string, double> >();
        }
    }
    private void OnEnable()
    {
        Instance   = this;
        BombActive = true;
        EnableDisableInput();
        Leaderboard.Instance.ClearSolo();
        LogUploader.Instance.Clear();
        callsNeeded = 1;
        CallingPlayers.Clear();
        callWaiting           = false;
        VoteDetonateAttempted = false;
        ProcessingClaimQueue  = false;
        VoteSolveCount        = 0;
        FindClaimPlayers.Clear();
        MysteryModuleShim.CoveredModules.Clear();
        RetryAllowed = true;

        _bombStarted = false;
        ParentService.GetComponent <KMGameInfo>().OnLightsChange += OnLightsChange;

        StartCoroutine(CheckForBomb());

        StartCoroutine(new WaitForSeconds(TwitchPlaySettings.data.InstantModuleClaimCooldown).Yield(() => ClaimCooldown = false));

        FindClaimUse = TwitchPlaySettings.data.FindClaimLimit;
        alertSound   = gameObject.Traverse <AudioSource>("AlertSound");
        StartCoroutine(AdjustFindClaimLimit());
        if (OtherModes.TrainingModeOn)
        {
            StartCoroutine(EndTrainingModeBomb());
        }
        try
        {
            string path = Path.Combine(Application.persistentDataPath, "TwitchPlaysLastClaimed.json");
            LastClaimedModule = SettingsConverter.Deserialize <Dictionary <string, Dictionary <string, double> > >(File.ReadAllText(path));
        }
        catch (Exception ex)
        {
            DebugHelper.LogException(ex, "Couldn't read TwitchPlaysLastClaimed.json:");
            LastClaimedModule = new Dictionary <string, Dictionary <string, double> >();
        }
    }
    private void OnEnable()
    {
        BombActive = true;
        EnableDisableInput();
        leaderboard.ClearSolo();
        TwitchPlaysService.logUploader.Clear();

        bool bombStarted = false;

        parentService.GetComponent <KMGameInfo>().OnLightsChange += delegate(bool on)
        {
            if (bombStarted || !on)
            {
                return;
            }
            bombStarted = true;

            if (TwitchPlaySettings.data.BombLiveMessageDelay > 0)
            {
                System.Threading.Thread.Sleep(TwitchPlaySettings.data.BombLiveMessageDelay * 1000);
            }

            if (_bombCommanders.Count == 1)
            {
                _ircConnection.SendMessage(TwitchPlaySettings.data.BombLiveMessage);
            }
            else
            {
                _ircConnection.SendMessage(TwitchPlaySettings.data.MultiBombLiveMessage);
            }

            if (TwitchPlaySettings.data.EnableAutomaticEdgework)
            {
                foreach (var commander in _bombCommanders)
                {
                    commander.FillEdgework(commander.twitchBombHandle.bombID != _currentBomb);
                }
            }
            OtherModes.setMultiplier(9);
        };

        StartCoroutine(CheckForBomb());
    }