private void initEclipseData(string datafilename) { // Assetsフォルダから読み込む string path = Application.dataPath + "/eclipsedata/" + datafilename; //Debug.Log(path); StreamReader reader = new StreamReader(path); string jsonstring = reader.ReadToEnd(); try { EclipseData data = JsonUtility.FromJson <EclipseData>(jsonstring); if (data != null && data.initDateTime()) { currenteclipsedata = data; EclipseDataHolder.setEclipseData(data); start = currenteclipsedata.getStartTime(); finish = currenteclipsedata.getFinishTime(); current = new DateTime(start.Year, start.Month, start.Day, start.Hour, start.Minute, 0, DateTimeKind.Utc); shadowrenderer.setEclipseData(currenteclipsedata, earthshadow, UmbralShadowRenderer.PLAYMODE); longitude = data.getInitialCameraLongitude(); latitude = data.getInitialCameraLatitude(); positionUpdated(0.0f, 0.0f); ready = true; } //reader.Close(); } catch (Exception e) { /*Debug.Log("readJson " + e.ToString()); */ } }
//EclipseDataHolderからデータを読み込む private void initFromEclipseDataHolder() { EclipseData data = EclipseDataHolder.getEclipseData(); if (data != null) { currenteclipsedata = data; start = currenteclipsedata.getStartTime(); finish = currenteclipsedata.getFinishTime(); current = new DateTime(start.Year, start.Month, start.Day, start.Hour, start.Minute, 0, DateTimeKind.Utc); longitude = data.getInitialMapLongitude(); latitude = data.getInitialMapLatitude(); shadowrenderer.setEclipseData(currenteclipsedata, earthshadow, UmbralShadowRenderer.PLAYMODE); setCameraPosition(); ready = true; } }