예제 #1
0
 public override void Delete()
 {
     Artist.Tags.Usages.Remove(this);
     Tag.AllArtistTagUsages.Remove(this);
     Votes.Clear();
     Count = 0;
 }
예제 #2
0
 public override void Delete()
 {
     Song.Tags.Usages.Remove(this);
     Tag.AllSongTagUsages.Remove(this);
     Votes.Clear();
     Count = 0;
 }
예제 #3
0
 private void btnClear_Click(object sender, RoutedEventArgs e)
 {
     Votes.Clear();
     SelectedVot = null;
     OnPropertyChanged("Votes");
     dgVotes.Items.Refresh();
 }
예제 #4
0
        public override void Delete()
        {
            base.Delete();

            Song.Tags.Usages.Remove(this);
            Tag.AllSongTagUsages.Remove(this);
            Votes.Clear();
        }
예제 #5
0
        public override void Delete()
        {
            base.Delete();

            Album.Tags.Usages.Remove(this);
            Tag.AllAlbumTagUsages.Remove(this);
            Votes.Clear();
        }
예제 #6
0
        private async void Update()
        {
            var bills = await IoC.API.BillsByMemberAsync(_Member.ID);

            if (bills.Any())
            {
                Bills.Clear();
                for (var i = 0; i < 5; i++)
                {
                    Bills.Add(new BillViewModel(bills[i]));
                }
            }

            var votes = await IoC.API.VotesByMemberAsync(_Member.ID);

            if (votes.Any())
            {
                Votes.Clear();
                for (var i = 0; i < 5; i++)
                {
                    Votes.Add(new VoteViewModel(votes[i]));
                }
            }
        }
    private void OnStateChange(KMGameInfo.State state)
    {
        CurrentState = state;

        if (!transform.gameObject.activeInHierarchy)
        {
            return;
        }

        StartCoroutine(StopEveryCoroutine());
        CheckSupport.Cleanup();
        Votes.Clear();

        if (state != KMGameInfo.State.PostGame && _leaderboardDisplay != null)
        {
            DestroyObject(_leaderboardDisplay);
            _leaderboardDisplay = null;
        }

        twitchGame?.gameObject.SetActive(state == KMGameInfo.State.Gameplay);

        OtherModes.RefreshModes(state);

        // Automatically check for updates after a round is finished or when entering the setup state but never more than once per hour.
        bool hourPassed = DateTime.Now.Subtract(Updater.LastCheck).TotalHours >= 1;

        if ((state == KMGameInfo.State.PostGame || state == KMGameInfo.State.Setup) && hourPassed && !Updater.UpdateAvailable)
        {
            _coroutinesToStart.Enqueue(AutomaticUpdateCheck());
        }

        switch (state)
        {
        case KMGameInfo.State.Gameplay:
            DefaultCamera();
            break;

        case KMGameInfo.State.Setup:
            DefaultCamera();
            _coroutinesToStart.Enqueue(VanillaRuleModifier.Refresh());
            _coroutinesToStart.Enqueue(MultipleBombs.Refresh());
            _coroutinesToStart.Enqueue(FactoryRoomAPI.Refresh());

            if (!initialLoad)
            {
                initialLoad = true;
                _coroutinesToStart.Enqueue(ComponentSolverFactory.LoadDefaultInformation(true));
                if (!TwitchPlaySettings.data.TwitchPlaysDebugEnabled)
                {
                    _coroutinesToStart.Enqueue(CheckSupport.FindSupportedModules());
                }
            }

            // Clear out the retry reward if we return to the setup room since the retry button doesn't return to setup.
            // A post game run command would set the retry bonus and then return to the setup room to start the mission, so we don't want to clear that.
            if (TwitchPlaySettings.GetRewardBonus() == 0)
            {
                TwitchPlaySettings.ClearRetryReward();
            }
            break;

        case KMGameInfo.State.PostGame:
            DefaultCamera();
            if (_leaderboardDisplay == null)
            {
                _leaderboardDisplay = Instantiate(TwitchLeaderboardPrefab);
            }
            Leaderboard.Instance.SaveDataToFile();
            break;

        case KMGameInfo.State.Transitioning:
            ModuleData.LoadDataFromFile();
            TwitchPlaySettings.LoadDataFromFile();

            var pageManager = SceneManager.Instance?.SetupState?.Room.GetComponent <SetupRoom>().BombBinder.MissionTableOfContentsPageManager;
            if (pageManager != null)
            {
                var tableOfContentsList = pageManager.GetValue <List <Assets.Scripts.BombBinder.MissionTableOfContents> >("tableOfContentsList");
                if (tableOfContentsList[SetupState.LastBombBinderTOCIndex].ToCID == "toc_tp_search")
                {
                    SetupState.LastBombBinderTOCIndex = 0;
                    SetupState.LastBombBinderTOCPage  = 0;
                }
            }

            break;
        }
    }
예제 #8
0
 public void ClearVotes()
 {
     Votes.Clear();
 }
예제 #9
0
 /// <summary>
 /// Sets the final decision on a round, and clears the votes.
 /// </summary>
 /// <param name="card">The card to mark as the "decision".</param>
 public void DecideVote(string card)
 {
     Decision = card;
     Votes.Clear(); // Remove this to send all votes from previous rounds to the client (possibly for later display).
 }
예제 #10
0
 /// <summary>
 /// Restarts the round by clearing all votes, un-flipping the cards, and clearing any final decision.
 /// </summary>
 public void Restart()
 {
     Votes.Clear();
     Flipped  = false;
     Decision = "";
 }
예제 #11
0
    public override IEnumerator ReportBombStatus()
    {
        if (_gameroom.GetType() == _factoryStaticModeType)
        {
            IEnumerator baseIEnumerator = base.ReportBombStatus();
            while (baseIEnumerator.MoveNext())
            {
                yield return(baseIEnumerator.Current);
            }
            yield break;
        }
        InitializeOnLightsOn = false;

        TwitchBomb bombHandle = TwitchGame.Instance.Bombs[0];

        bombHandle.BombName = _infiniteMode ? "Infinite bombs incoming" : $"{BombCount} bombs incoming";

        yield return(new WaitUntil(() => GetBomb != null || bombHandle.Bomb.HasDetonated));

        if (bombHandle.Bomb.HasDetonated && !_zenMode)
        {
            yield break;
        }

        float currentBombTimer = bombHandle.CurrentTimer + 5;
        int   currentBombID    = 1;

        while (GetBomb != null)
        {
            Object currentBomb = GetBomb;

            TimerComponent timerComponent = bombHandle.Bomb.GetTimer();
            yield return(new WaitUntil(() => timerComponent.IsActive));

            if (Math.Abs(currentBombTimer - bombHandle.CurrentTimer) > 1f)
            {
                yield return(null);

                InitializeGameModes(true);
            }

            bool enableCameraWall = OtherModes.ZenModeOn && IRCConnection.Instance.State == IRCConnectionState.Connected && TwitchPlaySettings.data.EnableFactoryZenModeCameraWall;
            if (enableCameraWall != TwitchGame.ModuleCameras.CameraWallEnabled)
            {
                if (enableCameraWall)
                {
                    TwitchGame.ModuleCameras.EnableCameraWall();
                }
                else
                {
                    TwitchGame.ModuleCameras.DisableCameraWall();
                }
            }
            bombHandle.BombName = $"Bomb {currentBombID} of {(_infiniteMode ? "∞" : BombCount.ToString())}";
            IRCConnection.SendMessage($"Bomb {currentBombID++} of {(_infiniteMode ? "∞" : BombCount.ToString())} is now live.");

            if (TwitchPlaySettings.data.EnableAutomaticEdgework)
            {
                bombHandle.FillEdgework();
            }
            else
            {
                bombHandle.EdgeworkText.text = TwitchPlaySettings.data.BlankBombEdgework;
            }
            if (OtherModes.Unexplodable)
            {
                bombHandle.StrikeLimit += bombHandle.StrikeCount;
            }

            IEnumerator bombHold = bombHandle.HoldBomb();
            while (bombHold.MoveNext())
            {
                yield return(bombHold.Current);
            }

            Bomb bomb1 = (Bomb)_internalBombProperty.GetValue(currentBomb, null);
            yield return(new WaitUntil(() =>
            {
                bool result = bomb1.HasDetonated || bomb1.IsSolved() || !TwitchGame.BombActive;
                if (!result || OtherModes.TimeModeOn)
                {
                    currentBombTimer = bomb1.GetTimer().TimeRemaining;
                }
                return result;
            }));

            if (!TwitchGame.BombActive)
            {
                yield break;
            }

            Votes.Clear();

            IRCConnection.SendMessage(TwitchGame.Instance.GetBombResult(false));
            TwitchPlaySettings.SetRetryReward();

            foreach (TwitchModule handle in TwitchGame.Instance.Modules)
            {
                //If the camera is still attached to the bomb component when the bomb gets destroyed, then THAT camera is destroyed as wel.
                TwitchGame.ModuleCameras.UnviewModule(handle);
            }

            if (TwitchPlaySettings.data.EnableFactoryAutomaticNextBomb)
            {
                bombHold = bombHandle.LetGoBomb();
                while (bombHold.MoveNext())
                {
                    yield return(bombHold.Current);
                }
                yield return(new WaitForSeconds(1.0f));

                //If for some reason we are somehow still holding the bomb, then the Let go did not register.
                //Try again exactly one more time.
                if (currentBomb == GetBomb)
                {
                    bombHold = bombHandle.HoldBomb();
                    while (bombHold.MoveNext())
                    {
                        yield return(bombHold.Current);
                    }
                    yield return(new WaitForSeconds(0.10f));

                    bombHold = bombHandle.LetGoBomb();
                    while (bombHold.MoveNext())
                    {
                        yield return(bombHold.Current);
                    }
                }
            }

            //If we are still holding the bomb, wait for it to actually be put down manually, or by a Twitch plays Drop bomb command.
            while (currentBomb == GetBomb)
            {
                yield return(new WaitForSeconds(0.1f));
            }

            bombHandle.StartCoroutine(DestroyBomb(currentBomb));

            if (GetBomb == null)
            {
                continue;
            }
            Bomb bomb = (Bomb)_internalBombProperty.GetValue(GetBomb, null);
            InitializeBomb(bomb, true);
        }
    }