Esempio n. 1
0
    void Start()
    {
        SoundMgr.Instance.PlayBGM(SoundMgr.Instance.bgm_title);          //プレイ時以外のBGM設定

        //staticなクラスのメンバ変数の初期化
        SetValue.initialize();
        //ローカルのハイスコアを取得する
        high           = PlayerPrefs.GetInt(highScoreKey, 0);
        user_name.text = "local";

        isOnline = false;
        logout_button.SetActive(false);
        login_button.SetActive(true);
        leader_board.SetActive(false);

        //ログインしていればユーザネームとログアウトボタンを表示
        //シングルトン化しているかの確認
        if (FindObjectOfType <UserAuth>() != null)
        {
            if (FindObjectOfType <UserAuth> ().currentPlayer() != null)
            {
                isOnline       = true;
                user_name.text = FindObjectOfType <UserAuth> ().currentPlayer();
                //ハイスコア取得
                highScore = new NCMB.HighScore(0, user_name.text);
                highScore.fetch();

                logout_button.SetActive(true);
                login_button.SetActive(false);
                leader_board.SetActive(true);
            }
        }
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        SoundMgr.Instance.PlayBGM(SoundMgr.Instance.bgm_title);          //プレイ時以外のBGM設定

        // ハイスコアを取得する。保存されてなければ0点。
        Initialize();

        //オンライン
        if (Manager.isOnline)
        {
            string name = FindObjectOfType <UserAuth>().currentPlayer();
            highScore = new NCMB.HighScore(0, name);
            highScore.fetch();

            StartCoroutine("WaitFetch");
        }
        else             //ローカル
        {
            leader_board.SetActive(false);

            // スコアがハイスコアより大きければ
            if (high_score < SetValue.total_score)
            {
                high_score = SetValue.total_score;
                Save();
            }
            // スコア・ハイスコアを表示する
            highscore_text.text = "HIGH : " + high_score;
            score_text.text     = "SCORE : " + SetValue.total_score;
        }
    }
Esempio n. 3
0
    void Start()
    {
        SoundMgr.Instance.PlayBGM (SoundMgr.Instance.bgm_title); //プレイ時以外のBGM設定

        //staticなクラスのメンバ変数の初期化
        SetValue.initialize ();
        //ローカルのハイスコアを取得する
        high = PlayerPrefs.GetInt (highScoreKey, 0);
        user_name.text = "local";

        isOnline = false;
        logout_button.SetActive (false);
        login_button.SetActive (true);
        leader_board.SetActive (false);

        //ログインしていればユーザネームとログアウトボタンを表示
        //シングルトン化しているかの確認
        if (FindObjectOfType<UserAuth>() != null) {
            if (FindObjectOfType<UserAuth> ().currentPlayer () != null) {
                isOnline = true;
                user_name.text = FindObjectOfType<UserAuth> ().currentPlayer ();
                //ハイスコア取得
                highScore = new NCMB.HighScore (0, user_name.text);
                highScore.fetch ();

                logout_button.SetActive (true);
                login_button.SetActive (false);
                leader_board.SetActive (true);
            }
        }
    }
Esempio n. 4
0
    // PlayerPrefsで保存するためのキー
    // もうローカルには保存しないので、以下の行は削除
    //private string highScoreKey = "highScore";
    void Start()
    {
        Initialize ();

        // ハイスコアを取得する。保存されてなければ0点。
        string name = FindObjectOfType<UserAuth>().currentPlayer();
        highScore = new NCMB.HighScore( 0, name );
        highScore.fetch();
    }
Esempio n. 5
0
    /*
     * // ゲーム開始前の状態に戻す
     * private void Initialize ()
     * {
     *      // スコアを0に戻す
     *      score = 0;
     *
     *      // ハイスコアを取得する。保存されてなければ0を取得する。
     *      highScore = PlayerPrefs.GetInt (highScoreKey, 0);
     * }
     */

    void Start()
    {
        Initialize();

        // ハイスコアを取得する。保存されてなければ0点。
        string name = FindObjectOfType <UserAuth>().currentPlayer();

        highScore = new NCMB.HighScore(0, name);
        highScore.fetch();
    }
Esempio n. 6
0
    void Start()
    {
        Initialize();

        isNewRecord = false;

        // ハイスコアを取得する。保存されてなければ0点。
        string name = FindObjectOfType <UserAuth>().CurrentPlayer();

        highScore = new NCMB.HighScore(0.0f, name);
        highScore.SarverFetch();
    }
Esempio n. 7
0
    void Start()
    {
        lBoard = new LeaderBoard();

        // テキストを表示するゲームオブジェクトを取得
        for( int i = 0; i < 5; ++i ) {
            top[i] = GameObject.Find ("Top" + i);
            nei[i] = GameObject.Find ("Neighbor" + i);
        }

        // フラグ初期化
        isScoreFetched = false;
        isRankFetched  = false;
        isLeaderBoardFetched = false;

        // 現在のハイスコアを取得
        string name = FindObjectOfType<UserAuth>().currentPlayer();
        currentHighScore = new NCMB.HighScore( -1, name );
        currentHighScore.fetch();
    }
Esempio n. 8
0
	// Use this for initialization
	void Start () {
		lBoard = new LeaderBoard();
		
		// テキストを表示するゲームオブジェクトを取得
		for( int i = 0; i < 5; ++i ) {
			top[i] = GameObject.Find ("Top" + i);
			nei[i] = GameObject.Find ("Neighbor" + i);
		}
		
		//マイスコアを表示するゲームオブジェクトの取得
		myName = GameObject.Find ("data_name");
		myScore = GameObject.Find ("data_score");
		myRank = GameObject.Find ("data_rank");
		
		// フラグ初期化
		isScoreFetched = false;
		isRankFetched  = false;
		isLeaderBoardFetched = false;
		
		//uuid
		/*
		_uuid=PlayerPrefs.GetString("Uuid", "__UNDEFINED__");
		_name=PlayerPrefs.GetString("Name", "__UNDEFINED__");
		System.Guid guid=System.Guid.NewGuid();
		if (_uuid == "__UNDEFINED__") _uuid = guid.ToString();
		if (_name == "__UNDEFINED__") _name = _uuid;
		PlayerPrefs.SetString("Uuid",_uuid);
		PlayerPrefs.SetString("Name",_name);
		PlayerPrefs.Save();
		*/

		_uuid = PlayerPrefs.GetString ("Uuid");
		_name = PlayerPrefs.GetString ("Name");

		
		// 現在のハイスコアを取得
		//string name = FindObjectOfType<UserAuth>().currentPlayer();
		currentHighScore = new NCMB.HighScore( -1, _name, _uuid );
		currentHighScore.fetch();	
	}
    void Start()
    {
        leaderBoard = new LeaderBoard();

        // テキストを表示するゲームオブジェクトを取得
        for (int i = 0; i < 5; ++i)
        {
            top[i] = GameObject.Find("Top" + i);
            nei[i] = GameObject.Find("Neighbor" + i);
        }

        // フラグ初期化
        isScoreFetched       = false;
        isRankFetched        = false;
        isLeaderBoardFetched = false;

        // 現在のハイスコアを取得
        string name = FindObjectOfType <UserAuth>().CurrentPlayer();

        currentHighScore = new NCMB.HighScore(10, name);
        currentHighScore.SarverFetch();
    }
Esempio n. 10
0
    // Update is called once per frame
    void Update()
    {
        if (user_auth.isLogIn && highScore == null)
        {
            string name = user_auth.currentPlayer();
            highScore = new NCMB.HighScore(-1, name);
            highScore.fetch();
        }

        if (!isHighScoreFetched && highScore != null && highScore.isFetched)
        {
            isHighScoreFetched = true;
            Debug.Log("Highscore Fetched!!");
            UpdateHighscoreText();
            startMenuCanvas.FetchPlayerRank(highScore.score);
        }

        if (Input.GetKeyDown(KeyCode.S))
        {
            SystemManager.gravity.GetDistanceWithGravityWall(player.transform.position);
        }


        if (!isIngame)
        {
            return;
        }

        UpdateIsDanger();
        UpdateIsGameOverFall();
        UpdateDistanceWatcher();
        UpdateStepsManager();
        UpdateGameOverHeight();
        gravityWall.Gravity();
        UpdateItemManager();
        Gravity();
    }
Esempio n. 11
0
/*	public void AddPoint (int scoin)
	{
		score = score + scoin;
		//		Debug.Log ("coin" + coin);
		//		score = score + coin;
	}
*/
		
	// ハイスコアの保存
	public void Save ()
	{
		Debug.Log("Score.Save() called!!!!");

		// ハイスコアを保存する
		PlayerPrefs.SetInt (highScoreKey, highScore);
		PlayerPrefs.Save ();

		//サーバーにハイスコアを保存する
		_name = PlayerPrefs.GetString ("Name");
		_uuid = PlayerPrefs.GetString ("Uuid");
		currentHighScore = new NCMB.HighScore( highScore, _name, _uuid );
		currentHighScore.updateScore();	//_uuidの二重登録を防ぐ
		
		// ゲーム開始前の状態に戻す
		Initialize ();
	}
Esempio n. 12
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;

			}
		}
	}
Esempio n. 13
0
 public static void SaveHighScoreNCMB(NCMB.HighScore highScore, int score)
 {
     highScore.score = score;
     highScore.save();
 }