Exemplo n.º 1
0
 public MessageReceiver(IMyMultiplayer multiplayer, IMyUtilities utilities)
 {
     this.multiplayer        = multiplayer;
     this.utilities          = utilities;
     this.messageLogger      = new MessageLogger();
     this.spawnToolsReplacer = new SpawnToolsReplacer();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Try to perform an Action on game thread, if it fails do not crash the game.
 /// </summary>
 public static void TryInvokeOnGameThread(this IMyUtilities util, Action invoke, [CallerFilePath] string callerFile = null, [CallerMemberName] string callerMember = null, [CallerLineNumber] int callerLineNumber = 0)
 {
     util.InvokeOnGameThread(() => {
         try { invoke.Invoke(); }
         catch (Exception ex)
         {
             Logger.AlwaysLog("Exception: " + ex, Logger.severity.ERROR, filePath: callerFile, member: callerMember, lineNumber: callerLineNumber);
         }
     });
 }
Exemplo n.º 3
0
 public static void SendMissionScreen(this IMyUtilities utilities, ulong steamId, string screenTitle = null, string currentObjectivePrefix = null, string currentObjective = null, string screenDescription = null, Action <ResultEnum> callback = null, string okButtonCaption = null, params object[] args)
 {
     if (steamId == MyAPIGateway.Multiplayer.ServerId || (MyAPIGateway.Session.Player != null && steamId == MyAPIGateway.Session.Player.SteamUserId))
     {
         utilities.ShowMissionScreen(screenTitle, currentObjectivePrefix, currentObjective, string.Format(Localize.SubstituteTexts(screenDescription), args), callback, okButtonCaption);
     }
     else
     {
         PushClientDialogMessage.SendMessage(steamId, screenTitle, currentObjectivePrefix, screenDescription, args);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Sends a message to an specific player.  If steamId is set as 0, then it is sent to the current player.
 /// </summary>
 public static void SendMessage(this IMyUtilities utilities, ulong steamId, string sender, string messageText, params object[] args)
 {
     if (steamId == MyAPIGateway.Multiplayer.ServerId || (MyAPIGateway.Session.Player != null && steamId == MyAPIGateway.Session.Player.SteamUserId))
     {
         utilities.ShowMessage(sender, messageText, args);
     }
     else
     {
         PushClientTextMessage.SendMessage(steamId, sender, messageText, args);
     }
 }
 public static void SendMissionScreen(this IMyUtilities utilities, ulong steamId, string screenTitle = null, string currentObjectivePrefix = null, string currentObjective = null, string screenDescription = null, Action <ResultEnum> callback = null, string okButtonCaption = null)
 {
     if (steamId == 0 || (MyAPIGateway.Session.Player != null && steamId == MyAPIGateway.Session.Player.SteamUserId))
     {
         utilities.ShowMissionScreen(screenTitle, currentObjectivePrefix, currentObjective, screenDescription, callback, okButtonCaption);
     }
     else
     {
         MessageClientDialogMessage.SendMessage(steamId, screenTitle, currentObjectivePrefix, screenDescription);
     }
 }
Exemplo n.º 6
0
 public static void Clean()
 {
     Session               = null;
     Entities              = null;
     Players               = null;
     CubeBuilder           = null;
     TerminalActionsHelper = null;
     Utilities             = null;
     Parallel              = null;
     Multiplayer           = null;
     PrefabManager         = null;
 }
Exemplo n.º 7
0
 public static void Clean()
 {
     Session     = null;
     Entities    = null;
     Players     = null;
     CubeBuilder = null;
     if (IngameScripting != null)
     {
         IngameScripting.Clean();
     }
     IngameScripting       = null;
     TerminalActionsHelper = null;
     Utilities             = null;
     Parallel         = null;
     Physics          = null;
     Multiplayer      = null;
     PrefabManager    = null;
     Input            = null;
     TerminalControls = null;
 }
Exemplo n.º 8
0
 public static void Clean()
 {
     Session = null;
     Entities = null;
     Players = null;
     CubeBuilder = null;
     TerminalActionsHelper = null;
     Utilities = null;
     Parallel = null;
     Multiplayer = null;
     PrefabManager = null;
     Input = null;
 }
 public static void ShowMessage(this IMyUtilities utilities, string sender, string messageText, params object[] args)
 {
     utilities.ShowMessage(sender, string.Format(messageText, args));
 }
Exemplo n.º 10
0
 public static void ShowMessage(this IMyUtilities utilities, string sender, string messageText, params object[] args)
 {
     utilities.ShowMessage(sender, string.Format(Localize.SubstituteTexts(messageText), args));
 }
Exemplo n.º 11
0
 public static void Clean()
 {
     Session = null;
     Entities = null;
     Players = null;
     CubeBuilder = null;
     if (IngameScripting != null)
     {
         IngameScripting.Clean();
     }
     IngameScripting = null;
     TerminalActionsHelper = null;
     Utilities = null;
     Parallel = null;
     Physics = null;
     Multiplayer = null;
     PrefabManager = null;
     Input = null;
     TerminalControls = null;
 }
Exemplo n.º 12
0
 public MessageSender(IMyMultiplayer multiplayer, IMyUtilities utilities)
 {
     this.multiplayer = multiplayer;
     this.utilities   = utilities;
 }