public override void OnTradeRemoveItem(Schema.Item schemaItem, Inventory.Item inventoryItem) { Bot.main.Invoke((Action)(() => { string itemValue = ""; string completeName = GetItemName(schemaItem, inventoryItem, out itemValue, false); ulong itemID = inventoryItem.Id; double value = 0; if (itemValue.Contains("ref")) { string newValue = ShowTrade.ReplaceLastOccurrence(itemValue, "ref", ""); value = Convert.ToDouble(newValue); } else if (itemValue.Contains("key")) { string newValue = ShowTrade.ReplaceLastOccurrence(itemValue, "keys", ""); value = Convert.ToDouble(newValue); value = value * BackpackTF.KeyPrice; } else if (itemValue.Contains("bud")) { string newValue = ShowTrade.ReplaceLastOccurrence(itemValue, "buds", ""); value = Convert.ToDouble(newValue); value = value * BackpackTF.BudPrice; } ShowTrade.OtherTotalValue -= value; if (ShowTrade.OtherTotalValue >= BackpackTF.BudPrice * 1.33) { double formatPrice = ShowTrade.OtherTotalValue / BackpackTF.BudPrice; string label = "Total Value: " + formatPrice.ToString("0.00") + " buds"; ShowTrade.UpdateLabel(label); } else if (ShowTrade.OtherTotalValue >= BackpackTF.KeyPrice) { double formatPrice = ShowTrade.OtherTotalValue / BackpackTF.KeyPrice; string label = "Total Value: " + formatPrice.ToString("0.00") + " keys"; ShowTrade.UpdateLabel(label); } else { double formatPrice = ShowTrade.OtherTotalValue; string label = "Total Value: " + formatPrice.ToString("0.00") + " ref"; ShowTrade.UpdateLabel(label); } ListOtherOfferings.Remove(completeName, itemID); ShowTrade.list_otherofferings.SetObjects(ListOtherOfferings.Get()); ShowTrade.itemsAdded--; if (ShowTrade.itemsAdded <= 0) { ShowTrade.check_userready.Enabled = false; } string itemName = GetItemName(schemaItem, inventoryItem, out itemValue, false); ShowTrade.AppendText(Bot.SteamFriends.GetFriendPersonaName(OtherSID) + " removed: ", itemName); ChatTab.AppendLog(OtherSID, "[Trade Chat] " + Bot.SteamFriends.GetFriendPersonaName(OtherSID) + " removed: " + itemName + "\r\n"); ShowTrade.ResetTradeStatus(); })); }
public void InsertMessages(string Source, List <ChatMessage> ListChatHistoryToInsert) { ChatTab ActiveChatTab; if (!DicChatHistory.TryGetValue(Source, out ActiveChatTab)) { ActiveChatTab = new ChatTab(Source); DicChatHistory.Add(Source, ActiveChatTab); } ActiveChatTab.ListChatHistory.InsertRange(0, ListChatHistoryToInsert); }
public void LoadTab() { if (tabRow.childCount <= 0) { return; } ChatTab newTab = tabRow.GetChild(0).GetComponent <ChatTab>(); if (newTab) { LoadTab(newTab.Data); } }
public override void OnTradeReady(bool ready) { Bot.main.Invoke((Action)(() => { if (ready) { ChatTab.AppendLog(OtherSID, "[Trade Chat] " + Bot.SteamFriends.GetFriendPersonaName(OtherSID) + " is ready. [" + DateTime.Now.ToLongTimeString() + "]\r\n"); } else { ChatTab.AppendLog(OtherSID, "[Trade Chat] " + Bot.SteamFriends.GetFriendPersonaName(OtherSID) + " is not ready. [" + DateTime.Now.ToLongTimeString() + "]\r\n"); } })); }
public static ObservableCollection <ChatTab> ParseUserData(string rawStringData) { ObservableCollection <ChatTab> chatTabs = new ObservableCollection <ChatTab>(); XDocument xDoc = XDocument.Parse(rawStringData); foreach (XElement chatElement in xDoc.Element("Chats").Elements("PersonalChat")) { XAttribute nameAttribute = chatElement.Attribute("name"); if (nameAttribute != null) { ObservableCollection <ChatMessage> messages = new ObservableCollection <ChatMessage>(); ChatTab chatTab = new ChatTab(); foreach (XElement messageElement in chatElement.Elements("Message")) { XElement timeElement = messageElement.Element("time"); XElement senderElement = messageElement.Element("sender"); XElement textElement = messageElement.Element("text"); if (nameAttribute != null && timeElement != null && senderElement != null && textElement != null) { messages.Add(new ChatMessage { Time = DateTime.Parse(timeElement.Value), Author = senderElement.Value, Message = textElement.Value }); } } chatTab.Name = nameAttribute.Value; chatTab.ChatMessages = messages; chatTab.chatType = ChatInstanceType.personal; chatTabs.Add(chatTab); } } foreach (XElement chatElement in xDoc.Element("Chats").Elements("GroupChat")) { XAttribute nameAttribute = chatElement.Attribute("name"); XAttribute passwordAttribute = chatElement.Attribute("password"); if (nameAttribute != null && passwordAttribute != null) { ChatTab chatTab = new ChatTab(); chatTab.Name = nameAttribute.Value; chatTab.Password = passwordAttribute.Value; chatTab.chatType = ChatInstanceType.group; chatTabs.Add(chatTab); } } return(chatTabs); }
public void AddMessage(string Source, ChatMessage NewMessage) { ChatTab ActiveChatTab; if (!DicChatHistory.TryGetValue(Source, out ActiveChatTab)) { ActiveChatTab = new ChatTab(Source); DicChatHistory.Add(Source, ActiveChatTab); } ActiveChatTab.ListChatHistory.Add(NewMessage); if (Source != _ActiveChatTabID) { DicChatHistory[Source].HasUnreadMessages = true; } }
public override void OnTradeMessage(string message) { Bot.main.Invoke((Action)(() => { string send = Bot.SteamFriends.GetFriendPersonaName(OtherSID) + ": " + message + " [" + DateTime.Now.ToLongTimeString() + "]\r\n"; ShowTrade.UpdateChat(send); ChatTab.AppendLog(OtherSID, "[Trade Chat] " + send); if (!ShowTrade.focused) { int duration = 3; FormAnimator.AnimationMethod animationMethod = FormAnimator.AnimationMethod.Slide; FormAnimator.AnimationDirection animationDirection = FormAnimator.AnimationDirection.Up; string title = "[Trade Chat] " + Bot.SteamFriends.GetFriendPersonaName(OtherSID) + " says:"; Notification toastNotification = new Notification(title, message, duration, animationMethod, animationDirection, Friends.chat.chatTab.avatarBox); toastNotification.Show(); } })); }
public void ClosePMTab(ChatTab whichTab) { if (whichTab == ChatTab.Private1) { _state.PrivateChat1Shown = false; } else if (whichTab == ChatTab.Private2) { _state.PrivateChat2Shown = false; } else { throw new ArgumentOutOfRangeException(nameof(whichTab), whichTab, "whichTab should be Private1 or Private2"); } _state.CachedScrollOffsets[whichTab] = 0; _tabLabels[whichTab].Text = ""; SelectTab(ChatTab.Local); }
private Vector2 GetDestinationVectorForTab(ChatTab tab) { var topLeft = new Vector2(DrawAreaWithParentOffset.X, DrawAreaWithParentOffset.Y); switch (tab) { case ChatTab.Private1: return(topLeft + new Vector2(23, 102)); case ChatTab.Private2: return(topLeft + new Vector2(156, 102)); case ChatTab.Local: case ChatTab.Global: case ChatTab.Group: case ChatTab.System: return(topLeft + new Vector2(289 + 44 * ((int)tab - 2), 102)); default: throw new ArgumentOutOfRangeException(nameof(tab), tab, null); } }
public override void OnTradeRemoveItem(Schema.Item schemaItem, Inventory.Item inventoryItem) { Debug.WriteLine("Item removed: ID: {0} | DefIndex: {1}", inventoryItem.Id, inventoryItem.Defindex); Bot.main.Invoke((Action)(() => { string itemValue = ""; string completeName = GetItemName(schemaItem, inventoryItem, out itemValue, false); ulong itemID = inventoryItem.Id; ShowTrade.list_otherofferings.SetObjects(ListOtherOfferings.Get()); ShowTrade.itemsAdded--; if (ShowTrade.itemsAdded <= 0) { ShowTrade.check_userready.Enabled = false; } string itemName = GetItemName(schemaItem, inventoryItem, out itemValue, false); ShowTrade.AppendText(Bot.SteamFriends.GetFriendPersonaName(OtherSID) + " removed: ", itemName); var count = ListOtherOfferings.Get().Count(x => x.Item.Defindex == inventoryItem.Defindex); ShowTrade.AppendText(string.Format("Number of {0}: {1}", schemaItem.ItemName, count)); ChatTab.AppendLog(OtherSID, "[Trade Chat] " + Bot.SteamFriends.GetFriendPersonaName(OtherSID) + " removed: " + itemName + "\r\n"); ShowTrade.ResetTradeStatus(); })); }
private ISpriteSheet GetSpriteSheetForTab(ChatTab tab) { if ((tab == ChatTab.Private1 && !_state.PrivateChat1Shown) || (tab == ChatTab.Private2 && !_state.PrivateChat2Shown)) { return(new EmptySpriteSheet()); } switch (tab) { case ChatTab.Private1: case ChatTab.Private2: return(CurrentTab == tab ? _largeSelected : _largeUnselected); case ChatTab.Local: case ChatTab.Global: case ChatTab.Group: case ChatTab.System: return(CurrentTab == tab ? _smallSelected : _smallUnselected); default: throw new ArgumentOutOfRangeException(); } }
public NavigationControl() { SuspendLayout();//(Increase performance), Reference: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.suspendlayout.aspx InitializeComponent(); isBusyTimer.Interval = 1020; //timer tick to update "isBusyIcon" every 1020 ms. isBusyTimer.Tick += isBusyTimer_Tick; isBusyTimer.Start(); ButtonList = new List <ButtonInfo>() //normal arrangement { new ButtonInfo() { Label = "HOME", TargetPath = "http://zero-k.info/", Icon = Buttons.home, Height = 32, Width = 80 }, new ButtonInfo() { Label = "CHAT", TargetPath = "chat", Icon = ZklResources.chat, Height = 32, Width = 65 }, new ButtonInfo() { Label = "SINGLEPLAYER", TargetPath = "http://zero-k.info/Missions", Icon = Buttons.spherebot, Width = 125, Height = 32, }, new ButtonInfo() { Label = "MULTIPLAYER", TargetPath = "battles", Icon = ZklResources.battle, Width = 115, Height = 32, }, new ButtonInfo() { Label = "PLANETWARS", TargetPath = "http://zero-k.info/Planetwars", Height = 32, }, new ButtonInfo() { Label = "MAPS", TargetPath = "http://zero-k.info/Maps", Icon = Buttons.map, Height = 32, Width = 75 }, new ButtonInfo() { Label = "REPLAYS", TargetPath = "http://zero-k.info/Battles", Icon = Buttons.video_icon, Height = 32, Width = 95 }, new ButtonInfo() { Label = "FORUM", TargetPath = "http://zero-k.info/Forum", Height = 32, Width = 65, }, new ButtonInfo() { Label = "SETTINGS", TargetPath = "settings", Icon = Buttons.settings, Height = 32, Width = 100, Dock = DockStyle.Right }, }; Instance = this; tabControl.TabPages.Clear(); chatTab = new ChatTab(); lastTabPaths[chatTab] = string.Format("chat/channel/{0}", Program.Conf != null ? Program.Conf.AutoJoinChannels.OfType <string>().FirstOrDefault():"zk"); AddTabPage(chatTab, "Chat"); if (Environment.OSVersion.Platform != PlatformID.Unix && !Program.Conf.UseExternalBrowser) { if (!Program.Conf.SingleInstance) //run in multiple TAB? { AddTabPage(new BrowserTab("http://zero-k.info/Maps", false), "Maps"); AddTabPage(new BrowserTab("http://zero-k.info/Missions", false), "sp"); AddTabPage(new BrowserTab("http://zero-k.info/Battles", false), "rp"); AddTabPage(new BrowserTab("http://zero-k.info/Planetwars", false), "pw"); AddTabPage(new BrowserTab("http://zero-k.info/Forum", true), "fm"); } var home = AddTabPage(new BrowserTab("http://zero-k.info/", true), "hm"); tabControl.SelectTab(home); if (Program.Conf.InterceptPopup) { AddTabPage(new BrowserTab("http", false), "other"); //a tab with generic match that match 100% of random URL (block new window) ButtonList.Add(new ButtonInfo() { Label = "OTHER", TargetPath = "http", Height = 32, Width = 65, }); } reloadButton1.Visible = true; } var battles = new BattleListTab(); AddTabPage(battles, "Battles"); AddTabPage(new SettingsTab(), "Settings"); AddTabPage(new ServerTab(), "Server"); AddTabPage(new AdvertiserWindow(), "Advertiser"); AddTabPage(new DownloaderTab(), "Rapid"); foreach (var but in ButtonList) { flowLayoutPanel1.Controls.Add(but.GetButton()); } flowLayoutPanel1.Controls.Add(logoutButton); flowLayoutPanel1.BringToFront(); ResumeLayout(); }
public void DrawGUI() { if(GUI.Button(new Rect(0, 600 * yScale, 60 * xScale, 20 * yScale), "Chat")) { currentTab = ChatTab.CHAT; } if(GUI.Button(new Rect(60 * xScale, 600 * yScale, 60 * xScale, 20 * yScale), "Game")) { currentTab = ChatTab.GAME; } if(GUI.Button(new Rect(120 * xScale, 600 * yScale, 60 * xScale, 20 * yScale), "Help")) { currentTab = ChatTab.HELP; } Rect ChatWindow = new Rect(0, 620 * yScale, 340 * xScale, 120 * yScale); Rect WriterWindow = new Rect(0, 740 * yScale, 340 * xScale, 20 * yScale); string chat_str = ""; if(currentTab == ChatTab.CHAT) { chat_str = FillWindow(ChatMessage); } else if(currentTab == ChatTab.GAME) { chat_str = FillWindow(GameMessage); } else if(currentTab == ChatTab.HELP) { chat_str = FillWindow(HelpMessage); } GUI.TextArea(ChatWindow, chat_str); currentMessage = GUI.TextField(WriterWindow, currentMessage); }
public HUD(Game g, PacketAPI api) : base(g) { if(!api.Initialized) throw new ArgumentException("Need to initialize connection before the in-game stuff will work"); m_packetAPI = api; DrawOrder = 5; mainFrame = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 1, true); topLeft = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 21, true); sidebar = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 22, true); topBar = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 23, true); filler = new Texture2D(g.GraphicsDevice, 1, 1); filler.SetData(new[] {Color.FromNonPremultiplied(8, 8, 8, 255)}); Texture2D mainButtonTexture = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 25); mainBtn = new XNAButton[NUM_BTN]; //set up panels Texture2D invBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 44); pnlInventory = new XNAPanel(new Rectangle(102, 330, invBG.Width, invBG.Height)) { BackgroundImage = invBG, Visible = false }; Texture2D spellsBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 62); pnlActiveSpells = new XNAPanel(new Rectangle(102, 330, spellsBG.Width, spellsBG.Height)) { BackgroundImage = spellsBG, Visible = false }; pnlPassiveSpells = new XNAPanel(new Rectangle(102, 330, spellsBG.Width, spellsBG.Height)) { BackgroundImage = spellsBG, Visible = false }; Texture2D chatBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 28); pnlChat = new XNAPanel(new Rectangle(102, 330, chatBG.Width, chatBG.Height)) { BackgroundImage = chatBG, Visible = false }; Texture2D statsBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 34); pnlStats = new XNAPanel(new Rectangle(102, 330, statsBG.Width, statsBG.Height)) { BackgroundImage = statsBG, Visible = false }; Texture2D onlineBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 36); pnlOnline = new XNAPanel(new Rectangle(102, 330, onlineBG.Width, onlineBG.Height)) { BackgroundImage = onlineBG, Visible = false }; Texture2D partyBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 42); pnlParty = new XNAPanel(new Rectangle(102, 330, partyBG.Width, partyBG.Height)) { BackgroundImage = partyBG, Visible = false }; Texture2D settingsBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 47); pnlSettings = new XNAPanel(new Rectangle(102, 330, settingsBG.Width, settingsBG.Height)) { BackgroundImage = settingsBG, Visible = false }; Texture2D helpBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 63); pnlHelp = new XNAPanel(new Rectangle(102, 330, helpBG.Width, helpBG.Height)) { BackgroundImage = helpBG, Visible = false }; Texture2D newsBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 48); pnlNews = new XNAPanel(new Rectangle(102, 330, newsBG.Width, newsBG.Height)) {BackgroundImage = newsBG}; //for easy update of all panels via foreach List<XNAPanel> pnlCollection = new List<XNAPanel>(10) { pnlInventory, pnlActiveSpells, pnlPassiveSpells, pnlChat, pnlStats, pnlOnline, pnlParty, pnlSettings, pnlHelp, pnlNews }; //pnlCollection.Add(pnlMacro); //if this ever happens... pnlCollection.ForEach(_pnl => World.IgnoreDialogs(_pnl)); for (int i = 0; i < NUM_BTN; ++i) { Texture2D _out = new Texture2D(g.GraphicsDevice, mainButtonTexture.Width / 2, mainButtonTexture.Height / NUM_BTN); Texture2D _ovr = new Texture2D(g.GraphicsDevice, mainButtonTexture.Width / 2, mainButtonTexture.Height / NUM_BTN); Rectangle _outRec = new Rectangle(0, i * _out.Height, _out.Width, _out.Height); Rectangle _ovrRec = new Rectangle(_ovr.Width, i * _ovr.Height, _ovr.Width, _ovr.Height); Color[] _outBuf = new Color[_outRec.Width * _outRec.Height]; Color[] _ovrBuf = new Color[_ovrRec.Width * _ovrRec.Height]; mainButtonTexture.GetData(0, _outRec, _outBuf, 0, _outBuf.Length); _out.SetData(_outBuf); mainButtonTexture.GetData(0, _ovrRec, _ovrBuf, 0, _ovrBuf.Length); _ovr.SetData(_ovrBuf); //0-5: left side, starting at 59, 327 with increments of 20 //6-10: right side, starting at 587, 347 Vector2 btnLoc = new Vector2(i < 6 ? 62 : 590, (i < 6 ? 330 : 350) + ((i < 6 ? i : i - 6) * 20)); mainBtn[i] = new XNAButton(new [] { _out, _ovr }, btnLoc); World.IgnoreDialogs(mainBtn[i]); } //left button onclick events mainBtn[0].OnClick += (s,e) => _doStateChange(InGameStates.Inventory); mainBtn[1].OnClick += (s,e) => World.Instance.ActiveMapRenderer.ToggleMapView(); mainBtn[2].OnClick += (s,e) => _doStateChange(InGameStates.Active); mainBtn[3].OnClick += (s, e) => _doStateChange(InGameStates.Passive); mainBtn[4].OnClick += (s, e) => _doStateChange(InGameStates.Chat); mainBtn[5].OnClick += (s, e) => _doStateChange(InGameStates.Stats); //right button onclick events mainBtn[6].OnClick += (s, e) => _doStateChange(InGameStates.Online); mainBtn[7].OnClick += (s, e) => _doStateChange(InGameStates.Party); //mainBtn[8].OnClick += OnViewMacro; //not implemented in EO client mainBtn[9].OnClick += (s, e) => _doStateChange(InGameStates.Settings); mainBtn[10].OnClick += (s, e) => _doStateChange(InGameStates.Help); SpriteBatch = new SpriteBatch(g.GraphicsDevice); state = InGameStates.News; chatRenderer = new EOChatRenderer(); chatRenderer.SetParent(pnlChat); chatRenderer.AddTextToTab(ChatTabs.Global, World.GetString(DATCONST2.STRING_SERVER), World.GetString(DATCONST2.GLOBAL_CHAT_SERVER_MESSAGE_1), ChatType.Note, ChatColor.Server); chatRenderer.AddTextToTab(ChatTabs.Global, World.GetString(DATCONST2.STRING_SERVER), World.GetString(DATCONST2.GLOBAL_CHAT_SERVER_MESSAGE_2), ChatType.Note, ChatColor.Server); newsTab = new ChatTab(pnlNews); chatTextBox = new ChatTextBox(new Rectangle(124, 308, 440, 19), g.Content.Load<Texture2D>("cursor"), "Microsoft Sans Serif", 8.0f) { Selected = true, Visible = true, MaxChars = 140 }; World.IgnoreDialogs(chatTextBox); chatTextBox.OnEnterPressed += _doTalk; chatTextBox.OnClicked += (s, e) => { //make sure clicking on the textarea selects it (this is an annoying problem in the original client) if (((EOGame)g).Dispatcher.Subscriber != null) ((XNATextBox) (g as EOGame).Dispatcher.Subscriber).Selected = false; (g as EOGame).Dispatcher.Subscriber = chatTextBox; chatTextBox.Selected = true; }; chatTextBox.OnTextChanged += (s, e) => { if (chatTextBox.Text.Length <= 0) { if (modeTextureLoaded && modeTexture != null) { modeTextureLoaded = false; modeTexture.Dispose(); modeTexture = null; currentChatMode = ChatMode.NoText; } return; } if (chatTextBox.Text.Length == 1 && chatTextBox.Text[0] == '~' && World.Instance.MainPlayer.ActiveCharacter.CurrentMap == World.Instance.JailMap) { chatTextBox.Text = ""; SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_WARNING, DATCONST2.JAIL_WARNING_CANNOT_USE_GLOBAL); return; } switch (chatTextBox.Text[0]) { case '!': currentChatMode = ChatMode.Private; break; case '@': //should show global if admin, otherwise, public/normal chat if (World.Instance.MainPlayer.ActiveCharacter.AdminLevel == AdminLevel.Player) goto default; currentChatMode = ChatMode.Global; break; case '~': currentChatMode = ChatMode.Global; break; case '+': { if (World.Instance.MainPlayer.ActiveCharacter.AdminLevel == AdminLevel.Player) goto default; currentChatMode = ChatMode.Admin; } break; case '\'': currentChatMode = ChatMode.Group; break; case '&': { if (World.Instance.MainPlayer.ActiveCharacter.GuildName == "") goto default; currentChatMode = ChatMode.Guild; } break; default: currentChatMode = ChatMode.Public; break; } }; ((EOGame)g).Dispatcher.Subscriber = chatTextBox; m_muteTimer = new Timer(s => { chatTextBox.IgnoreAllInput = false; currentChatMode = ChatMode.NoText; m_muteTimer.Change(Timeout.Infinite, Timeout.Infinite); }, null, Timeout.Infinite, Timeout.Infinite); statusLabel = new XNALabel(new Rectangle(97, 455, 1, 1), "Microsoft Sans Serif", 7f); clockLabel = new XNALabel(new Rectangle(558, 455, 1, 1), "Microsoft Sans Serif", 7f); StatusBars[0] = new HudElementHP(); StatusBars[1] = new HudElementTP(); StatusBars[2] = new HudElementSP(); StatusBars[3] = new HudElementTNL(); m_whoIsOnline = new EOOnlineList(pnlOnline); m_party = new EOPartyPanel(pnlParty); m_friendList = new XNAButton(GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 27, false, true), new Vector2(592, 312), new Rectangle(0, 260, 17, 15), new Rectangle(0, 276, 17, 15)) { Visible = true, Enabled = true }; m_friendList.OnClick += (o, e) => EOFriendIgnoreListDialog.Show(m_packetAPI, false); m_friendList.OnMouseOver += (o, e) => SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_BUTTON, DATCONST2.STATUS_LABEL_FRIEND_LIST); m_ignoreList = new XNAButton(GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 27, false, true), new Vector2(609, 312), new Rectangle(17, 260, 17, 15), new Rectangle(17, 276, 17, 15)) { Visible = true, Enabled = true }; m_ignoreList.OnClick += (o, e) => EOFriendIgnoreListDialog.Show(m_packetAPI, true); m_ignoreList.OnMouseOver += (o, e) => SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_BUTTON, DATCONST2.STATUS_LABEL_IGNORE_LIST); m_expInfo = new XNAButton(GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 58), new Vector2(55, 0), new Rectangle(331, 30, 22, 14), new Rectangle(331, 30, 22, 14)); m_expInfo.OnClick += (o, e) => EOSessionExpDialog.Show(); m_questInfo = new XNAButton(GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 58), new Vector2(77, 0), new Rectangle(353, 30, 22, 14), new Rectangle(353, 30, 22, 14)); //no need to make this a member variable //it does not have any resources to dispose and it is automatically disposed by the framework // ReSharper disable once UnusedVariable EOSettingsPanel settings = new EOSettingsPanel(pnlSettings); }
public void AddChat(ChatTab whichTab, string who, string message, ChatIcon chatIcon = ChatIcon.None, ChatColor chatColor = ChatColor.Default) { chatRenderer.AddTextToTab(whichTab, who, message, chatIcon, chatColor); }
public void SetTab(ChatTab t) { currentTab = t; }
public ChatPanel(INativeGraphicsManager nativeGraphicsManager, IChatRenderableGenerator chatRenderableGenerator, IChatProvider chatProvider, IHudControlProvider hudControlProvider, SpriteFont chatFont) { _nativeGraphicsManager = nativeGraphicsManager; _chatRenderableGenerator = chatRenderableGenerator; _chatProvider = chatProvider; _hudControlProvider = hudControlProvider; _chatFont = chatFont; //abs coordiantes: 568 309 _scrollBar = new ScrollBar(new Vector2(467, 2), new Vector2(16, 97), ScrollBarColors.LightOnMed, _nativeGraphicsManager) { LinesToRender = 7, Visible = true }; _chatRenderables = new List <IChatRenderable>(); _state = new ChatPanelStateCache(); CurrentTab = ChatTab.Local; var tabTexture = _nativeGraphicsManager.TextureFromResource(GFXTypes.PostLoginUI, 35); _smallSelected = new SpriteSheet(tabTexture, new Rectangle(307, 16, 43, 16)); _smallUnselected = new SpriteSheet(tabTexture, new Rectangle(264, 16, 43, 16)); _largeSelected = new SpriteSheet(tabTexture, new Rectangle(132, 16, 132, 16)); _largeUnselected = new SpriteSheet(tabTexture, new Rectangle(0, 16, 132, 16)); BackgroundImage = _nativeGraphicsManager.TextureFromResource(GFXTypes.PostLoginUI, 28); DrawArea = new Rectangle(102, 330, BackgroundImage.Width, BackgroundImage.Height); _tabLabels = new Dictionary <ChatTab, IXNALabel> { { ChatTab.Local, new XNALabel(Constants.FontSize08) { Text = "scr", ForeColor = Color.White } }, { ChatTab.Global, new XNALabel(Constants.FontSize08) { Text = "glb" } }, { ChatTab.Group, new XNALabel(Constants.FontSize08) { Text = "grp" } }, { ChatTab.System, new XNALabel(Constants.FontSize08) { Text = "sys" } }, { ChatTab.Private1, new XNALabel(Constants.FontSize08) { Text = "[priv 1]", Visible = false } }, { ChatTab.Private2, new XNALabel(Constants.FontSize08) { Text = "[priv 2]", Visible = false } } }; _tabLabelClickableAreas = new Dictionary <ChatTab, Rectangle> { { ChatTab.Local, new Rectangle(0, 0, 43, 16).WithPosition(GetDestinationVectorForTab(ChatTab.Local)) }, { ChatTab.Global, new Rectangle(0, 0, 43, 16).WithPosition(GetDestinationVectorForTab(ChatTab.Global)) }, { ChatTab.Group, new Rectangle(0, 0, 43, 16).WithPosition(GetDestinationVectorForTab(ChatTab.Group)) }, { ChatTab.System, new Rectangle(0, 0, 43, 16).WithPosition(GetDestinationVectorForTab(ChatTab.System)) }, { ChatTab.Private1, new Rectangle(0, 0, 132, 16).WithPosition(GetDestinationVectorForTab(ChatTab.Private1)) }, { ChatTab.Private2, new Rectangle(0, 0, 132, 16).WithPosition(GetDestinationVectorForTab(ChatTab.Private2)) }, }; foreach (var kvp in _tabLabels) { var startPos = GetDestinationVectorForTab(kvp.Key); kvp.Value.DrawPosition = startPos + new Vector2(14, 2); //note: these must be manually drawn so they appear on top of the tab graphics if (Game.Components.Contains(kvp.Value)) { Game.Components.Remove(kvp.Value); } } _closeButtonAreaForTab1 = new Rectangle(3, 3, 11, 11).WithPosition(GetDestinationVectorForTab(ChatTab.Private1)); _closeButtonAreaForTab2 = new Rectangle(3, 3, 11, 11).WithPosition(GetDestinationVectorForTab(ChatTab.Private2)); }
public void AddTextToTab(ChatTab tab, string who, string text, ChatIcon icon = ChatIcon.None, ChatColor col = ChatColor.Default) { tabs[(int)tab].AddText(who, text, icon, col); }
public void SendGameChatMessage(string msg, ChatTab tab = ChatTab.CHAT) { //if(opponent != null) //{ if(tab == ChatTab.CHAT) GameChat.AddChatMessage(PlayerVariables.playerName, msg); else if(tab == ChatTab.GAME) GameChat.AddGameMessage(PlayerVariables.playerName, msg); //networkView.RPC("SyncChat", opponent, PlayerVariables.enemyName, msg, (int)tab); //} }