public static void MessageHideAll(bool isHide) { if (!GetSelectedReceiveStatus()) { return; } if (isHide) { if (chatMode == ChatMode.Private) { return; } DirectBring(SelectedReceiverOffset, 8, out byte[] buffer); chatMode = (ChatMode)buffer[0]; chatTarget = buffer[4]; buffer[0] = 0; buffer[4] = 0x7F; DirectPatch(SelectedReceiverOffset, buffer); } else { byte[] buffer = new byte[8]; buffer[0] = (byte)chatMode; buffer[4] = chatTarget; DirectPatch(SelectedReceiverOffset, buffer); } }
public MenuItem(ChatMode mode, string title, Uri imageSource, int imageHeight) { Mode = mode; Title = title; ImageSource = imageSource; ImageHeight = imageHeight; }
public void SendSpeech(string text, ChatMode mode) // used by chatwindow. { MessageTypes speechType = MessageTypes.Normal; int hue = 0; switch (mode) { case ChatMode.Default: speechType = MessageTypes.Normal; hue = Settings.UserInterface.SpeechColor; break; case ChatMode.Whisper: speechType = MessageTypes.Whisper; hue = Settings.UserInterface.SpeechColor; break; case ChatMode.Emote: speechType = MessageTypes.Emote; hue = Settings.UserInterface.EmoteColor; break; case ChatMode.Party: // not yet implemented speechType = MessageTypes.Normal; hue = Settings.UserInterface.SpeechColor; break; case ChatMode.Guild: speechType = MessageTypes.Guild; hue = Settings.UserInterface.GuildMsgColor; break; case ChatMode.Alliance: speechType = MessageTypes.Alliance; hue = Settings.UserInterface.AllianceMsgColor; break; } m_Network.Send(new AsciiSpeechPacket(speechType, 0, hue + 2, "ENU", text)); }
/// <summary> /// Makes sure messages is added to the correct row in the chat. /// </summary> /// <param name="message"></param> private void InsertMessage(ChatMode chatMode, string message) { int index = 0; while (index < chatBackground.Texts.Count - 1) { if (chatBackground.Texts[index].Text.Length == 0) { chatBackground.Texts[index].Text = message; break; } index++; } //if (chatMode == ChatMode.Team && TeamMode.TeamDef != null) //{ // chatBackground.Texts[index].SetColor(TeamMode.TeamDef.Color); //} if (chatMode == ChatMode.Private) { chatBackground.Texts[index].SetColor(ColorRGBA.Pink); } else { chatBackground.Texts[index].SetColor(ColorRGBA.White); } chatBackground.Texts[index].Text = message; }
private bool onHideFullScreen(ChatEvents.HideFullScreen evt) { worldChat.gameObject.SetActive(value: true); ActiveChatMode = ChatMode.WORLD; Service.Get <EventDispatcher>().DispatchEvent(default(PlayerNameEvents.ShowPlayerNames)); return(false); }
protected void ChatHandler(NeutronPlayer player, ChatMode packet, MatchmakingTo matchmakingTo, int viewId, string message) { if (OnMessageReceived.Invoke(player, message)) { using (NeutronStream stream = Neutron.PooledNetworkStreams.Pull()) { NeutronStream.IWriter writer = stream.Writer; writer.WritePacket((byte)Packet.Chat); writer.Write(message); if (packet == ChatMode.Global) { player.Write(writer, TargetTo.All, matchmakingTo, Protocol.Tcp); } else if (packet == ChatMode.Private) { if (MatchmakingHelper.Server.GetPlayer(viewId, out NeutronPlayer playerFound)) { playerFound.Write(player, writer, TargetTo.Me, MatchmakingTo.Me, Protocol.Tcp); } else { player.Error(Packet.Chat, "Player not found!", ErrorMessage.PLAYER_NOT_FOUND); } } } } }
public static void MessageHide(bool isHide) { if (!GetReceiveStatus()) { return; } if (isHide) { if (chatMode == ChatMode.Private) { return; } byte[] buffer = new byte[1]; ReadProcessMemory(Warcraft3Info.Handle, ReceiverOffset, buffer, 1, out _); chatMode = (ChatMode)buffer[0]; ReadProcessMemory(Warcraft3Info.Handle, ReceiverOffset + 4, buffer, 1, out _); chatTarget = buffer[0]; WriteProcessMemory(Warcraft3Info.Handle, ReceiverOffset, new byte[] { 0x00 }, 1, out _); WriteProcessMemory(Warcraft3Info.Handle, ReceiverOffset + 4, new byte[] { 0x7F }, 1, out _); } else { WriteProcessMemory(Warcraft3Info.Handle, ReceiverOffset, new byte[] { (byte)chatMode }, 1, out _); WriteProcessMemory(Warcraft3Info.Handle, ReceiverOffset + 4, new byte[] { chatTarget }, 1, out _); } }
public static void ReceiveClientSettings(Player player, GameStream stream) { string locale = stream.ReadString(); byte viewDistance = stream.ReadByte(); ChatMode chatMode = (ChatMode)(int)stream.ReadVarInt().Value; bool colors = stream.ReadBoolean(); byte skinParts = stream.ReadByte(); VarInt mainHand = stream.ReadVarInt(); player.Locale = locale; player.ViewDistance = viewDistance; player.ChatMode = chatMode; player.ColorsEnabled = colors; foreach (SkinPart part in SkinParts) { if (skinParts.IsBitSet(part)) { player.DisplayedSkinParts.Add(part); } } player.MainHand.Value = mainHand; SendPlayerSlot(player, stream, player.Slot); // TODO - Declare Recipes // TODO - Set Tags // TODO - Set Entity Statuses }
public void SetChatMode(ChatMode newChatMode) { if (!_account.IsAuthenticated) { _account.RaiseError( "Authentication is required to use mutations. Set the AuthorizationToken property with your user token to authenticate"); } GraphQLRequest _req = new GraphQLRequest { Query = $"mutation{{chatModeSet(chatMode: {newChatMode}) {{ err {{ message }}}}}}" }; if (!Dlive.CanExecuteQuery()) { Task.Delay((Dlive.NextIntervalReset - DateTime.Now).Milliseconds).Wait(); } Dlive.IncreaseQueryCounter(); GraphQLResponse res = Task.Run(() => _account.Client.SendMutationAsync(_req)).Result; if (res.Errors != null) { _account.RaiseError($"An error occured while changing chatmode: {res.Errors[0].Message}"); } }
public override void OnKeyboardReturn(int textID, string text) { m_TextEntry.Text = string.Empty; m_MessageHistory.Add(new Tuple <ChatMode, string>(Mode, text)); m_MessageHistoryIndex = m_MessageHistory.Count; m_World.Interaction.SendSpeech(text, Mode); Mode = ChatMode.Default; }
private bool onShowFullScreen(ChatEvents.ShowFullScreen evt) { worldChat.ClearSpeechBubbles(); worldChat.gameObject.SetActive(value: false); ActiveChatMode = ChatMode.FULL_SCREEN; Service.Get <EventDispatcher>().DispatchEvent(default(PlayerNameEvents.HidePlayerNames)); return(false); }
public void SendChatMessage(string msg, ChatMode mode = ChatMode.INFO) { //only send in online mode, may be used for service messages from server if (m_initialized) { ChatMessage message = new ChatMessage(-1, mode, msg); //id -1 = server SendChatMessage(message); } }
public void OnModeChanged(ChatMode oValue, ChatMode nValue) { ModeChanged?.Invoke(this, EventArgs.Empty); if (ChatModeButton != null) { ChatModeButton.Label.Text = Mode.ToString(); } }
private void UpdateSourceRectangleForMode(ChatMode mode) { if (!SourceRectangle.HasValue) { throw new InvalidOperationException("SourceRectangle is expected to have a value."); } var source = SourceRectangle.Value; SourceRectangle = source.WithPosition(new Vector2(0, (float)mode * source.Height)); }
public ChatTextBox() { Size = new Size(400, 25); Opacity = 0.6F; HasTitle = false; HasFooter = false; HasTopBorder = false; CloseButton.Visible = false; AllowResize = true; CanResizeHeight = false; ChatModeButton = new DXButton { ButtonType = ButtonType.SmallButton, Size = new Size(60, SmallButtonHeight), Label = { Text = "本地" }, Parent = this, }; ChatModeButton.MouseClick += (o, e) => Mode = (ChatMode)(((int)(Mode) + 1) % 7); OptionsButton = new DXButton { ButtonType = ButtonType.SmallButton, Size = new Size(50, SmallButtonHeight), Label = { Text = "聊天设置" }, Parent = this, }; OptionsButton.MouseClick += (o, e) => { GameScene.Game.ChatOptionsBox.Visible = !GameScene.Game.ChatOptionsBox.Visible; }; TextBox = new DXTextBox { Size = new Size(350, 20), Parent = this, MaxLength = Globals.MaxChatLength, Opacity = 0.35f, }; TextBox.TextBox.KeyPress += TextBox_KeyPress; // TextBox.TextBox.KeyDown += TextBox_KeyDown; // TextBox.TextBox.KeyUp += TextBox_KeyUp; SetClientSize(new Size(TextBox.Size.Width + ChatModeButton.Size.Width + 15 + OptionsButton.Size.Width, TextBox.Size.Height)); ChatModeButton.Location = new Point(ClientArea.Location.X, ClientArea.Y - 1); TextBox.Location = new Point(ClientArea.Location.X + ChatModeButton.Size.Width + 5, ClientArea.Y); OptionsButton.Location = new Point(ClientArea.Location.X + TextBox.Size.Width + ChatModeButton.Size.Width + 10, ClientArea.Y - 1); }
public void OpenTeamChat() { //if (TeamMode.TeamDef == null) { //AddMessage(ChatMode.All, "Du musst erst einem Team beitreten bevor du den Teamchat verwenden kannst!"); // OpenAllChat(); return; } openChatMode = ChatMode.Team; prefix.Texts[0].Text = "Team: "; Open(); }
public override void OnKeyboardReturn(int textID, string text) { // local variables ChatMode sentMode = Mode; MessageTypes speechType = MessageTypes.Normal; int hue = 0; // save this message and reset chat for next entry m_TextEntry.Text = string.Empty; m_MessageHistory.Add(new Tuple <ChatMode, string>(Mode, text)); m_MessageHistoryIndex = m_MessageHistory.Count; Mode = ChatMode.Default; // send the message and display it locally. switch (sentMode) { case ChatMode.Default: speechType = MessageTypes.Normal; hue = Settings.UserInterface.SpeechColor; break; case ChatMode.Whisper: speechType = MessageTypes.Whisper; hue = Settings.UserInterface.SpeechColor; break; case ChatMode.Emote: speechType = MessageTypes.Emote; hue = Settings.UserInterface.EmoteColor; break; case ChatMode.Party: PlayerState.Partying.DoPartyCommand(text); return; case ChatMode.PartyPrivate: PlayerState.Partying.SendPartyPrivateMessage(m_PrivateMessageSerial, text); return; case ChatMode.Guild: speechType = MessageTypes.Guild; hue = Settings.UserInterface.GuildMsgColor; break; case ChatMode.Alliance: speechType = MessageTypes.Alliance; hue = Settings.UserInterface.AllianceMsgColor; break; } INetworkClient network = Service.Get <INetworkClient>(); network.Send(new AsciiSpeechPacket(speechType, 0, hue + 2, "ENU", text)); }
public override void ReadPacket() { Locale = Read <string>(); ViewDistance = Read <SByte>(); ChatMode = (ChatMode)(int)Read <VarInt>(); ChatColors = Read <bool>(); displayedSkinParts = (DisplayedSkinParts)Read <byte>(); mainHand = (MainHand)(int)Read <VarInt>(); Player.Locale = Locale; Player.ViewDistance = ViewDistance; Player.ChatMode = ChatMode; Player.ChatColors = ChatColors; Player.DisplayedSkinParts = displayedSkinParts; Player.MainHand = mainHand; }
/// <summary> /// Shifts chat rows to create space for the new message and controls message length /// </summary> /// <param name="message"></param> public void AddMessage(ChatMode chatmode, string message) { Log.Logger.Log(chatmode); if (!this.textBox.Enabled) { chatBackground.Show(); StartInactivityTimer(); } // resort chat rows if necessary int maxScreenSize = chatWidth - 30; if (chatBackground.Texts[chatBackground.Texts.Count - 1].Text.Length > 0) { for (int i = 0; i < chatBackground.Texts.Count - 1; i++) { chatBackground.Texts[i].Text = chatBackground.Texts[i + 1].Text; chatBackground.Texts[i].SetColor(chatBackground.Texts[i + 1].GetColor()); } } // split messages to multiple rows if (GUCView.StringPixelWidth(message) > maxScreenSize) { int charCounter = 0; string newMessage = ""; foreach (char c in message) { newMessage += c; charCounter++; if (!(GUCView.StringPixelWidth(newMessage) < maxScreenSize)) { InsertMessage(openChatMode, newMessage); // remains of the message if (message.Length > charCounter) { AddMessage(chatmode, message.Substring(charCounter)); } return; } } } // set message in the correct place InsertMessage(chatmode, message); }
public override void SendChat(int from, ChatMode mode, int target, string message) { if (mode == ChatMode.None) { return; } var log = from < 0 ? $"*** {message}" : $"{@from}:{Server.ClientName(@from)}: {message}"; Console.Print(OutputLevel.AddInfo, mode.ToString(), log); var msg = new GameMsg_SvChat() { ChatMode = mode, ClientId = from, TargetId = -1, Message = message, }; if (mode == ChatMode.All) { Server.SendPackMsg(msg, MsgFlags.Vital, -1); } else if (mode == ChatMode.Team) { Server.SendPackMsg(msg, MsgFlags.Vital | MsgFlags.NoSend, -1); var team = Players[from].Team; for (var i = 0; i < Players.Length; i++) { if (Players[i] != null && Players[i].Team == team) { Server.SendPackMsg(msg, MsgFlags.Vital | MsgFlags.NoRecord, i); } } } else { msg.TargetId = target; Server.SendPackMsg(msg, MsgFlags.Vital, from); Server.SendPackMsg(msg, MsgFlags.Vital, target); } }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { _Mode = 0; ModeChanged = null; LastPM = null; if (TextBox != null) { if (!TextBox.IsDisposed) { TextBox.Dispose(); } TextBox = null; } if (OptionsButton != null) { if (!OptionsButton.IsDisposed) { OptionsButton.Dispose(); } OptionsButton = null; } if (ChatModeButton != null) { if (!ChatModeButton.IsDisposed) { ChatModeButton.Dispose(); } ChatModeButton = null; } } }
public void SendChatMessage(string msg, ChatMode mode = ChatMode.ALL) { //only send in online mode if (m_initialized) { msg = msg.Trim(); if (msg.Length > c_messageMaxLength) { msg.Remove(c_messageMaxLength); } if (m_sendReady) { NetworkClient client = NetManager.singleton.client; ChatMessage message = new ChatMessage(0, mode, msg); client.Send(ExtendedMsgType.Chat, message); StartCoroutine("SendLock"); } } }
public override int TryReadPacket(byte[] Buffer, int Length) { int offset = 1; byte viewDistance = 0, chatFlags = 0, difficulty = 0; if (!TryReadString(Buffer, ref offset, out this.Locale)) return -1; if (!TryReadByte(Buffer, ref offset, out viewDistance)) return -1; if (!TryReadByte(Buffer, ref offset, out chatFlags)) return -1; if (!TryReadByte(Buffer, ref offset, out difficulty)) return -1; // Adds an extra 2 chunk buffer to make loading look nice this.ViewDistance = (8 << viewDistance) + 2; this.ChatMode = (ChatMode)(chatFlags & 0x3); this.ColorsEnabled = (chatFlags & 0x8) == 0x8; this.Difficulty = (Difficulty)difficulty; return offset; }
public void SetMode(ChatMode _mode) { mode = _mode; switch (_mode) { case ChatMode.mute: if (bIsShown) { TriggerUnscale(); } break; case ChatMode.awaiting: break; case ChatMode.picked: break; default: break; } }
public void OnModeChanged(ChatMode oValue, ChatMode nValue) { ModeChanged?.Invoke(this, EventArgs.Empty); if (ChatModeButton != null) { ChatModeButton.Label.Text = Mode.ToString(); } switch (Mode) { case ChatMode.Local: ChatModeButton.Label.Text = "本地"; break; case ChatMode.Shout: ChatModeButton.Label.Text = "喊话"; break; case ChatMode.Whisper: ChatModeButton.Label.Text = "私聊"; break; case ChatMode.Group: ChatModeButton.Label.Text = "组队"; break; case ChatMode.Guild: ChatModeButton.Label.Text = "行会"; break; case ChatMode.Global: ChatModeButton.Label.Text = "全服"; break; case ChatMode.Observer: ChatModeButton.Label.Text = "观察"; break; } }
public override int TryReadPacket(byte[] buffer, int length) { int offset = 1; byte viewDistance = 0, chatFlags = 0, difficulty = 0; if (!DataUtility.TryReadString(buffer, ref offset, out Locale)) return -1; if (!DataUtility.TryReadByte(buffer, ref offset, out viewDistance)) return -1; if (!DataUtility.TryReadByte(buffer, ref offset, out chatFlags)) return -1; if (!DataUtility.TryReadByte(buffer, ref offset, out difficulty)) return -1; if (!DataUtility.TryReadBoolean(buffer, ref offset, out ShowCape)) return -1; // Adds an extra 2 chunk buffer to make loading look nice ViewDistance = (8 << viewDistance) + 2; ChatMode = (ChatMode)(chatFlags & 0x3); ColorsEnabled = (chatFlags & 0x8) == 0x8; Difficulty = (Difficulty)difficulty; return offset; }
void Update() { if (!m_initialized) { return; } //TODO: migrate to PlayerInput? // if (!m_inputActive && Input.GetButtonUp("Chat")) if (!m_inputActive && Input.GetButtonDown("Submit")) { m_messageMode = ChatMode.ALL; PrepareInput(); } else if (!m_inputActive && Input.GetButtonDown("Team Chat")) { m_messageMode = ChatMode.TEAM; PrepareInput(); } else if (m_inputActive && Input.GetButtonUp("Cancel")) { TriggerInputEnd(); m_inputActive = false; } else if (m_inputActive) { m_inputActive = InputChatMessage(Input.inputString); } else { //no action } //update message log ProcessMessageBuffer(); }
public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction) { Locale = stream.ReadString(); ViewDistance = stream.ReadUInt8(); var flags = stream.ReadUInt8(); ChatFlags = (ChatMode)(flags & 0x3); ColorEnabled = stream.ReadBoolean(); Difficulty = (Difficulty)stream.ReadUInt8(); ShowCape = stream.ReadBoolean(); return mode; }
public void SetMuted() { currentChatMode = ChatMode.Muted; chatTextBox.ToggleTextInputIgnore(); m_muteTimer.Change(Constants.MuteDefaultTimeMinutes*60000, 0); }
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 ChatAlert(Regex condition, ChatMode mode) { Condition = condition; Completed = false; }
public void SetMuted() { currentChatMode = ChatMode.Muted; chatTextBox.IgnoreAllInput = true; m_muteTimer.Change(Constants.MuteDefaultTimeMinutes*60000, 0); }
public ClientSettingsPacket(string locale, byte viewDistance, ChatMode chatFlags, Difficulty difficulty, bool showCape) { Locale = locale; ViewDistance = viewDistance; ChatFlags = chatFlags; Difficulty = difficulty; ShowCape = showCape; }
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 override void OnKeyboardReturn(int textID, string text) { m_TextEntry.Text = string.Empty; m_MessageHistory.Add(new Tuple<ChatMode, string>(Mode, text)); m_MessageHistoryIndex = m_MessageHistory.Count; m_World.Interaction.SendSpeech(text, Mode); Mode = ChatMode.Default; }
private static extern void GetChatLineEx(int instanceID, short index, byte[] buffer, ref int size, ref ChatMode extra);
private ChatLogEntry GetLineExtra(short index) { // 210 to make sure it reads to end of string // for some reason 200 isn't big enough and it will strip some of the line off if it's long int size = 1024; byte[] buffer = new byte[size]; ChatMode mode = new ChatMode(); GetChatLineEx(_InstanceID, index, buffer, ref size, ref mode); if (size <= 0) return new ChatLogEntry() { LineText = String.Empty, LineType = ChatMode.Error, Index = 0 }; string tempLine = System.Text.Encoding.GetEncoding(1252).GetString(buffer, 0, size - 1); return new ChatLogEntry() { LineText = tempLine, LineType = mode, Index = index }; }
public override void Update(double totalMS, double frameMS) { if (m_TextEntry == null) { IResourceProvider provider = ServiceRegistry.GetService<IResourceProvider>(); IFont font = provider.GetUnicodeFont(0); m_TextEntry = new TextEntry(this, 1, Height - font.Height, Width, font.Height, 0, 0, MaxChatMessageLength, string.Empty); m_TextEntry.LegacyCarat = true; Mode = ChatMode.Default; AddControl(new CheckerTrans(this, 0, Height - 20, Width, 20)); AddControl(m_TextEntry); } for (int i = 0; i < m_TextEntries.Count; i++) { m_TextEntries[i].Update(totalMS, frameMS); if (m_TextEntries[i].IsExpired) { m_TextEntries[i].Dispose(); m_TextEntries.RemoveAt(i); i--; } } // Ctrl-Q = Cycle backwards through the things you have said today // Ctrl-W = Cycle forwards through the things you have said today if (m_Input.HandleKeyboardEvent(KeyboardEvent.Down, WinKeys.Q, false, false, true) && m_MessageHistoryIndex > -1) { if (m_MessageHistoryIndex > 0) m_MessageHistoryIndex -= 1; { Mode = m_MessageHistory[m_MessageHistoryIndex].Item1; m_TextEntry.Text = m_MessageHistory[m_MessageHistoryIndex].Item2; } } else if (m_Input.HandleKeyboardEvent(KeyboardEvent.Down, WinKeys.W, false, false, true)) { if (m_MessageHistoryIndex < m_MessageHistory.Count - 1) { m_MessageHistoryIndex += 1; Mode = m_MessageHistory[m_MessageHistoryIndex].Item1; m_TextEntry.Text = m_MessageHistory[m_MessageHistoryIndex].Item2; } else m_TextEntry.Text = string.Empty; } // backspace when mode is not default and Text is empty = clear mode. else if (m_Input.HandleKeyboardEvent(KeyboardEvent.Down, WinKeys.Back, false, false, false) && m_TextEntry.Text == string.Empty) { Mode = ChatMode.Default; } // if in default, only switch mode if there is a single command char (;, :, etc) followed by any other char. // in not in default, only switch mode if the single command char is the only char entered. if ((Mode == ChatMode.Default && m_TextEntry.Text.Length == 2) || (Mode != ChatMode.Default && m_TextEntry.Text.Length == 1)) { switch (m_TextEntry.Text[0]) { case ':': // emote Mode = ChatMode.Emote; break; case ';': // whisper Mode = ChatMode.Whisper; break; case '/': // party Mode = ChatMode.Party; break; case '\\': // guild Mode = ChatMode.Guild; break; case '|': // alliance Mode = ChatMode.Alliance; break; } } base.Update(totalMS, frameMS); }
public void SetMuted() { currentChatMode = ChatMode.Muted; chatTextBox.IgnoreAllInput = true; m_muteTimer.Change(Constants.MuteDefaultTimeMinutes * 60000, 0); }
public ChatMessageEventArgs(Client.Client client, string message, ChatMode mode) { Client = client ?? throw new ArgumentNullException(nameof(client)); Message = message ?? throw new ArgumentNullException(nameof(message)); Mode = mode; }
public void ReadPacket(MinecraftStream stream) { Locale = stream.ReadString(); ViewDistance = stream.ReadUInt8(); ChatFlags = (ChatMode)(stream.ReadUInt8() & 0x3); Difficulty = (Difficulty)stream.ReadUInt8(); ShowCape = stream.ReadBoolean(); }
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 = 100; mainFrame = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 1, true); topLeft = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 21, true); sidebar = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 22, true); topBar = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 23, true); filler = new Texture2D(g.GraphicsDevice, 1, 1); filler.SetData(new[] {Color.FromNonPremultiplied(8, 8, 8, 255)}); Texture2D mainButtonTexture = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 25); mainBtn = new XNAButton[NUM_BTN]; CreatePanels(); CreateMainButtons(g, mainButtonTexture); 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); CreateChatTextbox(); m_muteTimer = new Timer(s => { chatTextBox.ToggleTextInputIgnore(); currentChatMode = ChatMode.NoText; m_muteTimer.Change(Timeout.Infinite, Timeout.Infinite); }, null, Timeout.Infinite, Timeout.Infinite); statusLabel = new XNALabel(new Rectangle(97, 455, 1, 1), Constants.FontSize07) { DrawOrder = HUD_CONTROL_DRAW_ORDER }; clockLabel = new XNALabel(new Rectangle(558, 455, 1, 1), Constants.FontSize07) { DrawOrder = HUD_CONTROL_DRAW_ORDER }; m_whoIsOnline = new EOOnlineList(pnlOnline); m_party = new EOPartyPanel(pnlParty); m_friendList = new XNAButton(((EOGame)Game).GFXManager.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, DrawOrder = HUD_CONTROL_DRAW_ORDER }; m_friendList.OnClick += (o, e) => FriendIgnoreListDialog.Show(isIgnoreList: false, apiHandle: m_packetAPI); m_friendList.OnMouseOver += (o, e) => SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_BUTTON, DATCONST2.STATUS_LABEL_FRIEND_LIST); m_ignoreList = new XNAButton(((EOGame)Game).GFXManager.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, DrawOrder = HUD_CONTROL_DRAW_ORDER }; m_ignoreList.OnClick += (o, e) => FriendIgnoreListDialog.Show(isIgnoreList: true, apiHandle: m_packetAPI); m_ignoreList.OnMouseOver += (o, e) => SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_BUTTON, DATCONST2.STATUS_LABEL_IGNORE_LIST); m_expInfo = new XNAButton(((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 58), new Vector2(55, 0), new Rectangle(331, 30, 22, 14), new Rectangle(331, 30, 22, 14)) {DrawOrder = HUD_CONTROL_DRAW_ORDER}; m_expInfo.OnClick += (o, e) => SessionExpDialog.Show(); m_questInfo = new XNAButton(((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 58), new Vector2(77, 0), new Rectangle(353, 30, 22, 14), new Rectangle(353, 30, 22, 14)) {DrawOrder = HUD_CONTROL_DRAW_ORDER}; m_questInfo.OnClick += (o, e) => QuestProgressDialog.Show(m_packetAPI); //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 ChatModeChangeMessage(string channel, string messageId, PublicUserData user, RoomRole roomRole, bool subscribing, ChatMode mode) : base(ChatEventType.CHAT_MODE, channel, messageId, user, roomRole, subscribing) { NewMode = mode; }
private void CreateChatTextbox() { chatTextBox = new ChatTextBox(new Rectangle(124, 308, 440, 19), Game.Content.Load<Texture2D>("cursor"), Constants.FontSize08) { Selected = true, Visible = true, MaxChars = 140, DrawOrder = HUD_CONTROL_DRAW_ORDER }; 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) Game).Dispatcher.Subscriber != null) ((XNATextBox) ((EOGame) Game).Dispatcher.Subscriber).Selected = false; ((EOGame) Game).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) Game).Dispatcher.Subscriber = chatTextBox; }