コード例 #1
0
 /// <summary>
 /// Invoked when a name change command is received
 /// <para>The command must be validated within the method</para>
 /// </summary>
 /// <param name="nick">The nick/viewer who sent the command</param>
 /// <param name="command">The command received</param>
 /// <param name="argument">The argument received containing the new name to display</param>
 public void OnNameRecieved(string nick, string command, string argument)
 {
     if (command.IsCommand(m_NameCommand))
     {
         if (onNameChangeRequested != null)
         {
             onNameChangeRequested.Invoke(nick);
         }
         int index = m_PlayerQueue.FindIndex(x => x.nick == nick);
         if (index > -1)
         {
             if (m_NameMustFollow)
             {
                 if (m_PlayerQueue[index].follows)
                 {
                     m_PlayerQueue[index].displayName = argument;
                 }
                 else
                 {
                     m_TwitchChat.SendChatMessageFormat(m_FollowFirstFormat, nick);
                 }
             }
             else
             {
                 m_PlayerQueue[index].displayName = argument;
             }
         }
         else
         {
             m_TwitchChat.SendChatMessageFormat(m_JoinFirstFormat, nick);
         }
     }
 }
コード例 #2
0
        void TwitchChat_OnZCommand(TwitchChat twitchChat, CommandsArgs commandsArgs)
        {
            float value;

            if (float.TryParse(commandsArgs.argument, out value))
            {
                AddForceFromCommand(float.Parse(commandsArgs.argument),
                                    (val) => new Vector3(0.0f, 0.0f, val),
                                    (val) => Mathf.Clamp(val.z, -m_MaxSpeed.z, m_MaxSpeed.z));
            }
            else
            {
                twitchChat.SendChatMessageFormat("@{0} {1} requires 1 argument and it must be a number you used ({2})", commandsArgs.nick, commandsArgs.command, commandsArgs.argument);
            }
        }
コード例 #3
0
        void TwitchChat_OnMoveCommand(TwitchChat twitchChat, CommandsArgs commandsArgs)
        {
            int requiredArgsCount = 3;

            if (commandsArgs.nArgument.Length == requiredArgsCount)
            {
                float rmx;
                float rmy;
                float rmz;

                float.TryParse(commandsArgs.nArgument[MX], out rmx);
                float.TryParse(commandsArgs.nArgument[MY], out rmy);
                float.TryParse(commandsArgs.nArgument[MZ], out rmz);

                MovePlayer(rmx, rmy, rmz);
            }
            else
            {
                twitchChat.SendChatMessageFormat("@{0} {1} requires {2} arguments", commandsArgs.nick, commandsArgs.command, requiredArgsCount);
            }
        }