void Start() { Direction = 0; es2 = Resources.Load("time") as Entity_Sheet2; //DateTime dt2 = DateTime.FromOADate(es2.sheets[0].list[0].departure_Time); es3 = Resources.Load("TimeArrive") as Entity_Sheet3; }
void Start() { es2 = Resources.Load("time") as Entity_Sheet2; Debug.Log(es2.sheets[0].list[0].departure_Time); DateTime dt2 = DateTime.FromOADate(es2.sheets[0].list[0].departure_Time); Debug.Log(dt2); Debug.Log(dt2.Hour + ":" + dt2.Minute + ":" + dt2.Second); Debug.Log(dt2.DayOfWeek); Debug.Log(es2.sheets[0].list[1].departure_Station); Debug.Log(es2.sheets[0].list[1].train_number); DateTime dt3 = DateTime.FromOADate(es2.sheets[0].list[1].departure_Time); DateTime dt4 = DateTime.FromOADate(es2.sheets[0].list[2].departure_Time); Debug.Log(dt4 - dt3); int i; for (i = 0; i < SMA.StationJapanese.Length; i++) { if (hatu.Equals(SMA.StationJapanese[i])) { hatu = SMA.StationAlpha[i]; Direction = 1; RailDirection = "odpt.RailDirection:TokyoMetro.YoyogiUehara"; } if (chaku.Equals(SMA.StationJapanese[i])) { chaku = SMA.StationAlpha[i]; Direction = 0; RailDirection = "odpt.RailDirection:TokyoMetro.KitaAyase"; } } Debug.Log(chaku); Debug.Log(hatu); }
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (string asset in importedAssets) { if (!filePath.Equals(asset)) { continue; } Entity_Sheet2 data = (Entity_Sheet2)AssetDatabase.LoadAssetAtPath(exportPath, typeof(Entity_Sheet2)); if (data == null) { data = ScriptableObject.CreateInstance <Entity_Sheet2> (); 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_Sheet2.Sheet s = new Entity_Sheet2.Sheet(); s.name = sheetName; for (int i = 1; i <= sheet.LastRowNum; i++) { IRow row = sheet.GetRow(i); ICell cell = null; Entity_Sheet2.Param p = new Entity_Sheet2.Param(); cell = row.GetCell(0); p.departure_Station = (cell == null ? "" : cell.StringCellValue); cell = row.GetCell(1); p.departure_Time = (cell == null ? 0.0 : cell.NumericCellValue); cell = row.GetCell(2); p.rail_direction = (cell == null ? "" : cell.StringCellValue); cell = row.GetCell(3); p.train_number = (cell == null ? "" : cell.StringCellValue); cell = row.GetCell(4); p.day_sp = (cell == null ? "" : cell.StringCellValue); s.list.Add(p); } data.sheets.Add(s); } } ScriptableObject obj = AssetDatabase.LoadAssetAtPath(exportPath, typeof(ScriptableObject)) as ScriptableObject; EditorUtility.SetDirty(obj); } }