Esempio n. 1
0
 public void SetCommand <T>() where T : IChatCommand
 {
     if (this.IsConsumed)
     {
         throw new InvalidOperationException("Message has already been consumed.");
     }
     this.CommandId = ChatCommandId.FromType <T>();
 }
Esempio n. 2
0
        // Token: 0x06001348 RID: 4936 RVA: 0x0041B430 File Offset: 0x00419630
        public ChatCommandProcessor AddDefaultCommand <T>() where T : IChatCommand, new()
        {
            this.AddCommand <T>();
            ChatCommandId key = ChatCommandId.FromType <T>();

            this._defaultCommand = this._commands[key];
            return(this);
        }
Esempio n. 3
0
        public ChatCommandProcessor AddCommand <T>() where T : IChatCommand, new()
        {
            string        commandKey = "ChatCommand." + ((ChatCommandAttribute)AttributeUtilities.GetCacheableAttribute <T, ChatCommandAttribute>()).Name;
            ChatCommandId index      = ChatCommandId.FromType <T>();

            this._commands[index] = (IChatCommand)Activator.CreateInstance <T>();
            if (Language.Exists(commandKey))
            {
                this._localizedCommands.Add(Language.GetText(commandKey), index);
            }
            else
            {
                commandKey += "_";
                foreach (LocalizedText key in Language.FindAll((LanguageSearchFilter)((key, text) => key.StartsWith(commandKey))))
                {
                    this._localizedCommands.Add(key, index);
                }
            }
            return(this);
        }
Esempio n. 4
0
        public ChatCommandProcessor AddCommand <T>() where T : IChatCommand, new()
        {
            ChatCommandAttribute cacheableAttribute = AttributeUtilities.GetCacheableAttribute <T, ChatCommandAttribute>();
            string        commandKey    = "ChatCommand." + cacheableAttribute.Name;
            ChatCommandId chatCommandId = ChatCommandId.FromType <T>();

            _commands[chatCommandId] = new T();
            if (Language.Exists(commandKey))
            {
                _localizedCommands.Add(Language.GetText(commandKey), chatCommandId);
            }
            else
            {
                commandKey += "_";
                LocalizedText[] array = Language.FindAll((string key, LocalizedText text) => key.StartsWith(commandKey));
                foreach (LocalizedText key2 in array)
                {
                    _localizedCommands.Add(key2, chatCommandId);
                }
            }
            return(this);
        }
Esempio n. 5
0
        // Token: 0x06001347 RID: 4935 RVA: 0x0041B370 File Offset: 0x00419570
        public ChatCommandProcessor AddCommand <T>() where T : IChatCommand, new()
        {
            ChatCommandAttribute cacheableAttribute = AttributeUtilities.GetCacheableAttribute <T, ChatCommandAttribute>();
            string        commandKey    = "ChatCommand." + cacheableAttribute.Name;
            ChatCommandId chatCommandId = ChatCommandId.FromType <T>();

            this._commands[chatCommandId] = Activator.CreateInstance <T>();
            if (Language.Exists(commandKey))
            {
                this._localizedCommands.Add(Language.GetText(commandKey), chatCommandId);
            }
            else
            {
                commandKey += "_";
                LocalizedText[] array = Language.FindAll((string key, LocalizedText text) => key.StartsWith(commandKey));
                for (int i = 0; i < array.Length; i++)
                {
                    LocalizedText key2 = array[i];
                    this._localizedCommands.Add(key2, chatCommandId);
                }
            }
            return(this);
        }
Esempio n. 6
0
        public ChatCommandProcessor AddCommand <T>() where T : IChatCommand, new()
        {
            var commandKey = "ChatCommand." +
                             AttributeUtilities
                             .GetCacheableAttribute <T, ChatCommandAttribute>().Name;
            var index = ChatCommandId.FromType <T>();

            _commands[index] = new T();
            if (Language.Exists(commandKey))
            {
                _localizedCommands.Add(Language.GetText(commandKey), index);
            }
            else
            {
                commandKey += "_";
                foreach (var key in Language.FindAll((key, text) =>
                                                     key.StartsWith(commandKey)))
                {
                    _localizedCommands.Add(key, index);
                }
            }

            return(this);
        }
Esempio n. 7
0
 public void SetCommand <T>() where T : IChatCommand
 {
     this.CommandId = ChatCommandId.FromType <T>();
 }
Esempio n. 8
0
 public ChatMessage(string message)
 {
     this.CommandId = ChatCommandId.FromType <SayChatCommand>();
     this.Text      = message;
 }
Esempio n. 9
0
 public ChatCommandProcessor AddDefaultCommand <T>() where T : IChatCommand, new()
 {
     AddCommand <T>();
     _defaultCommand = _commands[ChatCommandId.FromType <T>()];
     return(this);
 }
 public ChatMessage(string message)
 {
     CommandId  = ChatCommandId.FromType <SayChatCommand>();
     Text       = message;
     IsConsumed = false;
 }