| | |
| | | private int InDay;
|
| | | #region Built-in |
| | | OpenServiceAchievementModel model { get { return ModelCenter.Instance.GetModel<OpenServiceAchievementModel>(); } } |
| | | List<int> SortList = new List<int>(); |
| | | protected override void BindController() |
| | | { |
| | | m_ScrollerController1.OnRefreshCell += OnRefreshGridCell_1; |
| | |
| | | |
| | | protected override void OnAfterOpen() |
| | | { |
| | | model.WeekPartyDayInfoUpdate += WeekPartyDayInfoUpdate; |
| | | } |
| | | |
| | | protected override void OnPreClose() |
| | | { |
| | | } |
| | | |
| | | {
|
| | | model.WeekPartyDayInfoUpdate -= WeekPartyDayInfoUpdate; |
| | | }
|
| | |
|
| | | |
| | |
|
| | | protected override void OnAfterClose() |
| | | { |
| | | }
|
| | | private void WeekPartyDayInfoUpdate()//列表刷新
|
| | | {
|
| | | m_ScrollerController2.m_Scorller.RefreshActiveCellViews();//刷新可见
|
| | | }
|
| | | #endregion |
| | | void OnCreateGridLineCell1(ScrollerController gridCtrl)
|
| | |
| | | {
|
| | | InDay = Index;
|
| | | model.SelectedNow = InDay;//选中天
|
| | | OnCreateGridLineCell2(m_ScrollerController2);
|
| | | m_ScrollerController1.m_Scorller.RefreshActiveCellViews();//刷新可见
|
| | | }
|
| | | });
|
| | |
| | | //-------------------------------
|
| | | void OnCreateGridLineCell2(ScrollerController gridCtrl)
|
| | | {
|
| | | ToAddSorting();//排序
|
| | | gridCtrl.Refresh();
|
| | | for (int i = 0; i < 8; i++)
|
| | | {
|
| | |
| | |
|
| | | }
|
| | | |
| | | private void ToAddSorting()
|
| | | {
|
| | | SortList.Clear();
|
| | | foreach (var key in model.WeekPartyDayDic.Keys)
|
| | | {
|
| | | if (key == model.SelectedNow)
|
| | | {
|
| | | for (int i = 0; i < model.WeekPartyDayDic[key].TemplateList.Length; i++)
|
| | | {
|
| | | SortList.Add(model.WeekPartyDayDic[key].TemplateList[i]);
|
| | | }
|
| | | }
|
| | | }
|
| | | SortList.Sort(Compare);
|
| | | }
|
| | | int Compare(int x, int y)//数组排列
|
| | | {
|
| | | bool havex1 = IsReceive(x);
|
| | | bool havey1 = IsReceive(y);
|
| | | if (havex1.CompareTo(havey1) != 0)
|
| | | {
|
| | | return -havex1.CompareTo(havey1);
|
| | | }
|
| | | bool havex2 = Undone(x);
|
| | | bool havey2 = Undone(y);
|
| | | if (havex2.CompareTo(havey2) != 0)
|
| | | {
|
| | | return -havex2.CompareTo(havey2);
|
| | | }
|
| | | bool havex3 = Completed(x);
|
| | | bool havey3 = Completed(y);
|
| | | if (havex3.CompareTo(havey3) != 0)
|
| | | {
|
| | | return -havex3.CompareTo(havey3);
|
| | | }
|
| | | int havex4 = SizeId(x);
|
| | | int havey4 = SizeId(y);
|
| | | if (havex4.CompareTo(havey4) != 0)
|
| | | {
|
| | | return havex4.CompareTo(havey4);
|
| | | }
|
| | | return 1;
|
| | | } |
| | | private bool IsReceive(int ID)//可领取
|
| | | {
|
| | | bool Bool = false;
|
| | | if (model.WeekPartyActionDic.ContainsKey(ID))
|
| | | {
|
| | | var WeekPartyAction = model.WeekPartyActionDic[ID];
|
| | | int number = WeekPartyAction.TotalTimes / WeekPartyAction.SingleTimes;
|
| | | int rewardNum = model.GetRewardNumber(model.SelectedNow, ID);//已领奖次数
|
| | | int carryOutNum = model.GetCarryOutNum(model.SelectedNow, ID);//已完成次数
|
| | | if (carryOutNum >= WeekPartyAction.SingleTimes && number > rewardNum)
|
| | | {
|
| | | Bool = true;
|
| | | }
|
| | | } |
| | | return Bool;
|
| | | } |
| | | private bool Undone(int ID)//未完成
|
| | | {
|
| | | bool Bool = false;
|
| | | if (model.WeekPartyActionDic.ContainsKey(ID))
|
| | | {
|
| | | var WeekPartyAction = model.WeekPartyActionDic[ID];
|
| | | int number = WeekPartyAction.TotalTimes / WeekPartyAction.SingleTimes;
|
| | | int rewardNum = model.GetRewardNumber(model.SelectedNow, ID);//已领奖次数
|
| | | int carryOutNum = model.GetCarryOutNum(model.SelectedNow, ID);//已完成次数
|
| | | if (WeekPartyAction.SingleTimes > carryOutNum)
|
| | | {
|
| | | Bool = true;
|
| | | }
|
| | | }
|
| | | return Bool;
|
| | | } |
| | | private bool Completed(int ID)//已领取
|
| | | {
|
| | | bool Bool = false;
|
| | | if (model.WeekPartyActionDic.ContainsKey(ID))
|
| | | {
|
| | | var WeekPartyAction = model.WeekPartyActionDic[ID];
|
| | | int number = WeekPartyAction.TotalTimes / WeekPartyAction.SingleTimes;
|
| | | int rewardNum = model.GetRewardNumber(model.SelectedNow, ID);//已领奖次数
|
| | | int carryOutNum = model.GetCarryOutNum(model.SelectedNow, ID);//已完成次数
|
| | | if (rewardNum> number)
|
| | | {
|
| | | Bool = true;
|
| | | }
|
| | | }
|
| | | return Bool;
|
| | | } |
| | | private int SizeId(int ID)
|
| | | {
|
| | | int index = 1;
|
| | | var config = Config.Instance.Get<WeekPartyConfig>(ID);
|
| | | if (config != null)
|
| | | {
|
| | | index = config.order;
|
| | | }
|
| | | return index;
|
| | | } |
| | | } |
| | | |
| | | } |