Exemple #1
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;
            }
        }
    }
    // 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;
            }
        }
    }
Exemple #3
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;
            }
        }
    }