public static void MainMenuOnGUI()
        {
            VersionControl.DrawInfoInCorner();
            float   num       = (float)(UI.screenWidth / 2);
            Vector2 paneSize  = MainMenuDrawer.PaneSize;
            double  x         = num - paneSize.x / 2.0;
            float   num2      = (float)(UI.screenHeight / 2);
            Vector2 paneSize2 = MainMenuDrawer.PaneSize;
            double  y         = num2 - paneSize2.y / 2.0 + 50.0;
            Vector2 paneSize3 = MainMenuDrawer.PaneSize;
            float   x2        = paneSize3.x;
            Vector2 paneSize4 = MainMenuDrawer.PaneSize;
            Rect    rect      = new Rect((float)x, (float)y, x2, paneSize4.y);

            rect.x = (float)((float)UI.screenWidth - rect.width - 30.0);
            Rect rect2 = new Rect(0f, (float)(rect.y - 30.0), (float)((float)UI.screenWidth - 85.0), 30f);

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.UpperRight;
            string text = "MainPageCredit".Translate();

            if (UI.screenWidth < 990)
            {
                Rect    position = rect2;
                float   xMax     = position.xMax;
                Vector2 vector   = Text.CalcSize(text);
                position.xMin  = xMax - vector.x;
                position.xMin -= 4f;
                position.xMax += 4f;
                GUI.color      = new Color(0.2f, 0.2f, 0.2f, 0.5f);
                GUI.DrawTexture(position, BaseContent.WhiteTex);
                GUI.color = Color.white;
            }
            Widgets.Label(rect2, text);
            Text.Anchor = TextAnchor.UpperLeft;
            Text.Font   = GameFont.Small;
            Vector2 a = MainMenuDrawer.TitleSize;

            if (a.x > (float)UI.screenWidth)
            {
                a *= (float)UI.screenWidth / a.x;
            }
            a *= 0.7f;
            Rect position2 = new Rect((float)((float)UI.screenWidth - a.x - 50.0), rect2.y - a.y, a.x, a.y);

            GUI.DrawTexture(position2, MainMenuDrawer.TexTitle, ScaleMode.StretchToFill, true);
            GUI.color = new Color(1f, 1f, 1f, 0.5f);
            float   num3            = (float)(UI.screenWidth - 8);
            Vector2 ludeonLogoSize  = MainMenuDrawer.LudeonLogoSize;
            float   x3              = num3 - ludeonLogoSize.x;
            Vector2 ludeonLogoSize2 = MainMenuDrawer.LudeonLogoSize;
            float   x4              = ludeonLogoSize2.x;
            Vector2 ludeonLogoSize3 = MainMenuDrawer.LudeonLogoSize;
            Rect    position3       = new Rect(x3, 8f, x4, ludeonLogoSize3.y);

            GUI.DrawTexture(position3, MainMenuDrawer.TexLudeonLogo, ScaleMode.StretchToFill, true);
            GUI.color  = Color.white;
            rect.yMin += 17f;
            MainMenuDrawer.DoMainMenuControls(rect, MainMenuDrawer.anyMapFiles);
        }
        public static void MainMenuOnGUI()
        {
            VersionControl.DrawInfoInCorner();
            Rect rect = new Rect((float)(UI.screenWidth / 2) - MainMenuDrawer.PaneSize.x / 2f, (float)(UI.screenHeight / 2) - MainMenuDrawer.PaneSize.y / 2f + 50f, MainMenuDrawer.PaneSize.x, MainMenuDrawer.PaneSize.y);

            rect.x = (float)UI.screenWidth - rect.width - 30f;
            Rect rect2 = new Rect(0f, rect.y - 30f, (float)UI.screenWidth - 85f, 30f);

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.UpperRight;
            string text = "MainPageCredit".Translate();

            if (UI.screenWidth < 990)
            {
                Rect position = rect2;
                position.xMin  = position.xMax - Text.CalcSize(text).x;
                position.xMin -= 4f;
                position.xMax += 4f;
                GUI.color      = new Color(0.2f, 0.2f, 0.2f, 0.5f);
                GUI.DrawTexture(position, BaseContent.WhiteTex);
                GUI.color = Color.white;
            }
            Widgets.Label(rect2, text);
            Text.Anchor = TextAnchor.UpperLeft;
            Text.Font   = GameFont.Small;
            Vector2 a = MainMenuDrawer.TitleSize;

            if (a.x > (float)UI.screenWidth)
            {
                a *= (float)UI.screenWidth / a.x;
            }
            a *= 0.7f;
            Rect position2 = new Rect((float)UI.screenWidth - a.x - 50f, rect2.y - a.y, a.x, a.y);

            GUI.DrawTexture(position2, MainMenuDrawer.TexTitle, ScaleMode.StretchToFill, true);
            GUI.color = new Color(1f, 1f, 1f, 0.5f);
            Rect position3 = new Rect((float)(UI.screenWidth - 8) - MainMenuDrawer.LudeonLogoSize.x, 8f, MainMenuDrawer.LudeonLogoSize.x, MainMenuDrawer.LudeonLogoSize.y);

            GUI.DrawTexture(position3, MainMenuDrawer.TexLudeonLogo, ScaleMode.StretchToFill, true);
            GUI.color  = Color.white;
            rect.yMin += 17f;
            MainMenuDrawer.DoMainMenuControls(rect, MainMenuDrawer.anyMapFiles);
            if (Debug.isDebugBuild)
            {
                Rect outRect = new Rect(rect.x - 310f, rect.y, 295f, 400f);
                MainMenuDrawer.DoDevBuildWarningRect(outRect);
            }
            Rect outRect2 = new Rect(8f, (float)(UI.screenHeight - 8 - 400), 240f, 400f);

            MainMenuDrawer.DoTranslationInfoRect(outRect2);
        }
Exemple #3
0
 public override void DoWindowContents(Rect rect)
 {
     base.DoWindowContents(rect);
     MainMenuDrawer.DoMainMenuControls(rect, this.anyGameFiles);
 }
        public static void DoMainMenuControls(Rect rect, bool anyMapFiles)
        {
            GUI.BeginGroup(rect);
            Rect rect2 = new Rect(0f, 0f, 170f, rect.height);
            Rect rect3 = new Rect(rect2.xMax + 17f, 0f, 145f, rect.height);

            Text.Font = GameFont.Small;
            List <ListableOption> list = new List <ListableOption>();

            if (Current.ProgramState == ProgramState.Entry)
            {
                string label;
                if (!"Tutorial".CanTranslate())
                {
                    label = "LearnToPlay".Translate();
                }
                else
                {
                    label = "Tutorial".Translate();
                }
                list.Add(new ListableOption(label, delegate
                {
                    MainMenuDrawer.InitLearnToPlay();
                }, null));
                list.Add(new ListableOption("NewColony".Translate(), delegate
                {
                    Find.WindowStack.Add(new Page_SelectScenario());
                }, null));
            }
            if (Current.ProgramState == ProgramState.Playing && !Current.Game.Info.permadeathMode)
            {
                list.Add(new ListableOption("Save".Translate(), delegate
                {
                    MainMenuDrawer.CloseMainTab();
                    Find.WindowStack.Add(new Dialog_SaveFileList_Save());
                }, null));
            }
            ListableOption item;

            if (anyMapFiles && (Current.ProgramState != ProgramState.Playing || !Current.Game.Info.permadeathMode))
            {
                item = new ListableOption("LoadGame".Translate(), delegate
                {
                    MainMenuDrawer.CloseMainTab();
                    Find.WindowStack.Add(new Dialog_SaveFileList_Load());
                }, null);
                list.Add(item);
            }
            if (Current.ProgramState == ProgramState.Playing)
            {
                list.Add(new ListableOption("ReviewScenario".Translate(), delegate
                {
                    WindowStack arg_29_0       = Find.WindowStack;
                    string fullInformationText = Find.Scenario.GetFullInformationText();
                    string name = Find.Scenario.name;
                    arg_29_0.Add(new Dialog_MessageBox(fullInformationText, null, null, null, null, name, false, null, null));
                }, null));
            }
            item = new ListableOption("Options".Translate(), delegate
            {
                MainMenuDrawer.CloseMainTab();
                Find.WindowStack.Add(new Dialog_Options());
            }, "MenuButton-Options");
            list.Add(item);
            if (Current.ProgramState == ProgramState.Entry)
            {
                item = new ListableOption("Mods".Translate(), delegate
                {
                    Find.WindowStack.Add(new Page_ModsConfig());
                }, null);
                list.Add(item);
                if (Prefs.DevMode && LanguageDatabase.activeLanguage == LanguageDatabase.defaultLanguage && LanguageDatabase.activeLanguage.anyError)
                {
                    item = new ListableOption("SaveTranslationReport".Translate(), delegate
                    {
                        LanguageReportGenerator.SaveTranslationReport();
                    }, null);
                    list.Add(item);
                }
                item = new ListableOption("Credits".Translate(), delegate
                {
                    Find.WindowStack.Add(new Screen_Credits());
                }, null);
                list.Add(item);
            }
            if (Current.ProgramState == ProgramState.Playing)
            {
                if (Current.Game.Info.permadeathMode)
                {
                    item = new ListableOption("SaveAndQuitToMainMenu".Translate(), delegate
                    {
                        LongEventHandler.QueueLongEvent(delegate
                        {
                            GameDataSaveLoader.SaveGame(Current.Game.Info.permadeathModeUniqueName);
                            MemoryUtility.ClearAllMapsAndWorld();
                        }, "Entry", "SavingLongEvent", false, null);
                    }, null);
                    list.Add(item);
                    item = new ListableOption("SaveAndQuitToOS".Translate(), delegate
                    {
                        LongEventHandler.QueueLongEvent(delegate
                        {
                            GameDataSaveLoader.SaveGame(Current.Game.Info.permadeathModeUniqueName);
                            LongEventHandler.ExecuteWhenFinished(delegate
                            {
                                Root.Shutdown();
                            });
                        }, "SavingLongEvent", false, null);
                    }, null);
                    list.Add(item);
                }
                else
                {
                    Action action = delegate
                    {
                        if (GameDataSaveLoader.CurrentGameStateIsValuable)
                        {
                            Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmQuit".Translate(), delegate
                            {
                                GenScene.GoToMainMenu();
                            }, true, null));
                        }
                        else
                        {
                            GenScene.GoToMainMenu();
                        }
                    };
                    item = new ListableOption("QuitToMainMenu".Translate(), action, null);
                    list.Add(item);
                    Action action2 = delegate
                    {
                        if (GameDataSaveLoader.CurrentGameStateIsValuable)
                        {
                            Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmQuit".Translate(), delegate
                            {
                                Root.Shutdown();
                            }, true, null));
                        }
                        else
                        {
                            Root.Shutdown();
                        }
                    };
                    item = new ListableOption("QuitToOS".Translate(), action2, null);
                    list.Add(item);
                }
            }
            else
            {
                item = new ListableOption("QuitToOS".Translate(), delegate
                {
                    Root.Shutdown();
                }, null);
                list.Add(item);
            }
            OptionListingUtility.DrawOptionListing(rect2, list);
            Text.Font = GameFont.Small;
            List <ListableOption> list2 = new List <ListableOption>();
            ListableOption        item2 = new ListableOption_WebLink("FictionPrimer".Translate(), "https://rimworldgame.com/backstory", TexButton.IconBlog);

            list2.Add(item2);
            item2 = new ListableOption_WebLink("LudeonBlog".Translate(), "https://ludeon.com/blog", TexButton.IconBlog);
            list2.Add(item2);
            item2 = new ListableOption_WebLink("Forums".Translate(), "https://ludeon.com/forums", TexButton.IconForums);
            list2.Add(item2);
            item2 = new ListableOption_WebLink("OfficialWiki".Translate(), "https://rimworldwiki.com", TexButton.IconBlog);
            list2.Add(item2);
            item2 = new ListableOption_WebLink("TynansTwitter".Translate(), "https://twitter.com/TynanSylvester", TexButton.IconTwitter);
            list2.Add(item2);
            item2 = new ListableOption_WebLink("TynansDesignBook".Translate(), "https://tynansylvester.com/book", TexButton.IconBook);
            list2.Add(item2);
            item2 = new ListableOption_WebLink("HelpTranslate".Translate(), MainMenuDrawer.TranslationsContributeURL, TexButton.IconForums);
            list2.Add(item2);
            item2 = new ListableOption_WebLink("BuySoundtrack".Translate(), "http://www.lasgameaudio.co.uk/#!store/t04fw", TexButton.IconSoundtrack);
            list2.Add(item2);
            float num = OptionListingUtility.DrawOptionListing(rect3, list2);

            GUI.BeginGroup(rect3);
            if (Current.ProgramState == ProgramState.Entry && Widgets.ButtonImage(new Rect(0f, num + 10f, 64f, 32f), LanguageDatabase.activeLanguage.icon))
            {
                List <FloatMenuOption> list3 = new List <FloatMenuOption>();
                foreach (LoadedLanguage current in LanguageDatabase.AllLoadedLanguages)
                {
                    LoadedLanguage localLang = current;
                    list3.Add(new FloatMenuOption(localLang.FriendlyNameNative, delegate
                    {
                        LanguageDatabase.SelectLanguage(localLang);
                        Prefs.Save();
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                Find.WindowStack.Add(new FloatMenu(list3));
            }
            GUI.EndGroup();
            GUI.EndGroup();
        }
 private static void <DoMainMenuControls> m__5()
 {
     MainMenuDrawer.CloseMainTab();
     Find.WindowStack.Add(new Dialog_Options());
 }
 private static void <DoMainMenuControls> m__3()
 {
     MainMenuDrawer.CloseMainTab();
     Find.WindowStack.Add(new Dialog_SaveFileList_Load());
 }
 private static void <DoMainMenuControls> m__0()
 {
     MainMenuDrawer.InitLearnToPlay();
 }