private void RenderSortButton(SortModeEnum buttonSort, string text) { var currentSort = _saveGameCollection.SortMode; GUIContent content = new GUIContent(text); Vector2 size = (HighLogic.CurrentGame.Parameters.CustomParams <BLSG1>().useAlternateSkin ? GUI.skin.toggle.CalcSize(content) : GUI.skin.textField.CalcSize(content)); if (GUILayout.Toggle(currentSort == buttonSort, text, GUILayout.ExpandWidth(false), GUILayout.Width(size.x + 20)) && currentSort != buttonSort) { _saveGameCollection.SortMode = buttonSort; } }
public MeshSequenceInfo(string pathToAnyObj, SortModeEnum sortMode) { SortMode = sortMode; State = StateEnum.Empty_path; SequenceName = ""; DirectoryPath = ""; infos = new ObjFileInfo[0]; // Date = System.DateTime.Now.ToString(); if (string.IsNullOrEmpty(pathToAnyObj)) { return; } if (!File.Exists(pathToAnyObj)) { State = StateEnum.File_not_found; return; } DirectoryInfo di = (new FileInfo(pathToAnyObj)).Directory; FileInfo[] fis = di.GetFiles("*.obj"); DirectoryPath = di.FullName; infos = new ObjFileInfo[fis.Length]; for (int i = 0; i < infos.Length; i++) { infos[i] = new ObjFileInfo(); infos[i].fi = fis[i]; infos[i].FileName = Path.GetFileNameWithoutExtension(fis[i].FullName); infos[i].ParsedNumber = GetNumberFromName(infos[i].FileName, ref infos[i].Hash); } if (SortMode == SortModeEnum.ByDate) { System.Array.Sort(infos, InfosDateComparer); } else { System.Array.Sort(infos, InfosNumberComparer); } SequenceName = string.Format("[{0}-{1}]", infos[0].FileName, infos[infos.Length - 1].FileName); State = StateEnum.Ready; }