Esempio n. 1
0
    private static UDataStruct GetGetUDataStruct(CSVFile csvFile, int index, string[] parameters)
    {
        int parameterLength = parameters.Length;

        UDataStruct uDataStruct = new UDataStruct();

        uDataStruct._id = csvFile.Get <string>(index, "ID");

        if (parameterLength > 0)
        {
            uDataStruct.variable_1 = csvFile.Get <string>(index, parameters[0]);
        }

        if (parameterLength > 1)
        {
            uDataStruct.variable_2 = csvFile.Get <string>(index, parameters[1]);
        }

        if (parameterLength > 2)
        {
            uDataStruct.variable_3 = csvFile.Get <string>(index, parameters[2]);
        }

        if (parameterLength > 3)
        {
            uDataStruct.variable_4 = csvFile.Get <string>(index, parameters[3]);
        }

        return(uDataStruct);
    }
Esempio n. 2
0
        public void ParseDialogueFromCSVPathList(string[] csvPathList)
        {
            if (csvPathList == null)
            {
                return;
            }

            foreach (string csvPath in csvPathList)
            {
                string csvText = FileUtility.GetFileText(csvPath);

                CSVFile csvFile = new CSVFile(csvText);

                int csvCount = csvFile.length;

                for (int i = 0; i < csvCount; i++)
                {
                    string scene_id = csvFile.Get <string>(i, "Scene_ID");

                    DialogueComp gDialogueComp = ParseDialogueCSV(csvFile, i);

                    cacheDialogueDict = UtilityMethod.EditDictionaryArray <DialogueComp>(cacheDialogueDict, scene_id, gDialogueComp);
                }
            }
        }
Esempio n. 3
0
        private DialogueComp ParseDialogueCSV(CSVFile csvFile, int i)
        {
            DialogueComp dialogueComp = new DialogueComp();

            dialogueComp._id = csvFile.Get <string>(i, "ID");

            dialogueComp.scene_id      = csvFile.Get <string>(i, "Scene_ID");
            dialogueComp.group_id      = csvFile.Get <string>(i, "Group");
            dialogueComp.type          = csvFile.Get <string>(i, "Type");
            dialogueComp.character_ids = csvFile.Get <string>(i, "Character");
            dialogueComp.animation     = csvFile.Get <string>(i, "Animation");
            dialogueComp.constraint    = csvFile.Get <string>(i, "Constraint");
            dialogueComp.effect        = csvFile.Get <string>(i, "Effect");
            dialogueComp.mainValue     = csvFile.Get <string>(i, "Main Value");

            return(dialogueComp);
        }
Esempio n. 4
0
    static private void CreateSkillStats(StatsHolder statsHolder)
    {
        TextAsset csvText = (TextAsset)AssetDatabase.LoadAssetAtPath(DATABASE_FOLDER + "/CSV/database - skill.csv", typeof(TextAsset));
        CSVFile   csvFile = new CSVFile(csvText.text);

        AssetDatabase.CreateFolder(DATABASE_FOLDER + "/Asset", "Skill");

        int csvCount = csvFile.length;

        for (int i = 0; i < csvCount; i++)
        {
            string id = csvFile.Get <string>(i, "ID");

            if (string.IsNullOrEmpty(id))
            {
                continue;
            }

            SkillStats c_prefab = ScriptableObjectUtility.CreateAsset <SkillStats>(DATABASE_FOLDER + "/Asset/Skill/", "[SkillStat] " + id);
            EditorUtility.SetDirty(c_prefab);

            c_prefab.id    = id;
            c_prefab.label = csvFile.Get <string>(i, "Label");

            c_prefab.parameter_1 = csvFile.Get <float>(i, "Parameter 1");
            c_prefab.parameter_2 = csvFile.Get <float>(i, "Parameter 2");
            c_prefab.parameter_3 = csvFile.Get <float>(i, "Parameter 3");
            c_prefab.parameter_4 = csvFile.Get <float>(i, "Parameter 4");

            statsHolder.stpObjectHolder.Add(c_prefab);
        }
    }
Esempio n. 5
0
    static private void CreateTaskStats(TaskHolder statsHolder)
    {
        //TextAsset csvText = (TextAsset)AssetDatabase.LoadAssetAtPath(CSV_FOLDER + "/database - task.csv", typeof(TextAsset));
        string csvText = System.IO.File.ReadAllText(Application.streamingAssetsPath + "/ExternalDatabase/CSV/" + ParameterFlag.CSVFileName.Task);

        CSVFile csvFile = new CSVFile(csvText);

        AssetDatabase.CreateFolder(ASSETS_FOLDER + "/Asset", "Task");

        int csvCount = csvFile.length;

        for (int i = 0; i < csvCount; i++)
        {
            string id = csvFile.Get <string>(i, "ID");

            if (string.IsNullOrEmpty(id))
            {
                continue;
            }

            TaskStats c_prefab = ScriptableObjectUtility.CreateAsset <TaskStats>(ASSETS_FOLDER + "/Asset/Task/", "[TaskStats] " + id);
            EditorUtility.SetDirty(c_prefab);

            c_prefab.id    = id;
            c_prefab.tag   = csvFile.Get <string>(i, "Tag");
            c_prefab.label = csvFile.Get <string>(i, "Name");

            c_prefab.cost   = csvFile.Get <string>(i, "Cost");
            c_prefab.effect = csvFile.Get <string>(i, "Effect");
            c_prefab.desc   = csvFile.Get <string>(i, "Description");

            statsHolder.stpObjectHolder.Add(c_prefab);
        }
    }
Esempio n. 6
0
    static private void CreateMonsterStats(StatsHolder statsHolder)
    {
        TextAsset csvText = (TextAsset)AssetDatabase.LoadAssetAtPath(DATABASE_FOLDER + "/CSV/database - monster.csv", typeof(TextAsset));
        CSVFile   csvFile = new CSVFile(csvText.text);

        AssetDatabase.CreateFolder(DATABASE_FOLDER + "/Asset", "Monster");

        string MonsterAnimatorPath = "Assets/Main/Animation/Monster/{0}/Animator.overrideController";

        int csvCount = csvFile.length;

        for (int i = csvCount - 1; i >= 0; i--)
        {
            string id = csvFile.Get <string>(i, "ID");

            if (string.IsNullOrEmpty(id))
            {
                continue;
            }

            MonsterStats c_prefab = ScriptableObjectUtility.CreateAsset <MonsterStats>(DATABASE_FOLDER + "/Asset/Monster/", "[MonsterStat] " + id);
            EditorUtility.SetDirty(c_prefab);

            c_prefab.id       = id;
            c_prefab.label    = csvFile.Get <string>(i, "Label");
            c_prefab.strategy = (VariableFlag.Strategy)csvFile.Get <int>(i, "Strategy");
            c_prefab.value    = csvFile.Get <float>(i, "Value");

            c_prefab.hp        = csvFile.Get <int>(i, "HP");
            c_prefab.atk       = csvFile.Get <float>(i, "ATK");
            c_prefab.spd       = csvFile.Get <float>(i, "SPD");
            c_prefab.range     = csvFile.Get <int>(i, "RANGE");
            c_prefab.moveSpeed = csvFile.Get <float>(i, "Move Speed");

            c_prefab.avgPrize  = csvFile.Get <int>(i, "Prize");
            c_prefab.sprite_id = csvFile.Get <string>(i, "Sprite ID");

            string rawSkills = csvFile.Get <string>(i, "Skill");
            if (!string.IsNullOrEmpty(rawSkills))
            {
                string[] skillArray = rawSkills.Split(new string[] { "," }, System.StringSplitOptions.None);
                c_prefab.skills = GetSkillFromIDs(statsHolder, skillArray);
            }

            RuntimeAnimatorController animator = AssetDatabase.LoadAssetAtPath(string.Format(MonsterAnimatorPath, c_prefab.sprite_id), typeof(AnimatorOverrideController)) as RuntimeAnimatorController;
            if (animator != null)
            {
                c_prefab.animator = animator;
            }

            statsHolder.stpObjectHolder.Add(c_prefab);
        }
    }
Esempio n. 7
0
    static private void CreateTowerStats(StatsHolder statsHolder)
    {
        TextAsset csvText = (TextAsset)AssetDatabase.LoadAssetAtPath(DATABASE_FOLDER + "/CSV/database - tower.csv", typeof(TextAsset));

        UnityEngine.Object[] rawSpriteSheet = AssetDatabase.LoadAllAssetsAtPath(TOWER_SPRITE_PATH);

        var sprteSheet = rawSpriteSheet.Where(q => q is Sprite).Cast <Sprite>().ToArray();


        CSVFile csvFile = new CSVFile(csvText.text);

        AssetDatabase.CreateFolder(DATABASE_FOLDER + "/Asset", "Tower");

        int csvCount = csvFile.length;

        for (int i = csvCount - 1; i >= 0; i--)
        {
            string id = csvFile.Get <string>(i, "ID");

            if (string.IsNullOrEmpty(id))
            {
                continue;
            }

            TowerStats c_prefab = ScriptableObjectUtility.CreateAsset <TowerStats>(DATABASE_FOLDER + "/Asset/Tower/", "[TowerStat] " + id);
            EditorUtility.SetDirty(c_prefab);

            c_prefab.id    = id;
            c_prefab.label = csvFile.Get <string>(i, "Label");
            c_prefab.tag   = csvFile.Get <string>(i, "Tag");

            c_prefab.hp    = csvFile.Get <float>(i, "HP");
            c_prefab.level = csvFile.Get <int>(i, "Level");
            c_prefab.atk   = csvFile.Get <float>(i, "ATK");
            c_prefab.spd   = csvFile.Get <float>(i, "SPD");
            c_prefab.range = csvFile.Get <float>(i, "RANGE");
            c_prefab.cost  = csvFile.Get <int>(i, "COST");
            c_prefab.value = c_prefab.cost;

            string upgradePath = csvFile.Get <string>(i, "Update Path");
            if (!string.IsNullOrEmpty(upgradePath))
            {
                string[] upgradePathArray = upgradePath.Split(new string[] { "," }, System.StringSplitOptions.None);
                c_prefab = UpdateTowerUpgradePath(c_prefab, statsHolder, upgradePathArray);
            }

            string rawSkills = csvFile.Get <string>(i, "Skill");
            if (!string.IsNullOrEmpty(rawSkills))
            {
                string[] skillArray = rawSkills.Split(new string[] { "," }, System.StringSplitOptions.None);
                c_prefab.skills = GetSkillFromIDs(statsHolder, skillArray);
            }

            c_prefab.sprite = UtilityMethod.LoadSpriteFromMulti(sprteSheet, csvFile.Get <string>(i, "Sprite ID"));

            statsHolder.stpObjectHolder.Add(c_prefab);
        }
    }