/** * Sends a chat message to a buddy when SEND button is pressed. */ public void OnSendMessageButtonClick(string buddyName) { // Get panel Transform panel = chatPanelsContainer.Find(buddyName); if (panel != null) { ChatPanel chatPanel = panel.GetComponent <ChatPanel>(); string message = chatPanel.messageInput.text; // Add a custom parameter containing the recipient name, // so that we are able to write messages in the proper chat tab ISFSObject _params = new SFSObject(); _params.PutUtfString("recipient", buddyName); Buddy buddy = sfs.BuddyManager.GetBuddyByName(buddyName); sfs.Send(new Sfs2X.Requests.Buddylist.BuddyMessageRequest(message, buddy, _params)); chatPanel.messageInput.text = ""; chatPanel.messageInput.ActivateInputField(); chatPanel.messageInput.Select(); } }
private void CreateChatPanel() { _chatPanel = Instantiate(chatPrefab, canvasParent).GetComponent <ChatPanel>(); _chatPanel.chatLogText.text = ""; _chatPanel.inputField.onEndEdit.AddListener(OnChatInput); _chatPanel.inputField.ActivateInputField(); }
void ToChatPanel(PersonalInfo friend) { GameAudio.instance.PlayAudioSourceUI("click_btn"); ChatPanel.Open(); if (ChatPanel.myicon == null) { ChatPanel.myicon = myicon; } if (friend != null)//玩家消息按钮 { if (!NetStart.chatmanlist.Contains(friend.id)) { NetStart.chatmanlist.Add(friend.id); } ChatPanel.selectedID = friend.id; } else//消息条数按钮 { //有未读的取第一条为默认,否则仍然是之前 if (MessageInfo.unReadMsg.Count > 0) { foreach (var item in MessageInfo.unReadMsg) { ChatPanel.selectedID = item.Key; break; } } } }
/** * Handles messages receive from buddies. */ private void OnBuddyMessage(BaseEvent evt) { bool isItMe = (bool)evt.Params["isItMe"]; Buddy sender = (Buddy)evt.Params["buddy"]; string message = (string)evt.Params["message"]; Buddy buddy; if (isItMe) { string buddyName = (evt.Params["data"] as ISFSObject).GetUtfString("recipient"); buddy = sfs.BuddyManager.GetBuddyByName(buddyName); } else { buddy = sender; } if (buddy != null) { // Open panel if needed OnChatBuddyButtonClick(buddy.Name); // Print message Transform panel = chatPanelsContainer.Find(buddy.Name); ChatPanel chatPanel = panel.GetComponent <ChatPanel>(); chatPanel.addMessage("<b>" + (isItMe ? "You" : buddy.Name) + ":</b> " + message); } }
public string GetTargetCharacter(string localTypedText) { //todo: error status bar message if there is no text following a character name if (_chatTypeCalculator.CalculateChatType(localTypedText) != ChatType.PM) { return(""); } if (CurrentTab == ChatTab.Private1) { return(_chatProvider.PMTarget1); } if (CurrentTab == ChatTab.Private2) { return(_chatProvider.PMTarget2); } var characterArray = localTypedText.Skip(1) .TakeWhile(x => x != ' ') .ToArray(); var characterName = new string(characterArray); ChatPanel.TryStartNewPrivateChat(characterName); return(characterName); }
public override void Awake() { request = RequestCode.Chat; actionCode = ActionCode.ChatPublic; chatPanel = GetComponent <ChatPanel>(); base.Awake(); }
public static void Process(string text) { text = text.Substring(1); string[] gm_params = text.Split(); switch (gm_params[0]) { case "time": Time(gm_params); break; case "kill": Kill(); break; case "zombie": Zombie(); break; case "gamemode": GameMode(gm_params); break; case "ao": AO(gm_params); break; default: ChatPanel.AddLine(ChatPanel.ErrorCode + "Unknown command."); break; } }
/////////////////////////////UDP sort private void UDPListen() { int LisPort = int.Parse(Info.UserName.Substring(6)) + 10000;//为每个用户使用单独侦听端口学号后4位加上10000 IPEndPoint remoteIpep = new IPEndPoint(IPAddress.Any, 0); UdpClient udpcRecv = new UdpClient(LisPort); while (true) { byte[] bytRecv = udpcRecv.Receive(ref remoteIpep); string fname = Encoding.Unicode.GetString(bytRecv, 0, bytRecv.Length); int start = Environment.TickCount; while (Math.Abs(Environment.TickCount - start) < 10)//毫秒 { } bytRecv = udpcRecv.Receive(ref remoteIpep); string recvmess = Encoding.Unicode.GetString(bytRecv, 0, bytRecv.Length); this.Invoke(new EventHandler(delegate { int index = -1; for (int i = 0; i < ChatList.Friends.Count; i++) { if (ChatList.Friends[i].Name == fname) { index = i; } } if (index == -1) { Friend f = new Friend(fname); string address = remoteIpep.Address.ToString(); string[] split = address.Split(new char[] { ':' }, 2); f.IP = split[0]; f.Online = true; f.newmess = true; f.tag.setstatus("[您有新的未读消息]"); f.dias.Add(recvmess); f.setabove += new SetAbove(MC.Chatlist_close); f.setabove5 += new SetAbove5(MC.addmember); ChatList.Friends.Add(f); } else { if (index == _index && Isgroup == false) { ChatList.Friends[index].dias.Add(recvmess); ChatList.Friends[index].tag.setstatus(""); Message NewSend = new Message(recvmess, 0, ChatList.Friends[index].headP, fname); ChatPanel.Controls.Add(NewSend); ChatPanel.ScrollControlIntoView(NewSend); } else { ChatList.Friends[index].dias.Add(recvmess); ChatList.Friends[index].newmess = true; ChatList.Friends[index].tag.setstatus("[您有新的未读消息]"); } } })); } }
public MainForm() { InitializeComponent(); this.listPathFiles = new List <string>(); this.loadMessageReived = new HandlerReceivedMessage(loadMessage); this.txtPortName.SelectedIndex = 0; this.txtRatioBaudios.SelectedIndex = 6; this.myChatPanel = new ChatPanel(this.contentChatPanelMain.Width, this.contentChatPanelMain.Height, 0, 0); this.contentChatPanelMain.Controls.Clear(); this.contentChatPanelMain.Controls.Add(this.myChatPanel); this.myChatPanel.changeheightPanel += new ChatPanel.ChangeheightPanel(updateScroll); this.myInputBox = new InputBox(); this.myInputBox.Location = new Point(35, 320); this.myInputBox.onFilesSend += new InputBox.HandlerSentFileClick(this.onSentFiles); this.myInputBox.onMessageSend += new InputBox.HandlerSentMessageClick(this.onSentMessage); this.Controls.Add(this.myInputBox); this.onUpdateScorll += new HandelerUpdateScroll(this.OnUpdateSrollAction); this.MaximizeBox = false; this.MaximumSize = this.Size; this.MinimumSize = this.Size; this.optionsForm = new Options(); this.optionsForm.handlerTxtPath += new Options.HandelrtextBoxPath(this.updateFolderPath); this.receivePath = this.optionsForm.getFolderPath(); }
public static void WinExperience(WinExperience P) { ChatPanel.RecieveChat(new ChatInfo { Message = string.Format("Experience Gained {0}.", P.Amount), Type = MirChatType.Experience }); MapObject.User.CurrentExperience += P.Amount; }
/** * Start a chat with a buddy. */ public void OnChatBuddyButtonClick(string buddyName) { // Check if panel is already open; if yes bring it to front Transform panel = chatPanelsContainer.Find(buddyName); if (panel == null) { GameObject newChatPanel = Instantiate(chatPanelPrefab) as GameObject; ChatPanel chatPanel = newChatPanel.GetComponent <ChatPanel>(); chatPanel.buddy = sfs.BuddyManager.GetBuddyByName(buddyName); chatPanel.closeButton.onClick.AddListener(() => OnChatCloseButtonClick(buddyName)); chatPanel.sendButton.onClick.AddListener(() => OnSendMessageButtonClick(buddyName)); chatPanel.messageInput.onEndEdit.AddListener(val => OnSendMessageKeyPress(buddyName)); /* * chatPanel.messageInput.onEndEdit.AddListener(val => * { * if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) * Debug.Log("End edit on enter"); * }); */ newChatPanel.transform.SetParent(chatPanelsContainer, false); } else { panel.SetAsLastSibling(); } }
public void ActivateTab(TextPanelTab tab) { switch (tab) { case TextPanelTab.Chat: ChatPanel.ScrollToEnd(); break; case TextPanelTab.Room: case TextPanelTab.RoomDescription: break; case TextPanelTab.Actions: case TextPanelTab.General: GeneralPanel.ScrollToEnd(); break; case TextPanelTab.Tells: TellsPanel.ScrollToEnd(); break; default: break; } }
void Update() { ConnectPanel.SetActive(!isConnect); LobbyPanel.SetActive(inLobby); CreateRoomPanel.SetActive(inCreateRoom); JoinRoomPanel.SetActive(inJoinRoom); ChatPanel.SetActive(inChatRoom); if (inChatRoom == true) { if (Input.GetKeyDown(KeyCode.Return)) { SentBotton(); } if (Input.GetKeyDown(KeyCode.KeypadEnter)) { SentBotton(); } } LobbyUserName.text = "Hi ! \n{ " + myName + " }"; CreateRoomUserName.text = myName; JoinRoomUserName.text = myName; HereIs.text = "Here is... " + roomName + " !!!"; LoginPanel.SetActive(inLogin); RegisterPanel.SetActive(inRegister); RePasswordPanel.SetActive(inRePassword); }
public static void ShowChatPanel() { if (instance == null) { instance = UISystem.InstantiateUI("ChatPanel").GetComponent <ChatPanel>(); } }
static void OnLoginRes(object data) { CSLoginRes rsp = NetworkManager.Deserialize <CSLoginRes>(data); Debug.Log("OnLoginRes,retcode=" + rsp.RetCode); if (rsp.RetCode == 0) { DataCenter.playerID = rsp.PlayerData.PlayerID; DataCenter.name = rsp.PlayerData.Name; DataCenter.spawnPosition = rsp.PlayerData.Position.ToVector3(); DataCenter.spawnRotation = rsp.PlayerData.Rotation.ToVector3(); ItemSelectPanel.Init(rsp.PlayerData.SelectIndex, rsp.PlayerData.SelectItems); DataCenter.state = ClientState.InRoom; ChunkManager.blockAttrs = rsp.BlockAttrs; LoginPanel.Close(); MainMenu.Close(); LoadingUI.Show(); SceneManager.LoadScene("GameScene"); ChatPanel.AddLine(DataCenter.name + ", welcome!"); } else { FastTips.Show(rsp.RetCode); } }
/// Called when the player actually spawns in as a new hero public void SetupHero() { if (WishHeroId == HeroId) { return; } // This shouldn't happen, but if we receive a bad hero ID, then revert it to default if (!HeroCollection.HeroDatas.ContainsKey(WishHeroId)) { WishHeroId = ExtractionConfig.DefaultHero; } // Don't print the message if we've just spawned in (which is the only case where HeroId should be empty) if (!string.IsNullOrEmpty(HeroId)) { string heroName = HeroCollection.HeroDatas[WishHeroId].Name; string oldHeroName = HeroCollection.HeroDatas[HeroId].Name; ChatPanel.AddInformation(To.Everyone, $"{Local.DisplayName} respawned as {heroName} (was {oldHeroName})"); } HeroId = WishHeroId; SetHeroControllerProperties(); Dress(); }
static void Time(string[] gm_params) { if (gm_params.Length == 3) { if (gm_params[1] == "set" || gm_params[1] == "add") { bool success = int.TryParse(gm_params[2], out int result); if (success) { if (result >= 0) { TimeOfDay.instance.tick = result; ChatPanel.AddLine("Set the time to " + result); } else { ChatPanel.AddLine(ChatPanel.ErrorCode + "The number you have entered (" + result + ") is too small, it must be at least 0"); } } else { ChatPanel.AddLine(ChatPanel.ErrorCode + '\'' + gm_params[2] + "\' is not a valid number"); } } else { ChatPanel.AddLine(ChatPanel.ErrorCode + "Usage: /time <set|add> <value>"); } } else { ChatPanel.AddLine(ChatPanel.ErrorCode + "Usage: /time <set|add> <value>"); } }
bool isMenu = true; //是否处于菜单场景 void Awake() { if (_instance == null) { _instance = this; } textChat.text = ""; iFMessage.text = ""; }
public void RefreshAllchatshow() { clearChatPanel(); if (Isgroup == false) { for (int i = 0; i < ChatList.Friends[_index].dias.Count; i++) { Message NewSend; if (ChatList.Friends[_index].dias[i][0] == 0) { NewSend = new Message(ChatList.Friends[_index].dias[i].Substring(1), 1, ChatList.Friends[_index].headP, Name); } else { NewSend = new Message(ChatList.Friends[_index].dias[i], 0, ChatList.Friends[_index].headP, Name); } ChatPanel.Controls.Add(NewSend); ChatPanel.ScrollControlIntoView(NewSend); } } else { for (int i = 0; i < ChatList.Chats[_gindex].dias.Count; i++) { Message NewSend; //string fname = ChatList.Chats[_gindex].dias[i].Substring(0, 10); string[] infoall = ChatList.Chats[_gindex].dias[i].Split((char)1); string fname = infoall[1];//发送方名字 string itemt = infoall[infoall.Length - 1]; if (fname == Info.UserName) { NewSend = new Message(itemt, 1, Info.headP, fname); } else { int tempi = -1; for (int j = 0; j < ChatList.Friends.Count; j++) { if (ChatList.Friends[j].Name == fname) { tempi = j; break; } } if (tempi == -1) { MessageBox.Show("出现连接异常", "建群提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); return; } NewSend = new Message(itemt, 0, ChatList.Friends[tempi].headP, fname); } ChatPanel.Controls.Add(NewSend); ChatPanel.ScrollControlIntoView(NewSend); } } }
// Method: StartServer_Click() // Description: This method takes the port from the interface, validates it // and once validated, it fire ups the server and send user to // chat screen. private void StartServer_Click(object sender, EventArgs e) { // application is running server, update the variable to let other methods know ServerItIs = true; // get port from interface and clear the textbox string portString = ServerPort.Text; ServerPort.Clear(); bool valid = false; // validate port int temp = 0; int.TryParse(portString, out temp); if (temp > 0) { valid = true; } // start server if port is valid if (valid) { Int32 port = Int32.Parse(portString); IPAddress ip = IPAddress.Parse("127.0.0.1"); try { server = new TcpListener(ip, port); // start server server.Start(); // bring chat panel to front ChatPanel.BringToFront(); TypeBox.Focus(); // update textbox at the top with IP address and port ConnectionInfo.Text = "IP: " + GetLocalIPAddress() + " Port: " + port; // start thread to handle the client ThreadPool.QueueUserWorkItem(HandleClient); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } else { MessageBox.Show("Port cannot be alphabet, special character or negative number." + "Please try again"); } }
/// Called when the player decides they want to switch to a different hero public void ChangeHero(string newHeroId) { if (!HeroCollection.HeroDatas.ContainsKey(newHeroId)) { return; } // We want to change hero; access Hero directly, change the ID there ChatPanel.AddInformation(To.Single(Local.Pawn), $"Hero {newHeroId} selected; this will change when you respawn"); WishHeroId = newHeroId; }
private void ProfessorExamView_Load(object sender, EventArgs e) { // 폰트 customFonts = new CustomFonts(); studentScreenList = new List <StudentWebRTCPanel>(); this.examTimeLabel.Font = customFonts.TimeLabelFont(); this.examLectureLabel.Font = customFonts.LabelFont(); this.examNameLabel.Font = customFonts.LabelFont(); this.examPercentLabel.Font = customFonts.LabelFont(); loadExam(); timer = new System.Windows.Forms.Timer(); timer.Interval = 1000; timer.Tick += timer_Tick_1; timer.Start(); this.noticePanel = new ChatPanel(customFonts, "공지사항 전송", ""); this.noticePanel.Location = new Point(18, 242); this.noticePanel.BringToFront(); this.noticePanel.SendButton.Click += noticeSendButton_Click_1; this.studentListPanel.Controls.Add(this.noticePanel); this.chatPanelList = new List <ChatPanel>(); this.nowChatPanel = noticePanel; //상단바 this.topBarPanel = new TopBarPanel(customFonts); this.topBarPanel.Location = new Point(0, 0); this.Controls.Add(topBarPanel); this.examPageNavigationPanel = new ExamPageNavigationPanel(customFonts); this.examPageNavigationPanel.Location = new System.Drawing.Point(8, 488); this.Controls.Add(this.examPageNavigationPanel); this.examPageNavigationPanel.AddPageButton.Visible = false; this.examPageNavigationPanel.RemovePageButton.Visible = false; setCheatTypePanels(); chatQueue = new Queue <Chat>(); studentList = new List <Student>(); enterQueue = new Queue <Student>(); exitQueue = new Queue <Student>(); doubtQueue = new Queue <Doubt>(); connectWebsocket(); exitBtn.Click += exitBtn_Click_1; sendNoticeBtn.Click += sendNoticeBtn_Click_1; }
private void sendNoticeBtn_Click_1(object sender, EventArgs e) { try { nowChatPanel.Visible = false; noticePanel.Visible = true; nowChatPanel = noticePanel; } catch (Exception error) { Console.WriteLine(error); } }
public ChatChannel(int channelId, string name, int width, int height, Texture2D backgroundSprite, ChatPanel parentPanel, bool canClose, SpriteFont font) { Font = font; ChannelId = channelId; ChatTab = new Tab(name, width, height, this, backgroundSprite); ParentChatPanel = parentPanel; CanClose = canClose; ParentViewport = ParentChatPanel.ParentViewport; int offsetY = ChatTab.Height + Tab.Stroke + 1; Height = ParentChatPanel.Height - offsetY; OffsetPosition = new Vector2(ParentChatPanel.ParentViewport.Viewport.X + ParentChatPanel.Stroke + 1, ParentChatPanel.ParentViewport.Viewport.Y + offsetY); //ChatScrollbar = new Scrollbar(1, "ChatScrollbar", ParentChatPanel.Height - ParentChatPanel.Stroke, ParentChatPanel.Height - ParentChatPanel.Stroke, new Vector2(ParentChatPanel.Position.X + ParentChatPanel.Width - 10 - ParentChatPanel.Stroke, ParentChatPanel.Position.Y + ParentChatPanel.Stroke + _Height + Tab.Stroke + 1), this, ParentChatPanel.ParentViewport, Storage.Instance.GetSpriteByName("UI_Scrollbar"), Storage.Instance.GetSpriteByName("UI_Arrow_Up"), Storage.Instance.GetSpriteByName("UI_Arrow_Down")); }
void Start() { ChunkChecker.Init(); ChunkRefresher.Init(); ChunkManager.Init(); ChunkPool.Init(); OtherPlayerManager.Init(); ItemSelectPanel.Show(); ChatPanel.ShowChatPanel(); List <Vector2Int> preloadChunks = Utilities.GetSurroudingChunks(PlayerController.GetCurrentChunk()); ChunkManager.ChunksEnterLeaveViewReq(preloadChunks); }
public static void ObjectChat(ObjectChat P) { /*string ObjectName = null; * * for (int I = 0; I < MapLayer.ObjectList.Count; I++) * { * if (MapLayer.ObjectList[I] == null || MirMapControl.ObjectList[I].ObjectID != P.ObjectID) continue; * ObjectName = MapLayer.ObjectList[I].Name; * break; * }*/ //Add Speach Bubble ChatPanel.RecieveChat(new ChatInfo { User = P.Name, Message = P.Message, Type = P.Type }); }
private void Form1_Load(object sender, EventArgs e) { Encrypt("Welcome to the chat room.", EncryptKey); btnClose.FlatAppearance.BorderSize = 0; btnCode.FlatAppearance.BorderSize = 0; btnSend.FlatAppearance.BorderSize = 0; btnConnect.FlatAppearance.BorderSize = 0; ChatPanel.Hide(); this.Size = new Size(484, 87); btnConnect.Location = new Point(12, 36); // Add "Welcome to the chat room." encrypted by the key listBox1.Items.Add(Encrypt("Welcome to the chat room.", EncryptKey)); listBox1.SelectedIndex = 0; Sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Sock.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); }
// Method: StartClient_Click() // Description: This method takes the IP and port from the interface, validates it // and once validated, it tries to connect to server, once connected, // send user to chat screen. private void StartClient_Click(object sender, EventArgs e) { bool valid = false; IPAddress ip; int port = 0; // validate ip and port if (IPAddress.TryParse(ipbox.Text, out ip) && int.TryParse(clientport.Text, out port)) { if (port > 0) { valid = true; } } // initialise client and connect to server if valid if (valid) { RunTheClient = new TcpClient(); try { // connect to server RunTheClient.Connect(ip, port); if (RunTheClient.Connected) { ChatPanel.BringToFront(); ConnectionInfo.Text = "Connected to server " + ip.ToString() + " at port " + port; TypeBox.Focus(); // start thread to receive messages from server ThreadPool.QueueUserWorkItem(HandleServer); } } // connection refused catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } else { MessageBox.Show("Invalid entry. Please try again."); } }
void Start() { SettingsPanel.Init(); ChunkRefresher.Init(); ChunkPool.Init(); ItemSelectPanel.Show(); ChatPanel.ShowChatPanel(); InventorySystem.Init(); GameModeManager.Init(); // load chunk here ChunkChecker.Init(); PlayerController.Init(); LocalNavMeshBuilder.Init(); ChunkRefresher.ForceRefreshAll(); }
public static void Capture() { DateTime time = DateTime.Now; string file = string.Format("{0}-{1:00}-{2:00}_{3:00}.{4:00}.{5:00}.png", time.Year, time.Month, time.Day, time.Hour, time.Minute, time.Second); string path = screenshotDir + file; if (!System.IO.Directory.Exists(screenshotDir)) { System.IO.Directory.CreateDirectory(screenshotDir); } ScreenCapture.CaptureScreenshot(path); string log = "Saved screenshot as <u>" + file + "</u>"; ChatPanel.AddLine(log); }