Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        //共通ゲームキャンバスオブジェクト&インスタンス取得
        CommonGameCanvasManager = GameObject.Find("CommonGameCanvasManager");
        InstanceCommonGameCanvasManagerScript = CommonGameCanvasManager.GetComponent <CommonGameCanvasManagerScript>();

        DebugText.text = ">Start";


        /*test
         * ES3.Save<int>("ES3Test1", 100);
         * DebugText.text += ">Save";
         * int ES3Test = ES3.Load<int>("ES3Test1");
         * DebugText.text += ">Load";
         * DebugStr += ES3Test.ToString();
         * DebugText.text += DebugStr;
         */



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


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


        //過去データのロードと過去データによるランキング初期化
        LoadSavedScoreToMakeRankAndNewScoreIndex();


        DebugText.text += ">NewScoreDataIndex Added";

        //スタート時のボタン生成
        CreateButtons();
    }
    //空文字を出す
    //



    // Start is called before the first frame update
//    void Start()
    void Start()
    {
        //共通ゲームキャンバスオブジェクト&インスタンス取得
        CommonGameCanvasManager = GameObject.Find("CommonGameCanvasManager");
        InstanceCommonGameCanvasManagerScript = CommonGameCanvasManager.GetComponent <CommonGameCanvasManagerScript>();

        DebugText.text = ">Start";


        /*test
         * ES3.Save<int>("ES3Test1", 100);
         * DebugText.text += ">Save";
         * int ES3Test = ES3.Load<int>("ES3Test1");
         * DebugText.text += ">Load";
         * DebugStr += ES3Test.ToString();
         * DebugText.text += DebugStr;
         */



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


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


        //ダミー過去セーブスコアリスト
        //        List<int> SaveScoreList = new List<int> { 300, 500, 600 };
        //        List<int> SaveScoreList = new List<int> {  };
        //        List<int> SaveScoreList = new List<int> { 300, 400, 100, 200, 800, 700 };


        bool existsKey = ES3.KeyExists(ScoreKeyName);

        Debug.Log("existsKey: " + existsKey);

        if (existsKey == true)
        {
            DebugText.text += ">Exists:True";
            Debug.Log(DebugText.text);
            SaveScoreList = ES3.Load <List <int> >(ScoreKeyName);
        }
        else
        {
            DebugText.text += ">Exists:false";
            Debug.Log(DebugText.text);
            SaveScoreList = new List <int> {
            };
        }


        Debug.Log("ScoreList = SaveScoreList");
        DebugText.text += ">ScoreList = SaveScoreList";


        //セーブスコアを呼出し
        ScoreList =  SaveScoreList;

        Debug.Log("ScoreList.Sort()");
        DebugText.text += ">ScoreList.Sort()";

        //セーブスコアを昇順にソートしておく
        ScoreList.Sort();

        //セーブスコアを得点の高い順に逆ソートしておく
        ScoreList.Reverse();


        //セーブスコアトップ5をランキングしておく(データない場合は-1)
        if (ScoreList.Count > 4)
        {
            OldScoreRanking[0] = ScoreList[0];
            OldScoreRanking[1] = ScoreList[1];
            OldScoreRanking[2] = ScoreList[2];
            OldScoreRanking[3] = ScoreList[3];
            OldScoreRanking[4] = ScoreList[4];
        }
        else if (ScoreList.Count == 4)
        {
            OldScoreRanking[0] = ScoreList[0];
            OldScoreRanking[1] = ScoreList[1];
            OldScoreRanking[2] = ScoreList[2];
            OldScoreRanking[3] = ScoreList[3];
            OldScoreRanking[4] = -1;
        }
        else if (ScoreList.Count == 3)
        {
            OldScoreRanking[0] = ScoreList[0];
            OldScoreRanking[1] = ScoreList[1];
            OldScoreRanking[2] = ScoreList[2];
            OldScoreRanking[3] = -1;
            OldScoreRanking[4] = -1;
        }
        else if (ScoreList.Count == 2)
        {
            OldScoreRanking[0] = ScoreList[0];
            OldScoreRanking[1] = ScoreList[1];
            OldScoreRanking[2] = -1;
            OldScoreRanking[3] = -1;
            OldScoreRanking[4] = -1;
        }
        else if (ScoreList.Count == 1)
        {
            OldScoreRanking[0] = ScoreList[0];
            OldScoreRanking[1] = -1;
            OldScoreRanking[2] = -1;
            OldScoreRanking[3] = -1;
            OldScoreRanking[4] = -1;
        }
        else if (ScoreList.Count == 0)
        {
            OldScoreRanking[0] = -1;
            OldScoreRanking[1] = -1;
            OldScoreRanking[2] = -1;
            OldScoreRanking[3] = -1;
            OldScoreRanking[4] = -1;
        }



        //新規スコア追加用の要素を用意する
        ScoreList.Add(99999);
        NewScoreDataIndex            = ScoreList.IndexOf(99999);
        ScoreList[NewScoreDataIndex] = 0;


        DebugText.text += ">NewScoreDataIndex Added";

        //スタート時のボタン生成
        CreateButtons();

        DebugText.text += ">CreateButtns()";
    }
Esempio n. 3
0
    // Start is called before the first frame update
    void Start()
    {
        //スマホデバック用
        DebugText.text = ">Start";


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


        //共通サウンドオブジェクト&インスタンス取得
        CommonSFXControllerObject         = GameObject.Find("CommonSFXController");
        InstanceCommonSFXControllerScript = CommonSFXControllerObject.GetComponent <CommonSFXControllerScript>();


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


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


        bool existsKey = ES3.KeyExists(ScoreKeyName);

        Debug.Log("existsKey: " + existsKey);

        if (existsKey == true)
        {
            DebugText.text += ">Exists:True";
            Debug.Log(DebugText.text);
            SaveScoreList = ES3.Load <List <int> >(ScoreKeyName);
        }
        else
        {
            DebugText.text += ">Exists:false";
            Debug.Log(DebugText.text);
            SaveScoreList = new List <int> {
            };
        }


        //セーブスコアリストをカレントスコアリストにロード
        ScoreList = SaveScoreList;
        Debug.Log("ScoreList = SaveScoreList");
        DebugText.text += ">ScoreList = SaveScoreList";


        //セーブスコアを昇順にソートしておく
        ScoreList.Sort();
        Debug.Log("ScoreList.Sort()");
        DebugText.text += ">ScoreList.Sort()";


        //セーブスコアを得点の高い順に逆ソートしておく
        ScoreList.Reverse();
        Debug.Log("ScoreList.Reverse()");
        DebugText.text += ">ScoreList.Reverse()";



        //セーブスコアトップ5をランキングしておく(データない場合は-1)
        if (ScoreList.Count > 4)
        {
            OldScoreRanking[0] = ScoreList[0];
            OldScoreRanking[1] = ScoreList[1];
            OldScoreRanking[2] = ScoreList[2];
            OldScoreRanking[3] = ScoreList[3];
            OldScoreRanking[4] = ScoreList[4];
        }
        else if (ScoreList.Count == 4)
        {
            OldScoreRanking[0] = ScoreList[0];
            OldScoreRanking[1] = ScoreList[1];
            OldScoreRanking[2] = ScoreList[2];
            OldScoreRanking[3] = ScoreList[3];
            OldScoreRanking[4] = -1;
        }
        else if (ScoreList.Count == 3)
        {
            OldScoreRanking[0] = ScoreList[0];
            OldScoreRanking[1] = ScoreList[1];
            OldScoreRanking[2] = ScoreList[2];
            OldScoreRanking[3] = -1;
            OldScoreRanking[4] = -1;
        }
        else if (ScoreList.Count == 2)
        {
            OldScoreRanking[0] = ScoreList[0];
            OldScoreRanking[1] = ScoreList[1];
            OldScoreRanking[2] = -1;
            OldScoreRanking[3] = -1;
            OldScoreRanking[4] = -1;
        }
        else if (ScoreList.Count == 1)
        {
            OldScoreRanking[0] = ScoreList[0];
            OldScoreRanking[1] = -1;
            OldScoreRanking[2] = -1;
            OldScoreRanking[3] = -1;
            OldScoreRanking[4] = -1;
        }
        else if (ScoreList.Count == 0)
        {
            OldScoreRanking[0] = -1;
            OldScoreRanking[1] = -1;
            OldScoreRanking[2] = -1;
            OldScoreRanking[3] = -1;
            OldScoreRanking[4] = -1;
        }



        //新規スコア追加用の要素を用意する
        ScoreList.Add(99999);
        NewScoreDataIndex            = ScoreList.IndexOf(99999);
        ScoreList[NewScoreDataIndex] = 0;
        DebugText.text += ">NewScoreDataIndex Added";

        //ゲームスタート時の音
        //        InstanceCommonSFXControllerScript.DoSoundSetQuestions();


        //本ゲームスタート時のボタン生成
        MakeQuestion();
        Debug.Log("CreateButtons()");
        DebugText.text += ">CreateButtns()";
    }
Esempio n. 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();
    }