예제 #1
0
        internal override void Awake()
        {
            LogFormatted("KSPTips Awake");

            LogFormatted("Loading Settings");
            settings = new Settings("settings.cfg");
            if (!settings.Load())
                LogFormatted("Settings Load Failed");

            if (isShowingGuides) {
                loadGuides();
                LogFormatted("GuidePages loaded: {0}",lstGuides.Count);
                string guideslist = "";
                foreach (GuidePage item in lstGuidePages)
                {
                    guideslist += "\r\n" + String.Format("{0}-{1}  {2}-{3}  {4}", item.guide.TargetScene, item.guide.Folder, item.guide.Title, item.Title, item.Image);
                }
                LogFormatted_DebugOnly(guideslist);

                windowGuides = gameObject.AddComponent<Windows.Guides>();
                windowGuides.mbTip = this;
                windowGuides.WindowRect = new Rect(100, 100, 600, 400);

                Texture2D texMainButton = new Texture2D(38, 38, TextureFormat.ARGB32, false);
                KSPTips.ExtractToTexture(ref texMainButton, "img_Book");
                AppButton = new AppLauncherButtonWrapper(texMainButton);
                GameEvents.onGUIApplicationLauncherReady.Add(AppButton.OnGUIAppLauncherReady);
                GameEvents.onGUIApplicationLauncherUnreadifying.Add(AppButton.OnGUIAppLauncherUnreadify);

                AppButton.onTrue += AppButton_onTrue;
                AppButton.onFalse += AppButton_onFalse;
            }

            if (isShowingTips)
            {
                loadTips();

                LogFormatted("KSPTips loaded: {0}", lstTips.Count);
                string tipslist = "";
                foreach (Tip item in lstTips)
                {
                    tipslist += "\r\n" + String.Format("{0}-{1}-{2}-{3}-{4}", item.Question, item.Answer, item.Image, item.GameMode, item.ModAssembly);
                }
                LogFormatted_DebugOnly(tipslist);

                windowTips = gameObject.AddComponent<Windows.Tips>();
                windowTips.mbTip = this;
                windowTips.Visible = !settings.Hidden;

                if (!settings.Hidden)
                {
                    SetRepeatRate(15);
                    StartRepeatingWorker();
                    ChangeTip();
                }

            }

            ///////////////////////////////////////////////////////////////////////////
            //Removed Building MouseOver Functionality
            ///////////////////////////////////////////////////////////////////////////
            //tipwindowBuilding = gameObject.AddComponent<KSPTipsWindowBuilding>();
            //tipwindowBuilding.mbTip = this;

            //Now do a background download of the tips as well
            KSPTipsDownloader.BeginCheck();

            #if DEBUG
            debugwin = gameObject.AddComponent<TipsWindowDebug>();
            debugwin.WindowRect = new Rect(0, 0, 100, 500);
            #endif
        }
예제 #2
0
        internal override void Awake()
        {
            LogFormatted("KSPTips Awake");

            LogFormatted("Loading Settings");
            settings = new Settings("settings.cfg");
            if (!settings.Load())
            {
                LogFormatted("Settings Load Failed");
            }

            if (isShowingGuides)
            {
                loadGuides();
                LogFormatted("GuidePages loaded: {0}", lstGuides.Count);
                string guideslist = "";
                foreach (GuidePage item in lstGuidePages)
                {
                    guideslist += "\r\n" + String.Format("{0}-{1}  {2}-{3}  {4}", item.guide.TargetScene, item.guide.Folder, item.guide.Title, item.Title, item.Image);
                }
                LogFormatted_DebugOnly(guideslist);

                windowGuides            = gameObject.AddComponent <Windows.Guides>();
                windowGuides.mbTip      = this;
                windowGuides.WindowRect = new Rect(100, 100, 600, 400);

                Texture2D texMainButton = new Texture2D(38, 38, TextureFormat.ARGB32, false);
                KSPTips.ExtractToTexture(ref texMainButton, "img_Book");
                AppButton = new AppLauncherButtonWrapper(texMainButton);
                GameEvents.onGUIApplicationLauncherReady.Add(AppButton.OnGUIAppLauncherReady);
                GameEvents.onGUIApplicationLauncherUnreadifying.Add(AppButton.OnGUIAppLauncherUnreadify);

                AppButton.onTrue  += AppButton_onTrue;
                AppButton.onFalse += AppButton_onFalse;
            }

            if (isShowingTips)
            {
                loadTips();

                LogFormatted("KSPTips loaded: {0}", lstTips.Count);
                string tipslist = "";
                foreach (Tip item in lstTips)
                {
                    tipslist += "\r\n" + String.Format("{0}-{1}-{2}-{3}-{4}", item.Question, item.Answer, item.Image, item.GameMode, item.ModAssembly);
                }
                LogFormatted_DebugOnly(tipslist);

                windowTips         = gameObject.AddComponent <Windows.Tips>();
                windowTips.mbTip   = this;
                windowTips.Visible = !settings.Hidden;

                if (!settings.Hidden)
                {
                    SetRepeatRate(15);
                    StartRepeatingWorker();
                    ChangeTip();
                }
            }

            ///////////////////////////////////////////////////////////////////////////
            //Removed Building MouseOver Functionality
            ///////////////////////////////////////////////////////////////////////////
            //tipwindowBuilding = gameObject.AddComponent<KSPTipsWindowBuilding>();
            //tipwindowBuilding.mbTip = this;


            //Now do a background download of the tips as well
            KSPTipsDownloader.BeginCheck();

#if DEBUG
            debugwin            = gameObject.AddComponent <TipsWindowDebug>();
            debugwin.WindowRect = new Rect(0, 0, 100, 500);
#endif
        }