Пример #1
0
        /// <summary>
        /// 通过[id]二分快速查表
        /// </summary>
        /// <param name="id">id</param>
        /// <returns></returns>
        public static DailyDataBase Query(this List <DailyDataBase> sorted, uint id)
        {
            var key = new DailyDataBase()
            {
                id = id
            };
            var comparer = new Comparer1();
            var index    = sorted.BinarySearch(key, comparer);

            return(index >= 0 ? sorted[index] : default(DailyDataBase));
        }
Пример #2
0
    /// <summary>
    /// 商城格子数据刷新
    /// </summary>
    /// <param name="grid"></param>
    /// <param name="index"></param>
    private void OnUpdateMallGridData(UIGridBase grid, int index)
    {
        if (grid is UITabGrid)
        {
            if (index > DailyTabValues.Count)
            {
                Engine.Utility.Log.Error("DailyPanel OnUpdateMallGridData faield,mallTabDic data errir");
                return;
            }

            UITabGrid tabGrid = grid as UITabGrid;
            tabGrid.SetName(DailyTabValues[index]);
            tabGrid.SetHightLight(activeTabId == index ? true : false);
            tabGrid.SetGridData(index);
        }
        else if (grid is UIDailyGrid)
        {
            DailyDataBase data = dailyDataList[index];
            if (DataManager.Manager <DailyManager>().ActiveDic.ContainsKey(data.id))
            {
                LivenessData list = DataManager.Manager <DailyManager>().ActiveDic[data.id];
                if (data != null && list != null)
                {
                    UIDailyGrid dailyGrid = grid as UIDailyGrid;
                    dailyGrid.SetDailyData(data, list);
                    dailyGrid.SetSelect(index == m_lstDailyID.IndexOf(selectDailyId));
                    dailyGrid.onClickDailyGrid = onClickDailyGrid;
                }
            }
        }
        else if (grid is UIDailyCalendarGrid)
        {
            UIDailyCalendarGrid data = grid as UIDailyCalendarGrid;
            if (data != null)
            {
                data.SetGridData(dailyIDs[index]);
                data.SetBg(todayIsMatch);
            }
        }
        else if (grid is UIDailyRewardGrid)
        {
            UIDailyRewardGrid data = grid as UIDailyRewardGrid;
            if (data != null)
            {
                if (index < m_lstRewardID.Count)
                {
                    data.SetGridData(m_lstRewardID[index]);
                }
            }
        }
    }
Пример #3
0
    public List <LivenessData> FormDailyData(DailyDataType type)
    {
        m_dicDailyData[DailyDataType.RiChangHuoDong].Clear();
        m_dicDailyData[DailyDataType.XianShiHuoDong].Clear();
        m_dicDailyData[DailyDataType.JiJiangKaiShi].Clear();
        m_dicDailyData[DailyDataType.ZhouLi].Clear();
        for (int i = 0; i < activeList.Count; i++)
        {
            DailyDataBase data = GameTableManager.Instance.GetTableItem <DailyDataBase>(activeList[i].type);
            if (data != null)
            {
                int level = MainPlayerHelper.GetPlayerLevel();
                if (level >= data.minLevel)
                {
                    if (data.type == 1)
                    {
                        if (m_dicDailyData.ContainsKey(DailyDataType.RiChangHuoDong))
                        {
                            m_dicDailyData[DailyDataType.RiChangHuoDong].Add(activeList[i]);
                        }
                    }
                    else if (data.type == 2)
                    {
                        m_dicDailyData[DailyDataType.XianShiHuoDong].Add(activeList[i]);
                    }
                    else
                    {
                        if (IsDailyScheduleInToday(data))
                        {
                            m_dicDailyData[DailyDataType.XianShiHuoDong].Add(activeList[i]);
                        }
                        else
                        {
                            m_dicDailyData[DailyDataType.JiJiangKaiShi].Add(activeList[i]);
                        }
                    }
                }
                else
                {
                    if (m_dicDailyData.ContainsKey(DailyDataType.JiJiangKaiShi))
                    {
                        m_dicDailyData[DailyDataType.JiJiangKaiShi].Add(activeList[i]);
                    }
                }
            }
        }

        return(m_dicDailyData[type]);
    }
Пример #4
0
    /// <summary>
    /// 刷新日常的日程时间
    /// </summary>
    public bool UpdateDataLeftTime(DailyDataBase data, out long leftSeconds)
    {
        StructScheduleInfo(data);
        bool isInSchedule = IsTimeInSchedule(data.id, DateTimeHelper.Instance.Now, out leftSeconds);

        if (isInSchedule)
        {
            LeftScheduleTime = 0;
        }
        else
        {
            LeftScheduleTime = leftSeconds;
        }

        return(isInSchedule);
    }
Пример #5
0
    public override void SetGridData(object data)
    {
        base.SetGridData(data);
        this.dailyID = (uint)data;
        DailyDataBase tab = GameTableManager.Instance.GetTableItem <DailyDataBase>(dailyID);

        if (tab != null)
        {
            name.text = tab.name;
            time.text = tab.activityTime;
            //time.text = DataManager.Manager<DailyManager>().GetActiveAndEndTimeByID(tab, 2).ToString();
        }
        else
        {
            Engine.Utility.Log.Error("null" + data.ToString());
        }
    }
Пример #6
0
    DailyPushData ConstructDailyPushData(DailyDataBase data)
    {
        long leftSeconds           = 0;
        bool inSchedule            = DataManager.Manager <DailyManager>().UpdateDataLeftTime(data, out leftSeconds);
        DailyPushMsgState curState = DailyPushMsgState.Closed;

        if (inSchedule)
        {
            if (leftSeconds > 0)
            {
                curState = DailyPushMsgState.Showing;
            }
            else
            {
                curState = DailyPushMsgState.Closed;
            }
        }
        else
        {
            if (leftSeconds <= 0 || leftSeconds > gap)
            {
                curState = DailyPushMsgState.Closed;
            }
            else if (leftSeconds <= gap)
            {
                curState = DailyPushMsgState.PreShow;
            }
            else
            {
                curState = DailyPushMsgState.Showing;
            }
        }

        DailyPushData pushDaily = new DailyPushData()
        {
            dailyID     = data.id,
            dailyName   = data.name,
            iconName    = data.pushIcon,
            leftSeconds = leftSeconds,
            InSchedule  = inSchedule,
            curState    = curState,
        };

        return(pushDaily);
    }
Пример #7
0
 public bool IsDailyScheduleInToday(DailyDataBase data)
 {
     if (m_scheduleDic.ContainsKey(data.id))
     {
         if (m_scheduleDic[data.id] != null)
         {
             DateTime dt = DateTimeHelper.TransformServerTime2DateTime(DateTimeHelper.Instance.Now);
             List <ScheduleDefine.ScheduleLocalData> list = m_scheduleDic[data.id];
             for (int i = 0; i < list.Count; i++)
             {
                 if (list[i].TabData.week == (uint)dt.DayOfWeek && list[i].TabData.cycleType == 3)
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Пример #8
0
    protected override void OnLoading()
    {
        base.OnLoading();

        for (int i = 0; i < m_grid_Grid.transform.childCount; i++)
        {
            Transform ts = m_grid_Grid.transform.GetChild(i);
            UIDailyAnswerAnswerGrid grid = ts.gameObject.GetComponent <UIDailyAnswerAnswerGrid>();
            if (grid == null)
            {
                grid = ts.gameObject.AddComponent <UIDailyAnswerAnswerGrid>();
            }

            grid.ReSetRightOrWrong();
            grid.SetSelect(false);
        }

        uint dailyId = DataManager.Manager <DailyAnswerManager>().DailyAnswerDailyId;

        m_dailyDb = GameTableManager.Instance.GetTableItem <DailyDataBase>(dailyId);
    }
Пример #9
0
 void SetBtnSchedule(DailyDataBase dailyData)
 {
     if (isInSchedule)
     {
         m_btn_Go.isEnabled = true;
         btn_go_label.text  = "参加";
     }
     else
     {
         if (leftSeconds > 0)
         {
             btn_go_label.text  = DataManager.Manager <DailyManager>().GetCloserScheduleTimeByID(dailyData.id);
             m_btn_Go.isEnabled = false;
         }
         else
         {
             btn_go_label.text  = "已结束";
             m_btn_Go.isEnabled = false;
         }
     }
 }
Пример #10
0
    /// <summary>
    /// 是否时间seconds在当前日常日程内
    /// </summary>
    /// <param name="date">当前时间</param>
    /// <param name="leftSeconds">如果在日程内,返回最大剩余时间
    /// ,如果不在日程内返回下一个日程最小等待时间</param>
    /// <returns></returns>
    public bool IsTimeInSchedule(uint dailyID, System.DateTime date, out long leftSeconds)
    {
        bool inSchedule = false;

        leftSeconds = 0;
        long scheduleLeftTime = 0;
        long nextScheduleTime = 0;

        if (!m_scheduleDic.ContainsKey(dailyID))
        {
            DailyDataBase data = GameTableManager.Instance.GetTableItem <DailyDataBase>(dailyID);
            StructScheduleInfo(data);
        }
        else
        {
            scheduleInfos = m_scheduleDic[dailyID];
        }

        if (null != scheduleInfos && scheduleInfos.Count > 0)
        {
            for (int i = 0; i < scheduleInfos.Count; i++)
            {
                if (scheduleInfos[i].IsInSchedule(date, out leftSeconds))
                {
                    inSchedule = true;
                    if (leftSeconds > scheduleLeftTime)
                    {
                        scheduleLeftTime = leftSeconds;
                    }
                }
                else if (leftSeconds > 0 && leftSeconds > nextScheduleTime)
                {
                    nextScheduleTime = leftSeconds;
                }
            }
        }
        leftSeconds = (inSchedule) ? scheduleLeftTime : nextScheduleTime;
        //Engine.Utility.Log.Error("ID:" + dailyID + "---bool:" + inSchedule + "---DateTime:" + date + "---leftSeconds:" + leftSeconds);
        return(inSchedule);
    }
Пример #11
0
    /// <summary>
    /// 构建日程信息
    /// </summary>
    public void StructScheduleInfo(DailyDataBase daily)
    {
        scheduleInfos = new List <ScheduleDefine.ScheduleLocalData>();
        table.DailyDataBase dailyData = daily;
        if (null != dailyData && !string.IsNullOrEmpty(dailyData.ScheduleId))
        {
            string[] scheduleIdArray = dailyData.ScheduleId.Split(new char[] { '_' });
            if (null != scheduleIdArray)
            {
                ScheduleDefine.ScheduleLocalData scheduleTemp = null;
                for (int i = 0; i < scheduleIdArray.Length; i++)
                {
                    scheduleTemp = new ScheduleDefine.ScheduleLocalData(uint.Parse(scheduleIdArray[i].Trim()));
                    scheduleInfos.Add(scheduleTemp);
                }

                if (!m_scheduleDic.ContainsKey(daily.id))
                {
                    m_scheduleDic.Add(daily.id, scheduleInfos);
                }
            }
        }
    }
Пример #12
0
 /// <summary>
 /// 设置选中数据
 /// </summary>
 /// <param name="mallItemId"></param>
 public void SetSelectDailyGrid(uint DailyID)
 {
     if (this.selectDailyId == DailyID)
     {
         return;
     }
     if (null != m_ctor_ContentScrollView)
     {
         UIDailyGrid grid = m_ctor_ContentScrollView.GetGrid <UIDailyGrid>(m_lstDailyID.IndexOf(selectDailyId));
         if (null != grid)
         {
             grid.SetSelect(false);
         }
         m_ctor_ContentScrollView.FocusGrid(m_lstDailyID.IndexOf(DailyID));
         grid = m_ctor_ContentScrollView.GetGrid <UIDailyGrid>(m_lstDailyID.IndexOf(DailyID));
         if (null != grid)
         {
             grid.SetSelect(true);
         }
     }
     selectDailyId = DailyID;
     curDailyData  = GameTableManager.Instance.GetTableItem <DailyDataBase>(DailyID);
     ShowDailInfo();
 }
Пример #13
0
 public override void SetGridData(object data)
 {
     base.SetGridData(data);
     if (data is RewardFindData)
     {
         m_rewardData = (RewardFindData)data;
         RewardFindID = m_rewardData.id;
         if (titleName != null)
         {
             DailyDataBase daily = GameTableManager.Instance.GetTableItem <DailyDataBase>(m_rewardData.id);
             if (daily != null)
             {
                 titleName.text = daily.name;
             }
         }
         if (leftTime != null)
         {
             leftTime.text = m_rewardData.left_time.ToString();
         }
         SetButtonState();
         RefreshItems();
         SetMoneyContent();
     }
 }
Пример #14
0
    void SetBtnSchedule(DailyDataBase dailyData)
    {
        long leftSeconds = 0;

        isInSchedule = DataManager.Manager <DailyManager>().UpdateDataLeftTime(dailyData, out leftSeconds);
        if (isInSchedule)
        {
            m_btn_JoinBtn.isEnabled = true;
            m_btn_JoinBtn.GetComponentInChildren <UILabel>().text = "参加";
        }
        else
        {
            if (leftSeconds > 0)
            {
                m_btn_JoinBtn.GetComponentInChildren <UILabel>().text = DataManager.Manager <DailyManager>().GetCloserScheduleTimeByID(dailyData.id);
                m_btn_JoinBtn.isEnabled = false;
            }
            else
            {
                m_btn_JoinBtn.GetComponentInChildren <UILabel>().text = "已结束";
                m_btn_JoinBtn.isEnabled = false;
            }
        }
    }
Пример #15
0
    public void Process(float deltaTime)
    {
        if (dailyPushList.Count > 0)
        {
            bool CanReduction = false;
            next_refresh_left_time -= deltaTime;
            if (next_refresh_left_time <= UnityEngine.Mathf.Epsilon)
            {
                next_refresh_left_time = DAILYTIMEUPDATEGAP;
                CanReduction           = true;
            }
            if (!CanReduction)
            {
                return;
            }


            bool update = false;
            for (int i = 0; i < dailyPushList.Count; i++)
            {
                dailyPushList[i].leftSeconds--;
                long leftSeconds = dailyPushList[i].leftSeconds;
                if (dailyPushList[i].InSchedule)
                {
                    //在日程内是还剩多久结束
                    if (leftSeconds > 0)
                    {
                        if (dailyPushList[i].curState != DailyPushMsgState.Showing)
                        {
                            dailyPushList[i].curState = DailyPushMsgState.Showing;
                            update = true;
                        }
                    }
                    else
                    {
                        if (dailyPushList[i].curState != DailyPushMsgState.Closed)
                        {
                            dailyPushList[i].curState = DailyPushMsgState.Closed;
                            update = true;
                        }
                    }
                }
                else
                {
                    //一开始不在日程内,时间推移需要重置一下进入日程后的状态
                    if (leftSeconds <= 0)
                    {
                        if (dailyPushList[i].curState == DailyPushMsgState.PreShow)
                        {
                            DailyDataBase data = GameTableManager.Instance.GetTableItem <DailyDataBase>(dailyPushList[i].dailyID);
                            if (data != null)
                            {
                                dailyPushList[i] = ConstructDailyPushData(data);
                                update           = true;
                            }
                        }
                        else
                        {
                            if (dailyPushList[i].curState != DailyPushMsgState.Closed)
                            {
                                dailyPushList[i].curState = DailyPushMsgState.Closed;
                                update = true;
                            }
                        }
                    }
                    else if (leftSeconds <= gap)
                    {
                        if (dailyPushList[i].curState != DailyPushMsgState.PreShow)
                        {
                            dailyPushList[i].curState = DailyPushMsgState.PreShow;
                            update = true;
                        }
                    }
                    else
                    {
                        if (dailyPushList[i].curState != DailyPushMsgState.Closed)
                        {
                            dailyPushList[i].curState = DailyPushMsgState.Closed;
                            update = true;
                        }
                    }
                }
            }
            if (update)
            {
                Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.REFRESHDAILYPUSHSTATUS, null);
            }
        }
    }
Пример #16
0
    public void ListSort(List <LivenessData> list)
    {
        tempList1.Clear();
        tempList2.Clear();
        tempList3.Clear();
        tempList4.Clear();
        tempList6.Clear();
        openList.Clear();
        closeList.Clear();
        for (int i = 0; i < list.Count; i++)
        {
            DailyDataBase data = GameTableManager.Instance.GetTableItem <DailyDataBase>(list[i].type);
            if (data != null)
            {
                int level = MainPlayerHelper.GetPlayerLevel();
                if (level >= data.minLevel)
                {
                    openList.Add(list[i]);
                }
                else
                {
                    closeList.Add(list[i]);
                }
                if (!ActiveDic.ContainsKey(list[i].type))
                {
                    ActiveDic.Add(list[i].type, list[i]);
                }
            }
        }
        long leftSeconds = 0;

        for (int x = 0; x < openList.Count; x++)
        {
            DailyDataBase data = GameTableManager.Instance.GetTableItem <DailyDataBase>(openList[x].type);
            if (data != null)
            {
                if (data.MaxTimes == 0 || (data.MaxTimes > openList[x].time && data.MaxTimes != 0))
                {
                    bool InSchedule = DataManager.Manager <DailyManager>().UpdateDataLeftTime(data, out leftSeconds);
                    if (InSchedule)
                    {
                        if (data.recommend == 1)
                        {
                            tempList1.Add(openList[x]);
                        }
                        else if (data.recommend == 2)
                        {
                            tempList2.Add(openList[x]);
                        }
                        else
                        {
                            tempList3.Add(openList[x]);
                        }
                    }
                    else
                    {
                        tempList4.Add(openList[x]);
                    }
                }
                else
                {
                    tempList6.Add(openList[x]);
                }
            }
        }
        LivenessData temp = new LivenessData();

        for (int a = 0; a < closeList.Count; a++)
        {
            DailyDataBase data1 = GameTableManager.Instance.GetTableItem <DailyDataBase>(closeList[a].type);
            if (data1 != null)
            {
                for (int b = closeList.Count - 1; b > a; b--)
                {
                    DailyDataBase data2 = GameTableManager.Instance.GetTableItem <DailyDataBase>(closeList[b].type);
                    if (data2 != null)
                    {
                        if (data1.minLevel > data2.minLevel)
                        {
                            temp         = closeList[a];
                            closeList[a] = closeList[b];
                            closeList[b] = temp;
                        }
                    }
                }
            }
        }
        activeList.Clear();
        activeList.AddRange(tempList1);
        activeList.AddRange(tempList2);
        activeList.AddRange(tempList3);
        activeList.AddRange(tempList4);
        activeList.AddRange(tempList6);
        activeList.AddRange(closeList);
    }
Пример #17
0
 public void SetDailyData(DailyDataBase data, LivenessData list)
 {
     dailyData = data;
     DailyID   = data.id;
     UpdateUI(list);
 }
Пример #18
0
 void ExecuteGoto(DailyDataBase dailyData)
 {
     if (null == dailyData)
     {
         return;
     }
     if (dailyData.isClosePanel == 1)
     {
         HideSelf();
     }
     if (dailyData.taskID > 0)
     {
         table.QuestDataBase questDb = GameTableManager.Instance.GetTableItem <table.QuestDataBase>(dailyData.taskID);
         if (questDb != null)
         {
             //如果是魔族任务 找当前在做的魔族任务执行 否则直接执行当前配置任务id
             if (questDb.dwType == (uint)GameCmd.TaskType.TaskType_Demons)
             {
                 List <QuestTraceInfo> lstdata = null;
                 DataManager.Manager <TaskDataManager>().GetAllQuestTraceInfo(out lstdata);
                 for (int i = 0; i < lstdata.Count; i++)
                 {
                     if (lstdata[i].taskType != TaskType.TaskType_Demons)
                     {
                         continue;
                     }
                     Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.TASK_DONING,
                                                                         new Client.stDoingTask()
                     {
                         taskid = lstdata[i].taskId
                     });
                     return;
                 }
             }
             Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.TASK_DONING,
                                                                 new Client.stDoingTask()
             {
                 taskid = dailyData.taskID
             });
         }
     }
     else if (dailyData.puGuaID > 0)
     {
         List <QuestTraceInfo> lstdata = new List <QuestTraceInfo>();
         DataManager.Manager <TaskDataManager>().GetAllQuestTraceInfo(out lstdata);
         for (int i = 0; i < lstdata.Count; i++)
         {
             if (lstdata[i].taskType != TaskType.TaskType_Loop)
             {
                 continue;
             }
             Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.TASK_DONING,
                                                                 new Client.stDoingTask()
             {
                 taskid = lstdata[i].taskId
             });
             return;
         }
         if (dailyData.jumpID > 0)
         {
             ItemManager.DoJump(dailyData.jumpID);
         }
     }
     else if (dailyData.jumpID > 0)
     {
         ItemManager.DoJump(dailyData.jumpID);
     }
 }