private bool IsColosseumOpen()
    {
        GameWebAPI.RespData_ColosseumInfoLogic respData_ColosseumInfo = DataMng.Instance().RespData_ColosseumInfo;
        List <CMD_QuestSelect.Schedule>        list = new List <CMD_QuestSelect.Schedule>();

        if (respData_ColosseumInfo == null || respData_ColosseumInfo.colosseumId == 0)
        {
            list.Clear();
            return(false);
        }
        if (respData_ColosseumInfo.openAllDay > 0)
        {
            return(true);
        }
        if (list.Count <CMD_QuestSelect.Schedule>() == 0)
        {
            GameWebAPI.RespDataMA_ColosseumTimeScheduleM respDataMA_ColosseumTimeScheduleMaster = MasterDataMng.Instance().RespDataMA_ColosseumTimeScheduleMaster;
            if (respDataMA_ColosseumTimeScheduleMaster == null)
            {
                return(false);
            }
            string b = respData_ColosseumInfo.colosseumId.ToString();
            foreach (GameWebAPI.RespDataMA_ColosseumTimeScheduleM.ColosseumTimeSchedule colosseumTimeSchedule in respDataMA_ColosseumTimeScheduleMaster.colosseumTimeScheduleM)
            {
                if (colosseumTimeSchedule.colosseumId == b)
                {
                    CMD_QuestSelect.Schedule item = new CMD_QuestSelect.Schedule
                    {
                        start = DateTime.Parse(colosseumTimeSchedule.startHour),
                        end   = DateTime.Parse(colosseumTimeSchedule.endHour)
                    };
                    list.Add(item);
                }
            }
        }
        foreach (CMD_QuestSelect.Schedule schedule in list)
        {
            if (schedule.start < ServerDateTime.Now && ServerDateTime.Now < schedule.end)
            {
                return(true);
            }
        }
        return(false);
    }
Exemplo n.º 2
0
        public static APIRequestTask RequestColosseumEntry(GameWebAPI.RespData_ColosseumInfoLogic colosseumInfo, Action <GameWebAPI.RespDataCL_ColosseumEntry> onReceived, bool isMockBattle = false, bool requestRetry = false)
        {
            int colosseumId = 0;

            if (colosseumInfo != null && colosseumInfo.colosseumId != 0)
            {
                colosseumId = colosseumInfo.colosseumId;
            }
            GameWebAPI.RequestCL_ColosseumEntry request = new GameWebAPI.RequestCL_ColosseumEntry
            {
                SetSendData = delegate(GameWebAPI.SendDataCL_ColosseumEntry param)
                {
                    param.colosseumId  = colosseumId;
                    param.isMockBattle = ((!isMockBattle) ? 0 : 1);
                },
                OnReceived = onReceived
            };
            return(new APIRequestTask(request, requestRetry));
        }
Exemplo n.º 3
0
 public ColosseumUtil()
 {
     this.colosseumInfo = DataMng.Instance().RespData_ColosseumInfo;
     if (this.colosseumInfo != null)
     {
         this.colosseumM = new GameWebAPI.RespDataMA_ColosseumM.Colosseum();
         GameWebAPI.RespDataMA_ColosseumM respDataMA_ColosseumMaster = MasterDataMng.Instance().RespDataMA_ColosseumMaster;
         if (respDataMA_ColosseumMaster != null)
         {
             this.colosseumM = respDataMA_ColosseumMaster.colosseumM.SingleOrDefault((GameWebAPI.RespDataMA_ColosseumM.Colosseum item) => item.colosseumId == this.colosseumInfo.colosseumId.ToString());
         }
         this.colosseumTimeScheduleM = new GameWebAPI.RespDataMA_ColosseumTimeScheduleM.ColosseumTimeSchedule[0];
         GameWebAPI.RespDataMA_ColosseumTimeScheduleM respDataMA_ColosseumTimeScheduleMaster = MasterDataMng.Instance().RespDataMA_ColosseumTimeScheduleMaster;
         if (respDataMA_ColosseumTimeScheduleMaster != null)
         {
             this.colosseumTimeScheduleM = respDataMA_ColosseumTimeScheduleMaster.colosseumTimeScheduleM.Where((GameWebAPI.RespDataMA_ColosseumTimeScheduleM.ColosseumTimeSchedule item) => item.colosseumId == this.colosseumInfo.colosseumId.ToString()).ToArray <GameWebAPI.RespDataMA_ColosseumTimeScheduleM.ColosseumTimeSchedule>();
         }
     }
 }