public void Update() { if (fadeTexture != null) { deltaFade += Time.deltaTime; if (deltaFade > 0.5f) { fadeTexture = null; } } if (BannerManager.Instance.Count() > 0) { Vector2 point = GlobalVars.Instance.PixelToGUIPoint(MouseUtil.ScreenToPixelPoint(Input.mousePosition)); if (!GlobalVars.Instance.ToGUIRect(crdBanner).Contains(point)) { deltaTimeChangeBanner += Time.deltaTime; if (deltaTimeChangeBanner > deltaTimeChangeBannerMax) { int num = id; deltaTimeChangeBanner = 0f; id++; if (id >= BannerManager.Instance.Count()) { id = 0; } if (id != num) { OnChangeBanner(num); } } } } }
private void DragItem() { if (IsDragging) { Vector2 vector = GlobalVars.Instance.PixelToGUIPoint(MouseUtil.ScreenToPixelPoint(Input.mousePosition)); Rect position = new Rect(vector.x, vector.y, 90f, 90f); Rect position2 = new Rect(vector.x + 3f, vector.y + 3f, 84f, 84f); GUI.Box(position, string.Empty, "BoxFadeBlue"); GUI.Box(position2, string.Empty, "LineBoxBlue"); TextureUtil.DrawTexture(position2, dragItem.Template.CurIcon(), ScaleMode.ScaleToFit); } }
private void aPlayer(Vector2 pos, NameCard player) { Texture2D badge = XpManager.Instance.GetBadge(player.Lv, player.Rank); if (null != badge) { TextureUtil.DrawTexture(new Rect(pos.x + crdBadge.x, pos.y + crdBadge.y, crdBadgeSize.x, crdBadgeSize.y), badge); } if (GlobalVars.Instance.MyButton(new Rect(pos.x, pos.y, crdUser.x, crdUser.y), string.Empty, "InvisibleButton") && Event.current.button == 1) { UserMenu userMenu = ContextMenuManager.Instance.Popup(); if (userMenu != null) { bool flag = MyInfoManager.Instance.IsClanee(player.Seq); userMenu.InitDialog(MouseUtil.ScreenToPixelPoint(Input.mousePosition), player.Seq, player.Nickname, !flag, masterAssign: false); } } LabelUtil.TextOut(new Vector2(pos.x + crdNick.x, pos.y + crdNick.y), player.Nickname, "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft); }
private void aPlayer(bool isRed, Rect rc, BrickManDesc desc) { bool flag = false; if (RoomManager.Instance.Master == MyInfoManager.Instance.Seq) { flag = true; } GUI.Box(rc, string.Empty, (!isRed) ? "ButtonBlue" : "ButtonRed"); Vector2 pos = new Vector2(rc.x + crdStatus.x, rc.y + crdStatus.y); bool flag2 = (MyInfoManager.Instance.Seq == desc.Seq) ? true : false; if (flag2) { desc.Status = MyInfoManager.Instance.Status; GUI.Box(rc, string.Empty, "BtnSelectF"); } switch (desc.Status) { case 2: case 4: LabelUtil.TextOut(pos, StringMgr.Instance.Get("PLAYING"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleRight); break; case 5: LabelUtil.TextOut(pos, StringMgr.Instance.Get("SHOPPING"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleRight); break; case 6: LabelUtil.TextOut(pos, StringMgr.Instance.Get("EQUIPPING"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleRight); break; case 1: if (RoomManager.Instance.Master != desc.Seq) { LabelUtil.TextOut(pos, StringMgr.Instance.Get("READY"), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleRight); } break; } if (flag && !flag2 && GlobalVars.Instance.MyButton(new Rect(rc.x, rc.y + crdX.y, crdX.width, crdX.height), string.Empty, "X")) { CSNetManager.Instance.Sock.SendCS_KICK_REQ(desc.Seq); } if (GlobalVars.Instance.MyButton(rc, string.Empty, "InvisibleButton") && Event.current.button == 1 && desc.Seq >= 0 && desc.Seq != MyInfoManager.Instance.Seq) { UserMenu userMenu = ContextMenuManager.Instance.Popup(); if (userMenu != null) { bool flag3 = MyInfoManager.Instance.IsClanee(desc.Seq) || desc.Clan >= 0; userMenu.InitDialog(MouseUtil.ScreenToPixelPoint(Input.mousePosition), desc.Seq, desc.Nickname, !flag3, flag); } } DrawClanMark(new Rect(rc.x + crdClanMark.x, rc.y + crdClanMark.y, crdClanMark.width, crdClanMark.height), desc.ClanMark); int level = XpManager.Instance.GetLevel(desc.Xp); Texture2D badge = XpManager.Instance.GetBadge(level, desc.Rank); if (null != badge) { TextureUtil.DrawTexture(new Rect(rc.x + crdBadge.x, rc.y + crdBadge.y, (float)badge.width, (float)badge.height), badge); } LabelUtil.TextOut(new Vector2(rc.x + crdNickname.x, rc.y + crdNickname.y), desc.Nickname, "Label", txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter); LabelUtil.TextOut(new Vector2(rc.x + crdClanName.x, rc.y + crdClanName.y), desc.ClanName, "MiniLabel", txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.MiddleRight); GameObject gameObject = BrickManManager.Instance.Get(desc.Seq); if (null != gameObject) { Rect position = new Rect(rc.x + crdPortrait.x, rc.y + crdPortrait.y, crdPortrait.width, crdPortrait.height); Camera camera = null; Camera[] componentsInChildren = gameObject.GetComponentsInChildren <Camera>(); int num = 0; while (camera == null && num < componentsInChildren.Length) { if (componentsInChildren[num].enabled) { camera = componentsInChildren[num]; } num++; } if (null != camera) { TextureUtil.DrawTexture(position, camera.targetTexture, ScaleMode.StretchToFill, alphaBlend: true); } } if (RoomManager.Instance.Master == desc.Seq) { TextureUtil.DrawTexture(new Rect(rc.x + crdTinyMasterIcon.x, rc.y + crdTinyMasterIcon.y, crdTinyMasterIcon.width, crdTinyMasterIcon.height), tinyMasterIcon, ScaleMode.StretchToFill); } }
public void OnGUI() { int num3 = GUI.depth = (GUI.depth = 50); Rect position = new Rect(crdClient); GUI.Box(position, string.Empty, "BoxChatBase"); Rect position2 = new Rect(crdChatRead); position2.y = crdChatRead.y - 35f; position2.width = crdChatRead.width - 120f; position2.height = 34f; string[] array = new string[3] { StringMgr.Instance.Get("ALL"), StringMgr.Instance.Get("WHISPER"), StringMgr.Instance.Get("CLAN") }; if (!DialogManager.Instance.IsModal && !bBtnActive) { GUI.enabled = false; } int num4 = selected; selected = GUI.SelectionGrid(position2, selected, array, array.Length, "BtnChat"); if (num4 != selected) { if (selected == 0) { chatMode = ChatText.CHAT_TYPE.NORMAL; } else if (selected == 1) { chatMode = ChatText.CHAT_TYPE.NORMAL; } else if (selected == 2 && MyInfoManager.Instance.IsClanMember) { chatMode = ChatText.CHAT_TYPE.CLAN; } changeChildButton(); } CheckChatKey(); ApplyFocus(); string nextControlName = "ChatInput"; string text = message; switch (chatMode) { case ChatText.CHAT_TYPE.NORMAL: GUI.SetNextControlName(nextControlName); message = GUI.TextField(crdInputTxtFld, message); break; case ChatText.CHAT_TYPE.CLAN: GUI.SetNextControlName(nextControlName); message = GUI.TextField(crdInputTxtFld, message, "ClanChat"); break; case ChatText.CHAT_TYPE.TEAM: GUI.SetNextControlName(nextControlName); message = GUI.TextField(crdInputTxtFld, message, "TeamChat"); break; case ChatText.CHAT_TYPE.SYSTEM: GUI.SetNextControlName(nextControlName); message = GUI.TextField(crdInputTxtFld, message, "GmChat"); break; } if (message.Length > maxMessageLength) { message = text; } if (GlobalVars.Instance.whisperNickFrom.Length > 0 && CommandInterpreter.Instance.IsReturnWhisper(message)) { message = "/w " + GlobalVars.Instance.whisperNickFrom + " "; cursorToEnd = true; } if (cursorToEnd) { cursorToEnd = false; TextEditor textEditor = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl); if (textEditor != null) { textEditor.pos = 1000; textEditor.selectPos = 1000; } } float num5 = viewSizeCopy.y - crdChatRead.height; if (num5 < 0f) { num5 = 0f; } bool flag = num5 <= scrollPosition.y; CalcViewSize(selected); if (flag) { scrollPosition.y = viewSizeCopy.y - crdChatRead.height; if (scrollPosition.y < 0f) { scrollPosition.y = 0f; } } scrollPosition = GUI.BeginScrollView(crdChatRead, scrollPosition, new Rect(0f, 0f, viewSizeCopy.x, viewSizeCopy.y)); float y = scrollPosition.y; float num6 = scrollPosition.y + crdChatRead.height; Vector2 pos = new Vector2(0f, 0f); foreach (ChatText item in chatQ) { if (item.Filtered(selected)) { Vector2 vector = LabelUtil.CalcSize("MissionLabel", item.FullMessage, viewSizeCopy.x); float y2 = pos.y; float num7 = pos.y + vector.y; if (num7 >= y && y2 <= num6) { LabelUtil.TextOut(pos, item.FullMessage, "MissionLabel", item.TextColor, item.OutlineColor, TextAnchor.UpperLeft, viewSizeCopy.x); if (GlobalVars.Instance.MyButton(new Rect(pos.x, pos.y, vector.x, vector.y), string.Empty, "InvisibleButton") && Event.current.button == 1 && item.Seq >= 0 && item.Seq != MyInfoManager.Instance.Seq) { UserMenu userMenu = ContextMenuManager.Instance.Popup(); if (userMenu != null) { bool flag2 = MyInfoManager.Instance.IsClanee(item.Seq); userMenu.InitDialog(MouseUtil.ScreenToPixelPoint(Input.mousePosition), item.Seq, item.Speaker, !flag2, masterAssign: false); } } } pos.y += vector.y; } } GUI.EndScrollView(); if (!DialogManager.Instance.IsModal && !bBtnActive) { GUI.enabled = true; } }
public int List(Rect rect, GUIContent buttonContent, GUIContent[] listContent, GUIStyle buttonStyle, GUIStyle boxStyle) { if (forceToUnShow) { if (bClickedComboButton) { GlobalVars.Instance.PlaySoundButtonClick(); bOpenList = false; } forceToUnShow = false; bClickedComboButton = false; return(GetSelectedItemIndex()); } maxList = listContent.Length; bool flag = false; int controlID = GUIUtility.GetControlID(FocusType.Passive); EventType typeForControl = Event.current.GetTypeForControl(controlID); if (typeForControl != EventType.MouseUp || bClickedComboButton) { } if (GUI.Button(rect, buttonContent, buttonStyle)) { if (useControlID == -1) { useControlID = controlID; bClickedComboButton = false; bOpenList = false; } if (useControlID != controlID) { useControlID = controlID; } bClickedComboButton = !bClickedComboButton; if (bClickedComboButton) { bOpenList = true; } GlobalVars.Instance.PlaySoundButtonClick(); } if (showUpDnButton) { GUIStyle style = GUI.skin.GetStyle(btnStyleDn); int width = style.normal.background.width; int height = style.normal.background.height; Rect position = new Rect(rect.x + rect.width - (float)width - 4f, rect.y + rect.height / 2f - (float)(height / 2), (float)width, (float)height); if (!bClickedComboButton) { GUI.Box(position, string.Empty, btnStyleDn); } else { GUI.Box(position, string.Empty, btnStyleUp); } } if (bClickedComboButton) { float num = guiStyle.fixedHeight * (float)listContent.Length; Rect position2 = new Rect(rect.x, rect.y + rect.height + 2f, rect.width, num); if (!scrollDown) { position2 = new Rect(rect.x, rect.y - num - 2f, rect.width, num); } if (scrollDown) { scrollViewVector = GUI.BeginScrollView(new Rect(rect.x, rect.y + rect.height, rect.width, num + 2f), scrollViewVector, new Rect(rect.x, rect.y + rect.height, rect.width, num), alwaysShowHorizontal: false, alwaysShowVertical: false); } else { scrollViewVector = GUI.BeginScrollView(new Rect(rect.x, rect.y - num, rect.width, num + 2f), scrollViewVector, new Rect(rect.x, rect.y - num, rect.width, num), alwaysShowHorizontal: false, alwaysShowVertical: false); } if (scrollDown) { GUI.Box(new Rect(rect.x, rect.y, rect.width, num + rect.height + 2f), string.Empty, boxStyle); } else { GUI.Box(new Rect(rect.x, rect.y - num, rect.width, num + rect.height + 2f), string.Empty, boxStyle); } int num2 = GUI.SelectionGrid(position2, selectedItemIndex, listContent, 1, guiStyle); if (num2 != selectedItemIndex) { selectedItemIndex = num2; flag = true; bOpenList = false; } GUI.EndScrollView(); if (Input.GetMouseButtonDown(0)) { Vector2 point = MouseUtil.ScreenToPixelPoint(Input.mousePosition); if (!battleUI) { point.x *= GlobalVars.Instance.ScreenRect.width / (float)Screen.width; point.y *= GlobalVars.Instance.ScreenRect.height / (float)Screen.height; if (isDialog) { point.x -= (GlobalVars.Instance.ScreenRect.width - parentWindowSize.x) / 2f; point.y -= (GlobalVars.Instance.ScreenRect.height - parentWindowSize.y) / 2f; } else { point.x -= (GlobalVars.Instance.ScreenRect.width - GlobalVars.Instance.UIScreenRect.width) / 2f; point.y -= (GlobalVars.Instance.ScreenRect.height - GlobalVars.Instance.UIScreenRect.height) / 2f; } } if (!position2.Contains(point)) { ForceUnShow(); } } } if (flag) { bClickedComboButton = false; } return(GetSelectedItemIndex()); }
public override bool DoDialog() { bool result = false; GUISkin skin = GUI.skin; GUI.skin = GUISkinFinder.Instance.GetGUISkin(); Vector2 pos = new Vector2(size.x / 2f, 15f); LabelUtil.TextOut(pos, StringMgr.Instance.Get("FRIEND_MANAGEMENT"), "BigLabel", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.UpperCenter); GUI.Box(crdOutline, string.Empty, "BoxPopLine"); selected = GUI.SelectionGrid(crdTab, selected, tab, 2, "PopTab"); if (selected == 0) { NameCard[] friends = MyInfoManager.Instance.GetFriends(connectedOnly: false); if (currentFriend >= friends.Length) { currentFriend = friends.Length - 1; } spFriend = GUI.BeginScrollView(viewRect: new Rect(0f, 0f, crdItemSize.x, crdItemSize.y * (float)friends.Length), position: crdView, scrollPosition: spFriend); float num = 0f; float num2 = 0f; for (int i = 0; i < 9 || i < friends.Length; i++) { if (i % 2 == 0) { GUI.Box(new Rect(num, num2, crdItemSize.x, crdItemSize.y), string.Empty, "BoxFadeBlue"); } if (i < friends.Length) { Texture2D badge = XpManager.Instance.GetBadge(friends[i].Lv, friends[i].Rank); if (null != badge) { TextureUtil.DrawTexture(new Rect(num + crdBadge.x, num2 + crdBadge.y, crdBadge.width, crdBadge.height), badge, ScaleMode.StretchToFill); } LabelUtil.TextOut(new Vector2(num + crdNickname.x, num2 + crdNickname.y), friends[i].Nickname, "Label", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleLeft); if (GlobalVars.Instance.MyButton(new Rect(num, num2, crdItemSize.x, crdItemSize.y), string.Empty, "InvisibleButton")) { currentFriend = i; if (Event.current.button == 1) { UserMenu userMenu = ContextMenuManager.Instance.Popup(); if (userMenu != null) { bool flag = MyInfoManager.Instance.IsClanee(friends[i].Seq); userMenu.InitDialog(MouseUtil.ScreenToPixelPoint(Input.mousePosition), friends[i].Seq, friends[i].Nickname, !flag, masterAssign: false); } } } if (!friends[i].IsConnected) { Color byteColor2FloatColor = GlobalVars.Instance.GetByteColor2FloatColor(150, 150, 150); LabelUtil.TextOut(new Vector2(num + crdCon.x, num2 + crdCon.y), StringMgr.Instance.Get("LOGOFF"), "Label", byteColor2FloatColor, GlobalVars.txtEmptyColor, TextAnchor.MiddleRight); } else { Channel channel = ChannelManager.Instance.Get(friends[i].SvrId); if (channel != null) { LabelUtil.TextOut(new Vector2(num + crdCon.x, num2 + crdCon.y), channel.Name, "Label", Color.green, GlobalVars.txtEmptyColor, TextAnchor.MiddleRight); } } if (currentFriend == i) { TextureUtil.DrawTexture(new Rect(num, num2, crdItemSize.x, crdItemSize.y), selectedBox, ScaleMode.StretchToFill); } } num2 += crdItemSize.y; } GUI.EndScrollView(); if (GlobalVars.Instance.MyButton(crdAddFriend, StringMgr.Instance.Get("ADD_FRIEND"), "BtnAction")) { ((AddFriendDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.ADD_FRIEND, exclusive: false))?.InitDialog(); } if (GlobalVars.Instance.MyButton(crdDelFriend, StringMgr.Instance.Get("DEL_FRIEND"), "BtnAction") && 0 <= currentFriend && currentFriend < friends.Length) { CSNetManager.Instance.Sock.SendCS_DEL_FRIEND_REQ(friends[currentFriend].Seq); } } else if (selected == 1) { NameCard[] bans = MyInfoManager.Instance.GetBans(); if (currentBan >= bans.Length) { currentBan = bans.Length - 1; } spBan = GUI.BeginScrollView(viewRect: new Rect(0f, 0f, crdItemSize.x, crdItemSize.y * (float)bans.Length), position: crdView, scrollPosition: spBan); float num3 = 0f; float num4 = 0f; for (int j = 0; j < 9 || j < bans.Length; j++) { if (j % 2 == 0) { GUI.Box(new Rect(num3, num4, crdItemSize.x, crdItemSize.y), string.Empty, "BoxFadeBlue"); } if (j < bans.Length) { LabelUtil.TextOut(new Vector2(num3 + 5f, num4 + crdNickname.y), bans[j].Nickname, "Label", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleLeft); if (GlobalVars.Instance.MyButton(new Rect(num3, num4, crdItemSize.x, crdItemSize.y), string.Empty, "InvisibleButton")) { currentBan = j; if (Event.current.button == 1) { ContextMenuManager.Instance.Popup()?.InitDialog(MouseUtil.ScreenToPixelPoint(Input.mousePosition), bans[j].Seq, bans[j].Nickname, clanInvitable: false, masterAssign: false); } } if (j == currentBan) { TextureUtil.DrawTexture(new Rect(num3, num4, crdItemSize.x, crdItemSize.y), selectedBox, ScaleMode.ScaleToFit); } } num4 += crdItemSize.y; } GUI.EndScrollView(); if (GlobalVars.Instance.MyButton(crdAddBan, StringMgr.Instance.Get("ADD_BAN"), "BtnAction")) { ((AddBanDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.ADD_BAN, exclusive: false))?.InitDialog(); } if (GlobalVars.Instance.MyButton(crdDelBan, StringMgr.Instance.Get("DEL_BAN"), "BtnAction") && 0 <= currentBan && currentBan < bans.Length) { CSNetManager.Instance.Sock.SendCS_DEL_BAN_REQ(bans[currentBan].Seq); } } Rect rc = new Rect(size.x - 44f, 5f, 34f, 34f); bool flag2 = DialogManager.Instance.IsPopup(DialogManager.DIALOG_INDEX.ADD_FRIEND) || DialogManager.Instance.IsPopup(DialogManager.DIALOG_INDEX.ADD_BAN); if (GlobalVars.Instance.MyButton(rc, string.Empty, "BtnClose") || (!flag2 && GlobalVars.Instance.IsEscapePressed())) { result = true; } if (!ContextMenuManager.Instance.IsPopup) { WindowUtil.EatEvent(); } GUI.skin = skin; return(result); }