public void SetCommand <T>() where T : IChatCommand { if (this.IsConsumed) { throw new InvalidOperationException("Message has already been consumed."); } this.CommandId = ChatCommandId.FromType <T>(); }
// 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); }
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); }
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); }
// 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); }
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); }
public void SetCommand <T>() where T : IChatCommand { this.CommandId = ChatCommandId.FromType <T>(); }
public ChatMessage(string message) { this.CommandId = ChatCommandId.FromType <SayChatCommand>(); this.Text = message; }
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; }