Esempio n. 1
0
    public void NameList(int number)
    {
        Kata = Resources.Load("NameListKatakana") as Entity_Katakana;
        Hira = Resources.Load("NameListHiragana") as Entity_Hiragana;


        switch (number)
        {
        case 1:
            int num = randomunum;
            inputKatakana = Kata.sheets[0].list[num].kake2;
            inputHiragana = Hira.sheets[0].list[num].Hira_kake2;
            Debug.Log("inputKatakana" + inputKatakana);

            break;

        case 2:
            int num2 = randomunum;

            inputKatakana = Kata.sheets[0].list[num2].kake4;
            inputHiragana = Hira.sheets[0].list[num2].Hira_kake4;
            break;

        case 3:
            int num3 = randomunum;

            inputKatakana = Kata.sheets[0].list[num3].kake6;
            inputHiragana = Hira.sheets[0].list[num3].Hira_kake6;
            break;

        case 4:
            int num4 = randomunum;

            inputKatakana = Kata.sheets[0].list[num4].yominikui4;
            inputHiragana = Hira.sheets[0].list[num4].Hira_yominikui4;
            break;
        }
    }
Esempio n. 2
0
    public void NameList(int number)
    {
        Kata = Resources.Load("NameListKatakana") as Entity_Katakana;
        Hira = Resources.Load("NameListHiragana") as Entity_Hiragana;

        switch (number)
        {
        case 1:
            switch (newNameJudgeBoss.randomunum)
            {
            case 0:
                int num01 = 0;
                if (strLength == 2)
                {
                    num01 = Random.Range(0, 2);
                }
                if (strLength == 3)
                {
                    num01 = Random.Range(2, 6);
                }

                inputKatakana = Kata.sheets[0].list[num01].kake3;
                inputHiragana = Hira.sheets[0].list[num01].Hira_kake3;
                break;

            case 1:
                int num02 = 0;
                if (strLength == 2)
                {
                    num02 = Random.Range(6, 8);
                }
                if (strLength == 3)
                {
                    num02 = Random.Range(8, 12);
                }
                inputKatakana = Kata.sheets[0].list[num02].kake3;
                inputHiragana = Hira.sheets[0].list[num02].Hira_kake3;

                break;

            case 2:
                int num03 = 0;
                if (strLength == 2)
                {
                    num03 = Random.Range(12, 14);
                }
                if (strLength == 3)
                {
                    num03 = Random.Range(14, 18);
                }
                inputKatakana = Kata.sheets[0].list[num03].kake3;
                inputHiragana = Hira.sheets[0].list[num03].Hira_kake3;

                break;

            case 3:
                int num04 = 0;
                if (strLength == 2)
                {
                    num04 = Random.Range(18, 21);
                }
                if (strLength == 3)
                {
                    num04 = Random.Range(21, 24);
                }
                inputKatakana = Kata.sheets[0].list[num04].kake3;
                inputHiragana = Hira.sheets[0].list[num04].Hira_kake3;

                break;

            case 4:
                int num05 = 0;
                if (strLength == 2)
                {
                    num05 = Random.Range(24, 27);
                }
                if (strLength == 3)
                {
                    num05 = Random.Range(27, 30);
                }
                inputKatakana = Kata.sheets[0].list[num05].kake3;
                inputHiragana = Hira.sheets[0].list[num05].Hira_kake3;

                break;
            }

            break;

        case 2:

            switch (newNameJudgeBoss.randomunum)
            {
            case 0:
                int num01 = 0;
                if (strLength == 2)
                {
                    num01 = Random.Range(0, 3);
                }
                if (strLength == 3)
                {
                    num01 = Random.Range(3, 6);
                }
                if (strLength == 4)
                {
                    num01 = Random.Range(6, 8);
                }
                inputKatakana = Kata.sheets[0].list[num01].kake5;
                inputHiragana = Hira.sheets[0].list[num01].Hira_kake5;

                break;

            case 1:
                int num02 = 0;
                if (strLength == 2)
                {
                    num02 = Random.Range(8, 11);
                }
                if (strLength == 3)
                {
                    num02 = Random.Range(11, 14);
                }
                if (strLength == 4)
                {
                    num02 = Random.Range(14, 16);
                }
                inputKatakana = Kata.sheets[0].list[num02].kake5;
                inputHiragana = Hira.sheets[0].list[num02].Hira_kake5;
                break;

            case 2:
                int num03 = 0;
                if (strLength == 2)
                {
                    num03 = 16;
                }
                if (strLength == 3)
                {
                    num03 = Random.Range(17, 23);
                }
                if (strLength == 4)
                {
                    num03 = 23;
                }
                inputKatakana = Kata.sheets[0].list[num03].kake5;
                inputHiragana = Hira.sheets[0].list[num03].Hira_kake5;
                break;

            case 3:
                int num04 = 0;
                if (strLength == 2)
                {
                    num04 = Random.Range(24, 26);
                }
                if (strLength == 3)
                {
                    num04 = Random.Range(26, 31);
                }
                if (strLength == 4)
                {
                    num04 = 31;
                }
                inputKatakana = Kata.sheets[0].list[num04].kake5;
                inputHiragana = Hira.sheets[0].list[num04].Hira_kake5;
                break;

            case 4:
                int num05 = 0;
                if (strLength == 2)
                {
                    num05 = 32;
                }
                if (strLength == 3)
                {
                    num05 = Random.Range(33, 38);
                }
                if (strLength == 4)
                {
                    num05 = Random.Range(38, 40);
                }
                inputKatakana = Kata.sheets[0].list[num05].kake5;
                inputHiragana = Hira.sheets[0].list[num05].Hira_kake5;
                break;
            }
            break;

        case 3:
            switch (newNameJudgeBoss.randomunum)
            {
            case 0:
                int num01 = 0;
                if (strLength == 2)
                {
                    num01 = Random.Range(0, 2);
                }
                if (strLength == 3)
                {
                    num01 = Random.Range(2, 9);
                }
                inputKatakana = Kata.sheets[0].list[num01].yominikui3;
                inputHiragana = Hira.sheets[0].list[num01].Hira_yominikui3;

                break;

            case 1:
                int num02 = 0;
                if (strLength == 2)
                {
                    num02 = Random.Range(9, 13);
                }
                if (strLength == 3)
                {
                    num02 = Random.Range(13, 18);
                }

                inputKatakana = Kata.sheets[0].list[num02].yominikui3;
                inputHiragana = Hira.sheets[0].list[num02].Hira_yominikui3;
                break;

            case 2:
                int num03 = 0;
                if (strLength == 2)
                {
                    num03 = Random.Range(18, 21);
                }
                if (strLength == 3)
                {
                    num03 = Random.Range(21, 27);
                }
                inputKatakana = Kata.sheets[0].list[num03].yominikui3;
                inputHiragana = Hira.sheets[0].list[num03].Hira_yominikui3;

                break;

            case 3:
                int num04 = 0;
                if (strLength == 2)
                {
                    num04 = 27;
                }
                if (strLength == 3)
                {
                    num04 = Random.Range(28, 36);
                }

                inputKatakana = Kata.sheets[0].list[num04].yominikui3;
                inputHiragana = Hira.sheets[0].list[num04].Hira_yominikui3;
                break;

            case 4:
                int num05 = 0;
                if (strLength == 2)
                {
                    num05 = Random.Range(36, 39);
                }
                if (strLength == 3)
                {
                    num05 = Random.Range(39, 45);
                }

                inputKatakana = Kata.sheets[0].list[num05].yominikui3;
                inputHiragana = Hira.sheets[0].list[num05].Hira_yominikui3;
                break;
            }

            break;

        case 4:
            switch (newNameJudgeBoss.randomunum)
            {
            case 0:
                int num01 = 0;
                if (strLength == 2)
                {
                    num01 = 0;
                }
                if (strLength == 3)
                {
                    num01 = Random.Range(1, 12);
                }
                inputKatakana = Kata.sheets[0].list[num01].yominikui5;
                inputHiragana = Hira.sheets[0].list[num01].Hira_yominikui5;

                break;

            case 1:
                int num02 = 0;
                if (strLength == 2)
                {
                    num02 = 12;
                }
                if (strLength == 3)
                {
                    num02 = Random.Range(13, 24);
                }

                inputKatakana = Kata.sheets[0].list[num02].yominikui5;
                inputHiragana = Hira.sheets[0].list[num02].Hira_yominikui5;
                break;

            case 2:
                int num03 = 0;
                if (strLength == 2)
                {
                    num03 = Random.Range(24, 27);
                }
                if (strLength == 3)
                {
                    num03 = Random.Range(27, 36);
                }

                inputKatakana = Kata.sheets[0].list[num03].yominikui5;
                inputHiragana = Hira.sheets[0].list[num03].Hira_yominikui5;
                break;

            case 3:
                int num04 = 0;
                if (strLength == 2)
                {
                    num04 = Random.Range(36, 38);
                }
                if (strLength == 3)
                {
                    num04 = Random.Range(38, 48);
                }

                inputKatakana = Kata.sheets[0].list[num04].yominikui5;
                inputHiragana = Hira.sheets[0].list[num04].Hira_yominikui5;
                break;

            case 4:
                int num05 = 0;
                if (strLength == 2)
                {
                    num05 = Random.Range(48, 50);
                }
                if (strLength == 3)
                {
                    num05 = Random.Range(50, 60);
                }

                inputKatakana = Kata.sheets[0].list[num05].yominikui5;
                inputHiragana = Hira.sheets[0].list[num05].Hira_yominikui5;
                break;
            }

            break;
        }
    }
    static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        foreach (string asset in importedAssets)
        {
            if (!filePath.Equals(asset))
            {
                continue;
            }

            Entity_Katakana data = (Entity_Katakana)AssetDatabase.LoadAssetAtPath(exportPath, typeof(Entity_Katakana));
            if (data == null)
            {
                data = ScriptableObject.CreateInstance <Entity_Katakana> ();
                AssetDatabase.CreateAsset((ScriptableObject)data, exportPath);
                data.hideFlags = HideFlags.NotEditable;
            }

            data.sheets.Clear();
            using (FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) {
                IWorkbook book = null;
                if (Path.GetExtension(filePath) == ".xls")
                {
                    book = new HSSFWorkbook(stream);
                }
                else
                {
                    book = new XSSFWorkbook(stream);
                }

                foreach (string sheetName in sheetNames)
                {
                    ISheet sheet = book.GetSheet(sheetName);
                    if (sheet == null)
                    {
                        Debug.LogError("[QuestData] sheet not found:" + sheetName);
                        continue;
                    }

                    Entity_Katakana.Sheet s = new Entity_Katakana.Sheet();
                    s.name = sheetName;

                    for (int i = 1; i <= sheet.LastRowNum; i++)
                    {
                        IRow  row  = sheet.GetRow(i);
                        ICell cell = null;

                        Entity_Katakana.Param p = new Entity_Katakana.Param();

                        cell = row.GetCell(0); p.kake2 = (cell == null ? "" : cell.StringCellValue);
                        cell = row.GetCell(1); p.kake3 = (cell == null ? "" : cell.StringCellValue);
                        cell = row.GetCell(2); p.kake4 = (cell == null ? "" : cell.StringCellValue);
                        cell = row.GetCell(3); p.kake5 = (cell == null ? "" : cell.StringCellValue);
                        cell = row.GetCell(4); p.kake6 = (cell == null ? "" : cell.StringCellValue);
                        cell = row.GetCell(5); p.yominikui3 = (cell == null ? "" : cell.StringCellValue);
                        cell = row.GetCell(6); p.yominikui4 = (cell == null ? "" : cell.StringCellValue);
                        cell = row.GetCell(7); p.yominikui5 = (cell == null ? "" : cell.StringCellValue);
                        s.list.Add(p);
                    }
                    data.sheets.Add(s);
                }
            }

            ScriptableObject obj = AssetDatabase.LoadAssetAtPath(exportPath, typeof(ScriptableObject)) as ScriptableObject;
            EditorUtility.SetDirty(obj);
        }
    }