public void SetText(string s) { if (invalidCharsPath == null) { invalidCharsPath = SfbFileSystem.GetInvalidFileNameChars().ToList().Where(a => a != '/' && a != '\\').ToArray(); } if (invalidCharsFileName == null) { // Remove control characters. This way the user is only notified about characters they can remove. invalidCharsFileName = SfbFileSystem.GetInvalidFileNameChars().ToList().Where(a => !char.IsControl(a)).ToArray(); } if (inputField == null) { inputField = GetComponent <InputField>(); inputField.onEndEdit.AddListener(OnSubmit); } if (fileBrowser == null) { fileBrowser = GetComponentInParent <SfbWindow>().fileBrowser; } text = s; inputField.text = s; inputField.MoveTextEnd(true); }
public override void Init(SfbInternal fileBrowser) { this.fileBrowser = fileBrowser; SetListeners(); // Init because the start function won't be called until next frame if it's just been instantiated inputField.Init(); var text = inputField.GetText(); Stopwatch sw = Stopwatch.StartNew(); int count = 1; while (fileBrowser.DirectoryExistsInCurrentDirectory(text)) { if (sw.ElapsedMilliseconds > 500) { text = inputField.GetText(); Debug.Log("Checking existing directories took too long, break."); break; } text = inputField.GetText() + " (" + count + ")"; count++; } inputField.SetText(text); }
public void Repopulate(IEnumerable<string> input) { if (type == SfbDropMenuType.NOT_SET) { Debug.LogError("DropMenu type not set."); return; } if (fileBrowser == null) { fileBrowser = GetComponentInParent<SfbWindow>().fileBrowser; } if (prefabItem == null || prefabItem.GetComponent<SfbDropMenuItem>() == null) { Debug.LogError("DropMenu item prefab not set or missing BrowserDropMenuItem component"); return; } for (int i = 0; i < content.childCount; i++) { Destroy(content.GetChild(i).gameObject); } items.Clear(); foreach (var item in input) { AddItem(item); } float height = items.Count() * prefabItem.GetComponent<RectTransform>().sizeDelta.y; if (height > maxHeight) { height = maxHeight; } else { } RectTransform rt = GetComponent<RectTransform>(); rt.sizeDelta = new Vector2(rt.sizeDelta.x, height); }
public void Init(SfbInternal fileBrowser) { this.fileBrowser = fileBrowser; var children = GetComponentsInChildren<SfbIElement>(); foreach (var child in children) { child.Init(fileBrowser); } }
public void SetListeners() { SfbInternal fileBrowser = GetComponentInParent <SfbWindow>().fileBrowser; if (fileBrowser == null) { return; } fileBrowser.SetButtonListeners(GetComponent <Button>(), action); }
public void Init(SfbInternal fileBrowser) { this.fileBrowser = fileBrowser; var children = GetComponentsInChildren <SfbIElement>(); foreach (var child in children) { child.Init(fileBrowser); } }
public virtual void Init(SfbInternal fileBrowser) { this.fileBrowser = fileBrowser; clickStopwatch = Stopwatch.StartNew(); scrollRect = GetComponentInChildren<ScrollRect>(); parentDraggable = GetComponentInParent<SfbDraggable>(); if (scrollRect.verticalScrollbar != null) { scrollRect.verticalScrollbar.onValueChanged.AddListener(StartShowOnScreenEntries); } }
public override void Init(SfbInternal fileBrowser) { if (prefabFileEntry == null || prefabFolderEntry == null || prefabLogicalDriveEntry == null) { Debug.LogError("Prefabs not set correctly in inspector"); return; } entryPrefabs.Add(prefabFileEntry); entryPrefabs.Add(prefabFolderEntry); entryPrefabs.Add(prefabLogicalDriveEntry); base.Init(fileBrowser); }
public override void Init(SfbInternal fileBrowser) { if (prefabFileEntry == null || prefabFolderEntry == null || prefabLogicalDriveEntry == null) { Debug.LogError("Prefabs not set correctly in inspector"); return; } entryPrefabs.Add(prefabFileEntry); entryPrefabs.Add(prefabFolderEntry); entryPrefabs.Add(prefabLogicalDriveEntry); base.Init(fileBrowser); }
public virtual void Init(SfbInternal fileBrowser) { this.fileBrowser = fileBrowser; clickStopwatch = Stopwatch.StartNew(); scrollRect = GetComponentInChildren <ScrollRect>(); parentDraggable = GetComponentInParent <SfbDraggable>(); if (scrollRect.verticalScrollbar != null) { scrollRect.verticalScrollbar.onValueChanged.AddListener(StartShowOnScreenEntries); } }
public void Repopulate(IEnumerable <string> input) { if (type == SfbDropMenuType.NOT_SET) { Debug.LogError("DropMenu type not set."); return; } if (fileBrowser == null) { fileBrowser = GetComponentInParent <SfbWindow>().fileBrowser; } if (prefabItem == null || prefabItem.GetComponent <SfbDropMenuItem>() == null) { Debug.LogError("DropMenu item prefab not set or missing BrowserDropMenuItem component"); return; } for (int i = 0; i < content.childCount; i++) { Destroy(content.GetChild(i).gameObject); } items.Clear(); foreach (var item in input) { AddItem(item); } float height = items.Count() * prefabItem.GetComponent <RectTransform>().sizeDelta.y; if (height > maxHeight) { height = maxHeight; } else { } RectTransform rt = GetComponent <RectTransform>(); rt.sizeDelta = new Vector2(rt.sizeDelta.x, height); }
public void SetText(string s) { if (invalidCharsPath == null) { invalidCharsPath = SfbFileSystem.GetInvalidFileNameChars().ToList().Where(a => a != '/' && a != '\\').ToArray(); } if (invalidCharsFileName == null) { // Remove control characters. This way the user is only notified about characters they can remove. invalidCharsFileName = SfbFileSystem.GetInvalidFileNameChars().ToList().Where(a => !char.IsControl(a)).ToArray(); } if (inputField == null) { inputField = GetComponent<InputField>(); inputField.onEndEdit.AddListener(OnSubmit); } if (fileBrowser == null) { fileBrowser = GetComponentInParent<SfbWindow>().fileBrowser; } text = s; inputField.text = s; inputField.MoveTextEnd(true); }
public override void Init(SfbInternal fileBrowser) { this.fileBrowser = fileBrowser; SetListeners(); // Init because the start function won't be called until next frame if it's just been instantiated inputField.Init(); var text = inputField.GetText(); Stopwatch sw = Stopwatch.StartNew(); int count = 1; while (fileBrowser.DirectoryExistsInCurrentDirectory(text)) { if (sw.ElapsedMilliseconds > 500) { text = inputField.GetText(); Debug.Log("Checking existing directories took too long, break."); break; } text = inputField.GetText() + " (" + count + ")"; count++; } inputField.SetText(text); }
public override void Init(SfbInternal fileBrowser) { this.fileBrowser = fileBrowser; SetListeners(); }
public abstract void Init(SfbInternal fileBrowser);
public bool SaveFile(string path, Action <string[]> outputMethod, string[] extensions = null) { return(SfbInternal.SaveFile(path, outputMethod, extensions)); }
private void Start() { fileBrowser = GetComponentInParent<SfbWindow>().fileBrowser; }
public override void Init(SfbInternal fileBrowser) { this.fileBrowser = fileBrowser; SetListeners(); }
public void HideWindow() { SfbInternal.HideWindow(); }
private void Start() { fileBrowser = GetComponentInParent <SfbWindow>().fileBrowser; }
public void ShowWindow() { SfbInternal.ShowWindow(); }
public abstract void Init(SfbInternal fileBrowser);
public void FakeFileSystem(SfbFileSystem fileSystem) { SfbInternal.FakeFileSystem(fileSystem); }
public void SetParentCanvas(Canvas canvas) { SfbInternal.SetParentCanvas(canvas); }