public AttackType() { waveSprite = new Animation(); recoverSprite = new Animation(); spreaderSprite = new Animation(); heaterSprite = new Animation(); bubblerSprite = new Animation(); onAction = (ParamsAction) delegate(object[] args) { }; }
public void RegisterCommand(BaseUnityPlugin owner, string command, ParamsAction action) { command = command.ToLower(); if (owners.ContainsKey(command)) { Logger.LogError($"{command} already registered"); return; } owners[command] = owner; customCommands[command] = action; Logger.LogInfo($"Registering Command: {command}"); }
//Any object can listen to an event any other object receives by design. public void RegisterListener(string name, ParamsAction action) { if (listeners.ContainsKey(name)) { listeners[name].Add(action); } else { listeners.Add(name, new List <ParamsAction>() { action }); } }
public static void AddCommand (string[] commandStrings, ParamsAction commandMethod, int reservedArguments = 0, bool fullMatch = false) { for (int i = 0; i < commandStrings.Length; i++) { if (commandDict.TryAdd(commandStrings[i].ToLower(), new Command(commandMethod, reservedArguments))) { Log.Debug("Added command \"{0}\" for {1} from {2} with {3} arguments.", commandStrings[i].ToLower(), commandMethod.Method.Name, commandMethod.Target, reservedArguments); } else { Log.Debug("Failed to add command \"{0}\" for {1} from {2} with {3} arguments.", commandStrings[i].ToLower(), commandMethod.Method.Name, commandMethod.Target, reservedArguments); } } }
public static bool AddCommand (string commandString, ParamsAction commandMethod, int reservedArguments = 0, bool fullMatch = false) { bool ret; if (ret = commandDict.TryAdd(commandString.ToLower(), new Command(commandMethod, reservedArguments, fullMatch))) { Log.Debug("Added command \"{0}\" for {1} from {2} with {3} arguments.", commandString.ToLower(), commandMethod.Method.Name, commandMethod.Target, reservedArguments); } else { Log.Debug("Failed to add command \"{0}\" for {1} from {2} with {3} arguments.", commandString.ToLower(), commandMethod.Method.Name, commandMethod.Target, reservedArguments); } return(ret); }
public T ParamsActionFunction <T>(ParamsAction <T> f) { T result = f(); return(result); }
public static ParamsAction <B> FixParam <A, B>(this A a, ParamsAction <A, B> f) { return(FixParam(f, a)); }
public static ParamsAction <B> FixParam <A, B>(this ParamsAction <A, B> f, A a) { return(b => f(a, b)); }