コード例 #1
0
        // Called upon leaving the app.
        public static void SaveUserSettings()
        {
            try
            {
                // Save user settings.
                Properties.Settings.Default["PortName"]    = PortName;
                Properties.Settings.Default["ClientId"]    = ClientId;
                Properties.Settings.Default["AccessToken"] = AccessToken;
                Properties.Settings.Default["ChannelName"] = ChannelName;
                Properties.Settings.Default["IsDarkTheme"] = IsDarkTheme;

                // Save alert settings.
                Properties.Settings.Default["FollowAlert"]      = Alerts[0].IsActive;
                Properties.Settings.Default["FollowAlertValue"] = Alerts[0].Signal;
                Properties.Settings.Default["FollowAlertType"]  = Alerts[0].SignalType.ToString();

                Properties.Settings.Default["SubAlert"]      = Alerts[1].IsActive;
                Properties.Settings.Default["SubAlertValue"] = Alerts[1].Signal;
                Properties.Settings.Default["SubAlertType"]  = Alerts[1].SignalType.ToString();

                Properties.Settings.Default["BitsAlert"]      = Alerts[2].IsActive;
                Properties.Settings.Default["BitsAlertValue"] = Alerts[2].Signal;
                Properties.Settings.Default["BitsAlertType"]  = Alerts[2].SignalType.ToString();

                Properties.Settings.Default["RaidAlert"]      = Alerts[3].IsActive;
                Properties.Settings.Default["RaidAlertValue"] = Alerts[3].Signal;
                Properties.Settings.Default["RaidAlertType"]  = Alerts[3].SignalType.ToString();

                Properties.Settings.Default["HostAlert"]      = Alerts[4].IsActive;
                Properties.Settings.Default["HostAlertValue"] = Alerts[4].Signal;
                Properties.Settings.Default["HostAlertType"]  = Alerts[4].SignalType.ToString();

                Properties.Settings.Default["EmoteAlert"]      = Alerts[5].IsActive;
                Properties.Settings.Default["EmoteAlertValue"] = Alerts[5].Signal;
                Properties.Settings.Default["EmoteAlertType"]  = Alerts[5].SignalType.ToString();

                // Save emotes list.
                var stringCollection = new StringCollection();
                stringCollection.AddRange(EmotesList.ToArray());
                Properties.Settings.Default["EmotesList"] = stringCollection;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                // Save whatever got written.
                Properties.Settings.Default.Save();
            }
        }
コード例 #2
0
ファイル: Client.cs プロジェクト: FrontLineBanana/RedM
        void PlayEmote(string emoteName)
        {
            var player = PlayerPedId();

            CitizenFX.Core.Debug.WriteLine("PlayerPed is: " + player.ToString());

            if (EmotesList.ContainsValue(conditions))
            {
                Function.Call(Hash._TASK_START_SCENARIO_IN_PLACE, player, emoteName, -1, false, false, false, 1.0, false);
                CitizenFX.Core.Debug.WriteLine("Playing emote: " + emoteName);
            }

            isInEmote = true;
        }
コード例 #3
0
ファイル: Client.cs プロジェクト: FrontLineBanana/RedM
        void SetEmoteNames()
        {
            for (int i = 0; i < emoteHash.Length; i++)
            {
                //Add Hashes and Custom Names
                EmotesList.Add(customName[i], emoteHash[i]);
            }

            CitizenFX.Core.Debug.WriteLine("List set.");

            /* for (int i = 0; i < emoteHash.Length; i++)
             * {
             *   //Add IDs to the list
             *   EmotesList.Add(i.ToString(), emoteHash[i]);
             * }
             *
             * CitizenFX.Core.Debug.WriteLine("IDs set.");
             */
        }
コード例 #4
0
        private void ChatClient_OnMessageReceived(object sender, TwitchLib.Client.Events.OnMessageReceivedArgs e)
        {
            // Check if message contains an emote that is on the list.
            if (EmotesList.Any(x => e.ChatMessage.Message.Contains(x)))
            {
                // Send a signal.
                try
                {
#if DEBUG
                    Trace.WriteLine("Emote received!");
#endif
                    SerialPortHelper.SendMessage(PortName, Alerts[5].Signal, Alerts[5].SignalType);
                }
                catch (Exception ex)
                {
#if DEBUG
                    Trace.WriteLine(ex.Message);
#endif
                }
            }
        }