コード例 #1
0
    public static void QuickSetSkillEffect()
    {
        var skilllist = SearchGameObject.SearchGameObjectList <Skill>
                            ("Assets/Resources/SkillAsset");

        var effectlist = SearchGameObject.SearchGameObjectList <SkillEffect>
                             ("Assets/Skill/SkillEffectAsset");
        var skillDic = skilllist.ToDictionary(e => e.SKillID.ToString());

        int size = effectlist.Count;

        for (int i = 0; i < size; ++i)
        {
            var e = effectlist[i];
            if (!skillDic.ContainsKey(e.name))
            {
                Debug.Log(e.name);
                continue;
            }
            skillDic[e.name].effect = e;
            EditorUtility.SetDirty(skillDic[e.name]);
            EditorUtility.DisplayCancelableProgressBar("配置技能特效", i + "/" + size, (float)i / size);
        }
        EditorUtility.ClearProgressBar();

        AssetDatabase.SaveAssets();
    }
コード例 #2
0
    public static void ExportSkillPoolConfig()
    {
        var    list = SearchGameObject.SearchGameObjectList <SkillPool>("Assets/Skill/SkillPoolAsset");
        var    dic  = list.ToDictionary(x => x.PokemonID);
        string json = JsonConvert.SerializeObject(dic);

        File.WriteAllText("Assets/Resources/Config/SkillPoolConfig.json", json, Encoding.UTF8);
        Debug.Log("精灵技能池导出成功");
    }
コード例 #3
0
    public static void GetBagItem()
    {
        const string  path     = "Assets/Resources/ReadTxt/BagItem.json";
        var           list     = SearchGameObject.SearchGameObjectList <Item>("Assets/BagItem");
        List <string> nameList = list.Select(x => x.Name).ToList();
        var           list2    = SearchGameObject.SearchGameObjectList <Item>("Assets/Resources/BagItem/BagItemAsset");
        int           i        = 0;

        foreach (Item e in list)
        {
            EditorUtility.DisplayCancelableProgressBar("复制道具数据", i + "/" + list.Count, (float)i / list.Count);
            Item other = list2.Find(x => x.Name == e.Name);
            if (e.Equals(other))
            {
                continue;
            }
            AssetDatabase.CreateAsset(e.Clone(), "Assets/Resources/BagItem/BagItemAsset/" + e.Name + ".asset");
        }
        EditorUtility.ClearProgressBar();
        var str = JsonConvert.SerializeObject(nameList);

        File.WriteAllText(path, str, Encoding.UTF8);
    }
コード例 #4
0
    public static void GetCanUsePokemon()
    {
        const string path = "Assets/Resources/Config/AllPokemons.json";
        var          list = SearchPokemon()
                            .Where(x => "" != x)
                            .ToList()
                            .ConvertAll(x => Convert.ToInt32(x));
        var str        = JsonConvert.SerializeObject(list);
        var SkillPools = SearchGameObject.SearchGameObjectList <SkillPool>("Assets/Skill/SkillPoolAsset")
                         .ConvertAll(x => x.PokemonID);

        foreach (int id in list)
        {
            if (SkillPools.Contains(id))
            {
                continue;
            }
            SkillPool skillPool = ScriptableObject.CreateInstance <SkillPool>();
            skillPool.PokemonID = id;
            AssetDatabase.CreateAsset(skillPool, "Assets/Skill/SkillPoolAsset/" + id + ".asset");
        }
        File.WriteAllText(path, str, Encoding.UTF8);
    }