public ExtensionsMenuScreen()
 {
     this.SaveScreen.StartNewGameForUsernameAndPass += (Action <string, string>)((username, pass) =>
     {
         OS.WillLoadSave = false;
         if (this.CreateNewAccountForExtension_UserAndPass == null)
         {
             return;
         }
         this.CreateNewAccountForExtension_UserAndPass(username, pass);
     });
     this.SaveScreen.LoadGameForUserFileAndUsername += (Action <string, string>)((filename, username) =>
     {
         OS.WillLoadSave = true;
         if (this.LoadAccountForExtension_FileAndUsername == null)
         {
             return;
         }
         this.LoadAccountForExtension_FileAndUsername(filename, username);
     });
     this.SaveScreen.RequestGoBack += (Action)(() => this.State = ExtensionsMenuScreen.EMSState.Normal);
     this.SaveScreen.DrawFromTop    = true;
     if (!Settings.AllowExtensionPublish)
     {
         return;
     }
     this.workshopPublishScreen         = new SteamWorkshopPublishScreen(Game1.getSingleton().Content);
     this.workshopPublishScreen.GoBack += (Action)(() => this.IsInPublishScreen = false);
 }
 public void ShowError(string error)
 {
     this.ReportOverride = error;
     this.State          = ExtensionsMenuScreen.EMSState.Normal;
 }
        private Vector2 DrawExtensionInfoDetail(Vector2 drawpos, Rectangle dest, SpriteBatch sb, ScreenManager screenMan, ExtensionInfo info)
        {
            sb.DrawString(GuiData.titlefont, info.Name.ToUpper(), drawpos, Utils.AddativeWhite * 0.66f);
            drawpos.Y += 80f;
            int height1 = sb.GraphicsDevice.Viewport.Height;
            int num1    = 256;

            if (height1 < 900)
            {
                num1 = 120;
            }
            Rectangle dest1   = new Rectangle((int)drawpos.X, (int)drawpos.Y, num1, num1);
            Texture2D texture = this.DefaultModImage;

            if (info.LogoImage != null)
            {
                texture = info.LogoImage;
            }
            FlickeringTextEffect.DrawFlickeringSprite(sb, dest1, texture, 2f, 0.5f, (object)null, Color.White);
            Vector2 position = drawpos + new Vector2((float)num1 + 40f, 20f);
            float   num2     = (float)dest.Width - (drawpos.X - (float)dest.X);
            string  text1    = Utils.SuperSmartTwimForWidth(info.Description, (int)num2, GuiData.smallfont);

            sb.DrawString(GuiData.smallfont, text1, position, Utils.AddativeWhite * 0.7f);
            drawpos.Y += (float)num1 + 10f;
            if (this.IsInPublishScreen)
            {
                Rectangle fullscreen = Utils.GetFullscreen();
                Rectangle dest2      = new Rectangle((int)drawpos.X, (int)drawpos.Y, fullscreen.Width - (int)drawpos.X * 2, fullscreen.Height - ((int)drawpos.Y + 50));
                return(this.workshopPublishScreen.Draw(sb, dest2, info));
            }
            if (this.ReportOverride != null)
            {
                string text2 = Utils.SuperSmartTwimForWidth(this.ReportOverride, 800, GuiData.smallfont);
                sb.DrawString(GuiData.smallfont, text2, drawpos + new Vector2(460f, 0.0f), this.ReportOverride.Length > 250 ? Utils.AddativeRed : Utils.AddativeWhite);
            }
            int val1    = 40;
            int num3    = 5;
            int num4    = info.AllowSave ? 4 : 2;
            int num5    = height1 - (int)drawpos.Y - 55;
            int height2 = Math.Min(val1, (num5 - num4 * num3) / num4);

            if (Button.doButton(7900010, (int)drawpos.X, (int)drawpos.Y, 450, height2, string.Format(LocaleTerms.Loc("New {0} Account"), (object)info.Name), new Color?(MainMenu.buttonColor)))
            {
                this.State = ExtensionsMenuScreen.EMSState.GetUsername;
                this.SaveScreen.ResetForNewAccount();
            }
            drawpos.Y += (float)(height2 + num3);
            if (info.AllowSave)
            {
                bool flag = !string.IsNullOrWhiteSpace(SaveFileManager.LastLoggedInUser.FileUsername);
                if (Button.doButton(7900019, (int)drawpos.X, (int)drawpos.Y, 450, height2, flag ? "Continue Account : " + SaveFileManager.LastLoggedInUser.Username : "******", new Color?(flag ? MainMenu.buttonColor : Color.Black)))
                {
                    OS.WillLoadSave = true;
                    if (this.LoadAccountForExtension_FileAndUsername != null)
                    {
                        this.LoadAccountForExtension_FileAndUsername(SaveFileManager.LastLoggedInUser.FileUsername, SaveFileManager.LastLoggedInUser.Username);
                    }
                }
                drawpos.Y += (float)(height2 + num3);
                if (Button.doButton(7900020, (int)drawpos.X, (int)drawpos.Y, 450, height2, LocaleTerms.Loc("Login") + "...", new Color?(flag ? MainMenu.buttonColor : Color.Black)))
                {
                    this.State = ExtensionsMenuScreen.EMSState.ShowAccounts;
                    this.SaveScreen.ResetForLogin();
                }
                drawpos.Y += (float)(height2 + num3);
            }
            if (Button.doButton(7900030, (int)drawpos.X, (int)drawpos.Y, 450, height2, LocaleTerms.Loc("Run Verification Tests"), new Color?(MainMenu.buttonColor)))
            {
                int    errorsAdded = 0;
                string str1        = ExtensionTests.TestExtensionForRuntime(screenMan, info.FolderPath, out errorsAdded);
                try
                {
                    ExtensionInfo.VerifyExtensionInfo(info);
                }
                catch (Exception ex)
                {
                    str1 = str1 + "\nExtension Metadata Error:\n" + Utils.GenerateReportFromException(ex);
                    ++errorsAdded;
                }
                if (errorsAdded == 0)
                {
                    this.ReportOverride = LocaleTerms.Loc("Testing...") + "\n" + LocaleTerms.Loc("All tests complete") + "\n0 " + LocaleTerms.Loc("Errors Found");
                }
                else
                {
                    this.ReportOverride = LocaleTerms.Loc("Errors Found") + ". " + string.Format(LocaleTerms.Loc("Writing report to {0}"), (object)(info.FolderPath + "/report.txt\n").Replace("\\", "/")) + str1;
                    string str2 = info.FolderPath + "/report.txt";
                    if (File.Exists(str2))
                    {
                        File.Delete(str2);
                    }
                    Utils.writeToFile(this.ReportOverride, str2);
                }
                MusicManager.transitionToSong("Music/Ambient/AmbientDrone_Clipped");
                ExtensionLoader.ActiveExtensionInfo = this.ExtensionInfoToShow;
            }
            drawpos.Y += (float)(height2 + num3);
            if (Settings.AllowExtensionPublish && PlatformAPISettings.Running)
            {
                if (Button.doButton(7900031, (int)drawpos.X, (int)drawpos.Y, 450, height2, LocaleTerms.Loc("Steam Workshop Publishing"), new Color?(MainMenu.buttonColor)))
                {
                    this.IsInPublishScreen = true;
                }
                drawpos.Y += (float)(height2 + num3);
            }
            if (Button.doButton(7900040, (int)drawpos.X, (int)drawpos.Y, 450, 25, LocaleTerms.Loc("Back to Extension List"), new Color?(MainMenu.exitButtonColor)))
            {
                this.ExtensionInfoToShow = (ExtensionInfo)null;
            }
            drawpos.Y += 30f;
            return(drawpos);
        }
 public void Reset()
 {
     this.State            = ExtensionsMenuScreen.EMSState.Normal;
     this.ScrollStartIndex = 0;
 }