public ChooseEntetyFromListHelper InitWindow <T>() where T : DataObject { ItemEditorViewer = BaseEditorStatic.GetDataViewer <T>(); FilterViewer = BaseEditorStatic.GetDataFilter <T>(); var listItems = BaseEditorStatic.DataStorager.All <T>().ToList(); FilterViewer.InitData(new ArrayList(listItems)); _dicItems = new Dictionary <string, DataObject>(); listItems.ForEach(i => _dicItems.Add(string.Format("{0}-{1}", i.Id, i.Name), i)); _btnNames = _dicItems.Keys.ToArray(); if (ItemEditorViewer.CanShow) { for (var i = 0; i < _btnNames.Length; i++) { if (_btnNames[i] == string.Format("{0}-{1}", ItemEditorViewer.GetCurrent().Id, ItemEditorViewer.CurrentName)) { _currentIndex = i; break; } } } else { _currentIndex = 0; ItemEditorViewer.SetCurrent(_dicItems[_btnNames[_currentIndex]]); } return(this); }
protected virtual void OnEnable() { this.minSize = new Vector2(600, 600); this.titleContent = new GUIContent() { text = "Chose Entity" }; _iconSelect = AssetDatabase.LoadAssetAtPath <Texture2D>(STRH.Editorstr.PathToSelectBtn); _currentSkin = BaseEditorStatic.GetSkinByName(); }
protected virtual void OnEnable() { this.minSize = new Vector2(600, 600); this.titleContent = new GUIContent() { text = "Set Setings " + NameObject }; _area = new AreaSizesHelperSettingsWindow(this); _oldSize = position; _currentSkin = BaseEditorStatic.GetSkinByName(); }
public static void ShowSettings <T>(T obj, string title) where T : DataObject { var window = GetWindow <SettingMiniHelperWindow>("Settings " + title, true); window.NameObject = typeof(T).Name; window._dataViewer = BaseEditorStatic.GetDataViewer <T>(); window._dataViewer.RefreshWindow += window.Repaint; window._dataViewer.SetCurrent(obj); window._area = new AreaSizesHelperSettingsWindow(window); window._oldSize = window.position; window.OnCloseEvent += () => { window._dataViewer.PrepareForSave(); BaseEditorStatic.DataStorager.Update(window._dataViewer.GetCurrent <T>()); }; window.ShowPopup(); }