コード例 #1
0
ファイル: TwitchConnection.cs プロジェクト: Joshimuz/GUI-tool
        public VotingElement GetRandomVotedEffect(out string username)
        {
            if (Config.Instance().TwitchMajorityVoting)
            {
                username = "******";

                VotingElement element = effectVoting.GetMajorityVote();
                element.Effect.ResetVoter();

                lastChoice = element.Id;

                return(element);
            }
            else
            {
                VotingElement element = effectVoting.GetRandomEffect(out username, out lastChoice);

                if (overrideEffectChoice >= 0 && overrideEffectChoice <= 2)
                {
                    username   = "******";
                    lastChoice = overrideEffectChoice;

                    element = effectVoting.VotingElements[overrideEffectChoice];
                    element.Effect.SetVoter(username);
                }
                return(element);
            }
        }
コード例 #2
0
        public void SetVoting(int votingMode, int untilRapidFire = -1, VotingElement votingElement = null, string username = null)
        {
            VotingMode = votingMode;
            if (VotingMode == 1)
            {
                effectVoting.Clear();
                effectVoting.GenerateRandomEffects();
                overrideEffectChoice = -1;
                lastChoice           = -1;

                SendMessage("Voting has started! Type 1, 2 or 3 (or #1, #2, #3) to vote for one of the effects!");
                foreach (VotingElement element in effectVoting.VotingElements)
                {
                    SendMessage($"#{element.Id + 1}: {element.Effect.GetDescription()}");
                }
            }
            else if (VotingMode == 2)
            {
                rapidFireVoters.Clear();
                SendMessage("ATTENTION, ALL GAMERS! RAPID-FIRE HAS BEGUN! VALID EFFECTS WILL BE ENABLED FOR 15 SECONDS!");
            }
            else
            {
                if (votingElement != null)
                {
                    SendEffectVotingToGame(false);

                    AbstractEffect effect = votingElement.Effect;

                    string effectText = effect.GetDescription();
                    SendMessage($"Cooldown has started! ({untilRapidFire} until Rapid-Fire) - Enabled effect: {effectText} voted by {(username ?? "GTA:SA Chaos")}");

                    if (untilRapidFire == 1)
                    {
                        SendMessage("Rapid-Fire is coming up! Get your cheats ready! - List of all effects: https://bit.ly/gta-sa-chaos-mod");
                    }
                }
                else
                {
                    SendMessage($"Cooldown has started! ({untilRapidFire} until Rapid-Fire)");
                }
            }
        }
コード例 #3
0
ファイル: TwitchConnection.cs プロジェクト: Joshimuz/GUI-tool
            public VotingElement GetRandomEffect(out string username, out int choice)
            {
                username = "******";

                Random random = new Random();

                VotingElement element = null;

                if (Voters.Count > 0)
                {
                    username = Voters.Keys.ToArray()[random.Next(Voters.Count)];
                    Voters.TryGetValue(username, out element);
                }

                if (element == null)
                {
                    element = VotingElements.ToArray()[random.Next(VotingElements.Count)];
                }

                choice = element.Id;
                element.Effect.SetVoter(username);

                return(element);
            }