public static bool Get_Activity_newState(this ModelManager mmng, int activityID) { bool result = false; ActivityData activityData = mmng.Get_Activity_Data(); Dictionary <int, ActivityData.ActivityNewState> dicActivityNewState = activityData.dicActivityNewState; if (dicActivityNewState != null && dicActivityNewState.ContainsKey(activityID)) { ActivityData.ActivityNewState activityNewState = activityData.dicActivityNewState[activityID]; result = (activityNewState.hasRewards || activityNewState.notRead); } return(result); }
private void OnMsg_activity_readActivity(MobaMessage msg) { int num = (int)msg.Param; ActivityData activityData = base.Data as ActivityData; if (activityData.dicActivityNewState.ContainsKey(num)) { ActivityData.ActivityNewState activityNewState = activityData.dicActivityNewState[num]; if (activityNewState.notRead) { activityNewState.notRead = false; this.SendActivity_hasRead(num); MobaMessageManagerTools.SendClientMsg(ClientC2V.activity_updateActivityState, activityNewState, true); } } }
private void InitActivityNewState() { ActivityData activityData = base.Data as ActivityData; if (activityData.dicActivityNewState == null) { activityData.dicActivityNewState = new Dictionary <int, ActivityData.ActivityNewState>(); } Dictionary <string, object> dicByType = BaseDataMgr.instance.GetDicByType <SysActivityVo>(); DateTime serverCurrentTime = ToolsFacade.ServerCurrentTime; foreach (KeyValuePair <string, object> current in dicByType) { SysActivityVo sysActivityVo = current.Value as SysActivityVo; if (sysActivityVo != null) { DateTime dateTime = ActivityTools.GetDateTime(sysActivityVo.show_start_time, true); DateTime dateTime2 = ActivityTools.GetDateTime(sysActivityVo.show_end_time, false); if (string.IsNullOrEmpty(sysActivityVo.show_start_time) || !(serverCurrentTime < dateTime)) { if (string.IsNullOrEmpty(sysActivityVo.show_end_time) || !(serverCurrentTime > dateTime2)) { int key = int.Parse(current.Key); if (!activityData.dicActivityNewState.ContainsKey(key)) { ActivityData.ActivityNewState activityNewState = new ActivityData.ActivityNewState { activityVo = sysActivityVo, type = sysActivityVo.activity_type_id, dicTaskState = new Dictionary <int, ActivityData.TaskState>() }; activityData.dicActivityNewState.Add(key, activityNewState); string[] array = sysActivityVo.module.Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { SysActivityModuleVo dataById = BaseDataMgr.instance.GetDataById <SysActivityModuleVo>(array[i]); if (dataById != null && dataById.type == 4) { if (string.IsNullOrEmpty(dataById.content_first)) { ClientLogger.Error("配置错误, 模块ID=" + dataById.id); } else { string[] array2 = dataById.content_first.Split(new char[] { ',' }); for (int j = 0; j < array2.Length; j++) { SysActivityTaskVo dataById2 = BaseDataMgr.instance.GetDataById <SysActivityTaskVo>(array2[j]); if (dataById2 == null) { ClientLogger.Error("配置错误,找不到SysActivityTaskVo id=" + array2[j]); } else { ActivityData.TaskState value = new ActivityData.TaskState { taskID = dataById2.id, taskVo = dataById2 }; activityNewState.dicTaskState.Add(dataById2.id, value); } } } } } } } } } } this.init = true; }
private void SendTask_stateChange(ActivityData.ActivityNewState newState) { MobaMessageManagerTools.SendClientMsg(ClientC2V.activity_updateTaskState, newState, false); }