/// <summary> /// 刷新私聊信息 /// </summary> /// <param name="uId"></param> public void RefreshPrivateChat(long uId) { if (_currType != 1) { _chatTopBtnItemControllerDic[1].OpenUpdateLabelTra(true); return; } if (uId == _currPrivateChatIndex) { ChangeList(ChatTool.GetPrivateChatNumber(_currPrivateChatIndex)); if (_chatSlideListStateInspection._IsDrag) { OpenNewMessageBtn(true); } else { OpenNewMessageBtn(false); } } if (_privateChatIconItemControllerDic.ContainsKey(uId)) { _privateChatIconItemControllerDic[uId].RefreshDataShow(); } PrivateChatBtnSort(uId); PrivateChatBtnUpdateLabel(uId); }
/// <summary> /// 刷新私聊按钮排序 /// </summary> /// <param name="uid"></param> public void PrivateChatBtnSort(long uid) { if (!_privateChatIconItemControllerDic.ContainsKey(uid)) { CreatePrivateChatItem(ChatTool.FindMessagePrivateChat_UID(uid)); } if (uid != _currPrivateChatIndex) { foreach (var item in _privateChatIconItemControllerDic) { if (item.Key == _currPrivateChatIndex) { item.Value.transform.SetSiblingIndex(0); } else if (item.Key == uid) { item.Value.transform.SetSiblingIndex(1); } } } else { foreach (var item in _privateChatIconItemControllerDic) { if (item.Key == _currPrivateChatIndex) { item.Value.transform.SetSiblingIndex(0); } } } }
/// <summary> /// 点击私聊头像按钮 /// </summary> /// <param name="uId"></param> public void ClickPrivateChat(long uId) { _currPrivateChatIndex = uId; _chatSlideListStateInspection.ResetData(); RefreshPrivateChat(); _chatTopBtnItemControllerDic[1].OpenUpdateLabelTra(ChatTool.IsNewMessagePrivateChat()); }
/// <summary> /// 房间消息发送成功 /// </summary> private void RoomChatSendSuccess() { _chatSlideListStateInspection.ResetData(); ChatInfo chatInfo = ChatTool.GetPlayData(_InputFieldStr); ChatTool.EnqueuetRoomChannelMessages(chatInfo); ClearInputField(); }
/// <summary> /// 私聊消息发送成功 /// </summary> private void PrivateSendSuccess() { _chatSlideListStateInspection.ResetData(); ChatInfo chatInfo = ChatTool.GetPlayData(_InputFieldStr); ChatTool.ReceivePrivateChatMessage(_currPrivateChatIndex, chatInfo); ClearInputField(); }
/// <summary> /// 初始化组件 /// </summary> void Initial() { _bulletScreenItemController = transform.Find("BulletScreenItem").GetComponent <ChatBulletScreenItemController>(); _boxRect = transform.Find("Box").GetComponent <RectTransform>(); _hidItemBox = transform.Find("HidItemBox").GetComponent <RectTransform>(); ChatTool.EnrollTakePushDataAction(TakePushData); _showCanvaGroup = GetComponent <CanvasGroup>(); _isInitial = true; }
public EliteAPITestForm(PolTool iPol) { InitializeComponent(); pol = iPol; api = iPol.EliteAPI; chat = new ChatTool(api); resource = new ResourceTool(api); control = new EliteAPIControl(pol, resource, chat); }
/// <summary> /// 点击勾选按钮 /// </summary> /// <param name="arg0"></param> private void ClickToggle(bool arg0) { if (arg0) { _data.IsRead = true; ChatTool.UpdatePrivateChatIsRead(_data.PrivateChatRoleUid, true); ChatPanelController._Instance.ClickPrivateChat(_data.PrivateChatRoleUid); NewMessage(false); } }
/// <summary> /// 点击私聊头像按钮 /// </summary> /// <param name="uId"></param> public void OpenPrivateChat(long uId, int iconId, string iconUrl, string playName, int experience) { ChatTool.CreationNullPrivateChatMessage(uId, iconId, iconUrl, playName, experience); _currPrivateChatIndex = uId; _chatTopBtnItemControllerDic[1].SetSelect(true); if (_privateChatIconItemControllerDic.ContainsKey(uId)) { _privateChatIconItemControllerDic[uId].SetSelcet(true); } }
public async void ScrollCellIndex(int idx) { ButtonEnterManor.onClick.RemoveAllListeners(); ButtonEnterManor.onClick.AddListener(OnEnterManor); curFriendStealInfo = StaticData.playerInfoData.listFriendStealInfo[idx]; //头像 imageIcon.sprite = ChatTool.GetIcon(curFriendStealInfo.headIcon); TextNickname.text = curFriendStealInfo.nickname; TextLevelNum.text = curFriendStealInfo.level.ToString(); handTag.gameObject.SetActive(curFriendStealInfo.isSteal); }
public async void Show(ChatInfo data, RectTransform tageTra, RectTransform astrictScope) { if (!_isInitial) { Initial(); } _currData = data; _thisCanvasGroup.alpha = 0; if (string.IsNullOrEmpty(_currData._iconUrl)) { _icon.sprite = ChatTool.GetIcon(_currData._iconId); } else { _icon.sprite = await ChatTool.GetIcon(_currData._iconUrl); } _showName.text = _currData._playName; _showGrade.text = StaticData.GetPlayerLevelByExp((int)_currData._experience).ToString(); //if (await StaticData.IsUserFriend(data._playUid)) //{ // _makeFriendsBtnImage.color = new Color(202f, 202f, 202f); //} //else //{ // _makeFriendsBtnImage.color = new Color(255f, 255f, 255f); //} if (ChatPanelController._Instance == null || (ChatPanelController._Instance._CurrPrivateChatIndex == data._playUid && ChatPanelController._Instance._CurrType == 1)) { //_chatBtnImage.color = new Color(202f, 202f, 202f); _chatBtn.enabled = false; } else { //_chatBtnImage.color = new Color(255f, 255f, 255f); _chatBtn.enabled = true; } if (StaticData.IsFriendOnline(_currData._playUid)) { _typeText.text = StaticData.GetMultilingual(120110); _typeLabelImage.sprite = await ABManager.GetAssetAsync <Sprite>("lt_tips_zx"); } else { _typeText.text = StaticData.GetMultilingual(120111); _typeLabelImage.sprite = await ABManager.GetAssetAsync <Sprite>("lt_tips_lx"); } SetPoint(tageTra, astrictScope); }
/// <summary> /// 获取当前item聊天数据 /// </summary> /// <param name="index"></param> public ChatInfo GetCurrChatItemData(int index) { switch (_currType) { case 0: return(ChatTool.GetWorldData(index)); case 1: return(ChatTool.GetPrivateChatData(_currPrivateChatIndex, index)); case 2: return(ChatTool.GetRoomData(index)); } return(null); }
/// <summary> /// 设置角标 /// </summary> void SetCornerTra() { RectTransform showContentParent = _contentShowText.transform.parent.GetComponent <RectTransform>(); float x = 0; if (ChatTool.IsPlay(_currData._playUid)) { x = showContentParent.rect.width / 2; } else { x = -(showContentParent.rect.width / 2); } _cornerTra.localPosition = new Vector3(x, _cornerTra.localPosition.y); }
/// <summary> /// 刷新房间聊天 /// </summary> public void RefreshRoomChat() { if (_currType != 2) { return; } ChangeList(ChatTool.GetRoomNumber()); if (_chatSlideListStateInspection._IsDrag) { OpenNewMessageBtn(true); } else { OpenNewMessageBtn(false); } }
/// <summary> /// 初始化组件 /// </summary> void Initial() { _showTextItemParent = transform.Find("ShowTextItem").GetComponent <RectTransform>(); _frameRect = transform.Find("Frame").GetComponent <RectTransform>(); _frameBtn = _frameRect.GetComponent <Button>(); _showTextItemBornAtRect = _frameRect.Find("TextBox").GetComponent <RectTransform>(); _iconBoxRect = _frameRect.Find("IconBox").GetComponent <RectTransform>(); _iconRect = _iconBoxRect.Find("Icon").GetComponent <RectTransform>(); _frameBtn.onClick.RemoveAllListeners(); _frameBtn.onClick.AddListener(ClickFrame); ChatTool.EnrollChatFrameAction(ReceiveData); InitialFramePoint(); _isInitial = true; }
/// <summary> /// 生成好友列表中LoopItem后的回调函数 /// 改变每个LoopItem的参数 /// </summary> /// <param name="idx"></param> public async void ScrollCellIndex(int idx) { Initial(); itemIndex = idx; scFriendInfo = StaticData.playerInfoData.listFriendInfo[idx]; //根据经验计算等级 int level = StaticData.GetPlayerLevelByExp(scFriendInfo.FriendExperience); _levelNum.GetComponent <Text>().text = level.ToString(); if (string.IsNullOrEmpty(scFriendInfo.ImageAddress)) { _iconImage.sprite = ChatTool.GetIcon(scFriendInfo.FriendImage); } else { _iconImage.sprite = await ChatTool.GetIcon(scFriendInfo.ImageAddress); } if (scFriendInfo.Online == true) { _online.gameObject.SetActive(true); _onlineBg.gameObject.SetActive(true); _outline.gameObject.SetActive(false); _outlineBg.gameObject.SetActive(false); } else { _outline.gameObject.SetActive(true); _outlineBg.gameObject.SetActive(true); _online.gameObject.SetActive(false); _onlineBg.gameObject.SetActive(false); } //昵称 _stealBtn.gameObject.SetActive(IsSteal(scFriendInfo)); _nickname.GetComponent <Text>().text = scFriendInfo.FriendName; if (scFriendInfo.Uid == StaticData.configExcel.Vertical[0].SpecialUid) { _btnDelete.gameObject.SetActive(false); } else { _btnDelete.gameObject.SetActive(true); } //_nickname.GetComponent<Text>().text = scFriendInfo.Uid.ToString(); }
/// <summary> /// コンストラクタ /// </summary> /// <param name="iPol"></param> /// <param name="iChat"></param> /// <param name="iSettings"></param> public HarakiriTool(PolTool iPol, ResourceTool iResource, ChatTool iChat, Settings iSettings) { pol = iPol; api = iPol.EliteAPI; chat = iChat; resource = iResource; settings = iSettings; fishDB = new FishDB(); harakiriDB = new HarakiriDB(); control = new EliteAPIControl(pol, resource, chat); control.MaxLoopCount = Constants.MAX_LOOP_COUNT; control.UseEnternity = settings.UseEnternity; control.BaseWait = settings.Global.WaitBase; control.ChatWait = settings.Global.WaitChat; this.RunningStatus = RunningStatusKind.Stop; this.HarakiriStatus = HarakiriStatusKind.Normal; }
/// <summary> /// 刷新世界聊天信息 /// </summary> public void RefreshWorldChat() { if (_currType != 0) { _chatTopBtnItemControllerDic[0].OpenUpdateLabelTra(true); return; } ChangeList(ChatTool.GetWorkdNumber()); if (_chatSlideListStateInspection._IsDrag) { OpenNewMessageBtn(true); } else { OpenNewMessageBtn(false); } }
public void Initial() { _thisRect = GetComponent <RectTransform>(); _btn = transform.Find("Button").GetComponent <UIPanelDrag>(); _btnRect = _btn.transform.GetComponent <RectTransform>(); _label = _btn.transform.Find("Label").GetComponent <Image>(); _canvasGroup = GetComponent <CanvasGroup>(); _btn.m_DragPlane = GetComponent <RectTransform>(); _canvasScaler = UIRoot.instance.GetUIRootCanvasTop().transform.GetComponent <CanvasScaler>(); _btn.actionOnClick = ClickBtn; _btn.actionOnPointerUp = PointerUp; _btn.actionOnPointerDown = PointerDown; InitialPoint(); ChatTool.EnrollChatMiniAction(OpenLabelAction); _canvasGroup.alpha = 0.5f; OpenLabel(ChatTool.IsNewMessagePrivateChat()); _isInitial = true; }
/// <summary> /// 加载玩家头像 /// </summary> private async void LoadPlayerIcon() { var roleID = StaticData.playerInfoData.userInfo.Image; var path = StaticData.configExcel.GetPlayerAvatarByID(roleID); ImageIcon.sprite = await ABManager.GetAssetAsync <Sprite>(path.Icon); if (Root2dSceneManager._instance != null && Root2dSceneManager._instance.isFriendManor) { if (string.IsNullOrEmpty(StaticData.playerInfoData.userInfo.ImageAddress)) { ImageIcon.sprite = ChatTool.GetIcon(StaticData.curFriendStealInfo.headIcon); } else { ImageIcon.sprite = await ChatTool.GetIcon(StaticData.playerInfoData.userInfo.ImageAddress); } } }
/// <summary> /// 是否是玩家自己发言 /// </summary> void IsPlay() { if (_currData.IsTimeIntervalSign) { ChangeDialogBox(0); } else { if (ChatTool.IsPlay(_currData._playUid)) { ChangeDialogBox(2); } else { ChangeDialogBox(1); } ShowData(); } }
/// <summary> /// 发送输入信息 /// </summary> private void OnSendBtn() { if (string.IsNullOrWhiteSpace(_InputFieldStr)) { ClearInputField(); return; } if (ShieldWordTool.BlockFont(ref _InputFieldStr)) { Debug.Log("处理屏蔽字"); } _sendBtn.enabled = false; if (_timeCountDownComponent == null) { CreationTimer(); } _sendBtnMaskImage.fillAmount = 1; _isBeTimeUnlock = true; StartCountingTime(StaticData.configExcel.GetVertical().ChatSendCD); switch (_currType) { case 0: ChatTool.NotifyServerWorldChatMessage(_InputFieldStr, SendSuccess, SendFailed); break; case 1: if (_currPrivateChatIndex != 0) { ChatTool.NotifyServerPrivateChatMessage(_currPrivateChatIndex, _InputFieldStr, PrivateSendSuccess, PrivateSendFailed); } else { StaticData.CreateToastTips(StaticData.GetMultilingual(120261)); } break; case 2: ChatTool.NotifyServerRoomChatMessage(_InputFieldStr, RoomChatSendSuccess, RoomChatSendFailed); break; } }
/// <summary> /// 判读左右吸附 /// </summary> /// <param name="vector3"></param> public void IsLeftAnRight(Vector3 vector3, bool isShake = true) { Vector3 left = new Vector3(-(_canvasScaler.referenceResolution.x / 2) + (_btnRect.sizeDelta.x / 2), vector3.y); Vector3 right = new Vector3((_canvasScaler.referenceResolution.x / 2) - (_btnRect.sizeDelta.x / 2), vector3.y); float radiusY = _thisRect.rect.height / 2; float maxY = radiusY - _btnRect.sizeDelta.y / 2; float minY = (-radiusY) + _btnRect.sizeDelta.y / 2; float distanceLeft = Vector3.Distance(vector3, left); float distanceRight = Vector3.Distance(vector3, right); if (vector3.y > maxY) { vector3 = new Vector3(vector3.x, maxY); } else if (vector3.y < minY) { vector3 = new Vector3(vector3.x, minY); } if (distanceLeft < distanceRight) { _btn.localPos = new Vector2(left.x, vector3.y); _btnRect.localPosition = new Vector2(left.x, vector3.y); } else { _btn.localPos = new Vector2(right.x, vector3.y); _btnRect.localPosition = new Vector2(right.x, vector3.y); } if (isShake) { StartCoroutine(ChatTool.BtnShake(_btnRect, new Vector3(10, 0, 0), 1, 500, () => { _canvasGroup.alpha = 0.5f; IsLeftAnRight(_btnRect.localPosition, false); StopAllCoroutines(); })); } }
/// <summary> /// 初始化面板 /// </summary> public void InitialPanel() { CleanTopDic(); CreateTopBtn(0, StaticData.GetMultilingual(120171)); CreateTopBtn(1, StaticData.GetMultilingual(120172)); if (ChatTool._IsBeRoom) { CreateTopBtn(2, StaticData.GetMultilingual(120173)); } _barrageToggle.isOn = ChatTool.GetBulletScreenOnOff(); SetBarrageToggleTageTra(_barrageToggle.isOn); OpenNewMessageBtn(false); ChatTool.OpenBulletScreenOnOff(false); ChatTool.EnrollAction(RefreshWorldChat, RefreshRoomChat, RefreshPrivateChat); _chatTopBtnItemControllerDic[1].OpenUpdateLabelTra(ChatTool.IsNewMessagePrivateChat()); long currTime = TimeHelper.ServerTimeStampNow; float currRemainingTime = (currTime - ChatTool._chatLeaveTime); currRemainingTime = currRemainingTime / 1000; if (currRemainingTime >= ChatTool._sendRemainingTime) { ChatTool._isOverCd = true; _isBeTimeUnlock = false; _sendBtnMaskImage.fillAmount = 0; if (!_sendBtn.enabled) { _sendBtn.enabled = true; } } else { if (_timeCountDownComponent == null) { CreationTimer(); } _isBeTimeUnlock = true; float TimeThanColumn = ChatTool._sendRemainingTime - currRemainingTime / StaticData.configExcel.GetVertical().ChatSendCD; _sendBtnMaskImage.fillAmount = TimeThanColumn; StartCountingTime(ChatTool._sendRemainingTime - currRemainingTime); } }
/// <summary> /// 点击顶部按钮 /// </summary> /// <param name="index"></param> public void ClickTopBtn(int index) { _currType = index; if (_currType != 1) { ChatTool.ClearBlankPrivateChat(); } if (_currType != 0) { SetBarrageToggleOpen(false); } else { SetBarrageToggleOpen(true); } _chatSlideListStateInspection.ResetData(); ClearInputField(); RefreshChat(); }
/// <summary> /// 展示数据 /// </summary> async void ShowData() { if (string.IsNullOrEmpty(_currData._iconUrl)) { _icon.sprite = ChatTool.GetIcon(_currData._iconId); } else { _icon.sprite = await ChatTool.GetIcon(_currData._iconUrl); } _showName.text = _currData._playName; _gradeShowText.text = StaticData.GetPlayerLevelByExp((int)_currData._experience).ToString(); _contentShowText.text = ChatTool.TextLineFeed(_currData._message, 25); LayoutRebuilder.ForceRebuildLayoutImmediate(_contentBoxTraTwo); LayoutRebuilder.ForceRebuildLayoutImmediate(_contentBoxTra); LayoutRebuilder.ForceRebuildLayoutImmediate(_thisRect); SetCornerTra(); ChatPanelController._Instance.CoerceItemBoxRefresh(); }
/// <summary> /// 设置面板位置 /// </summary> /// <param name="astrictScope"></param> public void SetPoint(RectTransform tageRect, RectTransform astrictScope) { Vector3 locaPoint = transform.InverseTransformPoint(tageRect.position); float x = locaPoint.x + _contentRect.rect.width / 2; float y = locaPoint.y - _contentRect.rect.height / 2; Vector3 newVector3 = new Vector3(x, y); _contentRect.localPosition = newVector3; _asteriskRect.localPosition = new Vector3(_contentRect.localPosition.x - (_contentRect.rect.width / 2) + 5, (_contentRect.localPosition.y + _contentRect.rect.height / 2) - 5); bool isBottomOut = ChatTool.AstrictScope(_contentRect, astrictScope); if (isBottomOut) { float yTwo = locaPoint.y + _contentRect.rect.height / 2; Debug.Log("触底y轴:" + yTwo); _contentRect.localPosition = new Vector3(x, yTwo); _asteriskRect.localPosition = new Vector3(_asteriskRect.localPosition.x, (_contentRect.localPosition.y - _contentRect.rect.height / 2) + 5); } _thisCanvasGroup.alpha = 1; }
/// <summary> /// 刷新聊天界面 /// </summary> void RefreshChat() { //Debug.Log("刷新界面"); switch (_currType) { case 0: _topTwoTra.gameObject.SetActive(false); _itemBoxTra.sizeDelta = new Vector2(_itemBoxTra.sizeDelta.x, 1472); _itemBoxTra.localPosition = new Vector2(_itemBoxTra.localPosition.x, 69); ChangeList(ChatTool.GetWorkdNumber()); break; case 1: _topTwoTra.gameObject.SetActive(true); _itemBoxTra.sizeDelta = new Vector2(_itemBoxTra.sizeDelta.x, 1291); _itemBoxTra.localPosition = new Vector2(_itemBoxTra.localPosition.x, -22); ClearList(); CreatePrivateChatItem(); break; } }
/// <summary> /// 关闭聊天面板 /// </summary> private void ClickCloseBtn() { if (_timeCountDownComponent != null) { Destroy(_timeCountDownComponent.gameObject); } UniversalTool.CancelUIAnimTwo(GetComponent <CanvasGroup>(), _bgTra, () => { UIComponent.HideUI(UIType.ChatPanel); _currPrivateChatIndex = 0; ChatTool.SetBulletScreenOnOff(_barrageToggle.isOn); //接收消息就存储 ChatTool.PrivateChatSaveFile(); //初始信息发送cd时记录离开时当前服务器时间戳 if (_isBeTimeUnlock && ChatTool._isOverCd) { ChatTool._isOverCd = false; ChatTool._chatLeaveTime = TimeHelper.ServerTimeStampNow; } Debug.Log("关闭_________________________________"); }); }
/// <summary> /// 生成好友列表中LoopItem后的回调函数 /// 改变每个LoopItem的参数 /// </summary> /// <param name="idx"></param> public async void ScrollCellIndex(int idx) { Initial(); itemIndex = idx; scOtherStruct = StaticData.playerInfoData.listApplyInfo[idx]; //根据经验计算等级 int level = StaticData.GetPlayerLevelByExp(scOtherStruct.FriendExperience); _levelNum.GetComponent <Text>().text = level.ToString(); if (string.IsNullOrEmpty(scOtherStruct.ImageAddress)) { _iconImage.sprite = ChatTool.GetIcon(scOtherStruct.FriendImage); } else { _iconImage.sprite = await ChatTool.GetIcon(scOtherStruct.ImageAddress); } //多语言,todo if (scOtherStruct.Online == true) { _online.gameObject.SetActive(true); _onlineBg.gameObject.SetActive(true); _outline.gameObject.SetActive(false); _outlineBg.gameObject.SetActive(false); } else { _outline.gameObject.SetActive(true); _outlineBg.gameObject.SetActive(true); _online.gameObject.SetActive(false); _onlineBg.gameObject.SetActive(false); } //昵称 _nickname.GetComponent <Text>().text = scOtherStruct.FriendName; //_nickname.GetComponent<Text>().text = scOtherStruct.Uid.ToString(); }