private static bool DrawPrice(Rect r, string cost, string gold, string goldbonus) { GUI.DrawTexture(r, MenuGold.tGray); Rect rect = r; r = new Rect(r.x, r.y, GUIM.YRES(128f), rect.height - GUIM.YRES(4f)); GUIM.DrawText(r, gold, TextAnchor.MiddleRight, BaseColor.White, 1, 20, true); r = new Rect(r.x + GUIM.YRES(130f), r.y, rect.height, rect.height); GUI.DrawTexture(new Rect(r.x + GUIM.YRES(4f), r.y + GUIM.YRES(4f), r.width - GUIM.YRES(8f), r.height - GUIM.YRES(8f)), MenuGold.tGold); if (goldbonus != string.Empty) { r = new Rect(r.x + r.height, r.y, GUIM.YRES(96f), rect.height - GUIM.YRES(4f)); GUIM.DrawText(r, goldbonus, TextAnchor.MiddleRight, BaseColor.White, 1, 20, true); r = new Rect(r.x + GUIM.YRES(98f), r.y, rect.height, rect.height); GUI.DrawTexture(new Rect(r.x + GUIM.YRES(4f), r.y + GUIM.YRES(4f), r.width - GUIM.YRES(8f), r.height - GUIM.YRES(8f)), MenuGold.tGold); r = new Rect(r.x + r.height + GUIM.YRES(4f), r.y, GUIM.YRES(96f), rect.height - GUIM.YRES(4f)); GUIM.DrawText(r, Lang.Get("_BONUS"), TextAnchor.MiddleLeft, BaseColor.White, 1, 20, true); } r = new Rect(rect.x + rect.width - GUIM.YRES(140f), r.y, GUIM.YRES(140f), rect.height); GUI.DrawTexture(r, MenuGold.tBuy); if (GameData.gVK) { r = new Rect(r.x, r.y, r.width, r.height - GUIM.YRES(4f)); GUIM.DrawText(new Rect(r.x, r.y, r.width - GUIM.YRES(72f), r.height), cost, TextAnchor.MiddleRight, BaseColor.White, 1, 20, true); GUI.DrawTexture(new Rect(r.x + GUIM.YRES(74f), r.y + GUIM.YRES(6f), GUIM.YRES(24f), GUIM.YRES(24f)), MenuGold.tVK); } if (GameData.gFB) { GUIM.DrawText(r, cost, TextAnchor.MiddleCenter, BaseColor.White, 1, 20, true); } return(GUIM.HideButton(r)); }
private static void DrawMenuButton(int state, Rect r, Texture2D normal, Texture2D hover) { Profile.mpos = new Vector2(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y); if (r.Contains(Profile.mpos)) { GUI.DrawTexture(r, hover); } else { GUI.DrawTexture(r, normal); } if (GUIM.HideButton(r)) { Main.HideAll(); if (state == 0) { MenuPlayer.SetActive(true); } if (state == 1) { MenuInventory.SetActive(true); } if (state == 2) { MenuGold.SetActive(true); } } }
public static bool Button(Rect r, BaseColor c, string text, TextAnchor anchor, BaseColor tc, int fp, int size, bool shadow) { GUI.color = GUIM.colorlist[(int)c]; GUI.DrawTexture(r, GUIM.tButton); GUI.color = Color.white; GUIM.DrawText(r, text, anchor, tc, fp, size, shadow); return(GUIM.HideButton(r)); }
public static void DrawProfile() { GUIM.DrawText(new Rect(Profile.rBackProfile.x, Profile.rBackProfile.y - GUIM.YRES(18f), Profile.rBackProfile.width, GUIM.YRES(18f)), Lang.Get("_PROFILE"), TextAnchor.MiddleLeft, BaseColor.White, 1, 12, false); Profile.mpos = new Vector2(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y); BaseColor fontcolor = BaseColor.White; GUIM.DrawBox(Profile.rBackProfile, Profile.tBlack); if (Main.avatar == null) { GUI.DrawTexture(Profile.rAvatar, Profile.tBlack); } else { GUI.DrawTexture(Profile.rAvatar, Main.avatar); } if (GUIM.HideButton(Profile.rBackName) && !GameData.gSteam) { Profile.inEdit = true; Profile.newname = BaseData.Name; } if (Profile.inEdit) { GUI.DrawTexture(Profile.rBackName, Profile.tGray); GUIM.DrawEdit(Profile.rBackName, ref Profile.newname, TextAnchor.MiddleCenter, BaseColor.White, 1, 14, true); } else { if (Profile.rBackName.Contains(Profile.mpos) && !GameData.gSteam) { GUI.DrawTexture(Profile.rBackName, Profile.tOrange); } else { GUI.DrawTexture(Profile.rBackName, Profile.tBlue); } GUIM.DrawText(Profile.rBackName, BaseData.Name, TextAnchor.MiddleCenter, fontcolor, 1, 14, true); } GUIM.DrawText(new Rect(Profile.rBackName.x, Profile.rBackProfile.y + GUIM.YRES(8f), Profile.rBackName.width, Profile.rBackName.height), Lang.Get("_NICKNAME"), TextAnchor.MiddleLeft, BaseColor.White, 1, 14, false); GUI.DrawTexture(new Rect(Profile.rBackProfile.x + GUIM.YRES(8f), Profile.rBackProfile.y + GUIM.YRES(80f), GUIM.YRES(48f), GUIM.YRES(24f)), Profile.tWhite); GUIM.DrawText(new Rect(Profile.rBackProfile.x + GUIM.YRES(8f), Profile.rBackProfile.y + GUIM.YRES(80f), GUIM.YRES(48f), GUIM.YRES(24f)), BaseData.Level, TextAnchor.MiddleCenter, BaseColor.Blue, 1, 14, false); GUI.DrawTexture(new Rect(Profile.rBackProfile.x + GUIM.YRES(58f), Profile.rBackProfile.y + GUIM.YRES(94f), GUIM.YRES(190f), GUIM.YRES(10f)), Profile.tGray); GUI.DrawTexture(new Rect(Profile.rBackProfile.x + GUIM.YRES(58f), Profile.rBackProfile.y + GUIM.YRES(94f), (float)BaseData.iProgress * 0.01f * GUIM.YRES(190f), GUIM.YRES(10f)), Profile.tOrange); GUIM.DrawText(new Rect(Profile.rBackProfile.x + GUIM.YRES(58f), Profile.rBackProfile.y + GUIM.YRES(80f), GUIM.YRES(190f), GUIM.YRES(12f)), BaseData.Progress, TextAnchor.MiddleRight, BaseColor.Gray, 1, 14, false); GUIM.DrawText(new Rect(Profile.rBackProfile.x + GUIM.YRES(58f), Profile.rBackProfile.y + GUIM.YRES(80f), GUIM.YRES(190f), GUIM.YRES(12f)), BaseData.EXPData, TextAnchor.MiddleLeft, BaseColor.Gray, 1, 14, false); if (GameData.gSteam) { return; } GUIM.DrawBox(Profile.rBackGold, Profile.tBlack); GUI.DrawTexture(new Rect(Profile.rBackGold.x + GUIM.YRES(14f), Profile.rBackGold.y + GUIM.YRES(6f), GUIM.YRES(30f), GUIM.YRES(30f)), Profile.tGold); GUIM.DrawText(new Rect(Profile.rBackGold.x + GUIM.YRES(50f), Profile.rBackGold.y + GUIM.YRES(1f), GUIM.YRES(110f), Profile.rBackGold.height - GUIM.YRES(4f)), BaseData.Gold, TextAnchor.MiddleLeft, BaseColor.White, 1, 20, false); Profile.DrawMenuButton(2, new Rect(Profile.rBackGold.x + GUIM.YRES(120f), Profile.rBackGold.y + GUIM.YRES(6f), GUIM.YRES(126f), GUIM.YRES(30f)), Profile.tGreen, Profile.tOrange); GUIM.DrawText(new Rect(Profile.rBackGold.x + GUIM.YRES(120f), Profile.rBackGold.y + GUIM.YRES(5f), GUIM.YRES(126f), GUIM.YRES(30f)), Lang.Get("_ADD_GOLD"), TextAnchor.MiddleCenter, BaseColor.White, 1, 14, true); }
public static void DrawButton(int state, string text, Rect r, Texture2D normal, Texture2D hover, Texture2D line) { TopBar.mpos = new Vector2(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y); Rect position = new Rect(r.x + (r.width - GUIM.YRES(50f)) / 2f, r.y - GUIM.YRES(8f), GUIM.YRES(50f), GUIM.YRES(50f)); if (TopBar.clicktime[state] + 0.05f > Time.time) { GUI.DrawTexture(r, line); GUI.color = Color.black; GUI.DrawTexture(position, normal); GUI.color = Color.white; GUI.DrawTexture(new Rect(r.x, r.y + GUIM.YRES(38f), r.width, GUIM.YRES(16f)), line); GUIM.DrawText(new Rect(r.x, r.y + GUIM.YRES(38f), r.width, GUIM.YRES(16f)), text, TextAnchor.MiddleCenter, BaseColor.White, 1, 14, true); } else if (r.Contains(TopBar.mpos)) { TopBar.buttontime[state] = Time.time; GUI.DrawTexture(position, hover); GUI.DrawTexture(new Rect(r.x, r.y + GUIM.YRES(38f), r.width, GUIM.YRES(16f)), line); GUIM.DrawText(new Rect(r.x, r.y + GUIM.YRES(38f), r.width, GUIM.YRES(16f)), text, TextAnchor.MiddleCenter, BaseColor.White, 1, 14, true); if (Input.GetMouseButton(0)) { TopBar.clicktime[state] = Time.time; } } else { float num = Time.time - TopBar.buttontime[state]; float num2 = 16f - num * 100f; if (num2 < 2f) { num2 = 2f; } GUI.DrawTexture(position, normal); GUI.DrawTexture(new Rect(r.x, r.y + GUIM.YRES(38f), r.width, GUIM.YRES(num2)), line); } if (GUIM.HideButton(r)) { Main.HideAll(); if (state == 0) { MenuServers.SetActive(true); } if (state == 1) { MenuShop.SetActive(true); } if (state == 2) { MenuOptions.SetActive(true); } } }
public static void Draw() { GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, GUIM.YRES(40f)), TopBar.tBlack); TopBar.rHeader_logo = new Rect(0f, 4f, 256f, 32f); GUIM.DrawTextureX(TopBar.rHeader_logo, TopBar.tHeader_logo); TopBar.DrawButton(0, Lang.Get("_PLAY"), TopBar.rButton[0], TopBar.tPlay[0], TopBar.tPlay[1], TopBar.tOrange); TopBar.DrawButton(1, Lang.Get("_SHOP"), TopBar.rButton[1], TopBar.tShop[0], TopBar.tShop[1], TopBar.tGreen); TopBar.DrawButton(2, Lang.Get("_OPTIONS"), TopBar.rButton[2], TopBar.tOptions[0], TopBar.tOptions[1], TopBar.tBlue); if (GameData.gSteam) { TopBar.mpos = new Vector2(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y); if (TopBar.rClose.Contains(TopBar.mpos)) { GUI.color = Color.red; } GUI.DrawTexture(TopBar.rClose, TopBar.tClose); GUI.color = Color.white; if (GUIM.HideButton(TopBar.rClose)) { Application.Quit(); } } }
private static bool DrawButtonServer(MenuServers.CServerData s, int pos) { Texture2D image = MenuServers.tGray; BaseColor fontcolor = BaseColor.LightGray; if (s.players == 16) { fontcolor = BaseColor.Red; } else if (s.players > 0) { fontcolor = BaseColor.Yellow; } if (s == MenuServers.currServer) { image = MenuServers.tWhite; if (s.players != 16) { fontcolor = BaseColor.Blue; } } string name = GameMode.GetName(s.gamemode); string text = s.mapname; string clearName = s.mapname; if (text != null) { string[] array = text.Split(new char[] { 'v' }); clearName = array[0]; } text = MapData.GetName(clearName); Rect rect = new Rect(0f, GUIM.YRES((float)(1 * pos * 26)), GUIM.YRES(40f), GUIM.YRES(24f)); Color white = new Color(1f, 1f, 1f, 0.5f); if (pos % 2 == 0) { white = new Color(1f, 1f, 1f, 0.35f); } if (s == MenuServers.currServer) { white = Color.white; } GUI.color = white; GUI.DrawTexture(rect, image); GUI.color = Color.white; GUIM.DrawText(rect, (s.idx + 1).ToString(), TextAnchor.MiddleCenter, fontcolor, 1, 12, false); rect.x = rect.x + rect.width + GUIM.YRES(2f); rect.width = GUIM.YRES(120f); GUI.color = white; GUI.DrawTexture(rect, image); GUI.color = Color.white; GUIM.DrawText(rect, name, TextAnchor.MiddleCenter, fontcolor, 1, 12, false); rect.x = rect.x + rect.width + GUIM.YRES(2f); rect.width = GUIM.YRES(104f); GUI.color = white; GUI.DrawTexture(rect, image); GUI.color = Color.white; GUIM.DrawText(rect, text, TextAnchor.MiddleCenter, fontcolor, 1, 10, false); rect.x = rect.x + rect.width + GUIM.YRES(2f); rect.width = GUIM.YRES(60f); GUI.color = white; GUI.DrawTexture(rect, image); GUI.color = Color.white; GUIM.DrawText(rect, "x" + s.rate.ToString(), TextAnchor.MiddleCenter, fontcolor, 1, 12, false); rect.x = rect.x + rect.width + GUIM.YRES(2f); rect.width = GUIM.YRES(80f); GUI.color = white; GUI.DrawTexture(rect, image); GUI.color = Color.white; GUIM.DrawText(rect, s.players.ToString() + "/16", TextAnchor.MiddleCenter, fontcolor, 1, 12, false); rect.x = 0f; rect.width = GUIM.YRES(404f); return(GUIM.HideButton(rect)); }
public static void DrawButton(int state, Rect r, string text, Texture2D icon) { BottomBar.mpos = new Vector2(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y); if (BottomBar.click2time[state] + 0.05f > Time.time) { GUI.DrawTexture(r, BottomBar.tWhite); GUI.color = Color.black; GUI.DrawTexture(new Rect(r.x + (r.width - r.height) / 2f, r.y, r.height, r.height), icon); GUI.color = Color.white; GUI.DrawTexture(new Rect(r.x, r.y - GUIM.YRES(14f), r.width, GUIM.YRES(16f)), BottomBar.tWhite); GUIM.DrawText(new Rect(r.x, r.y - GUIM.YRES(14f), r.width, GUIM.YRES(16f)), text, TextAnchor.MiddleCenter, BaseColor.Black, 0, 10, false); } else if (r.Contains(BottomBar.mpos)) { BottomBar.button2time[state] = Time.time; GUI.DrawTexture(new Rect(r.x + (r.width - r.height) / 2f, r.y, r.height, r.height), icon); GUI.DrawTexture(new Rect(r.x, r.y - GUIM.YRES(14f), r.width, GUIM.YRES(16f)), BottomBar.tWhite); GUIM.DrawText(new Rect(r.x, r.y - GUIM.YRES(14f), r.width, GUIM.YRES(16f)), text, TextAnchor.MiddleCenter, BaseColor.Black, 0, 10, false); if (Input.GetMouseButton(0)) { BottomBar.click2time[state] = Time.time; } } else { float num = Time.time - BottomBar.button2time[state]; float num2 = 16f - num * 100f; if (num2 < 2f) { num2 = 2f; } GUI.DrawTexture(new Rect(r.x + (r.width - r.height) / 2f, r.y, r.height, r.height), icon); GUI.DrawTexture(new Rect(r.x, r.y + GUIM.YRES(2f - num2), r.width, GUIM.YRES(num2)), BottomBar.tWhite); } if (GUIM.HideButton(r)) { if (state == 0) { Lang.ChangeLanguage(); } if (state == 1) { if (Options.menuvol != 0f) { Options.menuvol = 0f; } else { Options.menuvol = 0.25f; } PlayerPrefs.SetFloat("menuvol", Options.menuvol); GameObject gameObject = GameObject.Find("Camera"); if (gameObject && gameObject.GetComponent <AudioSource>()) { gameObject.GetComponent <AudioSource>().volume = Options.menuvol; } } if (state == 2) { Options.ToggleFullScreen(); } } }
public static bool DrawItem(Rect r, MenuShop.CShopData data) { int num = (int)GUIM.YRES(1f); if (num < 1) { num = 1; } bool flag = false; Vector2 mpos = new Vector2(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y); if (data == MenuShop.currData) { GUI.DrawTexture(r, MenuShop.tWhite); } else if (GUIM.Contains(r, mpos)) { GUI.DrawTexture(r, MenuShop.tGray); GUI.color = new Color(1f, 1f, 1f, 0.1f); GUI.DrawTexture(r, MenuShop.tWhite); GUI.color = Color.white; flag = true; } else { if (BaseData.item[data.wid] == 1) { GUI.color = new Color(1f, 1f, 1f, 0.05f); GUI.DrawTexture(r, MenuShop.tWhite); GUI.color = Color.white; } GUI.DrawTexture(new Rect(r.x, r.y, r.width, (float)num), MenuShop.tGray); GUI.DrawTexture(new Rect(r.x, r.y + r.height - (float)num, r.width, (float)num), MenuShop.tGray); GUI.DrawTexture(new Rect(r.x, r.y, (float)num, r.height), MenuShop.tGray); GUI.DrawTexture(new Rect(r.x + r.width - (float)num, r.y, (float)num, r.height), MenuShop.tGray); } if (data.level > 0) { BaseColor fontcolor = BaseColor.White; if (BaseData.iLevel < data.level) { fontcolor = BaseColor.Red; } GUIM.DrawText(r, "Lv." + data.level.ToString() + " ", TextAnchor.LowerRight, fontcolor, 1, 12, false); } if (data.section == 1) { GUI.DrawTexture(new Rect(r.x + GUIM.YRES(4f), r.y + GUIM.YRES(4f) + GUIM.YRES(33f), GUIM.YRES(88f), GUIM.YRES(22f)), data.icon); } if (data.section == 2) { GUI.DrawTexture(new Rect(r.x + GUIM.YRES(4f), r.y + GUIM.YRES(4f), GUIM.YRES(88f), GUIM.YRES(88f)), data.icon); } if (data.section == 3 || data.section == 4) { GUI.DrawTexture(new Rect(r.x + GUIM.YRES(4f), r.y + GUIM.YRES(4f), GUIM.YRES(88f), GUIM.YRES(88f)), data.icon); } if (data.section == 5) { GUI.DrawTexture(new Rect(r.x + GUIM.YRES(4f), r.y + GUIM.YRES(4f), GUIM.YRES(88f), GUIM.YRES(88f)), data.icon); } if (data.section == 0) { GUI.DrawTexture(new Rect(r.x + GUIM.YRES(4f), r.y + GUIM.YRES(4f) + GUIM.YRES(22f), GUIM.YRES(88f), GUIM.YRES(44f)), data.icon); } if (MenuInventory.isActive()) { bool flag2 = false; int id = WeaponData.GetId(data.name2); if (id > 0 && BaseData.profileWeapon[id] == data.wid) { flag2 = true; } if (BaseData.badge_back == data.wid || BaseData.badge_icon == data.wid || BaseData.mask_merc == data.wid || BaseData.mask_warcorp == data.wid || flag2) { GUI.color = Color.green; GUI.DrawTexture(new Rect(r.x + GUIM.YRES(4f), r.y + GUIM.YRES(4f), GUIM.YRES(10f), GUIM.YRES(10f)), MenuShop.apply); GUI.color = Color.white; } else if (flag && data.section > 0) { GUIM.DrawText(r, Lang.Get("_CLICK_TO_EQUIP"), TextAnchor.LowerCenter, BaseColor.White, 1, 10, false); } } bool result = false; if (GUIM.HideButton(r)) { MenuShop.currData = data; if (MenuShop.show) { if (MenuShop.currData.section == 3 || MenuShop.currData.section == 4) { MenuPlayer.PreviewMask(MenuShop.currData); MenuPlayer.SetPosition(0.9f, 0.03f, -1f); } else if (MenuShop.currData.section == 5) { MenuPlayer.playermodel = -1; if (MenuShop.currData.name2 == "ak47") { MenuPlayer.ChangePlayer(0, 6, 22); } else if (MenuShop.currData.name2 == "aks74u") { MenuPlayer.ChangePlayer(0, 7, 22); } else if (MenuShop.currData.name2 == "asval") { MenuPlayer.ChangePlayer(0, 8, 22); } else if (MenuShop.currData.name2 == "aug") { MenuPlayer.ChangePlayer(0, 18, 22); } else if (MenuShop.currData.name2 == "awp") { MenuPlayer.ChangePlayer(0, 22, 8); } else if (MenuShop.currData.name2 == "beretta") { MenuPlayer.ChangePlayer(0, 2, 22); } else if (MenuShop.currData.name2 == "bm4") { MenuPlayer.ChangePlayer(0, 9, 22); } else if (MenuShop.currData.name2 == "colt") { MenuPlayer.ChangePlayer(0, 3, 8); } else if (MenuShop.currData.name2 == "deagle") { MenuPlayer.ChangePlayer(0, 4, 8); } else if (MenuShop.currData.name2 == "famas") { MenuPlayer.ChangePlayer(0, 10, 22); } else if (MenuShop.currData.name2 == "glock17") { MenuPlayer.ChangePlayer(0, 1, 8); } else if (MenuShop.currData.name2 == "m4a1") { MenuPlayer.ChangePlayer(0, 11, 22); } else if (MenuShop.currData.name2 == "m24") { MenuPlayer.ChangePlayer(0, 21, 22); } else if (MenuShop.currData.name2 == "m90") { MenuPlayer.ChangePlayer(0, 23, 22); } else if (MenuShop.currData.name2 == "m110") { MenuPlayer.ChangePlayer(0, 20, 22); } else if (MenuShop.currData.name2 == "m249") { MenuPlayer.ChangePlayer(0, 25, 22); } else if (MenuShop.currData.name2 == "mp5") { MenuPlayer.ChangePlayer(0, 12, 22); } else if (MenuShop.currData.name2 == "mp7") { MenuPlayer.ChangePlayer(0, 13, 22); } else if (MenuShop.currData.name2 == "p90") { MenuPlayer.ChangePlayer(0, 14, 22); } else if (MenuShop.currData.name2 == "pkp") { MenuPlayer.ChangePlayer(0, 24, 22); } else if (MenuShop.currData.name2 == "qbz95") { MenuPlayer.ChangePlayer(0, 15, 22); } else if (MenuShop.currData.name2 == "remington") { MenuPlayer.ChangePlayer(0, 5, 22); } else if (MenuShop.currData.name2 == "spas12") { MenuPlayer.ChangePlayer(0, 16, 8); } else if (MenuShop.currData.name2 == "svd") { MenuPlayer.ChangePlayer(0, 19, 22); } else if (MenuShop.currData.name2 == "ump45") { MenuPlayer.ChangePlayer(0, 17, 22); } MenuPlayer.SetPosition(0.9f, 0.03f, -1f); } } result = true; } return(result); }