Пример #1
0
 /// <summary>
 /// Registers a mod handler function that will be called as soon as the message is received.
 /// This is called from the networking thread, so you should avoid interacting with KSP directly here as Unity is not thread safe.
 /// </summary>
 /// <param name="modName">Mod name.</param>
 /// <param name="handlerFunction">Handler function.</param>
 public bool RegisterRawModHandler(string modName, DMPMessageCallback handlerFunction)
 {
     lock (eventLock)
     {
         if (registeredRawMods.ContainsKey(modName))
         {
             DarkLog.Debug("Failed to register raw mod handler for " + modName + ", mod already registered");
             return(false);
         }
         DarkLog.Debug("Registered raw mod handler for " + modName);
         registeredRawMods.Add(modName, handlerFunction);
     }
     return(true);
 }
Пример #2
0
 /// <summary>
 /// Registers a mod handler function that will be called as soon as the message is received.
 /// This is called from the networking thread, so you should avoid interacting with KSP directly here as Unity is not thread safe.
 /// </summary>
 /// <param name="modName">Mod name.</param>
 /// <param name="handlerFunction">Handler function.</param>
 public bool RegisterRawModHandler(string modName, DMPMessageCallback handlerFunction)
 {
     lock (eventLock)
     {
         if (registeredRawMods.ContainsKey(modName))
         {
             DarkLog.Debug("Failed to register raw mod handler for " + modName + ", mod already registered");
             return false;
         }
         DarkLog.Debug("Registered raw mod handler for " + modName);
         registeredRawMods.Add(modName, handlerFunction);
     }
     return true;
 }
Пример #3
0
 /// <summary>
 /// Registers a mod handler function that will be called on every FixedUpdate.
 /// </summary>
 /// <param name="modName">Mod name.</param>
 /// <param name="handlerFunction">Handler function.</param>
 public bool RegisterFixedUpdateModHandler(string modName, DMPMessageCallback handlerFunction)
 {
     lock (eventLock)
     {
         if (registeredFixedUpdateMods.ContainsKey(modName))
         {
             DarkLog.Debug("Failed to register FixedUpdate mod handler for " + modName + ", mod already registered");
             return(false);
         }
         DarkLog.Debug("Registered FixedUpdate mod handler for " + modName);
         registeredFixedUpdateMods.Add(modName, handlerFunction);
         fixedUpdateQueue.Add(modName, new Queue <byte[]>());
     }
     return(true);
 }
Пример #4
0
 /// <summary>
 /// Registers a mod handler function that will be called on every FixedUpdate.
 /// </summary>
 /// <param name="modName">Mod name.</param>
 /// <param name="handlerFunction">Handler function.</param>
 public bool RegisterFixedUpdateModHandler(string modName, DMPMessageCallback handlerFunction)
 {
     lock (eventLock)
     {
         if (registeredFixedUpdateMods.ContainsKey(modName))
         {
             DarkLog.Debug("Failed to register FixedUpdate mod handler for " + modName + ", mod already registered");
             return false;
         }
         DarkLog.Debug("Registered FixedUpdate mod handler for " + modName);
         registeredFixedUpdateMods.Add(modName, handlerFunction);
         fixedUpdateQueue.Add(modName, new Queue<byte[]>());
     }
     return true;
 }