Example #1
0
    // ハイスコアの保存
    public void Save()
    {
        // ハイスコアを保存する
        //PlayerPrefs.SetInt (highScoreKey, highScore);
        //PlayerPrefs.Save ();

        // ハイスコアを保存する(ただし記録の更新があったときだけ)
        if (isNewRecord)
        {
            highScore.save();
        }
        // ゲーム開始前の状態に戻す
        Initialize();
    }
Example #2
0
    // ハイスコアの保存
    private void Save()
    {
        // ハイスコアを保存する(ただし記録の更新があったときだけ)
        if (isNewRecord)
        {
            highScore.save();
        }

        // ハイスコアを保存する
        //PlayerPrefs.SetInt (highScoreKey, 0);
        PlayerPrefs.SetInt(highScoreKey, high_score);
        PlayerPrefs.SetInt(thistimeScoreKey, SetValue.total_score);
        PlayerPrefs.Save();

        // ゲーム開始前の状態に戻す
        Initialize();
    }
Example #3
0
	void OnGUI () {
		//デバッグ用 Initの初期化
		if(GUI.Button(new Rect(100,100,80,20), "初期化")) {
			//Application.LoadLevel(1);
			PlayerPrefs.DeleteKey ("Init");
			PlayerPrefs.DeleteKey ("Name");
			//PlayerPrefs.DeleteKey ("Uuid");
		}
		
		
		if (is_firstPlay) {
			//初回起動時
			// グループの背景にTexture2Dのテクスチャを指定.
			GUIStyle style = new GUIStyle();
			style.normal.background = bgPanel;
			GUI.BeginGroup(new Rect(Screen.width / 2 - BgPanelWidth / 2, Screen.height / 2 - BgPanelHeight / 2, BgPanelWidth, BgPanelHeight), style);
			
			// 入力フィールドを作る
			Rect rect1 = new Rect(BgPanelWidth / 2 - TextFieldWidth / 2, (BgPanelHeight / 2 - TextFieldHeight / 2)-30, TextFieldWidth, TextFieldHeight);
			UserName = GUI.TextField(rect1, UserName, maxLength, inputStyle);
			//フォーカスの当て方が分からない!あとフォーカスカーソルの色の変え方も。
			//GUI.SetNextControlName("NameField");
			//GUI.FocusControl("NameField");
			//GUI.FocusWindow(NameField);
			
			if (GUI.Button(new Rect(BgPanelWidth / 2 - ButtonWidth / 2, (BgPanelHeight / 2 - ButtonHeight / 2)+90, ButtonWidth, ButtonHeight),"", kanryoButtonStyle)){
				if(UserName != ""){
					//print ("名前は " + UserName + "です。");
					
					//サーバーにデータを保存
					//UUIDの生成
					System.Guid guid=System.Guid.NewGuid();
					_uuid = guid.ToString();
					_name = UserName;

					currentHighScore = new NCMB.HighScore(_score,_name,_uuid);
					currentHighScore.save();

					//サーバー問い合わせ用にローカル保存
					PlayerPrefs.SetString("Uuid",_uuid);
					PlayerPrefs.SetString("Name",_name);
					
					Application.LoadLevel ("Start");
					//is_firstPlay = false;
				}else{
					print ("名前を入力してください。");
				}
			}
			GUI.EndGroup ();
		}else{
			//起動二回目以降
			// タイトルを表示する
			gameObject.GetComponent<Renderer>().enabled = true;
			
			// ボタンを表示する
			if (GUI.Button(new Rect(Screen.width / 2 - ButtonWidth / 2, (Screen.height / 2 - ButtonHeight / 2)+20, ButtonWidth, ButtonHeight),"", startButtonStyle)){
				print ("スタートをクリックしました");
				Application.LoadLevel ("Game");
				UnityChan2DController.gameflg = true;

			}
			if (GUI.Button(new Rect(Screen.width / 2 - ButtonWidth / 2, (Screen.height / 2 - ButtonHeight / 2)+120, ButtonWidth, ButtonHeight),"", rankingButtonStyle)){
				print ("ランキングをクリックしました");
				Application.LoadLevel ("Ranking");
				UnityChan2DController.gameflg = true;

			}
		}
	}
Example #4
0
 public static void SaveHighScoreNCMB(NCMB.HighScore highScore, int score)
 {
     highScore.score = score;
     highScore.save();
 }