private static int MissionSort(MissionListItemSimpleDataModel a, MissionListItemSimpleDataModel b) { var v1 = 0; var v2 = 0; if (eMissionState.Finished == (eMissionState)a.State) { v1 += 100000; } else if (eMissionState.Unfinished == (eMissionState)a.State) { v1 += 1000000; } else if (eMissionState.Acceptable == (eMissionState)a.State) { v1 += 10000000; } try { v1 += Table.GetMissionBase(a.MissionId).MissionBianHao; } catch { } if (eMissionState.Finished == (eMissionState)b.State) { v2 += 100000; } else if (eMissionState.Unfinished == (eMissionState)b.State) { v2 += 1000000; } else if (eMissionState.Acceptable == (eMissionState)b.State) { v2 += 10000000; } try { v2 += Table.GetMissionBase(b.MissionId).MissionBianHao; } catch { } if (v1 > v2) { return(1); } if (v1 < v2) { return(-1); } return(a.MissionId - b.MissionId); }
private MissionListItemSimpleDataModel CreateMissionDataModel(MissionBaseModel mis, MissionListItemSimpleDataModel data = null) { //任务id和数据 var missionId = mis.MissionId; var missionData = mis; //查表 var tableData = Table.GetMissionBase(missionId); if (null == tableData) { return(null); } //new个数据源 if (null == data) { data = new MissionListItemSimpleDataModel(); } //任务数据 data.MissionId = tableData.Id; data.MissionName = tableData.Name; data.State = missionData.Exdata[0]; data.Type = tableData.ViewType; //data.MissionDesc = tableData.TrackDescription + MissionManager.MissionContent(tableData, missionData.Exdata); var state = (eMissionState)data.State; ////跟据任务状态设置按钮文字 if (eMissionState.Unfinished == state) { //data.BtnName = Table.GetDictionary(Resource.Dictrionary.GoToMission).Desc[1]; data.BtnName = GameUtils.GetDictionaryText(522); } else if (eMissionState.Finished == state) { //data.BtnName = Table.GetDictionary(Resource.Dictrionary.ClaimReward).Desc[1]; data.BtnName = GameUtils.GetDictionaryText(523); } else if (eMissionState.Acceptable == state) { //data.BtnName = Table.GetDictionary(Resource.Dictrionary.ClaimReward).Desc[1]; data.BtnName = GameUtils.GetDictionaryText(524); } return(data); }