Exemplo n.º 1
0
        internal override void OnGUIOnceOnly()
        {
            //SkinsLibrary.SetCurrent(SkinsLibrary.DefSkinType.Unity);

            texBox           = new Texture2D(9, 9, TextureFormat.ARGB32, false);
            texBoxWithHeader = new Texture2D(9, 20, TextureFormat.ARGB32, false);
            texNext          = new Texture2D(10, 10, TextureFormat.ARGB32, false);
            texPrev          = new Texture2D(10, 10, TextureFormat.ARGB32, false);
            texPlay          = new Texture2D(16, 16, TextureFormat.ARGB32, false);
            texPause         = new Texture2D(16, 16, TextureFormat.ARGB32, false);
            texCross         = new Texture2D(16, 16, TextureFormat.ARGB32, false);
            texReset         = new Texture2D(16, 16, TextureFormat.ARGB32, false);

            texBookSmall     = new Texture2D(14, 14, TextureFormat.ARGB32, false);
            texKeyboardSmall = new Texture2D(16, 14, TextureFormat.ARGB32, false);

            KSPTips.ExtractToTexture(ref texReset, "img_Reset");
            KSPTips.ExtractToTexture(ref texCross, "img_Cross");
            KSPTips.ExtractToTexture(ref texPlay, "img_Play");
            KSPTips.ExtractToTexture(ref texPause, "img_Pause");
            KSPTips.ExtractToTexture(ref texNext, "img_Next");
            KSPTips.ExtractToTexture(ref texPrev, "img_Prev");
            KSPTips.ExtractToTexture(ref texBox, "tex_Box");
            KSPTips.ExtractToTexture(ref texBoxWithHeader, "tex_BoxWithHeader");

            KSPTips.ExtractToTexture(ref texBookSmall, "img_BookSmall");
            KSPTips.ExtractToTexture(ref texKeyboardSmall, "img_KeyboardSmall");
        }
Exemplo n.º 2
0
        internal override void OnGUIOnceOnly()
        {
            texBox   = new Texture2D(9, 9, TextureFormat.ARGB32, false);
            texNext  = new Texture2D(10, 10, TextureFormat.ARGB32, false);
            texPrev  = new Texture2D(10, 10, TextureFormat.ARGB32, false);
            texPlay  = new Texture2D(16, 16, TextureFormat.ARGB32, false);
            texPause = new Texture2D(16, 16, TextureFormat.ARGB32, false);
            texCross = new Texture2D(16, 16, TextureFormat.ARGB32, false);



            KSPTips.ExtractToTexture(ref texCross, "img_Cross");
            KSPTips.ExtractToTexture(ref texPlay, "img_Play");
            KSPTips.ExtractToTexture(ref texPause, "img_Pause");
            KSPTips.ExtractToTexture(ref texNext, "img_Next");
            KSPTips.ExtractToTexture(ref texPrev, "img_Prev");
            KSPTips.ExtractToTexture(ref texBox, "tex_Box");
        }
Exemplo n.º 3
0
        static void DownloadJobDone(object sender, RunWorkerCompletedEventArgs e)
        {
            String strTipsFile = wwwTips.text;

            MonoBehaviourExtended.LogFormatted("Download Complete: {0} Bytes", strTipsFile.Length);
            if (strTipsFile.Length > 0)
            {
                if (System.IO.File.Exists(KSPTips.PathPlugin + "/TipsDownloaded.cfg"))
                {
                    System.IO.File.Delete(KSPTips.PathPlugin + "/TipsDownloaded.cfg");
                }

                System.IO.File.WriteAllText(KSPTips.PathPlugin + "/TipsDownloaded.cfg", strTipsFile);

                ConfigNode cnToLoad = ConfigNode.Load(KSPTips.PathPlugin + "/TipsDownloaded.cfg");
                if (cnToLoad.GetNodes("TIP").Length > 0)
                {
                    MonoBehaviourExtended.LogFormatted("Contains Nodes, updating file, and reloading");
                    if (System.IO.File.Exists(KSPTips.PathPlugin + "/Tips.cfg"))
                    {
                        System.IO.File.Delete(KSPTips.PathPlugin + "/Tips.cfg");
                    }
                    System.IO.File.Copy(KSPTips.PathPlugin + "/TipsDownloaded.cfg", KSPTips.PathPlugin + "/Tips.cfg");

                    KSPTips.loadTips();
                }

                if (System.IO.File.Exists(KSPTips.PathPlugin + "/TipsDownloaded.cfg"))
                {
                    System.IO.File.Delete(KSPTips.PathPlugin + "/TipsDownloaded.cfg");
                }

                KSPTips.settings.DateTipsDownloaded = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
                KSPTips.settings.Save();
            }
        }
Exemplo n.º 4
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
        }