Ejemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        SkillDataList dataList = (SkillDataList)target;

        DrawDefaultInspector();

        if (GUILayout.Button("Reload list"))
        {
            reloadList(dataList);
        }
    }
Ejemplo n.º 2
0
    public static void Read()
    {
        bool newFile = false;

        SkillDataList dataList = null;

        UnityEngine.Object oldFile = AssetDatabase.LoadAssetAtPath(outFileName, typeof(SkillDataList));
        if (oldFile == null)
        {
            newFile  = true;
            dataList = ScriptableObject.CreateInstance(typeof(SkillDataList)) as SkillDataList;
        }
        else
        {
            dataList = oldFile as SkillDataList;
        }

        dataList._dataList.Clear();

        string jsonStr = File.ReadAllText(fileName);

        JsonHashtable ht = FCJson.jsonDecode(jsonStr) as JsonHashtable;

        foreach (System.Object obj in ht.ValueList)
        {
            Hashtable ht2 = obj as Hashtable;

            SkillData newData = new SkillData();

            newData.enemyID  = ht2["enemyId"] as string;
            newData.skillID  = ht2["skill"] as string;
            newData.roleID   = (int)ht2["role"];
            newData.ord      = (int)ht2["ord"];
            newData.nameIDS  = ht2["nameIDS"] as string;
            newData.descIDS  = ht2["description"] as string;
            newData.iconPath = ht2["iconPath"] as string;

            newData.isPassive = (int)ht2["isPassive"] == 1;

            dataList._dataList.Add(newData);
        }

        dataList._dataList.Sort(new SDComparer());

        if (newFile)
        {
            AssetDatabase.CreateAsset(dataList, outFileName);
        }
        else
        {
            EditorUtility.SetDirty(dataList);
        }
        Debug.Log(string.Format("Skill data imported OK. {0} records.", dataList._dataList.Count));
    }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
0
 void reloadList(SkillDataList dataList)
 {
     dataList.skills.Clear();
     dataList.skills.AddRange(Resources.FindObjectsOfTypeAll <Skill>());
     dataList.skills = dataList.skills.OrderBy(x => (int)(x.powerUp)).ToList();
 }