// Use this for initialization
 void Start()
 {
     //Get IRC component and register to receive messages from it.
     IRC = this.GetComponent<TwitchIRC>();
     IRC.StartIRC();
     IRC.messageReceivedEvent.AddListener(OnChatMsgReceived);
 }
示例#2
0
	void Start()
    {

        IRC = FindObjectOfType<TwitchIRC>();
        qs = new List<ChatQuestion>();
        //IRC.SendCommand("CAP REQ :twitch.tv/tags"); //register for additional data such as emote-ids, name color etc.
        IRC.messageRecievedEvent.AddListener(OnChatMsgRecieved);
    }
    private void Start()
    {
        // This is done just for the sake of simplicity,
        // In your own script, you should instead have a direct reference
        // to the TwitchIRC component (inspector)
        IRC = GameObject.Find("TwitchIRC").GetComponent <TwitchIRC>();

        // Add an event listener for new chat messages
        IRC.newChatMessageEvent.AddListener(NewMessage);
    }
    // Use this for initialization
    void Start()
    {
        Debug.Log("Hey mon ami", this.gameObject);
        PlayerPrefs.SetString("user", _userName);
        PlayerPrefs.SetString("oauth", _oAuth);
        PlayerPrefs.Save();

        _irc = GetComponent <TwitchIRC>();
        _irc.Login(_userName, _oAuth);
    }
示例#5
0
 void Start()
 {
     EventDict      = new Dictionary <string, EventInvoice>();
     activeInvoices = new Dictionary <string, EventInvoicePayload>();
     IRC            = this.GetComponent <TwitchIRC>();
     IRC.messageRecievedEvent.AddListener(OnChatMsgReceived);
     EventDict.Add("message", new MessageEventInvoice());
     EventDict.Add("donate", new DonationEventInvoice(DonationNameText));
     lnd.OnInvoiceSettled += new InvoiceSettledEventHandler(HandlePaidInvoice);
 }
示例#6
0
 private void Start()
 {
     IRC            = this.GetComponent <TwitchIRC>();
     actionCommands = new List <string>();
     actionPoll     = new string[5];
     textUI         = new GameObject[5];
     for (int i = 0; i < 5; i++)
     {
         textUI[i] = GameObject.Find("Action Text " + (i + 1));
     }
 }
示例#7
0
    // Start is called before the first frame update
    void Start()
    {
        webTwitchClient          = new WebClient();
        webTwitchClient.Encoding = System.Text.Encoding.UTF8;
        webTwitchClient.Headers.Set("Content-Type", "json");

        twitchIRC = GetComponent <TwitchIRC>();
        twitchIRC.messageRecievedEvent.AddListener(TwitchMessageReceive);


        //StartCoroutine(TwitchConnect());
    }
示例#8
0
    IEnumerator Start()
    {
        yield return(true);

        user.text  = PlayerPrefs.GetString("user");
        oauth.text = PlayerPrefs.GetString("auth");
        irc        = FindObjectOfType <TwitchIRC>();
        if (user.text.Length > 2)
        {
            Submit();
        }
    }
    // Use this for initialization
    void Start()
    {
        cd  = this.GetComponent <chatDecoder>();
        irc = this.GetComponent <TwitchIRC>();
        qm  = this.GetComponent <questionManager>();
        ui  = this.GetComponent <uiManager>();
        qm.loadNewQuestion();

        roundNumber = questionsPerRound;

        InvokeRepeating("tick", 5, 1);
    }
示例#10
0
    void Start()
    {
        irc          = this.GetComponent <TwitchIRC> ();
        currentPanel = pHome;

        bHome.onClick.AddListener(() => ActivateHome());
        bLaunch.onClick.AddListener(() => LaunchBot());
        bSettings.onClick.AddListener(() => ActivateSettings());
        bLink.onClick.AddListener(() => ActivateLink());

        bGetAuth.onClick.AddListener(() => GetAuth());
    }
    private IEnumerator UpdateFollowers()
    {
        while (Connected && IRC.ChannelName.Length > 0)
        {
            var form = new WWWForm();
            form.AddField("name", "value");
            var headers = form.headers;
            var url     = URLAntiCacheRandomizer("https://api.twitch.tv/kraken/channels/" + IRC.ChannelName + "/follows?limit=100");

            headers["Client-ID"] = "REMOVED FOR GITHUB"; //#TODO Replace with your Client-ID
            var www = new WWW(url, null, headers);
            yield return(www);

            if (string.IsNullOrEmpty(www.error))
            {
                var obj = JsonUtility.FromJson <FollowsDataFull>(www.text);
                if (obj != null)
                {
                    if (obj.follows != null)
                    {
                        if (obj.follows.Length > 0)
                        {
                            Debug.Log("Found " + obj._total + " followers, retrieved top " + obj.follows.Length);
                            foreach (var follower in obj.follows.Where(follower => !_knownFollowers.ContainsKey(follower.user._id)))
                            {
                                _knownFollowers.Add(follower.user._id, follower);
                                if (_gettingInitialFollowers)
                                {
                                    continue;
                                }
                                OnChatMsg(
                                    new TwitchIRC.TwitchMessage(
                                        TwitchIRC.ToTwitchNotice(
                                            follower.user.display_name + " is now following!",
                                            TwitchIRC.NoticeColor.Purple)));
                                PlayNewFollowerSound();
                            }
                            _gettingInitialFollowers = false;
                        }
                    }
                }
            }
            else
            {
                Debug.LogError("Error on page (" + url + "): " + www.error);
            }
            yield return(new WaitForSeconds(30f));
        }
    }
示例#12
0
    IEnumerator Start()
    {
        yield return(true);

        user.text  = PlayerPrefs.GetString("user");
        oauth.text = PlayerPrefs.GetString("oauth");
        if (irc == null)
        {
            irc = FindObjectOfType <TwitchIRC>();
        }
        if (irc != null)
        {
            irc.Connected = Connected;
        }
    }
示例#13
0
    // Use this for initialization
    void Start()
    {
        ResetRound();

        if (!gameLogic.offlineMode)
        {
            GetComponent <TwitchIRC>().enabled = true;
            IRC = GetComponent <TwitchIRC>();
            //IRC.SendCommand("CAP REQ :twitch.tv/tags"); //register for additional data such as emote-ids, name color etc.
            IRC.messageRecievedEvent.AddListener(OnChatMsgRecieved);
        }
        else
        {
            GetComponent <TwitchIRC>().enabled = false;
        }
    }
示例#14
0
    public static void StableRequest(GuestData stableRequester, TwitchIRC requestorIRC)
    {
        string stableString     = "Stable: ";
        int    ownedturtlecount = 0;

        foreach (TurtleData tD in stableRequester.ownedTurtles)
        {
            ownedturtlecount++;
            stableString = ownedturtlecount + ") " + tD.name + "  Acceleration: " + tD.baseAcceleration + " Endurance: " + tD.baseEndurance + " Favorite Surface: " + tD.favoriteSurface;
            requestorIRC.SendCommand("PRIVMSG #" + requestorIRC.channelName + " :/w " + stableRequester.guestName + " " + stableString);
        }
        if (stableRequester.ownedTurtles.Count == 0)
        {
            requestorIRC.SendCommand("PRIVMSG #" + requestorIRC.channelName + " :/w " + stableRequester.guestName + " You don't own any turtles. You can bid for one next race during the auction.");
        }
        requestorIRC.SendCommand(stableString);
    }
示例#15
0
        public Form1()
        {
            InitializeComponent();
            irc = new TwitchIRC();
            irc.Connect();
            irc.NewMessage += irc_NewMessage;
            TransparencyKey = Color.BlueViolet;
            //this.BackColor = Color.BlueViolet;

            this.TopMost   = true;
            textBox3.Text  = yMine.ToString();
            textBox4.Text  = xMine.ToString();
            textBox1.Text  = Properties.Settings.Default.tb1;
            textBox2.Text  = Properties.Settings.Default.tb2;
            tbChannel.Text = Properties.Settings.Default.channel;

            pntr1 = ConvertStringToPoint(textBox1.Text);
            pntr2 = ConvertStringToPoint(textBox2.Text);
        }
    // Use this for initialization
    void Start()
    {
        cup = GameObject.Find("Cup");
        IRC = FindObjectOfType <TwitchIRC>();
        //IRC.SendCommand("CAP REQ :twitch.tv/tags"); //register for additional data such as emote-ids, name color etc.
        IRC.messageRecievedEvent.AddListener(OnChatMsgRecieved);

        if (ColorSelect.selectedColor == "glass")
        {
            GetComponent <Renderer> ().material = glassMaterial;
        }
        if (ColorSelect.selectedColor == "metal")
        {
            GetComponent <Renderer> ().material = metalMaterial;
        }
        if (ColorSelect.selectedColor == "yellow")
        {
            GetComponent <Renderer> ().material = yellowMaterial;
        }
    }
示例#17
0
        private void Start()
        {
            if (IRC == null)
            {
                // Place TwitchIRC.cs script on an gameObject called "TwitchIRC"
                IRC = GameObject.Find("TwitchIRC").GetComponent <TwitchIRC>();
            }

            // Add an event listener
            IRC.newChatMessageEvent.AddListener(NewMessage);

            // Initialise fighters list
            activeFighters = new List <string>(maxFighters);

            // Debug message
            for (int index = 1; index <= 4; ++index)
            {
                NewMessage(new Chatter(new IRCPrivmsg($"bot{index}", "spydernic", "hi"), new IRCTags()
                {
                    displayName = $"Bot{index}"
                }));
            }
        }
    public void ToggleConnect()
    {
        if (!Connected)
        {
            var anonymousLogin = false;
            if (!string.IsNullOrEmpty(UsernameBox.text))
            {
                if (string.IsNullOrEmpty(OAuthBox.text))
                {
                    AddSystemNotice("OAuth not found. Connecting Anonymously.", TwitchIRC.NoticeColor.Yellow);
                    GenRandomJustinFan();
                    UsernameBox.text = _username;
                    OAuthBox.text    = "";
                    anonymousLogin   = true;
                }
            }
            else
            {
                AddSystemNotice("Username not found. Connecting Anonymously.", TwitchIRC.NoticeColor.Yellow);
                GenRandomJustinFan();
                UsernameBox.text = _username;
                OAuthBox.text    = "";
                anonymousLogin   = true;
            }
            if (ChannelBox != null && ChannelBox.text != "")
            {
                if (ChannelBox.text.Contains(" "))
                {
                    AddSystemNotice("Channel name invalid!", TwitchIRC.NoticeColor.Red);
                    return;
                }
                UsernameBox.interactable = false;
                OAuthBox.interactable    = false;
                ChannelBox.interactable  = false;
                ConnectButtonText.text   = "Press to Disconnect";

                Connected = true;
                OnChatMsg(new TwitchIRC.TwitchMessage(TwitchIRC.ToTwitchNotice(string.Format("Logging into #{0} as {1}!", ChannelFirstLetterToUpper(ChannelBox.text), FirstLetterToUpper(UsernameBox.text)))));
                IRC.NickName    = anonymousLogin ? _username : UsernameBox.text;
                IRC.Oauth       = anonymousLogin ? "a" : OAuthBox.text;
                IRC.ChannelName = ChannelBox.text.Trim().ToLower();

                IRC.enabled = true;
                IRC.MessageRecievedEvent.AddListener(OnChatMsg);
                IRC.StartIRC();
                _knownFollowers.Clear();
                StopCoroutine("UpdateViews");
                StopCoroutine("UpdateFollowers");
                StopCoroutine("SyncWithSteamVR");
                _gettingInitialFollowers = true;
                StartCoroutine("UpdateViews");
                StartCoroutine("UpdateFollowers");
                StartCoroutine("SyncWithSteamVR");
            }
            else
            {
                AddSystemNotice("Unable to Connect: Enter a Valid Channel Name!", TwitchIRC.NoticeColor.Red);
            }
        }
        else
        {
            UsernameBox.interactable = true;
            OAuthBox.interactable    = true;
            ChannelBox.interactable  = true;
            ConnectButtonText.text   = "Press to Connect";

            Connected = false;
            IRC.MessageRecievedEvent.RemoveListener(OnChatMsg);
            IRC.enabled = false;
            OnChatMsg(new TwitchIRC.TwitchMessage(TwitchIRC.ToTwitchNotice("Disconnected!", TwitchIRC.NoticeColor.Red)));
            _knownFollowers.Clear();
            StopCoroutine("UpdateViews");
            StopCoroutine("UpdateFollowers");
            ClearViewerCountAndChannelName("Disconnected");
        }
    }
示例#19
0
 static void OnMessage(TwitchIRC.Message message)
 {
 }
 // Use this for initialization
 void Start()
 {
     IRC = this.GetComponent <TwitchIRC>();
     //IRC.SendCommand("CAP REQ :twitch.tv/tags"); //register for additional data such as emote-ids, name color etc.
     IRC.messageRecievedEvent.AddListener(OnChatMsgRecieved);
 }
示例#21
0
 private void ShowPopup(TwitchIRC.Message message)
 {
     if (message is ChannelMessage)
     {
         ChannelMessage msg = (ChannelMessage)message;
         MessagePopup popup = new MessagePopup(msg.From, msg.Content, 100 * m_Popups.Count);
         popup.Show();
         m_Popups.Add(popup);
         popup.FormClosed += onPopupClosed;
     }
 }
示例#22
0
 private void onMessage(TwitchIRC.Message message)
 {
     if (InvokeRequired)
         Invoke(showPopup, message);
 }
	} //End.SendActionMessage()

	// Use this for initialization
	void Start()
	{
		IRC = this.GetComponent<TwitchIRC>();
		cultistGO = GameObject.Find ("Cultist");
		if (cultistGO)
			cultist = cultistGO.GetComponent<Cultist>();
		//IRC.SendCommand("CAP REQ :twitch.tv/tags"); //register for additional data such as emote-ids, name color etc.
		IRC.messageRecievedEvent.AddListener(OnChatMsgReceived);

		IRC.SendMsg ("!moobot poll close");
		string votes = "";
		foreach (string vote in voteOptions) {
			votes = votes + " " + vote;
		}
		IRC.SendMsg ("!moobot poll open w, s, a, d");
		InvokeRepeating ("PollResults", timer, timer);
	} //End.Start()
示例#24
0
 // Use this for initialization
 void Start()
 {
     IRC = this.GetComponent <TwitchIRC>();
     IRC.messageRecievedEvent.AddListener(OnChatMsgRecieved);
     lastPingTime = Time.time;
 }
示例#25
0
    public static void GetABet(string incomingBet, string incomingBettersName, GameObject raceManagerGameObjectRef)
    {
        //print("We got a bet: "+ incomingBet);

        RaceManager racemanagerScriptRef = raceManagerGameObjectRef.GetComponent <RaceManager>();

        foreach (GameObject eachTurtle in racemanagerScriptRef.TurtlesInTheRace)
        {
            TurtleAI turtleScriptRef = eachTurtle.GetComponent <TurtleAI>();
            if (incomingBet.CaseInsensitiveContains("register"))
            {
                foreach (GuestData gD in GuestManager.AllGuests)
                {
                    if (gD.guestName == incomingBettersName)
                    {
                        gD.registeredAddress = incomingBet;
                    }
                }
            }
            if (incomingBet.CaseInsensitiveContains("bid"))
            {
                TurtleForSale turtleForBiddingScriptRef = racemanagerScriptRef.CurrentTurtlesForSale[0].GetComponent <TurtleForSale>();
                if (incomingBet.CaseInsensitiveContains(turtleForBiddingScriptRef.myName))
                {
                    //Debug.Log("incoming bet " + incomingBet);
                    turtleForBiddingScriptRef.GetABid(int.Parse(Regex.Match(incomingBet, @"\d+").Value), incomingBettersName);
                }
            }
            if (RaceManager.isBettingOpen)
            {
                string mightBeExclamation;
                if (incomingBet.CaseInsensitiveContains("!1"))
                {
                }
                if (incomingBet.CaseInsensitiveContains(eachTurtle.name))
                {
                    //bet on the turtle
                    //print("Bet on this turtle " + eachTurtle.name);
                    DealWiththeBet(incomingBet, incomingBettersName, eachTurtle, turtleScriptRef, racemanagerScriptRef, raceManagerGameObjectRef);
                }
            }
            else
            {
                if (racemanagerScriptRef.hasRaceStarted && racemanagerScriptRef.hasRaceEnded != true)
                {
                    if (incomingBet.CaseInsensitiveContains(eachTurtle.name))
                    {
                        TurtleAI tsRef = eachTurtle.GetComponent <TurtleAI>();
                        tsRef.BaseSpeed += 0.1f;
                        TwitchIRC tIRC             = raceManagerGameObjectRef.GetComponent <TwitchIRC>();
                        string    ConfirmedQuip    = "Good luck!";
                        int       RandomQuipNumber = Random.Range(0, 20);
                        switch (RandomQuipNumber)
                        {
                        case 0:
                            ConfirmedQuip = eachTurtle.name + " has recieved a boost of inspiration! PogChamp";
                            break;

                        case 1:
                            ConfirmedQuip = "Go " + eachTurtle.name + " Go! PogChamp";
                            break;

                        case 2:
                            ConfirmedQuip = eachTurtle.name + " is freaking out! PogChamp";
                            break;

                        case 3:
                            ConfirmedQuip = eachTurtle.name + " is going in strong! PogChamp";
                            break;

                        case 4:
                            ConfirmedQuip = eachTurtle.name + " got another wind! PogChamp";
                            break;

                        case 5:
                            ConfirmedQuip = eachTurtle.name + " is making a break for it! PogChamp";
                            break;

                        case 6:
                            ConfirmedQuip = eachTurtle.name + "hogs the spotlight! PogChamp";
                            break;

                        case 7:
                            ConfirmedQuip = eachTurtle.name + "! PogChamp";
                            break;

                        case 8:
                            ConfirmedQuip = "Excitement rippling around " + eachTurtle.name + " now! PogChamp";
                            break;

                        case 9:
                            ConfirmedQuip = eachTurtle.name + " for home! PogChamp";
                            break;

                        case 10:
                            ConfirmedQuip = eachTurtle.name + " giving chase! PogChamp";
                            break;

                        case 11:
                            ConfirmedQuip = eachTurtle.name + " stretches hard! PogChamp";
                            break;

                        case 12:
                            ConfirmedQuip = eachTurtle.name + " is under the whip! PogChamp";
                            break;

                        case 13:
                            ConfirmedQuip = eachTurtle.name + " around wide, this could be setup for something special! PogChamp";
                            break;

                        case 14:
                            ConfirmedQuip = "There's the run for " + eachTurtle.name + "! PogChamp";
                            break;

                        case 15:
                            ConfirmedQuip = eachTurtle.name + " hype! PogChamp";
                            break;

                        case 16:
                            ConfirmedQuip = eachTurtle.name + " takes footing in its stride! PogChamp";
                            break;

                        case 17:
                            ConfirmedQuip = "There's " + eachTurtle.name + " going home! PogChamp";
                            break;

                        case 18:
                            ConfirmedQuip = eachTurtle.name + " still has a little bit left in the tank! PogChamp";
                            break;

                        case 19:
                            ConfirmedQuip = eachTurtle.name + " is starting to wind up! PogChamp";
                            break;

                        case 20:
                            ConfirmedQuip = eachTurtle.name + " hears the crowd! PogChamp";
                            break;
                        }
                        tIRC.SendCommand("PRIVMSG #" + tIRC.channelName + " : " + ConfirmedQuip);
                        Debug.Log("Boosted");
                    }
                }
            }
        }
    }
示例#26
0
 // Use this for initialization
 void Start()
 {
     gm  = GetComponent <gameManager>();
     irc = GetComponent <TwitchIRC>();
     qm  = GetComponent <questionManager>();
 }
示例#27
0
    private readonly Stopwatch _newFollowerSoundStopwatch = new Stopwatch(); // Used to prevent message sound spamming

    public void ToggleConnect()
    {
        if (!Connected)
        {
            if (UsernameBox != null && UsernameBox.text != "")
            {
                if (OAuthBox != null && OAuthBox.text != "")
                {
                    if (ChannelBox != null && ChannelBox.text != "")
                    {
                        if (ChannelBox.text.Contains(" "))
                        {
                            AddSystemNotice("Channel name invalid!", TwitchIRC.NoticeColor.Red);
                            return;
                        }
                        UsernameBox.interactable = false;
                        OAuthBox.interactable    = false;
                        ChannelBox.interactable  = false;
                        ConnectButtonText.text   = "Press to Disconnect";

                        Connected = true;
                        OnChatMsg(TwitchIRC.ToTwitchNotice(string.Format("Logging into #{0} as {1}!", ChannelFirstLetterToUpper(ChannelBox.text), FirstLetterToUpper(UsernameBox.text))));
                        IRC.NickName    = UsernameBox.text;
                        IRC.Oauth       = OAuthBox.text;
                        IRC.ChannelName = ChannelBox.text.Trim().ToLower();

                        IRC.enabled = true;
                        IRC.MessageRecievedEvent.AddListener(OnChatMsg);
                        IRC.StartIRC();
                        knownFollowers.Clear();
                        StopCoroutine("UpdateViews");
                        StopCoroutine("UpdateFollowers");
                        StopCoroutine("SyncWithSteamVR");
                        gettingInitialFollowers = true;
                        StartCoroutine("UpdateViews");
                        StartCoroutine("UpdateFollowers");
                        StartCoroutine("SyncWithSteamVR");
                    }
                    else
                    {
                        AddSystemNotice("Unable to Connect: Enter a Valid Channel Name!", TwitchIRC.NoticeColor.Red);
                    }
                }
                else
                {
                    AddSystemNotice("Unable to Connect: Enter a Valid OAuth Key! http://www.twitchapps.com/tmi/", TwitchIRC.NoticeColor.Red);
                }
            }
            else
            {
                AddSystemNotice("Unable to Connect: Enter a Valid Username!", TwitchIRC.NoticeColor.Red);
            }
        }
        else
        {
            UsernameBox.interactable = true;
            OAuthBox.interactable    = true;
            ChannelBox.interactable  = true;
            ConnectButtonText.text   = "Press to Connect";

            Connected = false;
            IRC.MessageRecievedEvent.RemoveListener(OnChatMsg);
            IRC.enabled = false;
            OnChatMsg(TwitchIRC.ToTwitchNotice("Disconnected!", TwitchIRC.NoticeColor.Red));
            knownFollowers.Clear();
            StopCoroutine("UpdateViews");
            StopCoroutine("UpdateFollowers");
            ClearViewerCountAndChannelName("Disconnected");
        }
    }
示例#28
0
    static void DealWiththeBet(string incomingBet, string incomingBettersName, GameObject eachTurtle, TurtleAI turtleScriptRef, RaceManager racemanagerScriptRef, GameObject raceManagerGameObjectRef)
    {
        if (incomingBet.CaseInsensitiveContains("win") || incomingBet.CaseInsensitiveContains("show") || incomingBet.CaseInsensitiveContains("place"))
        {
            //bet to win
            string numbersInMessage = Regex.Match(incomingBet, @"\d+").Value;
            int    betAsInt         = int.Parse(numbersInMessage);
            if (betAsInt < 0 || betAsInt > 1000000)
            {
                return;
            }
            BetData thisBet = new BetData();
            thisBet.TurtlesName = eachTurtle.name;
            thisBet.BetAmount   = betAsInt;
            if (incomingBet.CaseInsensitiveContains("win"))
            {
                thisBet.BetType = "win";
                turtleScriptRef.howMuchIsBetOnMe += thisBet.BetAmount;
            }
            if (incomingBet.CaseInsensitiveContains("place"))
            {
                thisBet.BetType = "place";
                turtleScriptRef.howMuchIsBetOnMeToPlace += thisBet.BetAmount;
            }
            if (incomingBet.CaseInsensitiveContains("show"))
            {
                thisBet.BetType = "show";
                turtleScriptRef.howMuchIsBetOnMeToShow += thisBet.BetAmount;
            }
            thisBet.BettersName = incomingBettersName;
            thisBet.BetOdds     = turtleScriptRef.myRealOdds;
            foreach (GuestData gD in GuestManager.AllGuests)
            {
                if (gD.guestName == thisBet.BettersName)
                {
                    if (gD.guestCash < thisBet.BetAmount)
                    {
                        thisBet.BetAmount = gD.guestCash;
                    }
                    if (gD.guestCash == thisBet.BetAmount)
                    {
                        GameObject     bottomToaster  = GameObject.Find("Toaster");
                        ToasterManager toastScriptRef = bottomToaster.GetComponent <ToasterManager>();
                        toastScriptRef.ShowAToaster(gD.guestName, " Went ALL IN!");
                    }
                    gD.guestCash -= thisBet.BetAmount;
                }
            }
            racemanagerScriptRef.CurrentRaceBets.Add(thisBet);

            TwitchIRC tIRC = raceManagerGameObjectRef.GetComponent <TwitchIRC>();
            if (!thisBet.BettersName.Contains("turtlebot"))
            {
                string betConfirmedQuip = "Good luck!";
                int    RandomQuipNumber = Random.Range(0, 10);
                switch (RandomQuipNumber)
                {
                case 0:
                    betConfirmedQuip = "Good luck!";
                    break;

                case 1:
                    betConfirmedQuip = "Go Go Go!";
                    break;

                case 2:
                    betConfirmedQuip = "Be sure to cheer it on!";
                    break;

                case 3:
                    betConfirmedQuip = "It's a lock. KevinTurtle";
                    break;

                case 4:
                    betConfirmedQuip = "It's been sandbagging looking for a good spot.";
                    break;

                case 5:
                    betConfirmedQuip = "Ka-Chow!";
                    break;

                case 6:
                    betConfirmedQuip = "They heard their going to break it's maiden. Kappa";
                    break;

                case 7:
                    betConfirmedQuip = "It's workouts are unpublished. Kappa";
                    break;

                case 8:
                    betConfirmedQuip = "Their UPS driver Lance knows it's owner. Kappa";
                    break;

                case 9:
                    betConfirmedQuip = "It's been getting in light because they were using the bug boy on it. Now they're ready to run with it!";
                    break;

                case 10:
                    betConfirmedQuip = "It's going to go for a great prize.";
                    break;
                }
                tIRC.SendCommand("PRIVMSG #" + tIRC.channelName + " : Bet confirmed. " + thisBet.BettersName + " Bet " + thisBet.BetAmount + " on " + thisBet.TurtlesName + " to " + thisBet.BetType + ". " + betConfirmedQuip);
            }
        }
    }
示例#29
0
	public void ConnectTwitchIRC()
	{
		bool error = false;
		if (string.IsNullOrEmpty(m_StreamName))
		{
			error = true;
			StreamNameUI.CrossFadeColor(Color.red, 0.5f, true, false);
		}
		if (string.IsNullOrEmpty(m_Username))
		{
			error = true;
			UsernameUI.CrossFadeColor(Color.red, 0.5f, true, false);
		}
		if (string.IsNullOrEmpty(m_OAuthToken))
		{
			error = true;
			OAuthTokenUI.CrossFadeColor(Color.red, 0.5f, true, false);
		}

		if (!error)
		{
			if (m_TwitchIRC != null)
			{
				DestroyImmediate(m_TwitchIRC.gameObject);
			}
			GameObject twitchObj = new GameObject("TwitchIRC");
			m_TwitchIRC = twitchObj.AddComponent<TwitchIRC>();
			m_TwitchIRC.ConnectedEvent += HandleTwitchIRCConnected;
			m_TwitchIRC.ConnectErrorEvent += HandleConnectErrorEvent;
			m_TwitchIRC.StreamName = m_StreamName;
			m_TwitchIRC.Username = m_Username;
			m_TwitchIRC.OAuthToken = m_OAuthToken;
			
			Object.DontDestroyOnLoad(twitchObj);

			m_TwitchIRC.Connect();
		}
	}
示例#30
0
 private void Awake()
 {
     I = this;
 }
示例#31
0
 // Start is called before the first frame update
 void Awake()
 {
     irc = GetComponentInChildren <TwitchIRC>();
     irc.newChatMessageEvent.AddListener(PrintMessage);
 }
 private void InitializeIRC()
 {
     if (IRC == null)
     {
         IRC = GetComponent<TwitchIRC>();
         if (IRC == null)
         {
             IRC = gameObject.AddComponent<TwitchIRC>();
         }
     }
     IRC.channelName = PlayerPrefs.GetString("channelname", "");
     IRC.StartIRC();
 }
示例#33
0
    public static void GetABet(string incomingBet, string incomingBettersName, GameObject raceManagerGameObjectRef)
    {
        //print("We got a bet: "+ incomingBet);

        RaceManager racemanagerScriptRef = raceManagerGameObjectRef.GetComponent <RaceManager>();

        foreach (GameObject eachTurtle in racemanagerScriptRef.TurtlesInTheRace)
        {
            TurtleAI turtleScriptRef = eachTurtle.GetComponent <TurtleAI>();
            if (incomingBet.CaseInsensitiveContains("register"))
            {
                foreach (GuestData gD in GuestManager.AllGuests)
                {
                    if (gD.guestName == incomingBettersName)
                    {
                        gD.registeredAddress = incomingBet;
                    }
                }
            }

            if (incomingBet.CaseInsensitiveContains("bid"))
            {
                if (incomingBet.CaseInsensitiveContains(" a"))
                {
                    Debug.Log("incoming bet " + incomingBet);
                    TurtleForSale turtleForBiddingScriptRef = racemanagerScriptRef.CurrentTurtlesForSale[0].GetComponent <TurtleForSale>();
                    turtleForBiddingScriptRef.GetABid(int.Parse(Regex.Match(incomingBet, @"\d+").Value));
                }
                if (incomingBet.CaseInsensitiveContains(" b"))
                {
                    Debug.Log("incoming bet " + incomingBet);
                    TurtleForSale turtleForBiddingScriptRef = racemanagerScriptRef.CurrentTurtlesForSale[1].GetComponent <TurtleForSale>();
                    turtleForBiddingScriptRef.GetABid(int.Parse(Regex.Match(incomingBet, @"\d+").Value));
                }
                if (incomingBet.CaseInsensitiveContains(" c"))
                {
                    Debug.Log("incoming bet " + incomingBet);
                    TurtleForSale turtleForBiddingScriptRef = racemanagerScriptRef.CurrentTurtlesForSale[2].GetComponent <TurtleForSale>();
                    turtleForBiddingScriptRef.GetABid(int.Parse(Regex.Match(incomingBet, @"\d+").Value));
                }
            }

            if (incomingBet.CaseInsensitiveContains(eachTurtle.name) && RaceManager.isBettingOpen)
            {
                //bet on the turtle
                //print("Bet on this turtle " + eachTurtle.name);


                if (incomingBet.CaseInsensitiveContains("win") || incomingBet.CaseInsensitiveContains("show") || incomingBet.CaseInsensitiveContains("place"))
                {
                    //bet to win
                    string numbersInMessage = Regex.Match(incomingBet, @"\d+").Value;
                    int    betAsInt         = int.Parse(numbersInMessage);
                    if (betAsInt < 0)
                    {
                        return;
                    }
                    BetData thisBet = new BetData();
                    thisBet.TurtlesName = eachTurtle.name;
                    thisBet.BetAmount   = betAsInt;
                    if (incomingBet.CaseInsensitiveContains("win"))
                    {
                        thisBet.BetType = "win";
                        turtleScriptRef.howMuchIsBetOnMe += thisBet.BetAmount;
                    }
                    if (incomingBet.CaseInsensitiveContains("place"))
                    {
                        thisBet.BetType = "place";
                        turtleScriptRef.howMuchIsBetOnMeToPlace += thisBet.BetAmount;
                    }
                    if (incomingBet.CaseInsensitiveContains("show"))
                    {
                        thisBet.BetType = "show";
                        turtleScriptRef.howMuchIsBetOnMeToShow += thisBet.BetAmount;
                    }
                    thisBet.BettersName = incomingBettersName;
                    thisBet.BetOdds     = turtleScriptRef.myRealOdds;
                    foreach (GuestData gD in GuestManager.AllGuests)
                    {
                        if (gD.guestName == thisBet.BettersName)
                        {
                            if (gD.guestCash < thisBet.BetAmount)
                            {
                                thisBet.BetAmount = gD.guestCash;
                            }
                            if (gD.guestCash == thisBet.BetAmount)
                            {
                                GameObject     bottomToaster  = GameObject.Find("Toaster");
                                ToasterManager toastScriptRef = bottomToaster.GetComponent <ToasterManager>();
                                toastScriptRef.ShowAToaster(gD.guestName, " Went ALL IN!");
                            }
                            gD.guestCash -= thisBet.BetAmount;
                        }
                    }
                    racemanagerScriptRef.CurrentRaceBets.Add(thisBet);

                    TwitchIRC tIRC = raceManagerGameObjectRef.GetComponent <TwitchIRC>();
                    if (!thisBet.BettersName.Contains("turtlebot"))
                    {
                        tIRC.SendMsg("Confirmed: " + thisBet.BettersName + " Bet " + thisBet.BetAmount + " on " + thisBet.TurtlesName + " to " + thisBet.BetType);
                    }

                    //tIRC.SendCommand(".PRIVMSG #turtleracingalpha :/w turtleracingalpha this is a whisper with .");
                    //tIRC.SendCommand("/PRIVMSG #turtleracingalpha :/w turtleracingalpha this is a whisper with /");
                    //tIRC.SendCommand(":PRIVMSG #turtleracingalpha :/w turtleracingalpha this is a whisper with :");
                    //tIRC.SendMsg("/w turtleracingalpha this is a whisper with msg");

                    //Debug.Log("For <color=green>" + thisBet.BetAmount + "</color> at odds of " + thisBet.BetOdds);
                }
            }
        }
    }
 // Add a system message to the chat display
 public void AddSystemNotice(string msgIn, TwitchIRC.NoticeColor colorEnum = TwitchIRC.NoticeColor.Blue)
 {
     OnChatMsg(new TwitchIRC.TwitchMessage(TwitchIRC.ToNotice("System", msgIn, colorEnum)));
 }
示例#35
0
    // Update is called once per frame
    void Update()
    {
        if (Time.timeSinceLevelLoad > 1 && !hasPlacedAIBets)
        {
            TwitchChatExample ChatLink = gameObject.GetComponent <TwitchChatExample>();
            for (int i = 0; i <= 128; i++)
            {
                ChatLink.fakeMessage(TurtlesInTheRace[Random.Range(0, 10)].name);
                if (i > 122)
                {
                    ChatLink.fakeMessage("bid A " + CurrentTurtlesForSale[0].GetComponent <TurtleForSale>().myName + " " + Random.Range(1, 10));
                }
            }
            hasPlacedAIBets = true;
        }

        if (Input.GetKeyDown(KeyCode.M))
        {
            if (BonusRoundManager.IsMusicEnabled)
            {
                BonusRoundManager.IsMusicEnabled = false;
                Debug.Log("Disabling Music");
            }
            else
            {
                BonusRoundManager.IsMusicEnabled = true;
                Debug.Log("Enabling Music");
            }
        }
        if (Input.GetKeyDown(KeyCode.X))
        {
            foreach (GameObject eachTurtle in TurtlesInTheRace)
            {
                TurtleAI ti = eachTurtle.GetComponent <TurtleAI>();
                ti.BaseSpeed = 50;
            }
            TimeBetweenRaces = 2;
        }
        if (Input.GetKeyDown(KeyCode.S))
        { //start the race shortcut
            TimeBetweenRaces = 2;
        }

        if (TimeBetweenRaces - 9 < Time.timeSinceLevelLoad && BettingOpenDialog.activeInHierarchy == true)
        {
            AudioSource.PlayClipAtPoint(bellSound, Camera.main.transform.position);
            BettingClosedDialog.SetActive(true);
            BettingOpenDialog.SetActive(false);
            raceInfoDialog.SetActive(false);
            RaceDetailsGridObject.SetActive(false);
        }
        if (TimeBetweenRaces - Time.timeSinceLevelLoad < 40 && !startedMusic)
        {
            print("time race ended " + timeRaceEnded + " time between races " + TimeBetweenRaces);

            MainCameraHelper.StartTheRaceMusic();
            startedMusic = true;
        }
        if (TimeBetweenRaces - 6 < Time.timeSinceLevelLoad && isBettingOpen)
        {
            isBettingOpen = false;
        }

        if (TimeBetweenRaces * 0.9f < Time.timeSinceLevelLoad && !hasAucionCompleted)
        {
            Auctioneer.FinalizeAuction(this.gameObject);
            hasAucionCompleted = true;
            AuctionTimerObject.SetActive(false);
            WholeAuctionObject.SetActive(false);
        }
        else
        {
            AuctionTimer.text = Mathf.RoundToInt((TimeBetweenRaces * 0.9f) - Time.timeSinceLevelLoad) + " Seconds";
        }

        if (TimeBetweenRaces < Time.timeSinceLevelLoad && !hasRaceStarted)
        {
            hasRaceStarted = true;
            RaceStartingTimerObject.SetActive(false);
            BettingClosedDialog.SetActive(false);
            RaceCam1.m_Speed = 1;
            //TimeBetweenRaces += Time.time; //this was causing extra delays
            BetManager.FinalizeOdds(this.gameObject);
        }
        else
        {
            RaceStartingTimer.text = Mathf.RoundToInt(TimeBetweenRaces - Time.timeSinceLevelLoad) + " Seconds";
        }
        if (hasRaceStarted && FinishLineCam.Priority != 16)
        {
            foreach (GameObject turtleRef in TurtlesInTheRace)
            {
                TurtleAI turlteScriptRef = turtleRef.GetComponent <TurtleAI>();

                /*if(BackHalfCam.Priority!=15 && turlteScriptRef.percentFinished > 0.5f){
                 *                      BackHalfCam.Priority = 15;
                 *              }*/
                if (turlteScriptRef.percentFinished > 0.9f)
                {
                    FinishLineCam.Priority = 16;
                }
            }
        }

        //If a single turtle finshed, open the in-race results gui.
        if (TurtleAI.HowManyTurtlesFinished > 0 && !hasRaceEnded)
        {
            if (!InRaceresultsScreen.activeInHierarchy)
            {
                InRaceresultsScreen.SetActive(true);
            }
        }

        if (TurtleAI.HowManyTurtlesFinished == 10 && !hasRaceEnded)
        {
            hasRaceEnded = true;
            PayOutWinners();
            InRaceresultsScreen.SetActive(false);
            RaceResultsScreen.SetActive(true);
            RaceStartingTitle.text = "Bonus Round in";
            BettingClosedDialog.SetActive(true);
            raceInfoDialog.SetActive(true);
            RaceResultsGUITextA.text = TurtleAI.RaceResultsColumn1 + "<nobr>";
            RaceResultsGUITextB.text = TurtleAI.RaceResultsColumn2 + "<nobr>";
            RaceResultsGuiTextC.text = TurtleAI.RaceResultsColumn3 + "<nobr>";
            RaceResultsGiuTextD.text = TurtleAI.RaceResultsColumn4 + "<nobr>";

            timeRaceEnded = Time.timeSinceLevelLoad;
            int   totalTrueBets = 0;
            float totalPaidOut  = 0;
            foreach (BetData eachBet in CurrentRaceBets)
            {
                //Check for winning bets
                if (eachBet.BetType == "win")
                {
                    foreach (RaceResultData contestant in GuestManager.CurrentRaceresults)
                    {
                        if (contestant.FinishingPlace == 1 && contestant.TurtleName == eachBet.TurtlesName)
                        {
                            //They predicted this win!
                            eachBet.didBetComeTrue = true;
                            totalTrueBets++;
                        }
                    }
                }
                if (eachBet.BetType == "place")
                {
                    foreach (RaceResultData contestant in GuestManager.CurrentRaceresults)
                    {
                        if (contestant.TurtleName == eachBet.TurtlesName)
                        {
                            if (contestant.FinishingPlace == 1 || contestant.FinishingPlace == 2)
                            {
                                eachBet.didBetComeTrue = true;
                                totalTrueBets++;
                            }
                        }
                    }
                }
                if (eachBet.BetType == "show")
                {
                    foreach (RaceResultData contestant in GuestManager.CurrentRaceresults)
                    {
                        if (contestant.TurtleName == eachBet.TurtlesName)
                        {
                            if (contestant.FinishingPlace <= 3)
                            {
                                eachBet.didBetComeTrue = true;
                                totalTrueBets++;
                            }
                        }
                    }
                }

                foreach (GuestData eachGuest in GuestManager.AllGuests)
                {
                    if (eachGuest.guestName == eachBet.BettersName)
                    {
                        if (eachBet.didBetComeTrue)
                        {
                            //Pay them if the bet won.
                            float     amountToPay = eachBet.BetAmount * eachBet.BetOdds;
                            TwitchIRC tIRC        = GetComponent <TwitchIRC>();
                            if (eachBet.BetType == "place")
                            {
                                amountToPay = eachBet.BetAmount + OddsDisplay.CurrentTotalPlacePool * (eachBet.BetAmount / (OddsDisplay.CurrentTotalPlacePool / 2));
                                //Debug.Log("Paying out " + amountToPay + " to " + eachGuest.guestName + " for betting " + eachBet.BetAmount + " on " + eachBet.TurtlesName + " to place of a pool of " + OddsDisplay.CurrentTotalPlacePool);
                                if (!eachGuest.guestName.Contains("turtlebot"))
                                {
                                    //tIRC.SendMsg("Paying out " + amountToPay + " to " + eachGuest.guestName + " for betting " + eachBet.BetAmount + " on " + eachBet.TurtlesName + "to place of a pool of " + OddsDisplay.CurrentTotalPlacePool);
                                }
                            }
                            if (eachBet.BetType == "win")
                            {
                                //Debug.Log("Paying out " + amountToPay + " to " + eachGuest.guestName + " for betting " + eachBet.BetAmount + " on " + eachBet.TurtlesName + " at odds of " + eachBet.BetOdds);
                                if (!eachGuest.guestName.Contains("turtlebot"))
                                {
                                    //tIRC.SendMsg("Paying out " + amountToPay + " to " + eachGuest.guestName + " for betting " + eachBet.BetAmount + " on " + eachBet.TurtlesName + " at odds of " + eachBet.BetOdds);
                                }
                            }
                            if (eachBet.BetType == "show")
                            {
                                amountToPay = eachBet.BetAmount + OddsDisplay.CurrentTotalShowPool * (eachBet.BetAmount / (OddsDisplay.CurrentTotalShowPool / 3));
                                //Debug.Log("Paying out " + amountToPay + " to " + eachGuest.guestName + " for betting " + eachBet.BetAmount + " on " + eachBet.TurtlesName + " to show of a pool of " + OddsDisplay.CurrentTotalShowPool);
                                if (!eachGuest.guestName.Contains("turtlebot"))
                                {
                                    //tIRC.SendMsg("Paying out " + amountToPay + " to " + eachGuest.guestName + " for betting " + eachBet.BetAmount + " on " + eachBet.TurtlesName + " to show of a pool of " + OddsDisplay.CurrentTotalShowPool);
                                }
                            }
                            eachGuest.guestCash += amountToPay;
                            totalPaidOut        += amountToPay;
                            float totalPaidIn = OddsDisplay.CurrentTotalPlacePool + OddsDisplay.CurrentTotalPot + OddsDisplay.CurrentTotalShowPool;
                            //print("Total paid out = " + totalPaidOut + " Total paid in = " + totalPaidIn);
                        }
                    }
                }
            }
        }
        if (timeRaceEnded > 1)
        {
            if (RaceStartingTimerObject.activeInHierarchy != true)
            {
                RaceStartingTimerObject.SetActive(true);
            }
            RaceStartingTimer.text = Mathf.RoundToInt((timeRaceEnded + (TimeBetweenRaces / 5)) - Time.timeSinceLevelLoad) + " Seconds";
            RaceStartingTitle.text = "Bonus Round in...";
            //Debug.Log("Time race ended " + timeRaceEnded + "  Time between races " + TimeBetweenRaces + "  current time " + Time.time);
            if (Time.timeSinceLevelLoad > timeRaceEnded + (TimeBetweenRaces / 5))
            {
                GuestManager.SaveGuestData();
                GuestManager.ClearNextRaceTurtles();
                SceneManager.LoadScene("Pachinko");
            }
        }
    }
示例#36
0
    void Start()
    {
        if (Purse > 3000)
        {
            Purse = 1000;
        }
        else
        {
            Purse += 500;
        }
        NextRacePurse.text = "Purse: " + Purse.ToString();
        int halfpurse = Purse / 10;

        NextRaceEntryFee.text = "Entry: " + halfpurse.ToString();
        nextLength            = Random.Range(0, 1);
        nextSurface           = Random.Range(0, 3);
        int randomRoll = Random.Range(1, 10);

        if (nextLength == 0)
        {
            NextRaceLengthHud.text = "Lenght: Short";
            if (nextSurface == 0)
            {
                NextRaceName.text = "Sprinters Stakes";
            }
            if (nextSurface == 1)
            {
                NextRaceName.text = "Sunset Sprint";
            }
            if (nextSurface == 2)
            {
                NextRaceName.text = "Sherwood Cup";
            }
        }
        if (nextLength == 1)
        {
            NextRaceLengthHud.text = "Length: Long";
            if (nextSurface == 0)
            {
                NextRaceName.text = "East Park";
            }
            if (nextSurface == 1)
            {
                NextRaceName.text = "Cairo Course";
            }
            if (nextSurface == 2)
            {
                NextRaceName.text = "Mazatlán Mile";
            }
        }
        if (nextSurface == 0)
        {
            NextRaceSurfaceHud.text = "Surface: Grass";
        }
        if (nextSurface == 1)
        {
            NextRaceSurfaceHud.text = "Surface: Sand";
        }
        if (nextSurface == 2)
        {
            NextRaceSurfaceHud.text = "Surface: Dirt";
        }

        IRC = this.GetComponent <TwitchIRC>();
        //IRC.SendCommand("CAP REQ :twitch.tv/tags"); //register for additional data such as emote-ids, name color etc.
        IRC.messageRecievedEvent.AddListener(OnChatMsgRecieved);
        fakeMessage(Random.Range(1, 3).ToString());
    }
示例#37
0
    void OnChatMsgRecieved(string msg)
    {
        TwitchIRC tIRC = GetComponent <TwitchIRC>();
        //parse from buffer.
        int msgIndex = msg.IndexOf("PRIVMSG #");
        //print(msg);
        string msgString = msg.Substring(msgIndex + IRC.channelName.Length + 11);
        string user      = msg.Substring(1, msg.IndexOf('!') - 1);

        GuestManager.CheckOrRegisterGuest(user);
        foreach (GuestData gD in GuestManager.AllGuests)
        {
            if (gD.guestName == user)
            {
                if (gD.bonusRoundBallsDropped < 6)
                {
                    gD.bonusRoundBallsDropped++;
                    DropBall(user);
                }
                if (msgString.CaseInsensitiveContains("stable"))
                {
                    StableReturner.StableRequest(gD, tIRC);
                }
                if (msgString.CaseInsensitiveContains("enter"))
                {
                    foreach (TurtleData tD in gD.ownedTurtles)
                    {
                        if (msgString.CaseInsensitiveContains(tD.name))
                        {
                            bool isTurtleAlreadyInRace = false;
                            foreach (TurtleData turtleInTheRaceSoFar in GuestManager.NextRacesTurtles)
                            {
                                if (turtleInTheRaceSoFar.name == tD.name)
                                {
                                    isTurtleAlreadyInRace = true;
                                    print("A turtle with that name is already entered");
                                }
                            }
                            print("Next races turtles count is at " + GuestManager.NextRacesTurtles.Count);
                            if (GuestManager.NextRacesTurtles.Count < 10)
                            {
                                if (isTurtleAlreadyInRace == false)
                                {
                                    if (gD.guestCash > (Purse / 10))
                                    {
                                        gD.guestCash -= Purse / 10;
                                        GuestManager.NextRacesTurtles.Add(tD);
                                        NextRacersList.text += GuestManager.NextRacesTurtles.Count + ") " + tD.name + " by " + tD.ownersName + "\n";
                                        Debug.Log(tD.name + " entered into next race!");
                                    }
                                    else
                                    {
                                        Debug.Log("Someone tried to enter but they didnt have enough coins");
                                    }
                                }
                                else
                                {
                                    Debug.Log("Someone tried to enter but we think they were already in the list");
                                }
                            }
                            else
                            {
                                Debug.Log("Someone tried to enter a turtle but the race was full");
                            }
                        }
                    }
                }
            }
        }

        //BetManager.GetABet(msgString, user, this.gameObject);
        Debug.Log("<color=purple> msg = " + msg + "</color><color=blue> msgString = " + msgString + "</color><color=purple>user = "******"</color>");

        tIRC.SendCommand("PRIVMSG #" + tIRC.channelName + " : ");
    }
 // Use this for initialization
 void Start()
 {
     IRC = this.GetComponent<TwitchIRC>();
     //IRC.SendCommand("CAP REQ :twitch.tv/tags"); //register for additional data such as emote-ids, name color etc.
     IRC.messageRecievedEvent.AddListener(OnChatMsgRecieved);
 }
示例#39
0
    void Start()
    {
        twitch = GetComponent <TwitchIRC>();

        twitch.messageRecievedEvent.AddListener(getCommand);
    }