コード例 #1
0
    private static List <MasterLoadSprite.Data> ReadExcel(Type _type)
    {
        string loadPath = SystemSetting.GetExcelSeetPath() + _type.Name + "Sheet.xls";
        List <MasterLoadSprite.Data> dataList = new List <MasterLoadSprite.Data> ();

        using (FileStream stream = File.Open(loadPath, FileMode.Open, FileAccess.Read)) {
            IWorkbook book  = new HSSFWorkbook(stream);
            ISheet    sheet = book.GetSheet("MainSeet");

            for (int i = 1; i < sheet.LastRowNum; i++)
            {
                IRow row     = sheet.GetRow(i);
                int  iColumn = 0;

                MasterLoadSprite.Data tmpData = new MasterLoadSprite.Data();

                //DataSwitch :
                tmpData.filename = row.GetCell(iColumn++).StringCellValue;
                tmpData.version  = (int)row.GetCell(iColumn++).NumericCellValue;
                tmpData.pre_load = (int)row.GetCell(iColumn++).NumericCellValue;
                tmpData.path     = row.GetCell(iColumn++).StringCellValue;
                tmpData.del_flg  = (int)row.GetCell(iColumn++).NumericCellValue;

                iColumn++;

                dataList.Add(tmpData);
            }
        }

        MasterLoadSpriteCSVLoader.UpdateCSVFile(dataList);

        return(dataList);
    }
コード例 #2
0
    public static void SetScriptableData(Type _type)
    {
        //プレハブにスクリプタブルオブジェクトを設置
        UnityEngine.Object[] assets;
        string assetName = SystemSetting.GetResourcesLoadPath() + _type.Name + "Asset";

        assets = Resources.LoadAll(assetName);

        MasterLoadSprite tmp     = new MasterLoadSprite();
        ScriptableObject sObject = null;

        foreach (UnityEngine.Object asset in assets)
        {
            if (asset is MasterLoadSprite)
            {
                tmp     = (MasterLoadSprite)asset;
                sObject = (ScriptableObject)asset;
            }
        }
        List <MasterLoadSprite.Data> listData = MasterLoadSpriteCSVLoader.GetListDataFromCSV(_type);

        tmp.DataList = listData;

        //最後に保存して変更を確定
        EditorUtility.SetDirty(sObject);
    }