// Update is called once per frame
    void Update()
    {
        //ボタン全消えで再度ボタンを生成
        if (NumberOfButtons == CountForReCreateButtons)
        {
            CreateButtons();
            CountForReCreateButtons = 0;
            TargetId = 1;
        }


        if (InstanceCommonGameCanvasManagerScript.GetTotalRestSeconds() < 0f)
        {
            if (NewScoreDataSavedFlg == false)
            {
                //ランキングを計算

                if (ScoreInt < OldScoreRanking[4])
                {
                    NewScoreRanking[0] = OldScoreRanking[0];
                    NewScoreRanking[1] = OldScoreRanking[1];
                    NewScoreRanking[2] = OldScoreRanking[2];
                    NewScoreRanking[3] = OldScoreRanking[3];
                    NewScoreRanking[4] = OldScoreRanking[4];
                }

                if (ScoreInt > OldScoreRanking[4])
                {
                    RankInt            = 5;
                    NewScoreRanking[0] = OldScoreRanking[0];
                    NewScoreRanking[1] = OldScoreRanking[1];
                    NewScoreRanking[2] = OldScoreRanking[2];
                    NewScoreRanking[3] = OldScoreRanking[3];
                    NewScoreRanking[4] = ScoreInt;
                }

                if (ScoreInt > OldScoreRanking[3])
                {
                    RankInt            = 4;
                    NewScoreRanking[0] = OldScoreRanking[0];
                    NewScoreRanking[1] = OldScoreRanking[1];
                    NewScoreRanking[2] = OldScoreRanking[2];
                    NewScoreRanking[3] = ScoreInt;
                    NewScoreRanking[4] = OldScoreRanking[3];
                }

                if (ScoreInt > OldScoreRanking[2])
                {
                    RankInt            = 3;
                    NewScoreRanking[0] = OldScoreRanking[0];
                    NewScoreRanking[1] = OldScoreRanking[1];
                    NewScoreRanking[2] = ScoreInt;
                    NewScoreRanking[3] = OldScoreRanking[2];
                    NewScoreRanking[4] = OldScoreRanking[3];
                }

                if (ScoreInt > OldScoreRanking[1])
                {
                    RankInt            = 2;
                    NewScoreRanking[0] = OldScoreRanking[0];
                    NewScoreRanking[1] = ScoreInt;
                    NewScoreRanking[2] = OldScoreRanking[1];
                    NewScoreRanking[3] = OldScoreRanking[2];
                    NewScoreRanking[4] = OldScoreRanking[3];
                }

                if (ScoreInt > OldScoreRanking[0])
                {
                    RankInt            = 1;
                    NewScoreRanking[0] = ScoreInt;
                    NewScoreRanking[1] = OldScoreRanking[0];
                    NewScoreRanking[2] = OldScoreRanking[1];
                    NewScoreRanking[3] = OldScoreRanking[2];
                    NewScoreRanking[4] = OldScoreRanking[3];
                }

                //ランキングへの書込み(-1で書き込むとランキング表示なし)
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank1(NewScoreRanking[0]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank2(NewScoreRanking[1]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank3(NewScoreRanking[2]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank4(NewScoreRanking[3]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank5(NewScoreRanking[4]);



                //ランクに入っていればハイライト
                InstanceCommonGameCanvasManagerScript.SetHighlightRank(RankInt);
                //            Debug.Log("ハイライト済み");


                //今回スコアをランキング画面にセット
                InstanceCommonGameCanvasManagerScript.SetThisTimeScoreText(ScoreInt.ToString());
                //            Debug.Log("スコアセット済み");


                //今回スコアに資したアクションをセット
                InstanceCommonGameCanvasManagerScript.SetThisTimeScoreMainActionText(CorrectAnswerCount.ToString());
                //            Debug.Log("アクションセット済み");


                //ボーナスポイント回数をセット
                InstanceCommonGameCanvasManagerScript.SetThisTimeBonusCountText(BonusPointCount.ToString());
                //            Debug.Log("ボーナスポイントセット済み");


                //バックボタンの遷移先を設定
                InstanceCommonGameCanvasManagerScript.SetBackSceneName(GameGroupName);


                //今回スコアをデータセーブ
                ES3.Save <List <int> >(ScoreKeyName, ScoreList);
                NewScoreDataSavedFlg = true;
            }
        }
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        //次の問題を作る
        ReMakeQuestion();

        //ゲーム終了処理:残り時間0で動く
        if (InstanceCommonGameCanvasManagerScript.GetTotalRestSeconds() < 0f)
        {
            //何回も動くと処理が重くなるので新スコアセーブ済みフラグFalseの場合のみ動く
            if (NewScoreDataSavedFlg == false)
            {
                //ランキングを計算
                if (ScoreInt < OldScoreRanking[4])
                {
                    NewScoreRanking[0] = OldScoreRanking[0];
                    NewScoreRanking[1] = OldScoreRanking[1];
                    NewScoreRanking[2] = OldScoreRanking[2];
                    NewScoreRanking[3] = OldScoreRanking[3];
                    NewScoreRanking[4] = OldScoreRanking[4];
                }

                if (ScoreInt > OldScoreRanking[4])
                {
                    RankInt            = 5;
                    NewScoreRanking[0] = OldScoreRanking[0];
                    NewScoreRanking[1] = OldScoreRanking[1];
                    NewScoreRanking[2] = OldScoreRanking[2];
                    NewScoreRanking[3] = OldScoreRanking[3];
                    NewScoreRanking[4] = ScoreInt;
                }

                if (ScoreInt > OldScoreRanking[3])
                {
                    RankInt            = 4;
                    NewScoreRanking[0] = OldScoreRanking[0];
                    NewScoreRanking[1] = OldScoreRanking[1];
                    NewScoreRanking[2] = OldScoreRanking[2];
                    NewScoreRanking[3] = ScoreInt;
                    NewScoreRanking[4] = OldScoreRanking[3];
                }

                if (ScoreInt > OldScoreRanking[2])
                {
                    RankInt            = 3;
                    NewScoreRanking[0] = OldScoreRanking[0];
                    NewScoreRanking[1] = OldScoreRanking[1];
                    NewScoreRanking[2] = ScoreInt;
                    NewScoreRanking[3] = OldScoreRanking[2];
                    NewScoreRanking[4] = OldScoreRanking[3];
                }

                if (ScoreInt > OldScoreRanking[1])
                {
                    RankInt            = 2;
                    NewScoreRanking[0] = OldScoreRanking[0];
                    NewScoreRanking[1] = ScoreInt;
                    NewScoreRanking[2] = OldScoreRanking[1];
                    NewScoreRanking[3] = OldScoreRanking[2];
                    NewScoreRanking[4] = OldScoreRanking[3];
                }

                if (ScoreInt > OldScoreRanking[0])
                {
                    RankInt            = 1;
                    NewScoreRanking[0] = ScoreInt;
                    NewScoreRanking[1] = OldScoreRanking[0];
                    NewScoreRanking[2] = OldScoreRanking[1];
                    NewScoreRanking[3] = OldScoreRanking[2];
                    NewScoreRanking[4] = OldScoreRanking[3];
                }

                //ランキングへの書込み(-1で書き込むとランキング表示なし)
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank1(NewScoreRanking[0]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank2(NewScoreRanking[1]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank3(NewScoreRanking[2]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank4(NewScoreRanking[3]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank5(NewScoreRanking[4]);

                //ランクに入っていればハイライト
                InstanceCommonGameCanvasManagerScript.SetHighlightRank(RankInt);
                Debug.Log("ハイライト済み");


                //今回スコアをランキング画面にセット
                InstanceCommonGameCanvasManagerScript.SetThisTimeScoreText(ScoreInt.ToString());
                Debug.Log("ランキングセット済み");


                //今回スコアに資したアクションをセット
                InstanceCommonGameCanvasManagerScript.SetThisTimeScoreMainActionText(CorrectAnswerCount.ToString());
                Debug.Log("アクション回数セット済み");


                //ボーナスポイント回数をセット
                InstanceCommonGameCanvasManagerScript.SetThisTimeBonusCountText(BonusPointCount.ToString());
                Debug.Log("ボーナスポイントセット済み");


                //バックボタンの遷移先を設定
                InstanceCommonGameCanvasManagerScript.SetBackSceneName(GameGroupName);


                //今回スコアをデータセーブ
                ES3.Save <List <int> >(ScoreKeyName, ScoreList);
                NewScoreDataSavedFlg = true;
            }
        }
    }
Beispiel #3
0
    public bool TouchButton(string id)
    {
        //デバッグ用に画面にログを出す
        InstanceCommonGameCanvasManagerScript.SetGameDescriptionText("TouchButtonIn");


        //タッチした時刻の記録
        TouchButtonTime[CountButtonTouch] = DateTime.Now;


        //回答数カウントアップ
        CountButtonTouch++;


        //正否判定
        if (TargetId.ToString() == id)
        {
            //あっていたら
            //デバッグ用に画面にログを出す
            InstanceCommonGameCanvasManagerScript.SetGameDescriptionText("TouchButtonCorrect");

            //正解音を出す
            InstanceCommonGameCanvasManagerScript.DoSoundCorrectAnswer();

            //正答時刻の記録
            CorrectTouchButtonTime[CountButtonTouch] = DateTime.Now;

            //平均正答時間の更新
            //ゲーム終了時に時間をタッチボタン数で割ってやれば良いので
            //ここでは記載しない

            //正解カウントアップ
            CorrectAnswerCount++;

            //連続正答数カウントアップ
            ConsectiveCorrectAnswers++;

            //スコア加算1(単純累積)
            ScoreInt += 200;
            InstanceCommonGameCanvasManagerScript.SetRealTimeScore(ScoreInt.ToString());
            InstanceCommonGameCanvasManagerScript.SetAddRealTimeScore(200);

            InstanceCommonGameCanvasManagerScript.SetGameDescriptionText("スコア1加算済み");

            //スコア加算2(ボーナス1:10連続ミスなし)
            if (ConsectiveCorrectAnswers == 10)
            {
                ScoreInt += 400;
                ConsectiveCorrectAnswers = 0;
                BonusPointCount++;
                InstanceCommonGameCanvasManagerScript.SetRealTimeScore(ScoreInt.ToString());
                InstanceCommonGameCanvasManagerScript.SetAddRealTimeBonusScore(400);
            }

            InstanceCommonGameCanvasManagerScript.SetGameDescriptionText("ボーナス1設定済み");


            //スコア加算3(ボーナス2:即反応0.5秒以内)
            TimeSpan ElapsedTime = CorrectTouchButtonTime[CountButtonTouch] - CorrectTouchButtonTime[CountButtonTouch - 1];
            Debug.Log("ElapsedTime.Milliseconds: " + ElapsedTime.Milliseconds);


            if (ElapsedTime.Milliseconds < 300)
            {
                ScoreInt += 300;
                ConsectiveCorrectAnswers = 0;
                BonusPointCount++;
                InstanceCommonGameCanvasManagerScript.SetRealTimeScore(ScoreInt.ToString());
                InstanceCommonGameCanvasManagerScript.SetAddRealTimeBonusScore(300);
            }

            InstanceCommonGameCanvasManagerScript.SetGameDescriptionText("ボーナス2設定済み");



            //コメントプレフィックス1
            string comment1 = "Great Responce!";

            //コメントサフィックス2
            string comment2 = "You Can Do Better Next Time!";


            //リザルトをテキストに変換
            string ScoreText = ScoreInt.ToString() + "pt!";

            string ResultText = comment1 + "\n" + ScoreText + "\n" + comment2;


            //リザルトへ書込み
            InstanceCommonGameCanvasManagerScript.SetResultText(ResultText);

            InstanceCommonGameCanvasManagerScript.SetGameDescriptionText("リザルト書込み済み");


            //過去スコアリストに今回スコアを追加するため過去スコア要素数+1のインデックスを
            //Start()で準備して使う
            ScoreRankingList[NewScoreDataIndex] = ScoreInt;



            //スコアリストに今回スコアを入れてもすぐにソートはしない
            //本クラスで終了判定を行っていないため
            //どの時点のスコアが最終スコアとなるか不明なため
            //ただし今回スコアは得点が伸びるたびに当該変数を
            //過去スコアと比較してランキングに反映する
            //ソートは次回呼出し時に行う

            InstanceCommonGameCanvasManagerScript.SetGameDescriptionText("ランキング設定前");


            //ランキングへの書込み
            if (ScoreInt < ScoreRankingList[4])
            {
                Debug.Log("5位以下");
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank1(ScoreRankingList[0]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank2(ScoreRankingList[1]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank3(ScoreRankingList[2]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank4(ScoreRankingList[3]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank5(ScoreRankingList[4]);
            }
            if (ScoreInt > ScoreRankingList[4])
            {
                Debug.Log("5位");
                RankInt = 5;
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank1(ScoreRankingList[0]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank2(ScoreRankingList[1]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank3(ScoreRankingList[2]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank4(ScoreRankingList[3]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank5(ScoreInt);
            }
            if (ScoreInt > ScoreRankingList[3])
            {
                Debug.Log("4位");

                RankInt = 4;
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank1(ScoreRankingList[0]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank2(ScoreRankingList[1]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank3(ScoreRankingList[2]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank4(ScoreInt);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank5(ScoreRankingList[3]);
            }
            if (ScoreInt > ScoreRankingList[2])
            {
                Debug.Log("3位");
                RankInt = 3;
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank1(ScoreRankingList[0]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank2(ScoreRankingList[1]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank3(ScoreInt);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank4(ScoreRankingList[2]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank5(ScoreRankingList[3]);
            }
            if (ScoreInt > ScoreRankingList[1])
            {
                Debug.Log("2位");

                RankInt = 2;
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank1(ScoreRankingList[0]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank2(ScoreInt);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank3(ScoreRankingList[1]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank4(ScoreRankingList[2]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank5(ScoreRankingList[3]);
            }
            if (ScoreInt > ScoreRankingList[0])
            {
                Debug.Log("1位");

                RankInt = 1;
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank1(ScoreInt);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank2(ScoreRankingList[0]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank3(ScoreRankingList[1]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank4(ScoreRankingList[2]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank5(ScoreRankingList[3]);
            }



            InstanceCommonGameCanvasManagerScript.SetGameDescriptionText("ランキング設定済み");


            //ランクに入っていればハイライト
            InstanceCommonGameCanvasManagerScript.SetHighlightRank(RankInt);
//            Debug.Log("ハイライト済み");


            //今回スコアをランキング画面にセット
            InstanceCommonGameCanvasManagerScript.SetThisTimeScoreText(ScoreInt.ToString());
//            Debug.Log("スコアセット済み");


            //今回スコアに資したアクションをセット
            InstanceCommonGameCanvasManagerScript.SetThisTimeScoreMainActionText(CorrectAnswerCount.ToString());
//            Debug.Log("アクションセット済み");


            //ボーナスポイント回数をセット
            InstanceCommonGameCanvasManagerScript.SetThisTimeBonusCountText(BonusPointCount.ToString());
//            Debug.Log("ボーナスポイントセット済み");


            //ボタン再生成管理カウントアップ
            CountForReCreateButtons++;


            //正答ボタン番号更新(+1)
            TargetId++;


            //デバッグ用に画面にログを出す
            InstanceCommonGameCanvasManagerScript.SetGameDescriptionText("TouchButtonOut");

            //Trueを返却して呼び出し元でボタン消す
            return(true);
        }
        else
        {
            //デバッグ用に画面にログを出す
            InstanceCommonGameCanvasManagerScript.SetGameDescriptionText("MisTouchButtonIn");

            //間違っていたら

            //不正解音を出す
            InstanceCommonGameCanvasManagerScript.DoSoundWrongAnswer();


            //誤答時間の記録
            WrongTouchButtonTime[CountButtonTouch] = DateTime.Now;


            //不正解カウントアップ
            WrongAnswerCount++;


            //連続正答数リセット
            ConsectiveCorrectAnswers = 0;


            //Falseを返却して呼び出し元では何もしない
            return(false);
        }
    }
Beispiel #4
0
    // Start is called before the first frame update
    void Start()
    {
        //画面遷移用にオブジェクト

        //共通ゲームキャンバスオブジェクト&インスタンス取得
        CommonGameCanvasManager = GameObject.Find("CommonGameCanvasManager");
        InstanceCommonGameCanvasManagerScript = CommonGameCanvasManager.GetComponent <CommonGameCanvasManagerScript>();

        //ゲームタイトルをランキングにセット
        InstanceCommonGameCanvasManagerScript.SetThisGameTitleText(GameTitleString);

        //ゲーム説明をセット
        InstanceCommonGameCanvasManagerScript.SetGameDescriptionText(GameDescription);

        //デバッグ用に画面にログを出す
        InstanceCommonGameCanvasManagerScript.SetGameDescriptionText("Start");


        //スコアリストをロードする


        //過去データをあるだけ抽出してリストに保存するループ
        while (true)
        {
            //デバッグ用に画面にログを出す
            InstanceCommonGameCanvasManagerScript.SetGameDescriptionText(ScoreDataCount.ToString());

            //ScoreKeyNameはグローバル変数でスコア番号サフィックス(scoreDataCount)をつけて配列管理
            string keyname = ScoreKeyName + ScoreDataCount;

            //デバッグ用に画面にログを出す
            InstanceCommonGameCanvasManagerScript.SetGameDescriptionText(keyname);

            //存在チェック関数KeyExists
            bool existsKeyFlg = ES3.KeyExists(keyname);
            int  existsKey    = ES3.Load <int>(keyname, defaultValue: 404);

//            existsKey = ScoreRankingList.Add(PlayerPrefs.GetInt(keyname, 404));


            //デバッグ用に画面にログを出す
            InstanceCommonGameCanvasManagerScript.SetGameDescriptionText("nothing");


            //存在なし=falseでデータ抜出しループブレイク
            if (existsKey == 404)
            {
                break;
            }
            if (existsKeyFlg == false)
            {
                break;
            }


            //存在ありでリストに保存
            ScoreRankingList.Add(ES3.Load <int>(keyname));
            //           ScoreRankingList.Add(PlayerPrefs.GetInt(keyname, 404));



            //デバッグ用に画面にログを出す
            //InstanceCommonGameCanvasManagerScript.SetGameDescriptionText(ES3.Load<int>(keyname).ToString());


            //次のデータ抽出のためカウントアップ値=データ件数
            ScoreDataCount++;
        }



        //デバッグ用に画面にログを出す
        InstanceCommonGameCanvasManagerScript.SetGameDescriptionText("過去データ抽出完了");


        //得られた過去データを昇順にソートしておく
        ScoreRankingList.Sort();

        //過去データリストを配列順に得点の高い順に逆ソートしておく
        ScoreRankingList.Reverse();

        //ダミーデータを追加して新規スコア追加用の要素を用意する
        ScoreRankingList.Add(99999);
        NewScoreDataIndex = ScoreRankingList.IndexOf(99999);
        ScoreRankingList[NewScoreDataIndex] = 0;



        //新規スコア追加用のセーブキーを用意しておく
        NewScoreDataKey = ScoreKeyName + NewScoreDataIndex;
        Debug.Log("NewScoreDataKey: " + NewScoreDataKey);

        //デバッグ用に画面にログを出す
        InstanceCommonGameCanvasManagerScript.SetGameDescriptionText("新規スコア追加用キー完了");


        //何もボタンを押さなかった場合の処理として過去データをランキングに入れておく
        //過去データは昇順に並べているので最後の要素が最大値=ランキング1
        if (ScoreRankingList.Count > 5)
        {
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank1(ScoreRankingList[0]);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank2(ScoreRankingList[1]);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank3(ScoreRankingList[2]);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank4(ScoreRankingList[3]);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank5(ScoreRankingList[4]);
        }
        else if (ScoreRankingList.Count == 4)
        {
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank1(ScoreRankingList[0]);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank2(ScoreRankingList[1]);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank3(ScoreRankingList[2]);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank4(ScoreRankingList[3]);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank5(0);
        }
        else if (ScoreRankingList.Count == 3)
        {
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank1(ScoreRankingList[0]);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank2(ScoreRankingList[1]);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank3(ScoreRankingList[2]);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank4(0);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank5(0);
        }
        else if (ScoreRankingList.Count == 2)
        {
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank1(ScoreRankingList[0]);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank2(ScoreRankingList[1]);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank3(0);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank4(0);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank5(0);
        }
        else if (ScoreRankingList.Count == 1)
        {
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank1(ScoreRankingList[0]);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank2(0);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank3(0);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank4(0);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank5(0);
        }
        else if (ScoreRankingList.Count == 0)
        {
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank1(0);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank2(0);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank3(0);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank4(0);
            InstanceCommonGameCanvasManagerScript.SetGameScoreRank5(0);
        }


        //スタート時のボタン生成
        CreateButtons();
    }
Beispiel #5
0
    void MakeRankAndHighlight()
    {
        if (InstanceCommonGameCanvasManagerScript.GetTotalRestSeconds() < 0f)
        {
            if (NewScoreDataSavedFlg == false)
            {
                //ランキングを計算

                if (ScoreInt < OldScoreRanking[4])
                {
                    NewScoreRanking[0] = OldScoreRanking[0];
                    NewScoreRanking[1] = OldScoreRanking[1];
                    NewScoreRanking[2] = OldScoreRanking[2];
                    NewScoreRanking[3] = OldScoreRanking[3];
                    NewScoreRanking[4] = OldScoreRanking[4];
                }

                if (ScoreInt > OldScoreRanking[4])
                {
                    RankInt            = 5;
                    NewScoreRanking[0] = OldScoreRanking[0];
                    NewScoreRanking[1] = OldScoreRanking[1];
                    NewScoreRanking[2] = OldScoreRanking[2];
                    NewScoreRanking[3] = OldScoreRanking[3];
                    NewScoreRanking[4] = ScoreInt;
                }

                if (ScoreInt > OldScoreRanking[3])
                {
                    RankInt            = 4;
                    NewScoreRanking[0] = OldScoreRanking[0];
                    NewScoreRanking[1] = OldScoreRanking[1];
                    NewScoreRanking[2] = OldScoreRanking[2];
                    NewScoreRanking[3] = ScoreInt;
                    NewScoreRanking[4] = OldScoreRanking[3];
                }

                if (ScoreInt > OldScoreRanking[2])
                {
                    RankInt            = 3;
                    NewScoreRanking[0] = OldScoreRanking[0];
                    NewScoreRanking[1] = OldScoreRanking[1];
                    NewScoreRanking[2] = ScoreInt;
                    NewScoreRanking[3] = OldScoreRanking[2];
                    NewScoreRanking[4] = OldScoreRanking[3];
                }

                if (ScoreInt > OldScoreRanking[1])
                {
                    RankInt            = 2;
                    NewScoreRanking[0] = OldScoreRanking[0];
                    NewScoreRanking[1] = ScoreInt;
                    NewScoreRanking[2] = OldScoreRanking[1];
                    NewScoreRanking[3] = OldScoreRanking[2];
                    NewScoreRanking[4] = OldScoreRanking[3];
                }

                if (ScoreInt > OldScoreRanking[0])
                {
                    RankInt            = 1;
                    NewScoreRanking[0] = ScoreInt;
                    NewScoreRanking[1] = OldScoreRanking[0];
                    NewScoreRanking[2] = OldScoreRanking[1];
                    NewScoreRanking[3] = OldScoreRanking[2];
                    NewScoreRanking[4] = OldScoreRanking[3];
                }

                //ランキングへの書込み(-1で書き込むとランキング表示なし)
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank1(NewScoreRanking[0]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank2(NewScoreRanking[1]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank3(NewScoreRanking[2]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank4(NewScoreRanking[3]);
                InstanceCommonGameCanvasManagerScript.SetGameScoreRank5(NewScoreRanking[4]);



                //ランクに入っていればハイライト
                InstanceCommonGameCanvasManagerScript.SetHighlightRank(RankInt);
                //            Debug.Log("ハイライト済み");


                //今回スコアをランキング画面にセット
                InstanceCommonGameCanvasManagerScript.SetThisTimeScoreText(ScoreInt.ToString());
                //            Debug.Log("スコアセット済み");


                //今回スコアに資したアクションをセット
                InstanceCommonGameCanvasManagerScript.SetThisTimeScoreMainActionText(CorrectAnswerCount.ToString());
                //            Debug.Log("アクションセット済み");


                //ボーナスポイント回数をセット
                InstanceCommonGameCanvasManagerScript.SetThisTimeBonusCountText(BonusPointCount.ToString());
                //            Debug.Log("ボーナスポイントセット済み");


                //バックボタンの遷移先を設定
                InstanceCommonGameCanvasManagerScript.SetBackSceneName(GameGroupName);

                int p = 0;
                foreach (object obj in ScoreList)
                {
                    Debug.Log("ScoreList[" + p + "]=" + obj);
                    p++;
                }

                int q = 0;
                foreach (object obj in ScoreDateTimeList)
                {
                    Debug.Log("ScoreList[" + q + "]=" + obj);
                    q++;
                }

                int r = 0;
                foreach (object obj in ScoreUploadedList)
                {
                    Debug.Log("ScoreList[" + r + "]=" + obj);
                    r++;
                }


                //今回スコアをデータセーブ
                ES3.Save <List <int> >(ScoreKeyName, ScoreList);
                ES3.Save <List <string> >(ScoreKeyName, ScoreDateTimeList);
                ES3.Save <List <bool> >(ScoreKeyName, ScoreUploadedList);
                NewScoreDataSavedFlg = true;
            }
        }
    }