예제 #1
0
파일: ModBase.cs 프로젝트: THDigi/PaintGun
        void IModBase.WorldExit()
        {
            try
            {
                OnWorldExit?.Invoke();

                for (int i = 0; i < Components.Count; ++i)
                {
                    try
                    {
                        Components[i].UnregisterComponent();
                    }
                    catch (Exception e)
                    {
                        Log.Error($"Exception during {Components[i].GetType().Name}.UnregisterComponent(): {e.Message}", Log.PRINT_MESSAGE);
                        Log.Error(e);
                    }
                }

                Components.Clear();
                ComponentRefreshFlags.Clear();
                ComponentUpdateInput.Clear();
                ComponentUpdateBeforeSim.Clear();
                ComponentUpdateAfterSim.Clear();
                ComponentUpdateDraw.Clear();
            }
            finally
            {
                Session  = null;
                Instance = null;
            }
        }
예제 #2
0
파일: ModBase.cs 프로젝트: THDigi/PaintGun
        protected ModBase(string modName, PaintGun_GameSession session)
        {
            Log.ModName       = modName;
            Log.AutoClose     = false;
            IsServer          = MyAPIGateway.Multiplayer.IsServer;
            IsDedicatedServer = (IsServer && MyAPIGateway.Utilities.IsDedicated);
            IsPlayer          = !IsDedicatedServer;

            Session  = session;
            Instance = (TModMain)(IModBase)this;
        }