private void UnregisterMotdRequest() { if (m_motdServerClient != null) { m_motdServerClient.UnregisterCallback(); m_motdServerClient = null; } }
protected override void OnPrefabInit() { base.OnPrefabInit(); MakeButton(new ButtonInfo(UI.FRONTEND.MAINMENU.NEWGAME, NewGame, 22)); MakeButton(new ButtonInfo(UI.FRONTEND.MAINMENU.LOADGAME, LoadGame, 14)); MakeButton(new ButtonInfo(UI.FRONTEND.MAINMENU.RETIREDCOLONIES, delegate { ActivateRetiredColoniesScreen(base.transform.gameObject, string.Empty, null); }, 14)); if (DistributionPlatform.Initialized) { MakeButton(new ButtonInfo(UI.FRONTEND.MAINMENU.TRANSLATIONS, Translations, 14)); MakeButton(new ButtonInfo(UI.FRONTEND.MODS.TITLE, Mods, 14)); } MakeButton(new ButtonInfo(UI.FRONTEND.MAINMENU.OPTIONS, Options, 14)); MakeButton(new ButtonInfo(UI.FRONTEND.MAINMENU.QUITTODESKTOP, QuitGame, 14)); KCrashReporter.MOST_RECENT_SAVEFILE = null; RefreshResumeButton(); Button_ResumeGame.onClick += ResumeGame; StartFEAudio(); SpawnVideoScreen(); CheckPlayerPrefsCorruption(); if (PatchNotesScreen.ShouldShowScreen()) { patchNotesScreen.gameObject.SetActive(true); } CheckDoubleBoundKeys(); topLeftAlphaMessage.gameObject.SetActive(false); nextUpdateTimer.gameObject.SetActive(false); m_motdServerClient = new MotdServerClient(); m_motdServerClient.GetMotd(delegate(MotdServerClient.MotdResponse response, string error) { MainMenu mainMenu = this; if (error == null) { topLeftAlphaMessage.gameObject.SetActive(true); nextUpdateTimer.gameObject.SetActive(true); motdImageHeader.text = response.image_header_text; motdNewsHeader.text = response.news_header_text; motdNewsBody.text = response.news_body_text; patchNotesScreen.UpdatePatchNotes(response.patch_notes_summary, response.patch_notes_link_url); nextUpdateTimer.UpdateReleaseTimes(response.last_update_time, response.next_update_time, response.update_text_override); if ((UnityEngine.Object)motdImage != (UnityEngine.Object)null && (UnityEngine.Object)response.image_texture != (UnityEngine.Object)null) { motdImage.sprite = Sprite.Create(response.image_texture, new Rect(0f, 0f, (float)response.image_texture.width, (float)response.image_texture.height), Vector2.zero); if (motdImage.sprite.rect.height != 0f) { AspectRatioFitter component = motdImage.gameObject.GetComponent <AspectRatioFitter>(); if ((UnityEngine.Object)component != (UnityEngine.Object)null) { float num2 = component.aspectRatio = motdImage.sprite.rect.width / motdImage.sprite.rect.height; } else { Debug.LogWarning("Missing AspectRatioFitter on MainMenu motd image."); } } motdImageButton.onClick.AddListener(delegate { Application.OpenURL(response.image_link_url); }); } } else { Debug.LogWarning("Motd Request error: " + error); } }); lastUpdateTime = Time.unscaledTime; activateOnSpawn = true; }