private void UpdateDataList <T>(DataList <T> dataList, ListSection <T> listSection) where T : BaseData { if (listSection.TotalEntries == 0) { return; } var currentSelected = listSection.SelectedIndex; dataList.entries[currentSelected] = (T)_infoSection.entrySelected; }
private void DrawInfo <T>(ListSection <T> listSection) where T : BaseData { if (listSection.TotalEntries == 0) { return; } var currentSelected = listSection.EntrySelected; _infoSection.entrySelected = currentSelected; _infoSection.Draw(_database); }
private void DrawEffects <T>(ListSection <T> listSection) where T : BaseData { if (listSection.TotalEntries == 0) { return; } var currentSelected = listSection.EntrySelected; _effectsSection.entrySelected = currentSelected; _effectsSection.Draw(); }
private void DrawContent <T>(ListSection <T> listSection, DataList <T> dataList, bool hasEffects = false) where T : BaseData { listSection.PrepareList(dataList); EditorGUILayout.BeginHorizontal(); { listSection.Draw(); EditorGUILayout.BeginVertical(); { DrawInfo(listSection); if (hasEffects) { DrawEffects(listSection); } } EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); UpdateDataList(dataList, listSection); }
private void OnEnable() { _database = new RPGDatabaseManager(); _database.Load(); if (_database.TotalEntries == 0) { DatabaseFolderHandler.ValidateAllFolders(); DatabaseFactory.CreateDatabase(); _database.Load(); } _actorDataList = _database.FetchEntry <ActorDataList>(); _classDataList = _database.FetchEntry <ActorClassDataList>(); _skillDataList = _database.FetchEntry <SkillDataList>(); _itemDataList = _database.FetchEntry <ItemDataList>(); _weaponDataList = _database.FetchEntry <WeaponDataList>(); _weaponTypeDataList = _database.FetchEntry <WeaponTypeDataList>(); _attributeSpectDataList = _database.FetchEntry <AttributeSpecDataList>(); _actorListSection = new ListSection <ActorData>(_actorDataList, "Actors"); _classListSection = new ListSection <ActorClassData>(_classDataList, "Classes"); _skillListSection = new ListSection <SkillData>(_skillDataList, "Skills"); _itemListSection = new ListSection <ItemData>(_itemDataList, "Items"); _weaponListSection = new ListSection <WeaponData>(_weaponDataList, "Weapons"); _weaponTypeListSection = new ListSection <WeaponTypeData>(_weaponTypeDataList, "Weapon Types"); var flags = ReorderableListFlags.ShowIndices | ReorderableListFlags.HideAddButton | ReorderableListFlags.DisableReordering | ReorderableListFlags.HideRemoveButtons; _attributeSpecListSection = new ListSection <AttributeSpecData>(_attributeSpectDataList, "Attribute Specs", flags); _infoSection = new InfoSection(); _effectsSection = new EffectsSection(); _coreTabSelected = (CoreTabId)DatabaseEditorPrefs.CoreTab; _mainTabSelected = (MainTabId)DatabaseEditorPrefs.MainTab; _configTabSelected = (ConfigTabId)DatabaseEditorPrefs.ConfigTab; }