private void OnGUI() { UnityEngine.GUI.backgroundColor = ColorCache.Black; UnityEngine.GUI.Box(new Rect(0, 0, Screen.width, Screen.height), string.Empty); UnityEngine.GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), ColorCache.Textures[ColorCache.Black]); UnityEngine.GUI.DrawTexture(GUIHelpers.AlignRect(192, 192, GUIHelpers.Alignment.CENTER), Styles.Logo); UnityEngine.GUI.Label(GUIHelpers.AlignRect(600, 150, GUIHelpers.Alignment.BOTTOMCENTER), "GucciGangMod\n" + "Loading".SetSize(32), Styles.TextStyle(TextAnchor.MiddleCenter, FontStyle.Bold, 64, false, ColorCache.White, ColorCache.White, ColorCache.White)); }
public void SetPosition() { chatWidth = Settings.ChatWidthSetting; chatHeight = Settings.ChatHeightSetting; chatInputRect = new Rect(30f, Screen.height - 300 + 275, chatWidth - 25f, 25f); chatRect = GUIHelpers.AlignRect(chatWidth, chatHeight - 15f, GUIHelpers.Alignment.BOTTOMLEFT, 5f, -30f); chatFeedRect = GUIHelpers.AlignRect(chatWidth, chatHeight - 15f, GUIHelpers.Alignment.BOTTOMRIGHT, -5f, -30f); }
public static Rect AlignRect(float width, float height, GUIHelpers.Alignment alignment) { return(GUIHelpers.AlignRect(width, height, new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), alignment, 0f, 0f)); }
public static Rect AlignRect(float width, float height, Rect parentRect, GUIHelpers.Alignment alignment) { return(GUIHelpers.AlignRect(width, height, parentRect, alignment, 0f, 0f)); }
private void OnGUI() { if (Styles.LabelStyle == null) { return; } UnityEngine.GUI.Label(VersionPanel, "GucciGangMod " + UIMainReferences.Version, Styles.LabelStyle[2]); GUILayout.BeginArea(Panel); { GUILayout.FlexibleSpace(); if (GUILayout.Button("Single".SetSize(24), GUILayout.Height(50f), GUILayout.Width(250f))) { NGUITools.SetActive(UIMainReferences.instance.panelMain.gameObject, false); GetInstance <Single>().Enable(); } GUILayout.Space(15f); if (GUILayout.Button("Multiplayer".SetSize(24), GUILayout.Height(50f), GUILayout.Width(250f))) { NGUITools.SetActive(UIMainReferences.instance.panelMain.gameObject, false); GetInstance <Multiplayer>().Enable(); } GUILayout.Space(15f); if (GUILayout.Button("Quit".SetSize(24), GUILayout.Height(50f), GUILayout.Width(250f))) { Application.Quit(); } } GUILayout.EndArea(); UnityEngine.GUI.Box(GUIHelpers.AlignRect(width + 10f, height + 10f, GUIHelpers.Alignment.TOPLEFT, 5f, 5f), ColorCache.Textures[ColorCache.PurpleMunsell]); GUILayout.BeginArea(GUIHelpers.AlignRect(width, height, GUIHelpers.Alignment.TOPLEFT, 10, 10)); { Grid(string.Empty, ref loginSwitchInt, leftPanelSwitcher, width: width - 5f, height: 35f); switch (loginSwitchInt) { case 0: { height = 130f + (LoginFengKAI.player.guildname == string.Empty ? 0f : LoginFengKAI.player.guildname.Split('\n').Length *Settings.SubHeaderHeight) + (FengGameManagerMKII.nameField == string.Empty ? 0 : Settings.SubHeaderHeight); if (FengGameManagerMKII.nameField != string.Empty) { Label(FengGameManagerMKII.nameField.SetColor("FFFFFF").ToHTML(), Settings.LabelType.SubHeader, width: width); } if (LoginFengKAI.player.guildname != string.Empty) { for (var i = 0; i < LoginFengKAI.player.guildname.Split('\n').Length; i++) { Label(LoginFengKAI.player.guildname.Split('\n')[i].SetColor("FFFF00").ToHTML(), Settings.LabelType.SubHeader, width: width); } } GUILayout.BeginHorizontal(); { TextField("Name", ref FengGameManagerMKII.nameField, rightElement, labelWidth: leftElement); } GUILayout.EndHorizontal(); GUILayout.Space(Settings.space); GUILayout.BeginHorizontal(); { TextArea("Guild", ref LoginFengKAI.player.guildname, rightElement, labelWidth: leftElement); } GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); { if (Button("Save", width / 2f - 5f)) { PlayerPrefs.SetString("Name", FengGameManagerMKII.nameField); PlayerPrefs.SetString("Guild", LoginFengKAI.player.guildname); } if (Button("Load", width / 2f - 5f)) { FengGameManagerMKII.nameField = PlayerPrefs.GetString("Name", string.Empty); LoginFengKAI.player.guildname = PlayerPrefs.GetString("Guild", string.Empty); } } GUILayout.EndHorizontal(); break; } case 1: { height = 185f; string server = UIMainReferences.ServerKey == UIMainReferences.PublicKey ? "Connected to Public server." : UIMainReferences.ServerKey == FengGameManagerMKII.s[0] ? "Connected to RC Private server." : FengGameManagerMKII.privateServerField == string.Empty ? "Connected to Custom server." : $"Connected to {UIMainReferences.ServerKey}."; Label(server.SetColor("FFFFFF"), Settings.LabelType.SubHeader, width: width); Grid("Protocol", ref Config.Settings.ConnectionProtocolSettings.Value, connectionProtocols, width: rightElement, labelWidth: leftElement); GUILayout.BeginHorizontal(); { Label("Public", width: leftElement); if (Button("Connect", width: rightElement)) { UIMainReferences.ServerKey = UIMainReferences.PublicKey; } } GUILayout.EndHorizontal(); GUILayout.Space(Settings.space); GUILayout.BeginHorizontal(); { Label("RCPrivate", width: leftElement); if (Button("Connect", width: rightElement)) { UIMainReferences.ServerKey = FengGameManagerMKII.s[0]; } } GUILayout.EndHorizontal(); GUILayout.Space(Settings.space); GUILayout.BeginHorizontal(); { TextField(string.Empty, ref FengGameManagerMKII.privateServerField, leftElement - 10f); GUILayout.Space(1f); if (Button("Connect", width: rightElement)) { UIMainReferences.ServerKey = FengGameManagerMKII.privateServerField; } } GUILayout.EndHorizontal(); break; } } } GUILayout.EndArea(); if (UnityEngine.GUI.Button(GUIHelpers.AlignRect(175f, Settings.ButtonHeight, GUIHelpers.Alignment.TOPRIGHT, -5f, 5f), "Custom Characters")) { Application.LoadLevel("characterCreation"); } if (UnityEngine.GUI.Button(GUIHelpers.AlignRect(175f, Settings.ButtonHeight, GUIHelpers.Alignment.TOPRIGHT, -5f, 5f + Settings.ButtonHeight + Settings.space), "Snapshot Reviewer")) { Application.LoadLevel("SnapShot"); } }