예제 #1
0
    public IEnumerator testCroutine()
    {
        yield return(new WaitForSeconds(1));

        PlayerPrefsCommon.PlaydataNewLoad();

        yield return(new WaitForSeconds(1));

        PlayerPrefsCommon.SaveItem(7, 5, 2);
        yield return(new WaitForSeconds(1));

        PlayerPrefsCommon.MaterialPlaydataStringFormat();
        yield return(new WaitForSeconds(1));

        playerPrefsCommon.SaveItemFiles();
        //for (int i = 0; i < PlayerPrefsCommon.MaterialsPlayData.Count; i++)
        //{
        //    for (int n = 0; n < PlayerPrefsCommon.MaterialsPlayData[i].Length; n++)
        //    {
        //        Debug.Log(PlayerPrefsCommon.MaterialsPlayData[i][n] + ",");
        //    }
        //}
        //for (int i = 0; i < PlayerPrefsCommon.MATERIALS_DATA.Count; i++)
        //{
        //    for (int n = 0; n < PlayerPrefsCommon.MATERIALS_DATA[i].Length; n++)
        //    {

        //        Debug.Log(PlayerPrefsCommon.MATERIALS_DATA[i][n] + ",");
        //    }
        //}
    }
예제 #2
0
    /// <summary>
    /// 各ウィンドウの確認画面処理
    /// </summary>
    public void OnClickOk()
    {
        //所持アイテム選択画面が動的なら
        if (ItemSelect.activeInHierarchy)
        {
            selectItemType = PlayerPrefsCommon.BooksPlayData[selectNumber][0];
            selectItemAtk  = PlayerPrefsCommon.BooksPlayData[selectNumber][1];
            selectItemMp   = PlayerPrefsCommon.BooksPlayData[selectNumber][2];
            ItemSelect.SetActive(false);
            StoneSelect.SetActive(true);
            EventSystem.current.SetSelectedGameObject(materialfirstObj);
            switch (selectItemType)
            {
            case 1:
                typename = "Sky";
                break;

            case 2:
                typename = "MARINE";
                break;

            case 3:
                typename = "Earth";
                break;
            }
            selectItemText.text = string.Format("TYPE:{0}\nATK:{1}\nMP:{2}", typename, selectItemAtk, selectItemMp);
        }
        else if (StoneSelect.activeInHierarchy)
        {
            nextAtk = selectItemAtk + selectAtk;
            nextMp  = selectItemMp + selectMp;
            StoneSelect.SetActive(false);
            resultItem.SetActive(true);
            EventSystem.current.SetSelectedGameObject(resultfirstObj);
            resultMaterialText.text = string.Format("TYPE:{0}\nATK:{1}\nMP:{2}", typename, nextAtk, nextMp);
        }
        else if (resultItem.activeInHierarchy)
        {
            //データ保存処理
            PlayerPrefsCommon.BooksPlayData[selectNumber][1] = nextAtk;
            PlayerPrefsCommon.BooksPlayData[selectNumber][2] = nextMp;
            PlayerPrefsCommon.BookPlaydataStringFormat();

            //素材削除
            PlayerPrefsCommon.MaterialDataDelete(selectNumber);
            PlayerPrefsCommon.MaterialPlaydataStringFormat();

            resultItem.SetActive(false);
            itemOkObj.SetActive(false);
            ItemSelect.SetActive(true);

            selectText.text = null;
            EventSystem.current.SetSelectedGameObject(itemfirstObj);
        }
    }
예제 #3
0
 private void Awake()
 {
     if (PlayerPrefsCommon.BOOKS_DATA.Count == 0 || PlayerPrefsCommon.MATERIALS_DATA.Count == 0)
     {
         //保存データが無ければセーブデータ読み込み
         PlayerPrefsCommon.SaveFilesLoad();
         Debug.Log("データ読み込み");
     }
     if (PlayerPrefsCommon.BooksPlayData.Count == 0 || PlayerPrefsCommon.MaterialsPlayData.Count == 0)
     {
         //プレイデータが空なら読み込む
         PlayerPrefsCommon.PlaydataNewLoad();
         Debug.Log("プレイデータ読み込み");
     }
 }
예제 #4
0
    private void Awake()
    {
        if (PlayerPrefsCommon.BOOKS_DATA.Count == 0 || PlayerPrefsCommon.MATERIALS_DATA.Count == 0)
        {
            PlayerPrefsCommon.SaveFilesLoad();
        }
        if (PlayerPrefsCommon.BooksPlayData.Count == 0)
        {
            //プレイデータが空なら読み込む
            PlayerPrefsCommon.PlaydataNewLoad();
        }
        itemType_1 = PlayerPrefsCommon.BooksPlayData[0][0];
        itemType_2 = PlayerPrefsCommon.BooksPlayData[1][0];
        itemType_3 = PlayerPrefsCommon.BooksPlayData[2][0];

        itemATK_1 = PlayerPrefsCommon.BooksPlayData[0][1];
        itemATK_2 = PlayerPrefsCommon.BooksPlayData[1][1];
        itemATK_3 = PlayerPrefsCommon.BooksPlayData[2][1];

        itemPOWER_1 = PlayerPrefsCommon.BooksPlayData[0][2];
        itemPOWER_2 = PlayerPrefsCommon.BooksPlayData[1][2];
        itemPOWER_3 = PlayerPrefsCommon.BooksPlayData[2][2];

        int value = Random.Range(1, 3);

        enemyType = value;
        switch (MapManager.SELECT_BATTLE_MODE)
        {
        case "Easy":
            enemyHp  = (float)EnemyStatus.EnemyEasy.HP;
            enemyAtk = (float)EnemyStatus.EnemyEasy.ATK;
            break;

        case "Normal":
            enemyHp  = (float)EnemyStatus.EnemyNormal.HP;
            enemyAtk = (float)EnemyStatus.EnemyNormal.ATK;
            break;

        case "Hard":
            enemyHp  = (float)EnemyStatus.EnemyHard.HP;
            enemyAtk = (float)EnemyStatus.EnemyHard.ATK;
            break;
        }
    }
예제 #5
0
    private IEnumerator DataLoadCoroutine()
    {
        if (PlayerPrefsCommon.BOOKS_DATA.Count == 0 || PlayerPrefsCommon.MATERIALS_DATA.Count == 0)
        {
            //保存データが無ければセーブデータ読み込み
            PlayerPrefsCommon.SaveFilesLoad();

            yield return(new WaitForSeconds(2));
        }
        if (PlayerPrefsCommon.BooksPlayData.Count == 0 || PlayerPrefsCommon.MaterialsPlayData.Count == 0)
        {
            //プレイデータが空なら読み込む
            PlayerPrefsCommon.PlaydataNewLoad();

            yield return(new WaitForSeconds(2));
        }

        yield return(new WaitForSeconds(1));
    }
예제 #6
0
    // Update is called once per frame
    void Update()
    {
        //プレイヤーのターンである場合
        if (battleTurn == BattleMode.Player)
        {
            if (!turnchenge)
            {
                if (PlayerStatus.PLAYER_HP <= 0)
                {
                    battleText.text = "MPが足りない!\n休んでMPの回復を待つことにした";
                    StartCoroutine(turnCoroutine(BattleMode.Enemy));
                    turnchenge = true;
                }
                else
                {
                    items.SetActive(true);
                    battleText.text = "自分のターン";
                    EventSystem.current.SetSelectedGameObject(items);
                    turnchenge = true;
                }
            }
        }

        //敵のターン
        if (battleTurn == BattleMode.Enemy)
        {
            if (!turnchenge)
            {
                turnchenge              = true;
                battleText.text         = "敵のターン\n";
                PlayerStatus.PLAYER_HP -= enemyAtk;
                battleText.text        += string.Format("敵の攻撃!\n{0}ダメージくらった…!\n", enemyAtk);
                if (PlayerStatus.PLAYER_HP <= 0)
                {
                    PlayerStatus.PLAYER_HP = 0;
                    battleText.text        = "HPが0になってしまった...";
                    StartCoroutine(turnCoroutine(BattleMode.Lose));
                    turnchenge = true;
                }
                else
                {
                    StartCoroutine(turnCoroutine(BattleMode.Player));
                    turnchenge = true;
                }
            }
        }

        //勝利した場合
        if (battleTurn == BattleMode.Win)
        {
            if (!turnchenge)
            {
                turnchenge = true;
                resultObj.SetActive(true);
                EventSystem.current.SetSelectedGameObject(resultOkbutton);
                //素材データ作成
                int newAtk  = Random.Range(1, 7);  //ランダムにアタックポイントをつける
                int newMp   = Random.Range(1, 10); //ランダムにマジックポイントをつける
                int newtype = Random.Range(1, 3);
                resultText.text = string.Format("ステータス\nATK:{0}\nMP:{1}", newAtk, newMp);
                //素材データセーブ
                PlayerPrefsCommon.SaveItem(newAtk, newMp, newtype);
                PlayerPrefsCommon.MaterialPlaydataStringFormat();
            }
        }

        if (battleTurn == BattleMode.Lose)
        {
            if (!turnchenge)
            {
                battleText.text += "私は全力でその場から逃げた";
                StartCoroutine(WaitMapLoad());
                turnchenge = true;
            }
        }

        if (battleTurn == BattleMode.Escape)
        {
            AudioManager2D.Instance.AudioBgm.Stop();
            SceneManager.LoadScene("Map");
        }
    }