Пример #1
0
        public override void _Ready()
        {
            MDStatics.GI = this;

            // Configuration first
            CreateConfiguration();

            // Init static classes first
            MDLog.Initialize(GetLogDirectory());
            MDArguments.PopulateArgs();
            MDProfiler.Initialize();
            MDOnScreenDebug.Initialize();

            // Hook up events
            GetTree().Connect("node_added", this, nameof(OnNodeAdded_Internal));
            GetTree().Connect("node_removed", this, nameof(OnNodeRemoved_Internal));

            // Init instances
            CreateGameSession();
            CreateGameSynchronizer();
            CreateReplicator();
            CreateInterfaceManager();

            RegisterNodeAndChildren(GetTree().Root);
        }
Пример #2
0
 // Starts a server or client based on the command args
 private void CheckArgsForConnectionInfo()
 {
     if (MDArguments.HasArg(ARG_STANDALONE))
     {
         StartStandalone();
     }
     // Expects -server=[port]
     else if (MDArguments.HasArg(ARG_SERVER))
     {
         int Port = MDArguments.GetArgInt(ARG_SERVER);
         StartServer(Port);
     }
     // Expects -client=[IPAddress:Port]
     else if (MDArguments.HasArg(ARG_CLIENT))
     {
         string   ClientArg = MDArguments.GetArg(ARG_CLIENT);
         string[] HostPort  = ClientArg.Split(":");
         if (HostPort.Length == 2)
         {
             StartClient(HostPort[0], HostPort[1].ToInt());
         }
         else
         {
             MDLog.Error(LOG_CAT,
                         $"Failed to parse client arg {ClientArg}, expecting -{ARG_CLIENT}=[IPAddress:Port]");
         }
     }
 }
Пример #3
0
 /// <summary>
 /// Disposes the profiler
 /// </summary>
 public void Dispose()
 {
     Timer.Stop();
     if (_enabledProfiles.Contains(LowerProfileName) || MDArguments.HasArg(LOG_ARG))
     {
         MDLog.Info(LOG_CAT, $"Profiling [{ProfileName}] took {GetMicroSeconds()} us");
     }
 }