public void SetSort(int i) { orderMode = (contractSortClass)i; if (contractWindow.Instance == null) { return; } contractWindow.Instance.RefreshContracts(); }
internal contractMission(string n, string active, string hidden, string vessels, bool asc, bool showActive, int sMode, bool Master) { _missionTitle = n; activeString = active; hiddenString = hidden; vesselIDString = vessels; ascendingOrder = asc; showActiveMissions = showActive; _masterMission = Master; orderMode = (contractSortClass)sMode; contractList = new Dictionary <Guid, contractUIObject>(); activeMissionList = new List <Guid>(); hiddenMissionList = new List <Guid>(); currentVessels = new Dictionary <Guid, Vessel>(); }
private List <Guid> sortContracts(List <Guid> list, contractSortClass sortClass, bool dsc) { sortList.Clear(); int l = list.Count; for (int i = 0; i < l; i++) { Guid id = list[i]; contractUIObject cC = currentMission.getContract(id); if (cC == null) { continue; } if (cC.Order != null) { continue; } sortList.Add(cC); } switch (sortClass) { case contractSortClass.Expiration: sortList.Sort((a, b) => RUIutils.SortAscDescPrimarySecondary(!dsc, a.Container.Duration.CompareTo(b.Container.Duration), a.Container.Title.CompareTo(b.Container.Title))); break; case contractSortClass.Acceptance: sortList.Sort((a, b) => RUIutils.SortAscDescPrimarySecondary(!dsc, a.Container.Root.DateAccepted.CompareTo(b.Container.Root.DateAccepted), a.Container.Title.CompareTo(b.Container.Title))); break; case contractSortClass.Reward: sortList.Sort((a, b) => RUIutils.SortAscDescPrimarySecondary(!dsc, a.Container.TotalReward.CompareTo(b.Container.TotalReward), a.Container.Title.CompareTo(b.Container.Title))); break; case contractSortClass.Difficulty: sortList.Sort((a, b) => RUIutils.SortAscDescPrimarySecondary(!dsc, a.Container.Root.Prestige.CompareTo(b.Container.Root.Prestige), a.Container.Title.CompareTo(b.Container.Title))); break; case contractSortClass.Planet: sortList.Sort((a, b) => RUIutils.SortAscDescPrimarySecondary(!dsc, a.Container.TargetPlanet.CompareTo(b.Container.TargetPlanet), a.Container.Title.CompareTo(b.Container.Title))); break; case contractSortClass.Type: sortList.Sort((a, b) => RUIutils.SortAscDescPrimarySecondary(!dsc, a.Container.Root.GetType().Name.CompareTo(b.Container.Root.GetType().Name), a.Container.Title.CompareTo(b.Container.Title))); sortList = typeSort(sortList, !dsc); break; } list.Clear(); if (pinnedList.Count > 0) { list.AddRange(pinnedList); } int k = sortList.Count; for (int i = 0; i < k; i++) { contractUIObject c = sortList[i]; if (c == null) { continue; } list.Add(c.ID); } return(list); }