Example #1
0
        public override void LoadData()
        {
            Instance = this;

            isCreativeGame = (MyAPIGateway.Session.SessionSettings.GameMode == MyGameModeEnum.Creative);
            isServer       = (MyAPIGateway.Session.OnlineMode == MyOnlineModeEnum.OFFLINE || MyAPIGateway.Multiplayer.IsServer);
            isDedicated    = (MyAPIGateway.Utilities.IsDedicated && isServer);

            MyLog.Default.WriteLineAndConsole($"isCreativeGame: {isCreativeGame}; isServer: {isServer}; isDedicated: {isDedicated}");

            if (!isDedicated)
            {
                HudApi = new HudAPIv2();
                HUD    = new Hud(HudApi);
            }

            if (isServer)
            {
                updateCounter = 0;
                PlayerList    = new List <IMyPlayer>();

                Config          = StorageFile.Load <Config>("config.xml");
                PlayerStatsDict = StorageFile.Load <PlayerStatsStorage>("stats.xml").ToDict();

                MovementCosts.SetFromConfig(Config);
            }
        }
Example #2
0
        protected override void UnloadData()
        {
            Instance = null;

            Networking?.Unregister();
            Networking = null;

            HUD?.Unload();
            HudApi?.Unload();

            PlayerList?.Clear();
            PlayerStatsDict?.Clear();
        }