Example #1
0
        public void Transition()
        {
            position += Time.deltaTime * speed * Vector2.right * -1;

            SetPosition(position);

            switch (status)
            {
            case NoticeStatus.Next:
                if (position.x < point)
                {
                    next?.Invoke();

                    status = NoticeStatus.Final;
                }
                break;

            case NoticeStatus.Final:
                if (position.x < destination)
                {
                    completed?.Invoke(ID);

                    status = NoticeStatus.End;
                }
                break;
            }
        }
Example #2
0
        private void Completed()
        {
            status = NoticeStatus.None;

            animator.onCompleted.AddListener(() =>
            {
                UIManager.Instance.Close(UIPanel.UIHorseLamp);
            });
            animator.Begin(false);
        }
Example #3
0
        public override void Refresh(Paramter paramter)
        {
            if (paramter == null)
            {
                return;
            }

            message.Add(paramter.Get <string>("message"));

            if (status == NoticeStatus.None)
            {
                status = NoticeStatus.Compute;
            }
        }
Example #4
0
        private void Completed(int ID)
        {
            int index = items.FindIndex(x => x.ID == ID);

            if (index != -1)
            {
                items[index].Destroy();
                items.RemoveAt(index);
            }

            if (items.Count == 0)
            {
                status = NoticeStatus.Completed;
            }
        }
Example #5
0
        private void Compute()
        {
            if (message.Count > 0)
            {
                ItemHorseLamp item = prefab.Create <ItemHorseLamp>();

                item.ID = NextID;

                item.next = Next;

                item.completed = Completed;

                item.Init(message[0], UnityEngine.UI.Config.ScreenHalfWidth);

                items.Add(item);

                message.RemoveAt(0);

                status = NoticeStatus.Transition;
            }
        }
Example #6
0
        public float Init(string content, float screen, float space = 100)
        {
            status = NoticeStatus.First;

            text.text = content;

            float width = Mathf.Max(text.preferredWidth, min);

            origin = screen + space;

            point = screen - width;

            destination = (screen + width + space) * -1;

            this.position = new Vector2(origin, 0);

            Adapt(position, width);

            status = NoticeStatus.Next;

            return(width);
        }
Example #7
0
 /// <summary>
 /// 获取用户通知的分页集合
 /// </summary>
 /// <param name="userId">用户Id</param>
 /// <param name="status">通知状态</param>
 /// <param name="typeId">通知类型Id</param>
 /// <param name="applicationId">应用Id</param>
 /// <param name="pageIndex">页码</param>
 /// <returns>通知分页集合</returns>
 public PagingDataSet<Notice> Gets(long userId, NoticeStatus? status, int? typeId, int? applicationId, int? pageIndex = null)
 {
     //按照创建日期倒序排序
     return noticeRepository.Gets(userId, status, typeId, applicationId, pageIndex ?? 1);
 }
        public ActionResult ClearAll(string spaceKey, NoticeStatus? status)
        {
            long userId = UserIdToUserNameDictionary.GetUserId(spaceKey);

            noticeService.ClearAll(userId, status);

            return RedirectToAction("ListNotices", new { spaceKey = spaceKey, pageIndex = 1 });
        }
Example #9
0
        public async Task <IEnumerable <Notice> > GetUserNoticesAsync(string userId, int index, int number, NoticeStatus noticeStatus)
        {
            var usersPosts = from x in DbContext.UserNoticePostRelationship
                             where x.UserId == userId && x.Notice.Status == noticeStatus
                             select x.Notice;

            usersPosts = usersPosts.OrderByDescending(n => n.DateCreated);

            if (index > 0)
            {
                usersPosts = usersPosts.Skip(index);
            }

            usersPosts = usersPosts.Take(number);

            return(await usersPosts
                   .Include(nb => nb.NoticeBoard)
                   .ToListAsync());
        }
Example #10
0
 /// <summary>
 /// 清空接收人的通知记录
 /// </summary>
 /// <param name="userId">接收人Id</param>
 /// <param name="status">通知状态</param>
 public void ClearAll(long userId, NoticeStatus? status = null)
 {
     noticeRepository.ClearAll(userId, status);
 }
        public ActionResult SetIsHandled(string spaceKey, long noticeId, NoticeStatus? status, int? pageIndex)
        {
            long userId = UserIdToUserNameDictionary.GetUserId(spaceKey);

            Notice notice = noticeService.Get(noticeId);
            if (notice != null)
                noticeService.SetIsHandled(noticeId);

            return RedirectToAction("_ListNotices", new { spaceKey = spaceKey, status = status, pageIndex = pageIndex });
        }
        public ActionResult _ListNotices(string spaceKey, NoticeStatus? status, int? pageIndex)
        {
            long userId = UserIdToUserNameDictionary.GetUserId(spaceKey);

            PagingDataSet<Notice> notices = noticeService.Gets(userId, status, null, null, pageIndex ?? 1);
            ViewData["userId"] = userId;
            ViewData["status"] = status;
            ViewData["pageIndex"] = pageIndex;
            return View(notices);
        }
        public ActionResult SetAllNoticeIsHandled(string spaceKey, NoticeStatus? status)
        {
            long userId = UserIdToUserNameDictionary.GetUserId(spaceKey);

            string selectedNoticeIDsString = Request.Form["noticeId"];
            if (!string.IsNullOrEmpty(selectedNoticeIDsString))
            {
                string[] selectedNoticeIDsStringArray = selectedNoticeIDsString.Split(',');
                if (selectedNoticeIDsStringArray != null && selectedNoticeIDsStringArray.Length > 0)
                {
                    int noticeId;
                    foreach (string Id in selectedNoticeIDsStringArray)
                    {
                        try
                        {
                            noticeId = int.Parse(Id);
                            noticeService.SetIsHandled(noticeId);
                        }
                        catch { }
                    }
                }
            }

            return RedirectToAction("ListNotices", new { spaceKey = spaceKey, status = status, pageIndex = 1 });
        }
        public ActionResult ListNotices(string spaceKey, NoticeStatus? status, int? pageIndex)
        {
            pageResourceManager.InsertTitlePart("通知");

            long userId = UserIdToUserNameDictionary.GetUserId(spaceKey);
            PagingDataSet<Notice> notices = noticeService.Gets(userId, status, null, null, pageIndex ?? 1);

            int unhandledCount = noticeService.GetUnhandledCount(userId);
            ViewData["unhandledCount"] = unhandledCount;
            ViewData["status"] = status;
            ViewData["pageIndex"] = pageIndex;

            return View(notices);
        }
Example #15
0
 /// <summary>
 /// 显示通知页面
 /// </summary>
 /// <param name="spaceKey">spaceKey</param>
 /// <param name="status">私信状态</param>
 /// <param name="pageIndex">页码</param>
 public string ListNotices(string spaceKey, NoticeStatus? status, int? pageIndex)
 {
     return CachedUrlHelper.Action("ListNotices", "MessageCenter", CommonAreaName, new RouteValueDictionary() { { "spaceKey", spaceKey }, { "status", status }, { "pageIndex", pageIndex } });
 }
Example #16
0
 /// <summary>
 /// 删除通知
 /// </summary>
 /// <param name="spaceKey">spaceKey</param>
 /// <param name="noticeId">通知ID</param>
 /// <param name="status">私信状态</param>
 /// <param name="pageIndex">页码</param>
 public string DeleteNotice(string spaceKey, long noticeId, NoticeStatus? status, int? pageIndex)
 {
     return CachedUrlHelper.Action("DeleteNotice", "MessageCenter", CommonAreaName, new RouteValueDictionary() { { "spaceKey", spaceKey }, { "noticeId", noticeId }, { "status", status }, { "pageIndex", pageIndex } });
 }
Example #17
0
 /// <summary>
 /// 更新通知为已读
 /// </summary>
 /// <param name="spaceKey">spaceKey</param>
 /// <param name="status">私信状态</param>
 public string ClearAll(string spaceKey, NoticeStatus? status)
 {
     return CachedUrlHelper.Action("ClearAll", "MessageCenter", CommonAreaName, new RouteValueDictionary() { { "spaceKey", spaceKey }, { "status", status } });
 }