示例#1
0
        protected override void OnDestroy()
        {
            loaded = false;

            if (window != null)
            {
                Destroy(window);
            }

            if (appButton != null)
            {
                Destroy(appButton);
            }

            if (toolbar != null)
            {
                Destroy(toolbar);
            }

            contractParser.onContractsParsed.Remove(onContractsLoaded);
            contractParser.onContractStateChange.Remove(refreshList);
            progressParser.onProgressParsed.Remove(onProgressLoaded);
            GameEvents.Contract.onContractsListChanged.Remove(onListChanged);

            instance = null;
        }
示例#2
0
        protected override void Start()
        {
            instance = this;

            if (HighLogic.CurrentGame.Mode != Game.Modes.CAREER)
            {
                Destroy(gameObject);
            }

            if (settings == null)
            {
                settings = new CapComSettings(filePath);

                //if (settings.useKSPStyle)
                //{
                //	CapComSkins.initializeKSPSkins();
                //	CC_SkinsLibrary.SetCurrent("CCKSPSkin");
                //}
                //else
                //{
                //	CapComSkins.initializeUnitySkins();
                //	CC_SkinsLibrary.SetCurrent("CCUnitySkin");
                //}
            }

            window = gameObject.AddComponent <CapComWindow>();

            if (ToolbarManager.ToolbarAvailable && !settings.stockToolbar)
            {
                if (toolbar == null)
                {
                    toolbar = gameObject.AddComponent <CC_Toolbar>();
                }
                if (appButton != null)
                {
                    Destroy(appButton);
                    appButton = null;
                }
            }
            else
            {
                if (appButton == null)
                {
                    appButton = gameObject.AddComponent <CC_StockToolbar>();
                }
                if (toolbar != null)
                {
                    Destroy(toolbar);
                    toolbar = null;
                }
            }

            contractParser.onContractsParsed.Add(onContractsLoaded);
            contractParser.onContractStateChange.Add(refreshList);
            progressParser.onProgressParsed.Add(onProgressLoaded);
            GameEvents.Contract.onContractsListChanged.Add(onListChanged);
        }
示例#3
0
        protected override void Start()
        {
            instance = this;

            if (HighLogic.CurrentGame.Mode != Game.Modes.CAREER)
                Destroy(this);

            if (settings == null)
            {
                settings = new CapComSettings(filePath);

                //if (settings.useKSPStyle)
                //{
                //	CapComSkins.initializeKSPSkins();
                //	CC_SkinsLibrary.SetCurrent("CCKSPSkin");
                //}
                //else
                //{
                //	CapComSkins.initializeUnitySkins();
                //	CC_SkinsLibrary.SetCurrent("CCUnitySkin");
                //}
            }

            window = gameObject.AddComponent<CapComWindow>();

            if (ToolbarManager.ToolbarAvailable && !settings.stockToolbar)
            {
                if (toolbar == null)
                    toolbar = gameObject.AddComponent<CC_Toolbar>();
                if (appButton != null)
                    Destroy(appButton);
            }
            else
            {
                if (appButton == null)
                    appButton = gameObject.AddComponent<CC_StockToolbar>();
                if (toolbar != null)
                    Destroy(toolbar);
            }

            contractParser.onContractsParsed.Add(onContractsLoaded);
            contractParser.onContractStateChange.Add(refreshList);
            progressParser.onProgressParsed.Add(onProgressLoaded);
            GameEvents.Contract.onContractsListChanged.Add(onListChanged);
        }
示例#4
0
        protected override void OnDestroy()
        {
            loaded = false;

            if (appButton != null)
                Destroy(appButton);

            if (toolbar != null)
                Destroy(toolbar);

            if (window != null)
                Destroy(window);

            contractParser.onContractsParsed.Remove(onContractsLoaded);
            contractParser.onContractStateChange.Remove(refreshList);
            progressParser.onProgressParsed.Remove(onProgressLoaded);
            GameEvents.Contract.onContractsListChanged.Remove(onListChanged);

            instance = null;
        }