Пример #1
0
        private void DoConfigControls(Rect rect)
        {
            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.ColumnWidth = 200f;
            listing_Standard.Begin(rect);
            if (listing_Standard.ButtonText("Load".Translate()))
            {
                Find.WindowStack.Add(new Dialog_ScenarioList_Load(delegate(Scenario loadedScen)
                {
                    curScen     = loadedScen;
                    seedIsValid = false;
                }));
            }
            if (listing_Standard.ButtonText("Save".Translate()) && CheckAllPartsCompatible(curScen))
            {
                Find.WindowStack.Add(new Dialog_ScenarioList_Save(curScen));
            }
            if (listing_Standard.ButtonText("RandomizeSeed".Translate()))
            {
                SoundDefOf.Tick_Tiny.PlayOneShotOnCamera();
                RandomizeSeedAndScenario();
                seedIsValid = true;
            }
            if (seedIsValid)
            {
                listing_Standard.Label("Seed".Translate().CapitalizeFirst());
                string a = listing_Standard.TextEntry(seed);
                if (a != seed)
                {
                    seed    = a;
                    curScen = ScenarioMaker.GenerateNewRandomScenario(seed);
                }
            }
            else
            {
                listing_Standard.Gap(Text.LineHeight + Text.LineHeight + 2f);
            }
            listing_Standard.CheckboxLabeled("EditMode".Translate().CapitalizeFirst(), ref editMode);
            if (editMode)
            {
                seedIsValid = false;
                if (listing_Standard.ButtonText("AddPart".Translate()))
                {
                    OpenAddScenPartMenu();
                }
                if (SteamManager.Initialized && (curScen.Category == ScenarioCategory.CustomLocal || curScen.Category == ScenarioCategory.SteamWorkshop) && listing_Standard.ButtonText(Workshop.UploadButtonLabel(curScen.GetPublishedFileId())) && CheckAllPartsCompatible(curScen))
                {
                    AcceptanceReport acceptanceReport = curScen.TryUploadReport();
                    if (!acceptanceReport.Accepted)
                    {
                        Messages.Message(acceptanceReport.Reason, MessageTypeDefOf.RejectInput, historical: false);
                    }
                    else
                    {
                        SoundDefOf.Tick_High.PlayOneShotOnCamera();
                        Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmSteamWorkshopUpload".Translate(), delegate
                        {
                            SoundDefOf.Tick_High.PlayOneShotOnCamera();
                            Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmContentAuthor".Translate(), delegate
                            {
                                SoundDefOf.Tick_High.PlayOneShotOnCamera();
                                Workshop.Upload(curScen);
                            }, destructive: true));
                        }, destructive: true));
                    }
                }
            }
            listing_Standard.End();
        }