234 lines
9.9 KiB
C#
234 lines
9.9 KiB
C#
public class XUiC_MainMenuRebirth : XUiC_MainMenu
|
|
{
|
|
public XUiC_SimpleButton btnRebirthDiscord;
|
|
|
|
public override void Init()
|
|
{
|
|
base.Init();
|
|
if (!GameManager.IsDedicatedServer)
|
|
{
|
|
this.btnRebirthDiscord = base.GetChildById("btnRebirthDiscord") as XUiC_SimpleButton;
|
|
this.btnRebirthDiscord.OnPressed += this.btnRebirthDiscord_OnPressed;
|
|
|
|
UILabel component = this.xui.playerUI.nguiWindowManager.GetWindow(EnumNGUIWindow.Version).GetComponent<UILabel>();
|
|
Mod mod = ModManager.GetMod("zzz_REBIRTH__Utils", true);
|
|
|
|
component.text = "[bf9ad9]REBIRTH[-] " + mod.Version + " / " + Constants.cVersionInformation.LongString;
|
|
Log.Out("Rebirth Version: " + mod.Version);
|
|
}
|
|
}
|
|
private void btnRebirthDiscord_OnPressed(XUiController _sender, int _mouseButton)
|
|
{
|
|
Application.OpenURL("https://discord.gg/gfBxVYy4mu");
|
|
}
|
|
|
|
/*public override void Init()
|
|
{
|
|
base.Init();
|
|
XUiC_MainMenu.ID = base.WindowGroup.ID;
|
|
this.btnNewGame = base.GetChildById("btnNewGame") as XUiC_SimpleButton;
|
|
this.btnContinueGame = base.GetChildById("btnContinueGame") as XUiC_SimpleButton;
|
|
this.btnConnectToServer = base.GetChildById("btnConnectToServer") as XUiC_SimpleButton;
|
|
this.btnRebirthDiscord = base.GetChildById("btnRebirthDiscord") as XUiC_SimpleButton;
|
|
this.btnEditingTools = base.GetChildById("btnEditingTools") as XUiC_SimpleButton;
|
|
this.btnOptions = base.GetChildById("btnOptions") as XUiC_SimpleButton;
|
|
this.btnCredits = base.GetChildById("btnCredits") as XUiC_SimpleButton;
|
|
this.btnQuit = base.GetChildById("btnQuit") as XUiC_SimpleButton;
|
|
this.btnNewGame.OnPressed += this.btnNewGame_OnPressed;
|
|
this.btnContinueGame.OnPressed += this.btnContinueGame_OnPressed;
|
|
this.btnConnectToServer.OnPressed += this.btnConnectToServer_OnPressed;
|
|
this.btnRebirthDiscord.OnPressed += this.btnRebirthDiscord_OnPressed;
|
|
this.btnEditingTools.OnPressed += this.btnEditingTools_OnPressed;
|
|
this.btnOptions.OnPressed += this.btnOptions_OnPressed;
|
|
this.btnCredits.OnPressed += this.btnCredits_OnPressed;
|
|
this.btnQuit.OnPressed += this.btnQuit_OnPressed;
|
|
|
|
if(!GameManager.IsDedicatedServer)
|
|
{
|
|
UILabel component = this.xui.playerUI.nguiWindowManager.GetWindow(EnumNGUIWindow.Version).GetComponent<UILabel>();
|
|
Mod mod = ModManager.GetMod("zzz_REBIRTH__Utils", true);
|
|
|
|
component.text = "[bf9ad9]REBIRTH[-] " + mod.Version + " / " + Constants.cVersionInformation.LongString;
|
|
}
|
|
}
|
|
|
|
private void btnRebirthDiscord_OnPressed(XUiController _sender, int _mouseButton)
|
|
{
|
|
Application.OpenURL("https://discord.gg/gfBxVYy4mu");
|
|
}
|
|
|
|
private void btnNewGame_OnPressed(XUiController _sender, int _mouseButton)
|
|
{
|
|
XUiC_NewContinueGame.SetIsContinueGame(base.xui, false);
|
|
this.CheckProfile(XUiC_NewContinueGame.ID);
|
|
}
|
|
|
|
private void btnContinueGame_OnPressed(XUiController _sender, int _mouseButton)
|
|
{
|
|
XUiC_NewContinueGame.SetIsContinueGame(base.xui, true);
|
|
this.CheckProfile(XUiC_NewContinueGame.ID);
|
|
}
|
|
|
|
private void btnConnectToServer_OnPressed(XUiController _sender, int _mouseButton)
|
|
{
|
|
this.CheckProfile(XUiC_ServerBrowser.ID);
|
|
}
|
|
|
|
private void btnEditingTools_OnPressed(XUiController _sender, int _mouseButton)
|
|
{
|
|
base.xui.playerUI.windowManager.Close(this.windowGroup.ID);
|
|
base.xui.playerUI.windowManager.Open(XUiC_EditingTools.ID, true, false, true);
|
|
}
|
|
|
|
private void btnOptions_OnPressed(XUiController _sender, int _mouseButton)
|
|
{
|
|
base.xui.playerUI.windowManager.Close(this.windowGroup.ID);
|
|
base.xui.playerUI.windowManager.Open(XUiC_OptionsMenu.ID, true, false, true);
|
|
}
|
|
|
|
private void btnCredits_OnPressed(XUiController _sender, int _mouseButton)
|
|
{
|
|
base.xui.playerUI.windowManager.Close(this.windowGroup.ID);
|
|
base.xui.playerUI.windowManager.Open(XUiC_Credits.ID, true, false, true);
|
|
}
|
|
|
|
private void btnQuit_OnPressed(XUiController _sender, int _mouseButton)
|
|
{
|
|
Application.Quit();
|
|
}
|
|
|
|
private void CheckProfile(string _windowToOpen)
|
|
{
|
|
base.xui.playerUI.windowManager.Close(this.windowGroup.ID);
|
|
if(ProfileSDF.CurrentProfileName().Length == 0)
|
|
{
|
|
XUiC_OptionsProfiles.Open(base.xui, delegate
|
|
{
|
|
this.xui.playerUI.windowManager.Open(_windowToOpen, true, false, true);
|
|
});
|
|
return;
|
|
}
|
|
|
|
base.xui.playerUI.windowManager.Open(_windowToOpen, true, false, true);
|
|
}
|
|
|
|
public override void Update(float _dt)
|
|
{
|
|
base.Update(_dt);
|
|
this.windowGroup.isEscClosable = false;
|
|
this.RefreshBindings();
|
|
bool _checkRestartAtMainMenu = true;
|
|
int num = PlatformManager.MultiPlatform.JoinSessionGameInviteListener == null ? 0 : (PlatformManager.MultiPlatform.JoinSessionGameInviteListener.IsProcessingIntent(out _checkRestartAtMainMenu) ? 1 : 0);
|
|
if (_checkRestartAtMainMenu)
|
|
ThreadManager.StartCoroutine(PlatformApplicationManager.CheckRestartCoroutine());
|
|
if (num != 0)
|
|
XUiC_ProgressWindow.Open(LocalPlayerUI.primaryUI, Localization.Get("lblReceivedGameInvite"), (System.Action)([PublicizedFrom(EAccessModifier.Internal)] () =>
|
|
{
|
|
PlatformManager.MultiPlatform.JoinSessionGameInviteListener?.Cancel();
|
|
LocalPlayerUI.primaryUI.windowManager.Open(XUiC_MainMenu.ID, true);
|
|
}));
|
|
this.DoLoadSaveGameAutomation();
|
|
}
|
|
|
|
public override bool GetBindingValue(ref string _value, string _bindingName)
|
|
{
|
|
if(_bindingName != null)
|
|
{
|
|
if(_bindingName == "systemtime_hr")
|
|
{
|
|
_value = DateTime.Now.Hour.ToString();
|
|
return true;
|
|
}
|
|
|
|
if(_bindingName == "systemtime_min")
|
|
{
|
|
_value = DateTime.Now.Minute.ToString();
|
|
return true;
|
|
}
|
|
|
|
if(_bindingName == "systemtime_sec")
|
|
{
|
|
_value = DateTime.Now.Second.ToString();
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return base.GetBindingValue(ref _value, _bindingName);
|
|
}
|
|
|
|
public override void OnOpen()
|
|
{
|
|
base.OnOpen();
|
|
PlatformManager.MultiPlatform.RichPresence.UpdateRichPresence(IRichPresence.PresenceStates.Menu);
|
|
TitleStorageOverridesManager.Instance.FetchFromSource((Action<TitleStorageOverridesManager.TSOverrides>)null);
|
|
|
|
XUiC_MainMenu.openedOnce = true;
|
|
SaveDataUtils.SaveDataManager.CommitAsync();
|
|
this.anySaveFilesExist = GameIO.GetPlayerSaves() > 0;
|
|
this.xui.playerUI.windowManager.Close("eacWarning");
|
|
this.xui.playerUI.windowManager.Close("crossplayWarning");
|
|
XUiC_MainMenuPlayerName.OpenIfNotOpen(this.xui);
|
|
|
|
if (base.xui.playerUI.ActionSetManager != null)
|
|
{
|
|
base.xui.playerUI.ActionSetManager.Reset();
|
|
base.xui.playerUI.ActionSetManager.Push(base.xui.playerUI.playerInput);
|
|
if(base.xui.playerUI.windowManager.IsWindowOpen(GUIWindowConsole.ID))
|
|
{
|
|
base.xui.playerUI.ActionSetManager.Push(base.xui.playerUI.playerInput.GUIActions);
|
|
}
|
|
}
|
|
|
|
this.btnConnectToServer.Enabled = PlatformManager.MultiPlatform.User.UserStatus != EUserStatus.OfflineMode;
|
|
base.xui.playerUI.nguiWindowManager.Show(EnumNGUIWindow.MainMenuBackground, false);
|
|
base.xui.playerUI.windowManager.Open("menuBackground", false, false, true);
|
|
base.xui.playerUI.windowManager.Open("mainMenuLogo", false, false, true);
|
|
GameManager.Instance.SetCursorEnabledOverride(false, false);
|
|
this.xui.playerUI.CursorController.SetCursorHidden(false);
|
|
this.GetChildById("btnNewGame").SelectCursorElement(true);
|
|
this.xui.playerUI.windowManager.OpenIfNotOpen("CalloutGroup", false);
|
|
this.xui.calloutWindow.ClearCallouts(XUiC_GamepadCalloutWindow.CalloutType.Menu);
|
|
this.xui.calloutWindow.AddCallout(UIUtils.ButtonIcon.FaceButtonSouth, "igcoSelect", XUiC_GamepadCalloutWindow.CalloutType.Menu);
|
|
this.xui.calloutWindow.RemoveCallout(UIUtils.ButtonIcon.FaceButtonEast, "igcoBack", XUiC_GamepadCalloutWindow.CalloutType.Menu);
|
|
this.xui.calloutWindow.SetCalloutsEnabled(XUiC_GamepadCalloutWindow.CalloutType.Menu, true);
|
|
TriggerEffectManager.SetMainMenuLightbarColor();
|
|
}
|
|
|
|
public override void OnClose()
|
|
{
|
|
base.OnClose();
|
|
base.xui.playerUI.windowManager.Close("mainMenuLogo");
|
|
this.xui.calloutWindow.AddCallout(UIUtils.ButtonIcon.FaceButtonEast, "igcoBack", XUiC_GamepadCalloutWindow.CalloutType.Menu);
|
|
XUiC_MainMenuPlayerName.Close(this.xui);
|
|
}
|
|
|
|
public static void Open(XUi _xuiInstance)
|
|
{
|
|
XUiC_MainMenu.shownNewsScreenOnce = true;
|
|
IJoinSessionGameInviteListener gameInviteListener = PlatformManager.NativePlatform.JoinSessionGameInviteListener;
|
|
if ((gameInviteListener != null ? (gameInviteListener.HasPendingIntent() ? 1 : 0) : 0) != 0)
|
|
XUiC_MainMenu.shownNewsScreenOnce = true;
|
|
if (!XUiC_MainMenu.shownNewsScreenOnce)
|
|
{
|
|
XUiC_NewsScreen.Open(_xuiInstance);
|
|
XUiC_MainMenu.shownNewsScreenOnce = true;
|
|
}
|
|
else
|
|
{
|
|
_xuiInstance.playerUI.windowManager.Open(XUiC_MainMenu.ID, true);
|
|
}
|
|
}
|
|
|
|
public static string ID = "";
|
|
public static bool openedOnce;
|
|
private XUiC_SimpleButton btnNewGame;
|
|
private XUiC_SimpleButton btnContinueGame;
|
|
private XUiC_SimpleButton btnConnectToServer;
|
|
private XUiC_SimpleButton btnRebirthDiscord;
|
|
private XUiC_SimpleButton btnEditingTools;
|
|
private XUiC_SimpleButton btnOptions;
|
|
private XUiC_SimpleButton btnCredits;
|
|
private XUiC_SimpleButton btnQuit;
|
|
public bool anySaveFilesExist;*/
|
|
}
|