コード例 #1
0
ファイル: AttackType.cs プロジェクト: MMBN-Engine/MMBN-Engine
        public AttackType()
        {
            waveSprite     = new Animation();
            recoverSprite  = new Animation();
            spreaderSprite = new Animation();
            heaterSprite   = new Animation();
            bubblerSprite  = new Animation();

            onAction = (ParamsAction) delegate(object[] args) { };
        }
コード例 #2
0
 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}");
 }
コード例 #3
0
ファイル: Entity.cs プロジェクト: LimaInc/Gnome-Anns-Sky
 //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
         });
     }
 }
コード例 #4
0
 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);
         }
     }
 }
コード例 #5
0
        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);
        }
コード例 #6
0
        public T ParamsActionFunction <T>(ParamsAction <T> f)
        {
            T result = f();

            return(result);
        }
コード例 #7
0
 public static ParamsAction <B> FixParam <A, B>(this  A a, ParamsAction <A, B> f)
 {
     return(FixParam(f, a));
 }
コード例 #8
0
 public static ParamsAction <B> FixParam <A, B>(this ParamsAction <A, B> f, A a)
 {
     return(b => f(a, b));
 }