private void AddMySmsOrCallVo(MySmsOrCallVo vo) { if (_npcSmsDic == null) { _npcSmsDic = new Dictionary <int, List <MySmsOrCallVo> >(); } if (_npcCallDic == null) { _npcCallDic = new Dictionary <int, List <MySmsOrCallVo> >(); } if (vo.SceneId < 10000) { if (!_npcSmsDic.ContainsKey(vo.NpcId)) { var list = new List <MySmsOrCallVo>(); _npcSmsDic.Add(vo.NpcId, list); } _npcSmsDic[vo.NpcId].Add(vo); } else if (vo.SceneId < 20000) { if (!_npcCallDic.ContainsKey(vo.NpcId)) { var list = new List <MySmsOrCallVo>(); _npcCallDic.Add(vo.NpcId, list); } _npcCallDic[vo.NpcId].Add(vo); } }
public override void SetData(params object[] paramsObjects) { if (paramsObjects.Length == 0) { return; } data = (MySmsOrCallVo)paramsObjects[0]; }
public override void OnMessage(Message message) { string name = message.Name; object[] body = message.Params; switch (name) { case MessageConst.CMD_PHONE_SHOW_SMS: _phonePanel.ShowSmsView(); break; case MessageConst.CMD_PHONE_SHOW_TELE: _phonePanel.ShowTelephoneView(); break; case MessageConst.CMD_PHONE_CALL_HANGUP: // _phonePanel.OnBackClick(); //_phoneCallController.Hide(); //_telephoneController.Show(); //_telephoneController.Refresh(); if (_phonePanel.PanelType == PhonePanelType.Normal) { _phonePanel.ShowTelephoneView(); _phonePanel.ShowBackBtn(); } else { ModuleManager.Instance.GoBack(); } break; case MessageConst.CMD_PHONE_SMS_SHOWDETAIL: List <MySmsOrCallVo> data = new List <MySmsOrCallVo>(); data = (List <MySmsOrCallVo>)body[0]; _phonePanel.ShowSmsDetailView(data); break; case MessageConst.CMD_PHONE_CALL_SHOWDETAIL: MySmsOrCallVo data1 = (MySmsOrCallVo)body[0]; _phonePanel.ShowPhoneCallView(data1); break; case MessageConst.CMD_PHONE_SHOW_FRIENDS: _phonePanel.ShowFriendsCircleView(); break; case MessageConst.CMD_PHONE_SHOW_WEIBO: _phonePanel.ShowWeiboView(); break; case MessageConst.CMD_PHONE_GUIDE_BACKBTN: _phonePanel.OnBackClick(); break; } }
public void ShowPhoneCallViewByTips(MySmsOrCallVo data) { if (data.SceneId < 10000) { List <MySmsOrCallVo> ldata = new List <MySmsOrCallVo>() { data }; ShowSmsDetailView(ldata); } else { ShowPhoneCallView(data); } }
private MySmsOrCallVo FindCurShowData(List <MySmsOrCallVo> list) { MySmsOrCallVo temp = null; temp = list.Find((item) => { return(item.IsReaded == false && item.selectIds.Count > 0); }); if (temp != null) { return(temp); } temp = list.Find((item) => { return(item.IsReaded == false && item.IsPlayerTrigger == false); }); if (temp != null) { return(temp); } return(temp); }
public static MySmsOrCallVo TransSmsOrCallData(UserMsgOrCallPB data) { var userMsg = data; var vo = new MySmsOrCallVo(); vo.SceneId = userMsg.SceneId; vo.NpcId = userMsg.NpcId; vo.CreateTime = userMsg.CreateTime; vo.FinishTime = userMsg.FinishTime; vo.IsReaded = userMsg.ReadState == 1; vo.selectIds = new List <int>(); vo.listenIds = new List <int>(); vo.selectIds.AddRange(userMsg.SelectIds); vo.listenIds.AddRange(userMsg.ListenIds); return(vo); }
private void UpdateCallDataByLocal(int sceneId, List <int> selects, bool isFinished = false) { MySmsOrCallVo vo = null; foreach (var v in _npcSmsDic) { foreach (var v1 in v.Value) { if (v1.SceneId == sceneId) { v1.selectIds = selects; v1.IsReaded = isFinished; return; } } } }
public void AddSmsOrCallData(MySmsOrCallVo vo) { Dictionary <int, List <MySmsOrCallVo> > dirc = vo.SceneId < 10000 ? _npcSmsDic : _npcCallDic; if (!dirc.ContainsKey(vo.NpcId)) { dirc[vo.NpcId] = new List <MySmsOrCallVo>(); } if (dirc[vo.NpcId].Find((m) => { return(m.SceneId == vo.SceneId); }) != null) { return; } if (!dirc[vo.NpcId].Contains(vo)) { dirc[vo.NpcId].Add(vo); } }
public void SetData(List <MySmsOrCallVo> data) { //todo //查找显示场景 _data = data; MySmsOrCallVo temp = null; MySmsOrCallVo lastTemp = null;//最近一条阅读的短信 List <MySmsOrCallVo> smsUnfinishOfOther; List <MySmsOrCallVo> smsUnfinishOfPlayer;; //List<MySmsOrCallVo> smsUnfinish = new List<MySmsOrCallVo>(); lastTemp = data.FindLast((item) => { return(item.IsReaded == true); }); smsUnfinishOfPlayer = data.FindAll((item) => { return(item.IsReaded == false && item.IsPlayerTrigger == true); }); smsUnfinishOfOther = data.FindAll((item) => { return(item.IsReaded == false && item.IsPlayerTrigger == false); }); temp = FindCurShowData(data); if (temp != null) { if (smsUnfinishOfOther.Contains(temp)) { smsUnfinishOfOther.Remove(temp); } else if (smsUnfinishOfPlayer.Contains(temp)) { smsUnfinishOfPlayer.Remove(temp); } } else { if (smsUnfinishOfPlayer.Count == 0) { if (data.Count > 0)//显示历史记录 { //data[data.Count].CreateTime data.Sort((a, b) => { return(a.FinishTime.CompareTo(b.FinishTime)); }); temp = data[data.Count - 1]; lastTemp = null; } } } //一次只能一个场景id进入 需求更改传入主角未完成的场景ids View.SetData(temp, smsUnfinishOfPlayer, smsUnfinishOfOther, lastTemp, data[0].Sender); }
public void ShowPhoneCallView(MySmsOrCallVo data) { HideAll(); if (_phoneCallController != null) { _phoneCallController.SetData(data); _phoneCallController.Show(); } else { var view = InstantiateView <PhoneCallView>("Phone/Prefabs/PhoneCallView"); _phoneCallController = new PhoneCallController(); _phoneCallController.View = (PhoneCallView)view; RegisterController(_phoneCallController); _phoneCallController.Start(); _phoneCallController.SetData(data); } HideBackBtn(); }
private static void HandleShowWindow(List <MySmsOrCallVo> waitToShows) { var lsit = waitToShows; if (lsit.Count == 0) { return; } MySmsOrCallVo vo = lsit[0]; if (!lsit.Remove(vo)) { return; } if (vo.SceneId < 10000) { var win = PopupManager.ShowWindow <SmsTipsWindow>("Phone/Prefabs/Tips/SmsTipsWindow"); win.SetData(vo); _curTipsShow = win; } else { var win = PopupManager.ShowWindow <CallTipsWindow>("Phone/Prefabs/Tips/CallTipsWindow"); win.SetData(vo); _curTipsShow = win; } _curTipCoroutine = ClientTimer.Instance.DelayCall(() => { _curTipsShow.Close(); _curTipsShow = null; _curTipCoroutine = null; if (lsit.Count > 0) { MySmsOrCallVo v1 = lsit[0]; HandleShowWindow(lsit); GlobalData.PhoneData.AddSmsOrCallData(v1); List <int> l = new List <int>(); l.Add(v1.SceneId); EliminatEsceneId(l); } }, 8.0f); }
public void SetData(MySmsOrCallVo data) { transform.Find("NameText").GetComponent <Text>().text = data.Sender; //var date = new DateTime(data.CreateTime); string dateStr = ""; long hasPassedStamp = ClientTimer.Instance.GetCurrentTimeStamp() - data.CreateTime; if (hasPassedStamp < 0) { dateStr = I18NManager.Get("Phone_Tips1"); } else if (hasPassedStamp < 1000 * 60 * 60 * 24) { // long s = (data.CreateTime / 1000) % 60; long m = (data.CreateTime / (60 * 1000)) % 60; long h = (data.CreateTime / (60 * 60 * 1000) + 8) % 24; // dateStr = string.Format("{0:D2}:{1:D2}:{2:D2}", h, m, s); dateStr = string.Format("{0:D2}:{1:D2}", h, m); } else { dateStr = I18NManager.Get("Phone_Tips2"); } // transform.Find("MsgText").GetComponent<Text>().text = date.ToShortTimeString(); transform.Find("MsgText").GetComponent <Text>().text = dateStr; transform.Find("CallTips/Tips").gameObject.SetActive(!data.IsReaded); transform.Find("LeftHeadIcon/Image").GetComponent <RawImage>().texture = ResourceManager.Load <Texture>(PhoneData.GetHeadPath(data.NpcId), ModuleConfig.MODULE_PHONE); PointerClickListener.Get(transform.gameObject).onClick = delegate(GameObject go) { //EventDispatcher.TriggerEvent(EventConst.PhoneCallItemClick, data); CacheManager.ClickItem(data.NpcId, () => { EventDispatcher.TriggerEvent(EventConst.PhoneCallItemClick, data); }); }; }
public void SetData(MySmsOrCallVo vo) { AudioManager.Instance.PlayEffect("sms_tips", 1); Debug.Log("SetData"); transform.Find("LeftHeadIcon/Image").GetComponent <RawImage>().texture = ResourceManager.Load <Texture>(PhoneData.GetHeadPath(vo.NpcId), null, true); _vo = vo; //string showStr = ""; //if (vo.FirstTalkInfo.TalkContent.Length >) transform.Find("ReadBtn/Text").GetComponent <Text>().text = vo.FirstTalkInfo.TalkContent; transform.Find("NpcName").GetComponent <Text>().text = vo.Sender; transform.Find("ReadBtn").GetComponent <Button>().onClick.AddListener(() => { Debug.Log("ReadBtn ...."); if (CacheManager.isGuideSmsBySceneId(vo.SceneId)) { ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_PHONE, true, false, vo ); Close(); return; } CacheManager.ClickItem(vo.NpcId, () => { ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_PHONE, true, false, vo ); Close(); }, () => { ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_PHONE, true, false, vo ); Close(); }); //ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_PHONE, // true, false, vo // ); //Close(); }); }
public void SetData(MySmsOrCallVo data) { _data = data; transform.Find("SenderName").GetComponent <Text>().text = GlobalData.NpcModel.GetNpcById(data.NpcId).NpcName; _npcMsg.transform.Find("LeftHeadIcon/Image").GetComponent <RawImage>().texture = ResourceManager.Load <Texture>(PhoneData.GetHeadPath(0), ModuleName); string bgPath = "Background/PhoneCallBg" + data.NpcId; _bg.texture = ResourceManager.Load <Texture>(bgPath, ModuleName); //if (data.selectIds == null || data.selectIds.Count == 0) //{ // ShowCallingStatus(); //} //else //{ // ShowTalkingStatus(); //} _curTalkId = data.FirstTalkInfo.TalkId; _isFinishedShowMsg = false; ShowSelects(false); ShowTalkingStatus(); }
public bool IsSmsOrCallTipsShow(MySmsOrCallVo vo) { Dictionary <int, List <MySmsOrCallVo> > dirc = vo.SceneId < 10000 ? _npcSmsDic : _npcCallDic; if (!dirc.ContainsKey(vo.NpcId)) { return(true); } //检查是否有未读完的消息 List <MySmsOrCallVo> list = dirc[vo.NpcId]; MySmsOrCallVo t_vo; for (int i = 0; i < list.Count; i++) { t_vo = list[i]; if (!t_vo.IsReaded) { return(false); } } return(true); }
private void ShowList() { _isShowCurrent = true; _container = transform.Find("ListContainer/Contents"); _container.gameObject.Show(); transform.Find("HistoryView").gameObject.Hide(); for (int i = 0; i < _container.childCount; i++) { Destroy(_container.GetChild(i).gameObject); } var containerTrans = transform.Find("ListContainer"); var rect = containerTrans.GetComponent <ScrollRect>(); rect.verticalNormalizedPosition = 1; var prefab = GetPrefab("Phone/Prefabs/Item/TelephoneItem"); foreach (var vk in _data) { MySmsOrCallVo callVo = null; List <MySmsOrCallVo> mySms = vk.Value; mySms.Sort(); callVo = vk.Value.Find((match) => { return(match.IsReaded == false); }); if (callVo == null) { mySms.Sort((a, b) => { return(a.FinishTime.CompareTo(b.FinishTime)); }); callVo = mySms[mySms.Count - 1]; } else { } var item = Instantiate(prefab) as GameObject; item.transform.SetParent(_container, false); item.transform.localScale = Vector3.one; item.GetComponent <TelephoneItem>().SetData(callVo); } }
public void SetData(MySmsOrCallVo vo) { AudioManager.Instance.PlayEffect("call_tips", 1); //todo 根据vo设置头像 transform.Find("Bg/NpcName").GetComponent <Text>().text = vo.Sender; transform.Find("RefuseBtn").GetComponent <Button>().onClick.AddListener(() => { Debug.Log("RefuseBtn"); Close(); }); transform.Find("AnswerBtn").GetComponent <Button>().onClick.AddListener(() => { Debug.Log("AnswerBtn"); CacheManager.ClickItem(vo.NpcId, () => { ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_PHONE, true, false, vo ); Close(); }, () => { ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_PHONE, true, false, vo ); Close(); }); //ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_PHONE, // true, false, vo // ); //Close(); }); }
public void SetData(MySmsOrCallVo data) { Data = data; transform.Find("Text").GetComponent <Text>().text = data.SmsRuleInfo.smsSceneInfo.SceneName; }
//顶部弹出窗口跳入 public void SetDataById(MySmsOrCallVo data) { //View.SetData(data);. View.SetData(data); }
public void SetData(MySmsOrCallVo data) { View.SetData(data); }
private void OnClickMsgItem(MySmsOrCallVo data) { SendMessage(new Message(MessageConst.CMD_PHONE_CALL_SHOWDETAIL, Message.MessageReciverType.DEFAULT, data)); }
static List <MySmsOrCallVo> _waitToShows;//等待显示一般只有四个NPC的 /// <summary> /// 通用手机tips /// </summary> /// <param name="content">提示内容</param> /// <param name="title">标题</param> /// <param name="okBtnText">确定按钮文本</param> /// <param name="cancelBtnText">取消按钮文本</param> /// <returns></returns> public static void ShowPhoneTipsWindow(Action finished = null) { var curStep = GuideManager.CurStage(); //如果能保证新手引导要使用的资源提前达到包里的话,该判断条件可以去掉 if (curStep < GuideStage.ExtendDownloadStage) { finished?.Invoke(); return; } _waitToShows.Clear(); bool isHoldShow = false; byte[] buffer = NetWorkManager.GetByteData(new Com.Proto.UserPhoneTipDataReq() { }); NetWorkManager.Instance.Send <Com.Proto.UserPhoneTipDataRes>(Assets.Scripts.Module.NetWork.CMD.PHONEC_TIPS_DATA, buffer, (res) => { List <int> EliminatSceneIds = new List <int>(); for (int i = 0; i < res.FriendCircles.Count; i++) { FriendCircleVo vo = PhoneData.TransFriendCircleData(res.FriendCircles[i]); if (vo == null) { continue; } GlobalData.PhoneData.AddFriendCircleData(vo); Util.SetIsRedPoint(Constants.REDPOINT_PHONE_BGVIEW_FC, true); EliminatSceneIds.Add(vo.SceneId); } for (int i = 0; i < res.MicroBlogs.Count; i++) { WeiboVo vo = PhoneData.TransWeiboData(res.MicroBlogs[i]); if (vo == null) { continue; } GlobalData.PhoneData.AddWeiboData(vo); Util.SetIsRedPoint(Constants.REDPOINT_PHONE_BGVIEW_WEIBO, true); EliminatSceneIds.Add(vo.SceneId); } bool isShowTips = false; //MySmsOrCallVo voTips = null; for (int i = 0; i < res.MsgOrCalls.Count; i++) { //一次只会触发一条短信 先默认最后一条 //先转数据格式 MySmsOrCallVo vo = PhoneData.TransSmsOrCallData(res.MsgOrCalls[i]); if (vo == null || vo.FirstTalkInfo.NpcId == 0) { continue; } isShowTips = GlobalData.PhoneData.IsSmsOrCallTipsShow(vo); if (!isShowTips) { if (vo.SceneId < 10000) { Util.SetIsRedPoint(Constants.REDPOINT_PHONE_BGVIEW_SMS, true); } else { Util.SetIsRedPoint(Constants.REDPOINT_PHONE_BGVIEW_CALL, true); } GlobalData.PhoneData.AddSmsOrCallData(vo); EliminatSceneIds.Add(vo.SceneId); } else { if (_waitToShows.Find((m) => { return(m.NpcId == vo.NpcId); }) != null) { continue; } _waitToShows.Add(vo); } } if (_waitToShows.Count > 0)//第一个默认添加 { _waitToShows.Sort(); GlobalData.PhoneData.AddSmsOrCallData(_waitToShows[0]); EliminatSceneIds.Add(_waitToShows[0].SceneId); } for (int i = 0; i < res.MsgOrCalls.Count; i++) { //一次只会触发一条短信 先默认最后一条 //先转数据格式 MySmsOrCallVo vo = PhoneData.TransSmsOrCallData(res.MsgOrCalls[i]); if (vo == null || vo.FirstTalkInfo.NpcId != 0) { continue; } GlobalData.PhoneData.AddSmsOrCallData(vo); EliminatSceneIds.Add(vo.SceneId); if (vo.SceneId < 10000) { Util.SetIsRedPoint(Constants.REDPOINT_PHONE_BGVIEW_SMS, true); } else { Util.SetIsRedPoint(Constants.REDPOINT_PHONE_BGVIEW_CALL, true); } } //test EliminatEsceneId(EliminatSceneIds); finished?.Invoke(); // if (!isShowTips) return; HandleShowWindow(_waitToShows); return; }, (v) => { finished?.Invoke(); }); }
public void SetData(List <MySmsOrCallVo> data) { MySmsOrCallVo smsVo = FindCurShowData(data); _data = data; if (smsVo == null) { data.Sort((a, b) => { return(a.FinishTime.CompareTo(b.FinishTime)); }); smsVo = data[data.Count - 1]; Debug.LogError(smsVo.SceneId); // transform.Find("MsgText").GetComponent<Text>().text = "无消息"; transform.Find("MsgText").GetComponent <Text>().text = smsVo.CurTalkInfo.TalkContent; transform.Find("NumTips").gameObject.SetActive(false); } else { transform.Find("NumTips").gameObject.SetActive(true); transform.Find("NumTips/Text").GetComponent <Text>().text = "1"; transform.Find("MsgText").GetComponent <Text>().text = I18NManager.Get("Phone_Sms_New"); } transform.Find("NameText").GetComponent <Text>().text = smsVo.Sender; transform.Find("LeftHeadIcon/Image").GetComponent <RawImage>().texture = ResourceManager.Load <Texture>(PhoneData.GetHeadPath(smsVo.NpcId), ModuleConfig.MODULE_PHONE); var date = new DateTime(smsVo.CreateTime); string dateStr = ""; long hasPassedStamp = ClientTimer.Instance.GetCurrentTimeStamp() - smsVo.CreateTime; if (hasPassedStamp < 0) { dateStr = I18NManager.Get("Phone_Tips1"); } else if (hasPassedStamp < 1000 * 60 * 60 * 24) { // long s = (smsVo.CreateTime / 1000) % 60; long m = (smsVo.CreateTime / (60 * 1000)) % 60; long h = (smsVo.CreateTime / (60 * 60 * 1000) + 8) % 24; // dateStr = string.Format("{0:D2}:{1:D2}:{2:D2}", h, m, s); dateStr = string.Format("{0:D2}:{1:D2}", h, m); } else { dateStr = I18NManager.Get("Phone_Tips2"); } transform.Find("Text").GetComponent <Text>().text = dateStr; //transform.Find("Text").GetComponent<Text>().text = date.ToShortTimeString(); PointerClickListener.Get(transform.gameObject).onClick = delegate(GameObject go) { if (CacheManager.isGuideSmsBySceneId(smsVo.SceneId)) { EventDispatcher.TriggerEvent(EventConst.PhoneSmsItemClick, data); return; } CacheManager.ClickItem(smsVo.NpcId, () => { EventDispatcher.TriggerEvent(EventConst.PhoneSmsItemClick, data); }, () => { EventDispatcher.TriggerEvent(EventConst.PhoneSmsItemClick, data); } ); // EventDispatcher.TriggerEvent(EventConst.PhoneSmsItemClick, data); }; }