/// <summary> /// 开始动画 /// </summary> public void StartAnimation() { float x = (_canvasScaler.referenceResolution.x / 2); _outBtn.gameObject.SetActive(true); StartCoroutine(MailboxTool.MoveUI(_topTra.transform, new Vector3(-(x - _topTra.GetComponent <RectTransform>().sizeDelta.x / 2), _topTra.localPosition.y), () => { StartCoroutine(MailboxTool.MoveUI(_contentScrollRect.transform, new Vector3(-(x - _contentScrollRect.GetComponent <RectTransform>().sizeDelta.x / 2), _contentScrollRect.transform.localPosition.y), () => { if (_mailData._isHaveAccessory) { StartCoroutine(MailboxTool.MoveUI(_colourBarTra.transform, new Vector3(-(x - _colourBarTra.GetComponent <RectTransform>().sizeDelta.x / 2), _colourBarTra.transform.localPosition.y), () => { MoveItem(_mailAccessoryItems, 0, () => { ChangBtnScale(Vector3.one, () => { _uiIntegralController.interactable = true; }); }); }, _animationSpeed)); } else { _uiIntegralController.interactable = true; } }, _animationSpeed)); }, _animationSpeed)); }
/// <summary> /// 关闭动画 /// </summary> void CloseAnimation() { float x = (_canvasScaler.referenceResolution.x / 2); StartCoroutine(MailboxTool.MoveUI(_topTra.transform, new Vector3(-(x + _topTra.GetComponent <RectTransform>().sizeDelta.x / 2), _topTra.localPosition.y), () => { StartCoroutine(MailboxTool.MoveUI(_contentScrollRect.transform, new Vector3(-(x + _contentScrollRect.GetComponent <RectTransform>().sizeDelta.x / 2), _contentScrollRect.transform.localPosition.y), () => { if (_mailData._isHaveAccessory) { StartCoroutine(MailboxTool.MoveUI(_colourBarTra.transform, new Vector3(-(x + _colourBarTra.GetComponent <RectTransform>().sizeDelta.x / 2), _colourBarTra.transform.localPosition.y), () => { QuitMoveItem(_mailAccessoryItems, 0, () => { ChangBtnScale(Vector3.zero, () => { StopAllCoroutines(); ResetDataType(); Hide(); }); }); }, _animationSpeed)); } else { ResetDataType(); Hide(); } }, _animationSpeed)); }, _animationSpeed)); }
/// <summary> /// 移动彩条 /// </summary> /// <param name="tage"></param> /// <param name="tageScale"></param> /// <param name="endAction"></param> void FollowUpAnimation(Vector3 tage, Vector3 tageScale, Action endAction) { StartCoroutine(MailboxTool.MoveUI(_colourBar, tage, () => { ChangBtnScale(tageScale, endAction); }, _animationSpeed)); }
/// <summary> /// 移动邮件 /// </summary> /// <param name="tages"></param> /// <param name="x"></param> /// <param name="isRecover"></param> /// <param name="endAction"></param> /// <param name="index"></param> void MoveMail(List <Transform> tages, float x, bool isRecover, Action endAction, int index) { if (index < tages.Count - 1) { StartCoroutine(MailboxTool.MoveUITwo(tages[index], new Vector3(x, tages[index].localPosition.y), () => { index = index + 1; MoveMail(tages, x, isRecover, endAction, index); }, _animationSpeed, 150f)); } else if (index == tages.Count - 1) { StartCoroutine(MailboxTool.MoveUI(tages[index], new Vector3(x, tages[index].localPosition.y), () => { Transform cont = _contentRectTra.Find("Content"); ContentSizeFitter contentSizeFitter = cont.GetComponent <ContentSizeFitter>(); VerticalLayoutGroup verticalLayoutGroup = cont.GetComponent <VerticalLayoutGroup>(); if (isRecover) { cont.localPosition = new Vector3(0, cont.localPosition.y); contentSizeFitter.enabled = true; verticalLayoutGroup.enabled = true; } endAction?.Invoke(); }, _animationSpeed)); Debug.Log("最后一封"); } }
/// <summary> /// 领取动画 /// </summary> /// <param name="tageTras"></param> /// <param name="oldParents"></param> void HarvestItemAnimation(List <Transform> tageTras, List <Transform> oldParents) { for (int i = 0; i < tageTras.Count; i++) { tageTras[i].SetParent(_gatherTra); } List <Vector3> tagePoints = new List <Vector3>(); for (int i = 0; i < tageTras.Count; i++) { float x = UnityEngine.Random.Range(-200, 200); Vector3 vector3 = new Vector3(x, _gatherTraUp.localPosition.y); tagePoints.Add(vector3); } StartCoroutine(MailboxTool.MoveUIs(tageTras, tagePoints, () => { GatherMoveItem(tageTras, 0, () => { Debug.Log("领取完毕"); for (int i = 0; i < tageTras.Count; i++) { tageTras[i].SetParent(oldParents[i]); tageTras[i].localPosition = Vector3.zero; } }); }, 3000)); }
/// <summary> /// 修改按钮尺寸 /// </summary> /// <param name="tageScale"></param> /// <param name="endAction"></param> void ChangBtnScale(Vector3 tageScale, Action endAction) { StartCoroutine(MailboxTool.ChangScale(_getLabelTra.transform, tageScale, null, _animationSpeed)); StartCoroutine(MailboxTool.ChangScale(_confirmBtn.transform, tageScale, () => { endAction?.Invoke(); Debug.Log("展开按钮完毕"); }, 10f)); }
/// <summary> /// 一键领取 /// </summary> private void OnClickAKeyToToGetBtn() { List <MailData> mailDatas = GetAllCanGetMails(); if (mailDatas == null || mailDatas.Count <= 0) { return; } MailboxTool.GetMailAccessoryInWareHouse(0, GetMailAccessoryInWareHouseAction); }
/// <summary> /// 点击确认 /// </summary> private void OnClickConfirmBtn() { if (_mailData._isHaveAccessory) { if (_mailData._type != MailState.ReadAlreadyState) { MailboxTool.GetMailAccessoryInWareHouse(_mailData._mailID, GetMailAccessoryInWareHouseAction); } } }
public void Show() { if (!_isInitial) { Initial(); } MailboxTool.RegisterPushAction(PushData); MailboxTool.GetMailboxData(GetMailData); }
/// <summary> /// 登录+ 设置昵称完成完成进入主页 /// </summary> private async void LoginCompleteEnterManor() { //await ChatTool.InitialChat(); HideAnimEffect(); if (!ChapterHelper.IsFinishSection()) { await ChapterHelper.NewUserJoinChapter(); } else { //关闭登录界面 UIComponent.RemoveUI(UIType.UILogin); //加载自己庄园 await StaticData.ToManorSelf(); StaticData.DataDot(Company.Cfg.DotEventId.LoginToLobby); //登录完成初始化角色 //HallRoleManager.Instance.InitRole(); } //加载本地存储数据 UniversalTool.LoadLocalSaveData(); RedDotManager.Initial(); //是否请求每日订单 if (StaticData.playerInfoData.userInfo.SectionId >= 1000) //1000 序章 { //请求每日订单 StaticData.RequestDeals(); } //打开公告界面 StaticData.OpenUISystemNotification(); //更新任务图标红点标记 2020/12/18 TaskPanelTool.InitialUpdateTaskTag(); //更新邮件图标红点标记 2020/12/21 MailboxTool.InitialUpdateTaskTag(); StaticData.SetSceneState(StaticData.SceneState.ManorSelf); List <int> GuideIdList = new List <int>(); if (StaticData.playerInfoData.userInfo.Guidance != null) { for (int i = 0; i < StaticData.playerInfoData.userInfo.Guidance.Count; i++) { GuideIdList.Add(StaticData.playerInfoData.userInfo.Guidance[i]); } } GuideCanvasComponent._instance.SetGuideFinishListId(GuideIdList); //关闭登录界面 UIComponent.RemoveUI(UIType.UILogin); }
/// <summary> /// 修改按钮尺寸 /// </summary> /// <param name="tageScale"></param> /// <param name="endAction"></param> void ChangBtnScale(Vector3 tageScale, Action endAction) { List <Transform> tras = new List <Transform>(); tras.Add(_akeyToDelete.transform); tras.Add(_akeyToGet.transform); //StartCoroutine(MailboxTool.ChangScale(tras, tageScale, null, _animationSpeed)); StartCoroutine(MailboxTool.ChangScale(tras, tageScale, () => { endAction?.Invoke(); Debug.Log("展开按钮完毕"); }, 10f)); }
/// <summary> /// 显示信件 /// </summary> /// <param name="mailData"></param> public void ShowMail(MailData mailData, List <CSMailAccessory> cSMailAccessories) { _mailData = mailData; if (!_isInitial) { Initial(); } _titleText.text = _mailData._mailName; //设置发件时间 DateTime time = MailboxTool.GetDateTime(_mailData._timestamp); switch (_mailData._addressor) { case 1: _addressorText.text = "系统" + " " + time.Year + "-" + time.Month + "-" + (time.Day - 7) + " " + time.Hour + ":" + time.Minute; break; case 2: _addressorText.text = "管理员" + " " + time.Year + "-" + time.Month + "-" + (time.Day - 7) + " " + time.Hour + ":" + time.Minute; break; } _contentText.text = _mailData._mailContent; if (_mailData._isHaveAccessory) { _accessoryBoxRect.gameObject.SetActive(true); CreationAccessoryItem(cSMailAccessories); if (_mailData._type == MailState.ReadAlreadyState) { _getLabelTra.gameObject.SetActive(true); _confirmBtn.gameObject.SetActive(false); } else { _getLabelTra.gameObject.SetActive(false); _confirmBtn.gameObject.SetActive(true); } _colourBarTra.gameObject.SetActive(true); } else { _colourBarTra.gameObject.SetActive(false); _accessoryBoxRect.gameObject.SetActive(false); _getLabelTra.gameObject.SetActive(false); _confirmBtn.gameObject.SetActive(false); } _contentScrollRect.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(_contentRect.rect.width, _contentRect.rect.height); ResetPoint(); StartAnimation(); }
/// <summary> /// 移动附件item /// </summary> /// <param name="items"></param> /// <param name="index"></param> void GatherMoveItem(List <Transform> items, int index, Action endAction) { if (index >= items.Count) { Debug.Log("附件移动完毕"); endAction?.Invoke(); return; } StartCoroutine(MailboxTool.MoveUITwo(items[index], _gatherTraDown.localPosition, () => { int indexTwo = index + 1; GatherMoveItem(items, indexTwo, endAction); }, 4000, 100)); }
/// <summary> /// 关闭动画 /// </summary> void CloseAnimation() { _topRectTra.gameObject.SetActive(false); MoveMail(-1120f, false, () => { FollowUpAnimation(new Vector3(-1242f, _colourBar.localPosition.y), Vector3.zero, () => { MailboxTool.ChangeMailType(_mailDataDic, () => { StopAllCoroutines(); MailboxTool._isGetMaliData = false; RedDotManager.UpdateRedDot(RedDotManager.RedDotKey.Mailbox); MailboxTool.RegisterPushAction(null); UIComponent.HideUI(UIType.Mailbox); }); }); }); }
/// <summary> /// 修改邮件剩余时间 /// </summary> void ChangeTime() { foreach (var item in _mailTimerDic) { //计算当前服务器时间 long CurrTimeStampServer = TimeHelper.ServerTimeStampNow; //计算剩余时间 long CurrRemainTime = MailboxController.Instance.GetData(item.Key)._timestamp - CurrTimeStampServer; float remainingTime = CurrRemainTime / 1000f; remainingTime = (remainingTime - Time.deltaTime); if (remainingTime <= 0) { //Debug.Log("倒计时结束"); } else { //Debug.Log("修改剩余时间"); item.Value.text = MailboxTool.GetTimeRemaining(remainingTime); } } }
/// <summary> /// 打开邮件 /// </summary> public void OpenMail(int mailId) { if (_mailDataDic.ContainsKey(mailId)) { _titleBgTra.gameObject.SetActive(false); MoveMail(-1120f, false, () => { FollowUpAnimation(new Vector3(-1242f, _colourBar.localPosition.y), Vector3.zero, () => { MailboxTool.OpenMail(_mailDataDic[mailId]); }); }); //StartCoroutine(MailboxTool.MoveUI(_topRectTra, new Vector3(-1242f, _topRectTra.localPosition.y), () => { MoveMail(-1120f, false, () => { FollowUpAnimation(new Vector3(-1242f, _colourBar.localPosition.y), Vector3.zero, () => { MailboxTool.OpenMail(_mailDataDic[mailId]); }); }); }, _animationSpeed)); } }
static RigisterCmdPush() { //好友申请推送 dic[typeof(SCFriendApplyPushMsg)] = (msg, code) => { new FriendPush().ExecuteFriendApplyCmd(msg); }; //好友同意推送 dic[typeof(SCFriendAcceptPushMsg)] = (msg, code) => { new FriendPush().ExecuteFriendAcceptCmd(msg); }; //好友拒绝推送 dic[typeof(SCFriendRepulsePushMsg)] = (msg, code) => { new FriendPush().ExecuteFriendRepulseCmd(msg); }; //好友删除推送 dic[typeof(SCFriendDeletePushMsg)] = (msg, code) => { new FriendPush().ExecuteFriendDeleteCmd(msg); }; //聊天推送 dic[typeof(SCChat)] = (msg, code) => { //世界聊天推送 if (code == 50011) { ChatTool.ExecuteWorldChatMessageCmd(msg); } else if (code == 50012)// 私聊 { ChatTool.ExecutePrivateChatMessageCmd(msg); } else if (code == 50013)//房间聊天 { ChatTool.ExecuteRoomChatMessageCmd(msg); } else { Debug.LogError("code = " + code + " not register"); } }; //晚会玩家进入房间 推送 dic[typeof(SCEntranceRoomInfo)] = (msg, code) => { PartyServerDockingManager.PushEntranceRoom(msg); }; //晚会玩家移动 推送 dic[typeof(SCMoveLocation)] = (msg, code) => { PartyServerDockingManager.PushPlayerMove(msg); }; //晚会有玩家退出房间 推送 dic[typeof(SCDepartureRoom)] = (msg, code) => { PartyServerDockingManager.PushPlayerQuitRoom(msg); }; //晚会结束 推送 dic[typeof(SCActivityFinish)] = (msg, code) => { PartyServerDockingManager.PushPartyEnd(msg); }; //晚会竞猜信息 推送 dic[typeof(SCpushGuessingInfo)] = (msg, code) => { PartyServerDockingManager.PushPartyGuessInfo(msg); }; //系统公告 推送 dic[typeof(SCNotePushMess)] = (msg, code) => { StaticData.PushSystemNotification(msg); }; dic[typeof(SCEmtpyMailPushMsg)] = (msg, code) => { MailboxTool.ReceptionPushData(msg); }; dic[typeof(SCSendMailPushMsg)] = (msg, code) => { MailboxTool.ReceptionPushDataTwo(msg); }; }
/// <summary> /// 有推送邮件时的更新 /// </summary> public void PushData() { MailboxTool.GetMailboxData(GetMailDataUpdate); }