Exemple #1
0
    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()); */ }
    }
Exemple #2
0
    //日食データをアセットバンドルから初期化する
    IEnumerator initEclipseDataFromAssetBundle(string datafilename)
    {
        string jsonstring = null;

        if (Application.platform == RuntimePlatform.WindowsEditor)
        {
            string       path   = Application.dataPath + "/StreamingAssets/" + datafileprefix + datafilename;
            StreamReader reader = new StreamReader(path);

            jsonstring = reader.ReadToEnd();
            reader.Close();
        }
        else if (Application.platform == RuntimePlatform.Android)
        {
            string bundleUrl = Path.Combine("jar:file://" + Application.dataPath + "!/assets" + "/", datafileprefix + datafilename);
            WWW    www       = new WWW(bundleUrl);
            yield return(www);

            while (!www.isDone)
            {
            }
            jsonstring = www.text;
            //text = "count =" + www.text.Length.ToString();
        }
        try
        {
            EclipseData data = JsonUtility.FromJson <EclipseData>(jsonstring);
            if (data != null && data.initDateTime())
            {
                currenteclipsedata = data;
                EclipseDataHolder.setEclipseData(currenteclipsedata);

                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());*/ }
    }
Exemple #3
0
    //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.getInitialCameraLongitude();
            latitude  = data.getInitialCameraLatitude();

            shadowrenderer.setEclipseData(currenteclipsedata, earthshadow, UmbralShadowRenderer.PLAYMODE);
            positionUpdated(0.0f, 0.0f);
            ready = true;
        }
    }