Beispiel #1
0
        public ChatViewModel(int gamenum, KailleraWindowController mgr, Game game = null)
        {
            wind = new ChatWindow();
            gameNumber = gamenum;
            wind.Userup += UpdateUsers;
            updater += wind.WindowUpdate;            
            wind.listBox1.ItemsSource = DisplayUsers;
            wind.addBuddyList += addBuddy;

            wind.Logger = ChatLogger.getLog(game);

            //Set small line height to avoid large line breaks
            Paragraph p = wind.richTextBox1.Document.Blocks.FirstBlock as Paragraph;
            p.LineHeight = 1;
            wind.textBox1.KeyDown += Chat_sendMessageIfEnter;

            wind.Closed += (object sender, EventArgs e) => winClosed(sender, e);

            wind.gameNumber = gamenum;

            //If this is a game chat, we want to leave the game upon window close
            if (gamenum != 0)
            {
                wind.Closed += beginLeaveGame;
                wind.Title = game.name;
            }
            wind.Show();

            //Make this the active window in the tray manager
            KailleraTrayManager.Instance.addActiveWindow(wind);
        }
        private void OpenChatWindow(string userNameInput)
        {
            var userName = new User()
            {
                UserName = userNameInput
            };

            var chatWindow = new ChatWindow(userName);
            chatWindow.Show();
        }
        private void OnLoginButtonClick(object sender, RoutedEventArgs e)
        {
            var postData = "grant_type=password";
            postData += "&username="******"&password="******"http://localhost:28499/Token");
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = data.Length;
            using (var stream = request.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
            }

            var responseString = string.Empty;
            try
            {
                var response = (HttpWebResponse)request.GetResponse();
                responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            if (responseString != "")
            {
                var chatWindow = new ChatWindow(this.UserName.Text);
                chatWindow.Show();
                this.Close();
            }
            else
            {
                var messageBox = new CustomMessageBox("Invalid user name or password");
                messageBox.ShowDialog();
                this.UserName.Text = "";
                this.Password.Password = "";
            }
        }
Beispiel #4
0
 /// <summary>チャット枠を隠す</summary>
 public void HideChatWindow() => ChatWindow.Hide();
Beispiel #5
0
 private void Start()
 {
     chatWindow = FindObjectOfType <ChatWindow>();
 }
Beispiel #6
0
 public void Addline(ChatWindow cw, string sUser, string sMessage)
 {
     AddLineDelegate handler = new AddLineDelegate(AddLineHandler);
     Factory.MainForm.BeginInvoke(handler, new object[] {cw, sUser, sMessage});
 }
Beispiel #7
0
 public void ShowChatSync(string user)
 {
     foreach(ChatWindow c in Chats){
         if (c.User == user)
         {
             c.Show();
             c.Focus();
             return;
         }
     }
     ChatWindow temp = new ChatWindow(user);
     Chats.Add(temp);
     temp.Show();
 }
		//
		#region Settings Tab
		//

		//
		#region Settings > Chat Tab
		//
		private void SetTargetWindow(ChatWindow window, bool enabled)
		{
			try
			{
				Util.SetDefaultWindow(window, enabled);
				if (Util.DefaultWindow == ChatWindow.Default)
				{
					Util.SetDefaultWindow(ChatWindow.MainChat, true);
					chkOutputs[0].Checked = true;
					if (window != ChatWindow.MainChat)
					{
						Util.Warning(Util.PluginName + " messages will no longer be shown in this window", window);
						Util.HelpMessage(Util.PluginName + " messages will now be shown in this window");
					}
				}
				else
				{
					if (enabled)
					{
						Util.HelpMessage(Util.PluginName + " messages will now be shown in this window", window);
					}
					else
					{
						Util.Warning(Util.PluginName + " messages will no longer be shown in this window", window);
					}
				}
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
Beispiel #9
0
        /// <summary>
        /// OnNewIncomingConversation
        /// Handles new conversations initiated by a peer
        /// </summary>			
        internal static void HandleAcceptedConversation(Conversation conversation, ChatType chatType)
        {
            Logger.Debug("ChatWindowManager.NewAcceptedConversation was called");

            if(conversation.PeerUser == null) {
                Logger.Error("NewIncomingConversation event had a conversation with null PeerUser");
                return;
            }

            // If we have a ChatWindow for this conversation, don't do anything... the ChatWindow
            // will handle the change
            if(ChatWindowManager.ChatWindowExists(conversation.PeerUser.ID))
                return;

            ChatWindowManager cwm = ChatWindowManager.Instance;

            Logger.Debug("**************Creating chat window");
            ChatWindow cw = new ChatWindow(conversation, chatType);
            Logger.Debug("**************Creating chat window 2");
            cwm.chatWindows[conversation.PeerUser.ID] = cw;
            cw.DeleteEvent += cwm.OnChatWindowDeleted;
            cw.ShowAll();
        }
 private void OnListViewItemDoubleClick(object sender, MouseButtonEventArgs e)
 {
     try {
         var item = (ListViewItem)sender;
         if (item != null) {
             var chatUser = (ChatUser)item.Content;
             if (chatUser != null) {
                 if (_chatWindow == null) {
                     _chatWindow = ChatWindow.Instance;
                     _viewChatUsers = _chatWindow.ViewChatUsers;
                 }
                 var viewChatUser = GetViewChatUser(chatUser);
                 if (!(from t in _viewChatUsers select t.ChatUser).Contains<ChatUser>(chatUser)) {
                     _viewChatUsers.Insert(0, viewChatUser);
                 }
                 _chatWindow.SelectedViewChatUser = _viewChatUsers.First(t => t.ChatUser.Equals(chatUser));
                 _chatWindow.Show();
             }
         }
     }
     catch (Exception exception) {
         _log.Error(exception);
     }
 }
Beispiel #11
0
 void Awake()
 {
     _chatWindowPanle = this;
 }
Beispiel #12
0
 public void AddWindowToDictionary(ChatWindow window)
 {
     window.SetWindowId(_windows.Count.ToString());
     _windows[_windows.Count.ToString()] = window;
 }
Beispiel #13
0
        private void CommandCallback(string command, string[] args, ChatWindow chatWindow)
        {
            if (args.Length > 0)
            {
                switch (args[0].ToLower())
                {
                case "enable":
                case "start":
                case "on":
                    _enabled = true;
                    chatWindow.WriteLine("Bot enabled");
                    break;

                case "stop":
                case "off":
                case "disable":
                    _enabled = false;
                    MovementController.Instance.Halt();
                    chatWindow.WriteLine("Bot disabled");
                    break;

                case "setpos":
                    chatWindow.WriteLine(
                        $"Updating defense pos from {_posToDefend} to {DynelManager.LocalPlayer.Position}");
                    _posToDefend        = DynelManager.LocalPlayer.Position;
                    _returnToDefensePos = true;
                    break;

                case "nopos":
                    chatWindow.WriteLine(
                        $"Removing defense pos");
                    _returnToDefensePos = false;
                    break;

                case "ignore":
                    if (args.Length > 1)
                    {
                        string name = string.Join(" ", args.Skip(1));
                        _namesToIgnore.Add(name);
                        chatWindow.WriteLine($"Added \"{name}\" to ignored mob list");
                    }
                    else
                    {
                        chatWindow.WriteLine("Please specify a name");
                    }
                    break;

                case "unignore":
                    break;

                case "status":
                    break;

                case "radius":
                case "range":
                    if (args.Length > 1 && float.TryParse(args[1], out float newRange))
                    {
                        chatWindow.WriteLine(
                            $"Updating defense radius from {_defenseRadius} to {newRange}");
                        _defenseRadius = newRange;
                    }
                    break;

                case "pos":
                    break;
                }
            }
        }
 public void SetChatRoom(ChatWindow chat_room)
 {
     this.chat_room = chat_room;
 }
Beispiel #15
0
        //private ITextToPronounceConverter _textConverter;
        ///// <summary>音声合成の前処理器。実行中に変更してもOKなタイプ</summary>
        //public ITextToPronounceConverter TextConverter
        //{
        //    get
        //    {
        //        return _textConverter ?? (_textConverter = new ImeTextConverter());
        //    }
        //    set
        //    {
        //        if (value != null)
        //        {
        //            _textConverter = value;
        //        }
        //    }
        //}

        /// <summary>リソースを解放します。</summary>
        public void Dispose()
        {
            ChatWindow.Dispose();
            _voiceOperater.Dispose();
            _keyboardHook.Dispose();
        }
Beispiel #16
0
 public static void HelpMessage(string msg, ChatWindow targetWindows)
 {
     AddChatText("<{ " + PluginName + " }> " + msg, HelpColor, targetWindows);
 }
Beispiel #17
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            ScreenService.Instance.GraphicsDevice.Viewport = ScreenService.Instance.DefaultScreenCamera.CurrentViewport;
            spriteBatch.Begin(
                SpriteSortMode.FrontToBack, // this is also the order for building the screen.
                null,
                SamplerState.PointClamp,
                null,
                null,
                null,
                ScreenService.Instance.DefaultScreenCamera.TransformMatrix);
            base.Draw(spriteBatch);

            if (!Images.Any())
            {
                Messages.Add("no image received from server");
            }
            foreach (var img in Images.ToList())
            {
                img.Draw(spriteBatch);
            }

            if (!InventoryImages.Any())
            {
                Messages.Add("no inventory image received from server");
            }
            foreach (var img in InventoryImages.ToList())
            {
                img.Draw(spriteBatch);
            }

            MultiplayerText.Draw(spriteBatch);
            HealthImage.Draw(spriteBatch);
            SpeedImage.Draw(spriteBatch);
            StrenghImage.Draw(spriteBatch);
            DialogImage.Draw(spriteBatch);
            CursorImage.Draw(spriteBatch);

            //LerpMouseImage.Draw(spriteBatch);

            if (InfoWindow?.IsVisible == true)
            {
                InfoWindow?.Draw(spriteBatch);
            }

            if (DialogWindow?.IsVisible == true)
            {
                DialogWindow?.Draw(spriteBatch);
            }

            if (InventoryWindow?.IsVisible == true)
            {
                InventoryWindow.Draw(spriteBatch);
            }

            if (CharacterWindow?.IsVisible == true)
            {
                MoneyCount.Draw(spriteBatch);
                CharacterWindow?.Draw(spriteBatch);
            }

            if (CharacterWindow?.IsVisible == true)
            {
                CharacterWindow?.Draw(spriteBatch);
            }

            if (ChatWindow?.IsVisible == true)
            {
                ChatWindow?.Draw(spriteBatch);
            }

            spriteBatch.End();
        }
Beispiel #18
0
        /// <summary>
        /// Creates a chat of type with person
        /// </summary>	
        public static void InitiateChat(Person person, ChatType type)
        {
            Logger.Debug ("ChatWindowManager.InitiateChat with {0}", person.DisplayName);

            if(person.ProviderUser == null) {
                throw new ApplicationException("Person contained a null ProviderUser");
            }

            if (ChatWindowManager.ChatWindowExists (person.ProviderUser.ID) == true) {
                ChatWindow cw = ChatWindowManager.Instance.chatWindows[person.ProviderUser.ID];
                cw.UpdateChatType(type);
                cw.Present();
            } else {
                // Create a new ChatWindow
                ChatWindow cw = new ChatWindow(person, person.ProviderUser, type);
                ChatWindowManager.Instance.chatWindows[person.ProviderUser.ID] = cw;
                cw.DeleteEvent += ChatWindowManager.Instance.OnChatWindowDeleted;
                Logger.Debug("About to present the window to chat with: {0}", person.DisplayName);
                cw.Present();
            }
        }
Beispiel #19
0
 public void Extract_Chat(object parameter)
 {
     ChatWindow _newChatWindow = new ChatWindow(this, _myChat);
 }
 public void AddWindowToDictionary(ChatWindow window)
 {
     window.SetWindowId(_windows.Count.ToString());
     _windows[_windows.Count.ToString()] = window;
 }
Beispiel #21
0
 public static void Warning(string msg, ChatWindow targetWindows)
 {
     //wtcw("«3»<{ «2»" + PluginName + "«3» }> «d»" + msg, 3, targetWindow);
     AddChatText("<{ " + PluginName + " }> " + msg, WarningColor, targetWindows);
 }
Beispiel #22
0
 public void ShowChatHandler(string user, string message)
 {
     ChatWindow temp = new ChatWindow(user, message);
     Chats.Add(temp);
     temp.Show();
     FlashWindow.Flash(temp);
 }
Beispiel #23
0
 public static void Debug(string msg, ChatWindow targetWindows)
 {
     AddChatText("<{ " + PluginName + " Debug }> " + msg, 12, targetWindows);
 }
Beispiel #24
0
 private void AddLineHandler(ChatWindow cw, string user, string message)
 {
     cw.AddLine(user, message);
     if (!cw.Focused) FlashWindow.Flash(cw);
 }
Beispiel #25
0
 public void wire(ChatWindow ch)
 {
     this.ch = ch;
 }
    void Awake()
    {
        Application.runInBackground = true;

        if ( SmartFoxConnection.IsInitialized ) {
            smartFox = SmartFoxConnection.Connection;
        } else {
            Application.LoadLevel("login");
            return;
        }

        // Register callbacks
        smartFox.AddEventListener(SFSEvent.LOGOUT, OnLogout);
        smartFox.AddEventListener(SFSEvent.CONNECTION_LOST, OnConnectionLost);
        smartFox.AddEventListener(SFSEvent.PUBLIC_MESSAGE, OnPublicMessage);
        smartFox.AddEventListener(SFSEvent.ROOM_JOIN, OnJoinRoom);
        smartFox.AddEventListener(SFSEvent.ROOM_CREATION_ERROR, OnCreateRoomError);
        smartFox.AddEventListener(SFSEvent.USER_ENTER_ROOM, OnUserEnterRoom);
        smartFox.AddEventListener(SFSEvent.USER_EXIT_ROOM, OnUserLeaveRoom);
        smartFox.AddEventListener(SFSEvent.ROOM_ADD, OnRoomAdded);
        smartFox.AddEventListener(SFSEvent.ROOM_REMOVE, OnRoomDeleted);

        chatWindow = new ChatWindow(20, 110, Screen.width-250, Screen.height-150);

        // Lets update internal API room list that might have changed while we played a game
        SetupRoomList();

        started = true;
    }
Beispiel #27
0
 /// <summary> 任意のコンテンツを表示させる </summary>
 /// <param name="content"> 表示するコンテンツ </param>
 public void ShowContent(object content) => ChatWindow.RenderContent(content);