Esempio n. 1
0
        private void GoToScenarioEditor()
        {
            Page_ScenarioEditor page_ScenarioEditor = new Page_ScenarioEditor(CanEditScenario(curScen) ? curScen : curScen.CopyForEditing());

            page_ScenarioEditor.prev = this;
            Find.WindowStack.Add(page_ScenarioEditor);
            Close();
        }
        private void GoToScenarioEditor()
        {
            Scenario            scen = (!this.CanEditScenario(this.curScen)) ? this.curScen.CopyForEditing() : this.curScen;
            Page_ScenarioEditor page_ScenarioEditor = new Page_ScenarioEditor(scen);

            page_ScenarioEditor.prev = this;
            Find.WindowStack.Add(page_ScenarioEditor);
            this.Close(true);
        }
Esempio n. 3
0
 private void OpenAddScenPartMenu()
 {
     FloatMenuUtility.MakeMenu(from p in ScenarioMaker.AddableParts(this.curScen)
                               where p.category != ScenPartCategory.Fixed
                               orderby p.label
                               select p, (ScenPartDef p) => p.LabelCap, delegate(ScenPartDef p)
     {
         Page_ScenarioEditor page_ScenarioEditor = this;
         return(delegate
         {
             page_ScenarioEditor.AddScenPart(p);
         });
     });
 }
Esempio n. 4
0
 protected override bool CanDoNext()
 {
     if (!base.CanDoNext())
     {
         return(false);
     }
     if (this.curScen == null)
     {
         return(false);
     }
     if (!Page_ScenarioEditor.CheckAllPartsCompatible(this.curScen))
     {
         return(false);
     }
     Page_SelectScenario.BeginScenarioConfiguration(this.curScen, this);
     return(true);
 }
        protected override bool CanDoNext()
        {
            bool result;

            if (!base.CanDoNext())
            {
                result = false;
            }
            else if (this.curScen == null)
            {
                result = false;
            }
            else if (!Page_ScenarioEditor.CheckAllPartsCompatible(this.curScen))
            {
                result = false;
            }
            else
            {
                Page_SelectScenario.BeginScenarioConfiguration(this.curScen, this);
                result = true;
            }
            return(result);
        }
Esempio n. 6
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(), null))
            {
                Find.WindowStack.Add(new Dialog_ScenarioList_Load(delegate(Scenario loadedScen)
                {
                    this.curScen     = loadedScen;
                    this.seedIsValid = false;
                }));
            }
            if (listing_Standard.ButtonText("Save".Translate(), null) && Page_ScenarioEditor.CheckAllPartsCompatible(this.curScen))
            {
                Find.WindowStack.Add(new Dialog_ScenarioList_Save(this.curScen));
            }
            if (listing_Standard.ButtonText("RandomizeSeed".Translate(), null))
            {
                SoundDefOf.TickTiny.PlayOneShotOnCamera(null);
                this.RandomizeSeedAndScenario();
                this.seedIsValid = true;
            }
            if (this.seedIsValid)
            {
                listing_Standard.Label("Seed".Translate().CapitalizeFirst(), -1f);
                string a = listing_Standard.TextEntry(this.seed, 1);
                if (a != this.seed)
                {
                    this.seed    = a;
                    this.curScen = ScenarioMaker.GenerateNewRandomScenario(this.seed);
                }
            }
            else
            {
                listing_Standard.Gap((float)(Text.LineHeight + Text.LineHeight + 2.0));
            }
            listing_Standard.CheckboxLabeled("EditMode".Translate().CapitalizeFirst(), ref this.editMode, (string)null);
            if (this.editMode)
            {
                this.seedIsValid = false;
                if (listing_Standard.ButtonText("AddPart".Translate(), null))
                {
                    this.OpenAddScenPartMenu();
                }
                if (SteamManager.Initialized && (this.curScen.Category == ScenarioCategory.CustomLocal || this.curScen.Category == ScenarioCategory.SteamWorkshop) && listing_Standard.ButtonText(Workshop.UploadButtonLabel(this.curScen.GetPublishedFileId()), null) && Page_ScenarioEditor.CheckAllPartsCompatible(this.curScen))
                {
                    AcceptanceReport acceptanceReport = this.curScen.TryUploadReport();
                    if (!acceptanceReport.Accepted)
                    {
                        Messages.Message(acceptanceReport.Reason, MessageTypeDefOf.RejectInput);
                    }
                    else
                    {
                        SoundDefOf.TickHigh.PlayOneShotOnCamera(null);
                        Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmSteamWorkshopUpload".Translate(), delegate
                        {
                            SoundDefOf.TickHigh.PlayOneShotOnCamera(null);
                            Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmContentAuthor".Translate(), delegate
                            {
                                SoundDefOf.TickHigh.PlayOneShotOnCamera(null);
                                Workshop.Upload(this.curScen);
                            }, true, null));
                        }, true, null));
                    }
                }
            }
            listing_Standard.End();
        }