コード例 #1
0
        //グローバルセッティングを保存します
        public void saveGlobal(SaveGlobalObject sobj)
        {
            NovelSingleton.GameManager.globalSetting = sobj;
            string json = LitJson.JsonMapper.ToJson(sobj);


            //WebPlayer の場合保存方法に変化を入れる
            if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.OSXPlayer)
            {
                PlayerPrefs.SetString("setting.dat", json);
            }
            else
            {
                string path = storagePath + "/setting.dat";

                //ディレクトリ存在チェック
                if (!Directory.Exists(storagePath))
                {
                    Directory.CreateDirectory(storagePath);
                }


                FileStream fs = new FileStream(path,
                                               FileMode.Create,
                                               FileAccess.Write);

                StreamWriter sw = new StreamWriter(fs);
                sw.Write(json);
                sw.Flush();
                sw.Close();
                fs.Close();
            }
        }
コード例 #2
0
        //グローバルセッティングを保存します
        public void saveGlobal(SaveGlobalObject sobj)
        {
            NovelSingleton.GameManager.globalSetting = sobj;
            string json = LitJson.JsonMapper.ToJson(sobj);



            string path = storagePath + "/setting.dat";

            //ディレクトリ存在チェック
            if (!Directory.Exists(storagePath))
            {
                Directory.CreateDirectory(storagePath);
            }


            FileStream fs = new FileStream(path,
                                           FileMode.Create,
                                           FileAccess.Write);

            StreamWriter sw = new StreamWriter(fs);

            sw.Write(json);
            sw.Flush();
            sw.Close();
            fs.Close();
        }
コード例 #3
0
ファイル: SaveManager.cs プロジェクト: 2ty/race3d
		//グローバルセッティングを保存します
		public void saveGlobal(SaveGlobalObject sobj){

			NovelSingleton.GameManager.globalSetting = sobj;
			string json = LitJson.JsonMapper.ToJson (sobj);


			//WebPlayer の場合保存方法に変化を入れる
			if (Application.platform == RuntimePlatform.WindowsWebPlayer || Application.platform == RuntimePlatform.OSXWebPlayer) {

				PlayerPrefs.SetString("setting.dat", json);

			} else {

				string path = storagePath + "/setting.dat";

				//ディレクトリ存在チェック
				if (!Directory.Exists (storagePath)) {
					Directory.CreateDirectory (storagePath);
				}


				FileStream fs = new FileStream (path,
					               FileMode.Create,
					               FileAccess.Write);

				StreamWriter sw = new StreamWriter (fs);
				sw.Write (json);
				sw.Flush ();
				sw.Close ();
				fs.Close ();
			}
		}
コード例 #4
0
        public void loadGlobal()
        {
            string path = storagePath + "/setting.dat";

            if (!File.Exists(path))
            {
                //ファイル作製
                this.saveGlobal(new SaveGlobalObject());
            }

            FileStream fs = new FileStream(path,
                                           FileMode.Open,
                                           FileAccess.Read);

            StreamReader sr   = new StreamReader(path, System.Text.Encoding.Default);
            string       json = sr.ReadToEnd();

            SaveGlobalObject obj = LitJson.JsonMapper.ToObject <SaveGlobalObject>(json);

            sr.Close();
            fs.Close();

            NovelSingleton.GameManager.globalSetting = obj;

            //グローバル変数を格納する
            StatusManager.variable.replaceAll("global", NovelSingleton.GameManager.globalSetting.globalVar);

            StatusManager.variable.trace("global");
        }
コード例 #5
0
        public void loadGlobal()
        {
            ////WebPlayer の場合保存方法に変化を入れる
            //if (Application.platform == RuntimePlatform.WindowsWebPlayer || Application.platform == RuntimePlatform.OSXWebPlayer) {

            //	if (!PlayerPrefs.HasKey ("setting.dat")) {
            //		this.saveGlobal (new SaveGlobalObject ());
            //	}

            //	string json = PlayerPrefs.GetString ("setting.dat");

            //	SaveGlobalObject obj = LitJson.JsonMapper.ToObject<SaveGlobalObject> (json);
            //	NovelSingleton.GameManager.globalSetting = obj;


            //} else {


            string path = storagePath + "/setting.dat";

            if (!File.Exists(path))
            {
                //ファイル作製
                this.saveGlobal(new SaveGlobalObject());
            }

            FileStream fs = new FileStream(path,
                                           FileMode.Open,
                                           FileAccess.Read);

            StreamReader sr   = new StreamReader(path, System.Text.Encoding.Default);
            string       json = sr.ReadToEnd();

            SaveGlobalObject obj = LitJson.JsonMapper.ToObject <SaveGlobalObject> (json);

            sr.Close();
            fs.Close();

            NovelSingleton.GameManager.globalSetting = obj;

            //}

            //グローバル変数を格納する
            StatusManager.variable.replaceAll("global", NovelSingleton.GameManager.globalSetting.globalVar);

            StatusManager.variable.trace("global");
        }