예제 #1
0
        public void UpdateRequestUI(bool writeSummary = true)
        {
            Plugin.Log("start updateUI");
            try {
                if (writeSummary)
                {
                    RequestBot.WriteQueueSummaryToFile(); // Write out queue status to file, do it first
                }
                Dispatcher.RunOnMainThread(() =>
                {
                    //this.interactable = true;

                    if (RequestQueue.Songs.Count == 0)
                    {
                        this.gameObject.GetComponentInChildren <Image>().color = Color.red;
                    }
                    else
                    {
                        this.gameObject.GetComponentInChildren <Image>().color = Color.green;
                    }
                });
            }
            catch (Exception ex) {
                Plugin.Log(ex.ToString());
            }
            finally {
                Plugin.Log("end update UI");
            }
        }
        public void AddSongToQueue_onEmptyQueue_insertsAtIndex0()
        {
            List <SongRequest> queue = new();
            int insertionPoint       = RequestBot.GetQueueInsertionPoint(queue, RequestBot.QueueInsertionStyle.RoundRobin, "A");

            Assert.Equal(0, insertionPoint);
        }
 private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
 {
     if (arg0.name == "Menu")
     {
         Settings.OnLoad();
         RequestBot.OnLoad();
     }
 }
예제 #4
0
        public void Constraactor(SoloFreePlayFlowCoordinator soloFreePlayFlowCoordinator, LevelCollectionViewController levelCollectionViewController, RequestFlowCoordinator requestFlowCoordinator, RequestBot bot)
        {
            _soloFlowCoordinator           = soloFreePlayFlowCoordinator;
            _levelCollectionViewController = levelCollectionViewController;
            _flowCoordinator     = requestFlowCoordinator;
            _bot                 = bot;
            _bot.RecevieRequest += this._bot_RecevieRequest;

            _bot.Dismiss         += this.Bot_Dismiss;
            _bot.UpdateUI        += this._bot_UpdateUI;
            this.transform.parent = _levelCollectionViewController.rectTransform;
        }
        public void AddSongToQueue_onQueueWhereEveryoneHasOneSong_insertsAtEnd()
        {
            List <SongRequest> queue = new()
            {
                new SongRequest(null, generateFakeTwitchUser("A"), DateTime.UtcNow),
                new SongRequest(null, generateFakeTwitchUser("B"), DateTime.UtcNow),
                new SongRequest(null, generateFakeTwitchUser("C"), DateTime.UtcNow),
            };
            int insertionPoint = RequestBot.GetQueueInsertionPoint(queue, RequestBot.QueueInsertionStyle.RoundRobin, "D");

            Assert.Equal(3, insertionPoint);
        }
        public void AddSongToQueue_onIfThisIsRequestersFirstSongAndSomeoneHasMultipleSongsInQueue_insertBeforeAnyonesSecondSong()
        {
            List <SongRequest> queue = new()
            {
                new SongRequest(null, generateFakeTwitchUser("A"), DateTime.UtcNow),
                new SongRequest(null, generateFakeTwitchUser("B"), DateTime.UtcNow),
                new SongRequest(null, generateFakeTwitchUser("A"), DateTime.UtcNow),
                new SongRequest(null, generateFakeTwitchUser("C"), DateTime.UtcNow),
            };
            int insertionPoint = RequestBot.GetQueueInsertionPoint(queue, RequestBot.QueueInsertionStyle.RoundRobin, "D");

            Assert.Equal(2, insertionPoint);
        }
예제 #7
0
        public static void PRIVMSG(TwitchMessage twitchMsg, MatchCollection tags)
        {
            twitchMsg.user.displayName = twitchMsg.hostString.Split('!')[0];
            foreach (Match t in tags)
            {
                ParseMessageTag(t, ref twitchMsg);
            }

            MessageParser.Parse(new ChatMessage(Utilities.StripHTML(twitchMsg.message), twitchMsg));
            if (Config.Instance.SongRequestBot)
            {
                RequestBot.Parse(twitchMsg.user, twitchMsg.message);
            }
        }
예제 #8
0
        protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling)
        {
            if (firstActivation)
            {
                var KeyboardContainer = new GameObject("KeyboardContainer", typeof(RectTransform)).transform as RectTransform;
                KeyboardContainer.SetParent(this.rectTransform, false);
                KeyboardContainer.sizeDelta = new Vector2(60f, 40f);

                var mykeyboard = this._factiry.Create().Setup(KeyboardContainer, "");

#if UNRELEASED
                //mykeyboard.AddKeys(BOTKEYS, 0.4f);
                RequestBot.AddKeyboard(mykeyboard, "emotes.kbd", 0.4f);
#endif
                mykeyboard.AddKeys(KEYBOARD.QWERTY); // You can replace this with DVORAK if you like
                mykeyboard.DefaultActions();

#if UNRELEASED
                const string SEARCH = @"

[CLEAR SEARCH]/0 /2 [NEWEST]/0 /2 [UNFILTERED]/30 /2 [PP]/0'!addsongs/top/pp pp%CR%' /2 [SEARCH]/0";
#else
                const string SEARCH = @"

[清空搜索]/0 /2 [最新]/0 /2 [不过滤]/30 /2 [搜索]/0";
#endif


                mykeyboard.SetButtonType("OkButton"); // Adding this alters button positions??! Why?
                mykeyboard.AddKeys(SEARCH, 0.75f);

                mykeyboard.SetAction("清空搜索", key => { this._bot?.ClearSearch(key); });
                mykeyboard.SetAction("不过滤", this._bot.UnfilteredSearch);
                mykeyboard.SetAction("搜索", this._bot.MSD);
                mykeyboard.SetAction("最新", this._bot.Newest);


#if UNRELEASED
                RequestBot.AddKeyboard(mykeyboard, "decks.kbd", 0.4f);
#endif

                // The UI for this might need a bit of work.
                mykeyboard.AddKeyboard("RightPanel.kbd");
            }
            base.DidActivate(firstActivation, addedToHierarchy, screenSystemEnabling);
        }
예제 #9
0
        protected override void DidActivate(bool firstActivation, ActivationType type)
        {
            if (firstActivation)
            {
                RectTransform KeyboardContainer = new GameObject("KeyboardContainer", typeof(RectTransform)).transform as RectTransform;
                KeyboardContainer.SetParent(rectTransform, false);
                KeyboardContainer.sizeDelta = new Vector2(60f, 40f);

                var mykeyboard = new KEYBOARD(KeyboardContainer, "");

#if UNRELEASED
                //mykeyboard.AddKeys(BOTKEYS, 0.4f);
                RequestBot.AddKeyboard(mykeyboard, "emotes.kbd", 0.4f);
#endif
                mykeyboard.AddKeys(KEYBOARD.QWERTY); // You can replace this with DVORAK if you like
                mykeyboard.DefaultActions();

#if UNRELEASED
                const string SEARCH = @"

[CLEAR SEARCH]/0 /2 [NEWEST]/0 /2 [UNFILTERED]/30 /2 [PP]/0'!addsongs/top/pp pp%CR%' /2 [SEARCH]/0";
#else
                const string SEARCH = @"

[CLEAR SEARCH]/0 /2 [NEWEST]/0 /2 [UNFILTERED]/30 /2 [SEARCH]/0";
#endif


                mykeyboard.SetButtonType("OkButton"); // Adding this alters button positions??! Why?
                mykeyboard.AddKeys(SEARCH, 0.75f);

                mykeyboard.SetAction("CLEAR SEARCH", RequestBot.ClearSearch);
                mykeyboard.SetAction("UNFILTERED", RequestBot.UnfilteredSearch);
                mykeyboard.SetAction("SEARCH", RequestBot.MSD);
                mykeyboard.SetAction("NEWEST", RequestBot.Newest);


#if UNRELEASED
                RequestBot.AddKeyboard(mykeyboard, "decks.kbd", 0.4f);
#endif

                // The UI for this might need a bit of work.
                RequestBot.AddKeyboard(mykeyboard, "RightPanel.kbd");
            }
        }