/// <summary> /// Opens the lobby's chat dialog. /// </summary> private void OpenChatDialog() { WindowManager.Instance.OpenWindow("GameClient_ChatDialog", () => { chatDialog = GameObject.Find("ChatDialog").GetComponent <ChatDialog>(); var chatAddon = ClientAPI.GetMasterServerClientAddon <ChatClientAddon>(); chatDialog.onSendButtonPressed = text => { if (!string.IsNullOrEmpty(text)) { chatAddon.SendPublicChatMessage("Lobby", text); } }; chatAddon.onReceivedPublicChatText = (channel, sender, text) => { if (channel == "Lobby") { if (chatDialog != null) { chatDialog.WriteText(sender + ": " + text); } } }; }); }
private void OpenChatDialog(object sender, MouseButtonEventArgs e) { ContactListItem item = (sender as ListBox).SelectedItem as ContactListItem; item.RemoveTip(); var user = item.User; if (CurrentUser.DialogTable.ContainsKey(user.UserName)) { var dailog = CurrentUser.DialogTable[user.UserName]; dailog.Show(); dailog.Activate(); } else { ChatDialog dialog = null; if (user.UserName.StartsWith("@@") == true) { dialog = new GroupChatDialog(user); } else { dialog = new UserChatDialog(user); } CurrentUser.DialogTable.Add(user.UserName, dialog); dialog.Show(); } }
/// <summary> /// Attempts to start a chat dialog with the given <paramref name="npc"/>. /// </summary> /// <param name="npc">NPC to start the chat dialog with.</param> /// <returns>True if the dialog was started with the <paramref name="npc"/>; otherwise false.</returns> public bool StartChat(NPC npc) { // Check if the chat can be started if (!CanStartChat(npc)) { return(false); } _chattingWith = npc; // Tell the client to open the dialog using (var pw = ServerPacket.StartChatDialog(npc.MapEntityIndex, ChatDialog.ID)) { _user.Send(pw, ServerMessageType.GUI); } // Get the first page to use var initialPage = ChatDialog.GetInitialDialogItem(); Debug.Assert(initialPage != null); _dialogItem = GetNextDialogPage(initialPage); // Tell the user which page to use NotifyUserOfNewPage(); return(true); }
public async Task <ChatDialogDTO> CreateDialog(ChatDialogDTO dialog) { var participant1 = await _unitOfWork.AccountRepository.GetByIdAsync(dialog.ParticipantOneId); var participant2 = await _unitOfWork.AccountRepository.GetByIdAsync(dialog.ParticipantTwoId); var dl = new ChatDialog { Participant1 = participant1, Participant2 = participant2, Messages = new List <ChatMessage>() }; var createdDialog = _unitOfWork.ChatDialogRepository.Create(dl); await _unitOfWork.SaveAsync(); return(new ChatDialogDTO { Id = createdDialog.Id, ParticipantOneId = createdDialog.Participant1.Id, ParticipantTwoId = createdDialog.Participant2.Id, Participant1_Hided = dialog.Participant1_Hided, Participant2_Hided = dialog.Participant2_Hided, ParticipantAvatar = createdDialog.Participant2.CroppedAvatar ?? createdDialog.Participant2.Avatar, LastMessageTime = DateTimeOffset.Now }); }
private void ChangeAMode(S.ChangeAMode p) { AMode = p.Mode; switch (p.Mode) { case AttackMode.Peace: ChatDialog.ReceiveChat("[Attack Mode: Peaceful]", ChatType.Hint); break; case AttackMode.Group: ChatDialog.ReceiveChat("[Attack Mode: Group]", ChatType.Hint); break; case AttackMode.Guild: ChatDialog.ReceiveChat("[Attack Mode: Guild]", ChatType.Hint); break; case AttackMode.EnemyGuild: ChatDialog.ReceiveChat("[Attack Mode: Enemy Guild]", ChatType.Hint); break; case AttackMode.RedBrown: ChatDialog.ReceiveChat("[Attack Mode: Red+Brown]", ChatType.Hint); break; case AttackMode.All: ChatDialog.ReceiveChat("[Attack Mode: All]", ChatType.Hint); break; } }
private void PlayRandomDialog(ChatDialog[] dialogs) { lastDialogTime = Time.time; int choice = UnityEngine.Random.Range(0, dialogs.Length); ChatDialog dialogToShow = dialogs[choice]; SetNextDialog(dialogToShow); }
public void SetNextDialog(ChatDialog dialog) { nextDialog = dialog; if (waitForTrigger != null) { waitForTrigger.SetTrigger(); } }
private IEnumerator Show(ChatMission chatEvent) { this.chatMission = chatEvent; chatHeader.text = "Chat with " + chatEvent.PartnerName; currentDialog = chatEvent.startDialog; while (true) { for (int i = 0; i < currentDialog.DialogLines.Length; i++) { ChatEntry entry = currentDialog.DialogLines[i]; yield return(waitForTrigger = new ChatWaitForTimeOrTrigger(entry.Delay)); if (waitForTrigger.IsTriggered()) { break; } ChatEntryObject chatEntryObject = Instantiate(chatEntryPrefab, chatFieldRoot); if (entry.SenderType == ChatEntry.Sender.other) { chatEntryObject.FadeIn(entry.Message, true, chatEvent.PartnerFace); } else { chatEntryObject.FadeIn(entry.Message, false, chatEvent.MyFace); } } if (currentDialog == chatEvent.endDialog) { break; } if (nextDialog == null) { //Have to wait for next dialog currentDialog = null; yield return(waitForTrigger = new ChatWaitForTrigger()); } currentDialog = nextDialog; nextDialog = null; } yield return(new WaitForSeconds(chatEvent.TimeToShowUntilLastMessage)); canvasGroup.DOFade(0, fadeDuration); yield return(new WaitForSeconds(fadeDuration)); Destroy(gameObject); }
// Token: 0x06000A22 RID: 2594 RVA: 0x00040208 File Offset: 0x0003E408 public void CreatePrivateChat(int cmid) { ChatDialog chatDialog = null; ChatDialog chatDialog2; if (this._dialogsByCmid.TryGetValue(cmid, out chatDialog2) && chatDialog2 != null) { chatDialog = chatDialog2; } else { CommActorInfo commActorInfo = null; if (PlayerDataManager.IsFriend(cmid) || PlayerDataManager.IsFacebookFriend(cmid)) { CommUser commUser = this._friendUsers.Find((CommUser u) => u.Cmid == cmid); if (commUser != null) { chatDialog = new ChatDialog(commUser, UserGroups.Friend); } } else if (AutoMonoBehaviour <CommConnectionManager> .Instance.Client.Lobby.TryGetPlayer(cmid, out commActorInfo)) { CommUser commUser; ClanMemberView member; if (PlayerDataManager.TryGetClanMember(cmid, out member)) { commUser = new CommUser(member); commUser.SetActor(commActorInfo); } else { commUser = new CommUser(commActorInfo); } this._otherUsers.Add(commUser); chatDialog = new ChatDialog(commUser, UserGroups.Other); } if (chatDialog != null) { this._dialogsByCmid.Add(cmid, chatDialog); } } if (chatDialog != null) { ChatPageGUI.SelectedTab = TabArea.Private; this.SelectedDialog = chatDialog; this.SelectedCmid = cmid; } else { Debug.LogError(string.Format("Player with cmuneID {0} not found in communicator!", cmid)); } }
/// <summary> /// if the login packet was successfull, the server sends it back. so we need to open the chat ui. /// </summary> /// <param name="packet"></param> private void handleLogin(Packet packet) { ChatDialog form = new ChatDialog(packet.SenderNickname); myDialog.Invoke((MethodInvoker) delegate() { form.Show(); }); //set login dialog to unvisible if successfully logged in myDialog.Visible = false; myDialog = form; }
// Token: 0x06000AA3 RID: 2723 RVA: 0x0004429C File Offset: 0x0004249C private void DoDialogFooter(Rect rect, ChatGroupPanel pane, ChatDialog dialog) { GUI.BeginGroup(rect, BlueStonez.window_standard_grey38); bool enabled = GUI.enabled; GUI.enabled &= (!AutoMonoBehaviour <CommConnectionManager> .Instance.Client.Lobby.IsPlayerMuted && dialog != null); GUI.SetNextControlName("@CurrentChatMessage"); this._currentChatMessage = GUI.TextField(new Rect(6f, 6f, rect.width - 60f, rect.height - 12f), this._currentChatMessage, 140, BlueStonez.textField); this._currentChatMessage = this._currentChatMessage.Trim(new char[] { '\n' }); if (this._spammingNotificationTime > Time.time) { GUI.color = Color.red; GUI.Label(new Rect(15f, 6f, rect.width - 66f, rect.height - 12f), LocalizedStrings.DontSpamTheLobbyChat, BlueStonez.label_interparkmed_10pt_left); GUI.color = Color.white; } else { string text = string.Empty; if (dialog != null && dialog.UserCmid > 0) { if (dialog.CanChat) { text = LocalizedStrings.EnterAMessageHere; } else { text = dialog.UserName + LocalizedStrings.Offline; } } else { text = LocalizedStrings.EnterAMessageHere; } if (string.IsNullOrEmpty(this._currentChatMessage) && GUI.GetNameOfFocusedControl() != "@CurrentChatMessage") { GUI.color = new Color(1f, 1f, 1f, 0.3f); GUI.Label(new Rect(10f, 6f, rect.width - 66f, rect.height - 12f), text, BlueStonez.label_interparkmed_10pt_left); GUI.color = Color.white; } } if ((GUITools.Button(new Rect(rect.width - 51f, 6f, 45f, rect.height - 12f), new GUIContent(LocalizedStrings.Send), BlueStonez.buttondark_small) || Event.current.keyCode == KeyCode.Return) && !AutoMonoBehaviour <CommConnectionManager> .Instance.Client.Lobby.IsPlayerMuted && this._lastMessageSentTimer > 0.29f) { this.SendChatMessage(); GUI.FocusControl("@CurrentChatMessage"); } GUI.enabled = enabled; GUI.EndGroup(); }
// Token: 0x06000AA1 RID: 2721 RVA: 0x00043F50 File Offset: 0x00042150 private void DoDialog(Rect rect, ChatGroupPanel pane, ChatDialog dialog) { if (dialog == null) { return; } if (dialog.CheckSize(rect) && !Input.GetMouseButton(0)) { this._dialogScroll.y = float.MaxValue; } GUI.BeginGroup(new Rect(rect.x, rect.y + Mathf.Clamp(rect.height - dialog._heightCache, 0f, rect.height), rect.width, rect.height)); int num = 0; float num2 = 0f; this._dialogScroll = GUITools.BeginScrollView(new Rect(0f, 0f, dialog._frameSize.x, dialog._frameSize.y), this._dialogScroll, new Rect(0f, 0f, dialog._contentSize.x, dialog._contentSize.y), false, false, true); foreach (InstantMessage instantMessage in dialog._msgQueue) { if (dialog.CanShow == null || dialog.CanShow(instantMessage.Context)) { if (num % 2 == 0) { GUI.Label(new Rect(0f, num2, dialog._contentSize.x - 1f, instantMessage.Height), GUIContent.none, BlueStonez.box_grey38); } if (GUI.Button(new Rect(0f, num2, dialog._contentSize.x - 1f, instantMessage.Height), GUIContent.none, BlueStonez.dropdown_list)) { this._selectedCmid = instantMessage.Cmid; } if (string.IsNullOrEmpty(instantMessage.PlayerName)) { GUI.color = new Color(0.6f, 0.6f, 0.6f); GUI.Label(new Rect(4f, num2, dialog._contentSize.x - 8f, 20f), instantMessage.Text, BlueStonez.label_interparkbold_11pt_left); } else { GUI.color = this.GetNameColor(instantMessage); GUI.Label(new Rect(4f, num2, dialog._contentSize.x - 8f, 20f), instantMessage.PlayerName + ":", BlueStonez.label_interparkbold_11pt_left); GUI.color = new Color(0.9f, 0.9f, 0.9f); GUI.Label(new Rect(4f, num2 + 20f, dialog._contentSize.x - 8f, instantMessage.Height - 20f), instantMessage.Text, BlueStonez.label_interparkmed_11pt_left); } GUI.color = new Color(1f, 1f, 1f, 0.5f); GUI.Label(new Rect(4f, num2, dialog._contentSize.x - 8f, 20f), instantMessage.TimeString, BlueStonez.label_interparkmed_10pt_right); GUI.color = Color.white; num2 += instantMessage.Height; num++; } } GUITools.EndScrollView(); dialog._heightCache = num2; GUI.EndGroup(); }
// Token: 0x06000A28 RID: 2600 RVA: 0x00040950 File Offset: 0x0003EB50 public ChatDialog AddNewDialog(CommUser user) { ChatDialog chatDialog = null; if (user != null && !this._dialogsByCmid.TryGetValue(user.Cmid, out chatDialog)) { if (PlayerDataManager.IsFriend(user.Cmid) || PlayerDataManager.IsFacebookFriend(user.Cmid)) { chatDialog = new ChatDialog(user, UserGroups.Friend); } else { chatDialog = new ChatDialog(user, UserGroups.Other); } this._dialogsByCmid.Add(user.Cmid, chatDialog); } return(chatDialog); }
/// <summary> /// If the given <paramref name="page"/> is a dialog-less page, this will skip to the next page /// that contains dialog. If the <paramref name="page"/> has dialog, this will just return /// that same <paramref name="page"/>. /// </summary> /// <param name="page">The page to attempt to skip through.</param> /// <returns>The page to use, or null if the dialog has ended.</returns> NPCChatDialogItemBase GetNextDialogPage(NPCChatDialogItemBase page) { // Skip until we find a null page, or we are no longer at a branch while (page != null && page.IsBranch) { // Evaluate the branch to get the response var branchResponse = page.EvaluateBranch(_user, _chattingWith); // Make sure we execute any actions on the response if (branchResponse.Actions != null) { foreach (var action in branchResponse.Actions) { action.Execute(_user, _chattingWith); } } // Get the next dialog item page from the response page = ChatDialog.GetDialogItem(branchResponse.Page); } return(page); }
public GameScene() { MapControl.AutoRun = false; MapControl.AutoHit = false; Slaying = false; Thrusting = false; HalfMoon = false; CrossHalfMoon = false; DoubleSlash = false; TwinDrakeBlade = false; FlamingSword = false; GroupDialog.GroupList.Clear(); Scene = this; BackColour = Color.Transparent; MoveTime = CMain.Time; KeyDown += GameScene_KeyDown; MainDialog = new MainDialog { Parent = this }; ChatDialog = new ChatDialog { Parent = this }; ChatControl = new ChatControlBar { Parent = this }; InventoryDialog = new InventoryDialog { Parent = this }; CharacterDialog = new CharacterDialog { Parent = this, Visible = false }; BeltDialog = new BeltDialog { Parent = this }; StorageDialog = new StorageDialog { Parent = this, Visible = false }; MiniMapDialog = new MiniMapDialog { Parent = this }; InspectDialog = new InspectDialog { Parent = this, Visible = false }; OptionDialog = new OptionDialog { Parent = this, Visible = false }; MenuDialog = new MenuDialog { Parent = this, Visible = false }; NPCDialog = new NPCDialog { Parent = this, Visible = false }; NPCGoodsDialog = new NPCGoodsDialog { Parent = this, Visible = false }; NPCDropDialog = new NPCDropDialog { Parent = this, Visible = false }; NPCAwakeDialog = new NPCAwakeDialog { Parent = this, Visible = false }; HelpDialog = new HelpDialog { Parent = this, Visible = false }; MountDialog = new MountDialog { Parent = this, Visible = false }; FishingDialog = new FishingDialog { Parent = this, Visible = false }; FishingStatusDialog = new FishingStatusDialog { Parent = this, Visible = false }; GroupDialog = new GroupDialog { Parent = this, Visible = false }; GuildDialog = new GuildDialog { Parent = this, Visible = false }; GuildBuffDialog = new GuildBuffDialog { Parent = this, Visible = false }; BigMapDialog = new BigMapDialog { Parent = this, Visible = false }; TrustMerchantDialog = new TrustMerchantDialog { Parent = this, Visible = false }; CharacterDuraPanel = new CharacterDuraPanel { Parent = this, Visible = false }; DuraStatusPanel = new DuraStatusDialog { Parent = this, Visible = true }; TradeDialog = new TradeDialog { Parent = this, Visible = false }; GuestTradeDialog = new GuestTradeDialog { Parent = this, Visible = false }; SkillBarDialog = new SkillBarDialog { Parent = this, Visible = false }; ChatOptionDialog = new ChatOptionDialog { Parent = this, Visible = false }; ChatNoticeDialog = new ChatNoticeDialog { Parent = this, Visible = false }; QuestListDialog = new QuestListDialog { Parent = this, Visible = false }; QuestDetailDialog = new QuestDetailDialog {Parent = this, Visible = false}; QuestTrackingDialog = new QuestTrackingDialog { Parent = this, Visible = false }; QuestLogDialog = new QuestDiaryDialog {Parent = this, Visible = false}; RankingDialog = new RankingDialog { Parent = this, Visible = false }; MailListDialog = new MailListDialog { Parent = this, Visible = false }; MailComposeLetterDialog = new MailComposeLetterDialog { Parent = this, Visible = false }; MailComposeParcelDialog = new MailComposeParcelDialog { Parent = this, Visible = false }; MailReadLetterDialog = new MailReadLetterDialog { Parent = this, Visible = false }; MailReadParcelDialog = new MailReadParcelDialog { Parent = this, Visible = false }; IntelligentCreatureDialog = new IntelligentCreatureDialog { Parent = this, Visible = false };//IntelligentCreature IntelligentCreatureOptionsDialog = new IntelligentCreatureOptionsDialog { Parent = this, Visible = false };//IntelligentCreature IntelligentCreatureOptionsGradeDialog = new IntelligentCreatureOptionsGradeDialog { Parent = this, Visible = false };//IntelligentCreature RefineDialog = new RefineDialog { Parent = this, Visible = false }; RelationshipDialog = new RelationshipDialog { Parent = this, Visible = false }; FriendDialog = new FriendDialog { Parent = this, Visible = false }; MemoDialog = new MemoDialog { Parent = this, Visible = false }; MentorDialog = new MentorDialog { Parent = this, Visible = false }; GameShopDialog = new GameShopDialog { Parent = this, Visible = false }; //not added yet KeyboardLayoutDialog = new KeyboardLayoutDialog { Parent = this, Visible = false }; for (int i = 0; i < OutputLines.Length; i++) OutputLines[i] = new MirLabel { AutoSize = true, BackColour = Color.Transparent, Font = new Font(Settings.FontName, 10F), ForeColour = Color.LimeGreen, Location = new Point(20, 25 + i * 13), OutLine = true, }; }
protected override void Dispose(bool disposing) { if (disposing) { Scene = null; User = null; MoveTime = 0; AttackTime = 0; NextRunTime = 0; CanMove = false; CanRun = false; MapControl = null; MainDialog = null; ChatDialog = null; ChatControl = null; InventoryDialog = null; CharacterDialog = null; StorageDialog = null; BeltDialog = null; MiniMapDialog = null; InspectDialog = null; OptionDialog = null; MenuDialog = null; NPCDialog = null; QuestDetailDialog = null; QuestListDialog = null; QuestLogDialog = null; QuestTrackingDialog = null; GameShopDialog = null; MentorDialog = null; RelationshipDialog = null; CharacterDuraPanel = null; DuraStatusPanel = null; HoverItem = null; SelectedCell = null; PickedUpGold = false; UseItemTime = 0; PickUpTime = 0; InspectTime = 0; DisposeItemLabel(); AMode = 0; PMode = 0; Lights = 0; NPCTime = 0; NPCID = 0; DefaultNPCID = 0; for (int i = 0; i < OutputLines.Length; i++) if (OutputLines[i] != null && OutputLines[i].IsDisposed) OutputLines[i].Dispose(); OutputMessages.Clear(); OutputMessages = null; } base.Dispose(disposing); }
// Token: 0x06000A29 RID: 2601 RVA: 0x000409C8 File Offset: 0x0003EBC8 internal void RemoveDialog(ChatDialog d) { this._dialogsByCmid.Remove(d.UserCmid); this._otherUsers.RemoveAll((CommUser u) => u.Cmid == d.UserCmid); this.SelectedDialog = null; }
// Token: 0x06000AA2 RID: 2722 RVA: 0x00008683 File Offset: 0x00006883 private void DoDialogHeader(Rect rect, ChatDialog d) { GUI.Label(rect, GUIContent.none, BlueStonez.window_standard_grey38); GUI.Label(rect, d.Title, BlueStonez.label_interparkbold_11pt); }
public async Task <TeamDTO> FormTeamAsync(ReceiveTeamDTO receivedTeam) { var currentUser = await _currentUser.GetCurrentUserProfile(); if (currentUser == null || currentUser.UserRole != Role.Manager) { return(null); } var userRepo = uow.GetRepository <UserProfile>(); List <TeamTranslator> translators = new List <TeamTranslator>(); UserProfile currentTranslator; List <DialogParticipant> teamChatDialogParticipants = new List <DialogParticipant>() { new DialogParticipant() { Participant = currentUser } }; foreach (var id in receivedTeam.TranslatorIds) { currentTranslator = await userRepo.GetAsync(id); if (currentTranslator != null && currentTranslator.UserRole == Role.Translator) { translators.Add(new TeamTranslator { UserProfile = currentTranslator }); if (currentTranslator.Id != currentUser.Id) { teamChatDialogParticipants.Add(new DialogParticipant() { Participant = currentTranslator }); } } } if (translators.Count < 1) { return(null); } Team newTeam = await uow.GetRepository <Team>().CreateAsync( new Team() { TeamTranslators = translators, CreatedBy = currentUser, Name = receivedTeam.Name }); await uow.SaveAsync(); foreach (var translator in newTeam.TeamTranslators) { await notificationService.SendNotification(new NotificationDTO { SenderId = currentUser.Id, Message = $"You received an invitation in team {newTeam.Name}", ReceiverId = translator.TranslatorId, NotificationAction = NotificationAction.JoinTeam, Payload = newTeam.Id, Options = new List <OptionDTO>() { new OptionDTO() { OptionDefinition = OptionDefinition.Accept }, new OptionDTO() { OptionDefinition = OptionDefinition.Decline } } }); } var teamChatDialog = new ChatDialog() { DialogName = newTeam.Name, DialogParticipants = teamChatDialogParticipants, DialogType = ChatGroup.chatTeam, Identifier = newTeam.Id }; await uow.GetRepository <ChatDialog>().CreateAsync(teamChatDialog); await uow.SaveAsync(); return(newTeam != null?mapper.Map <TeamDTO>(newTeam) : null); }
void Start() { Instance = this; HideDialog(); }
/// <summary> /// Progresses the chat dialog by using the given <paramref name="responseIndex"/>. /// </summary> /// <param name="responseIndex">The index of the response to use for the current dialog page.</param> /// <exception cref="Exception">The <see cref="_responseConditionalFailureType"/> is invalid.</exception> public void EnterResponse(byte responseIndex) { // Ensure there is a chat session going on if (!IsChatting) { const string errmsg = "Could not enter response of index `{0}` since there is no chat session active."; if (log.IsErrorEnabled) { log.ErrorFormat(errmsg, responseIndex); } Debug.Fail(string.Format(errmsg, responseIndex)); return; } // Check for a valid range if (!_user.Intersects(_chattingWith)) { if (log.IsInfoEnabled) { log.Info("Dialog aborted since the User is no longer near the target."); } EndChat(); return; } // Get the response var response = _dialogItem.GetResponse(responseIndex); if (response == null) { EndChat(); return; } Debug.Assert(response.Value == responseIndex, "Something went wrong, and we got the wrong response. lolwtf?"); // Ensure the selected response index is allowed (response conditionals check) if (!response.CheckConditionals(_user, _chattingWith)) { #pragma warning disable 162 switch (_responseConditionalFailureType) { case ResponseConditionalFailureHandleType.EndDialog: EndChat(); return; case ResponseConditionalFailureHandleType.ResendDialogItem: NotifyUserOfNewPage(); return; default: throw new Exception("Invalid _responseConditionalFailureType."); } #pragma warning restore 162 } // Execute the actions if (response.Actions != null) { foreach (var action in response.Actions) { action.Execute(_user, _chattingWith); } } // Get the next page var nextPage = ChatDialog.GetDialogItem(response.Page); nextPage = GetNextDialogPage(nextPage); // Set the new page _dialogItem = nextPage; // Check if the dialog has ended, otherwise just notify the user of the new page if (_dialogItem == null) { EndChat(); } else { NotifyUserOfNewPage(); } }