Example #1
0
        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;
        }
Example #2
0
        void Start()
        {
            //Loading database
            _database = new RPGDatabaseManager();
            _database.Load();

            //Fetching data and injecting into runtime classes
            var actorList = _database.FetchEntry <ActorDataList>();

            _actors = new Actor[actorList.Count];

            for (int i = 0; i < actorList.Count; i++)
            {
                var actorData = actorList.entries[i];
                var classData = _database.FetchClassData(actorData.classId);
                _actors[i] = new Actor(actorData, classData);

                var hp = _database.FetchAmount(actorData.Id, actorData.initialLevel, ActorAttributeType.HP);
                var mp = _database.FetchAmount(actorData.Id, actorData.initialLevel, ActorAttributeType.MP);

                var str  = _database.FetchAmount(actorData.Id, actorData.initialLevel, ActorAttributeType.Strength);
                var intl = _database.FetchAmount(actorData.Id, actorData.initialLevel, ActorAttributeType.Intelligence);

                var dex = _database.FetchAmount(actorData.Id, actorData.initialLevel, ActorAttributeType.Dextery);
                var agi = _database.FetchAmount(actorData.Id, actorData.initialLevel, ActorAttributeType.Agility);

                var lck = _database.FetchAmount(actorData.Id, actorData.initialLevel, ActorAttributeType.Luck);

                var def = _database.FetchAmount(actorData.Id, actorData.initialLevel, ActorAttributeType.Defense);
                var res = _database.FetchAmount(actorData.Id, actorData.initialLevel, ActorAttributeType.Resistance);

                _actors[i].wpnName      = _database.FetchWeapon(actorData.initialWeapon).name;
                _actors[i].expNextLevel = _database.FetchExpForNextLevel(actorData.Id, actorData.initialLevel);

                _actors[i].SetAttributes(hp, mp, str, intl, dex, agi, lck, def, res);
            }

            //Displaying it on the UI
            for (int i = 0; i < actorList.Count; i++)
            {
                partyInfoWnd.UpdateDisplay(_actors[i], i);
            }

            TransitionTo(State.PartyInfo);
        }