Beispiel #1
0
        public void OnClickButton()
        {
            if (selectItem.canSelect)
            {
                SoundController.Instance.PlaySe(SoundController.Instance.buttonSe);
                EncryptedPlayerPrefs.SaveInt(Const.KEY_CHARA, int.Parse(selectItem.num));
                Retry();
                return;
            }

            if (selectItem.canBuy)
            {
                SoundController.Instance.PlaySe(SoundController.Instance.casher);

                int point = EncryptedPlayerPrefs.LoadInt(Const.KEY_POINT, 0);
                int diff  = point - selectItem.price;
                EncryptedPlayerPrefs.SaveInt(Const.KEY_POINT, diff);
                pointText.text = diff + "P";
                string enabledCharas = EncryptedPlayerPrefs.LoadString(Const.KEY_ENABLE_CHARAS, "0");
                enabledCharas = enabledCharas + "," + selectItem.num;
                EncryptedPlayerPrefs.SaveString(Const.KEY_ENABLE_CHARAS, enabledCharas);
                selectItem.canSelect = true;
                priceText.text       = ("PLAY");
            }
        }
Beispiel #2
0
    private void AdSuccess()
    {
        SoundController.Instance.PlaySe(SoundController.Instance.rewardedSe);
        rewardButton.SetActive(false);
        reawrdedTextObj.SetActive(true);
        point += 100;
        EncryptedPlayerPrefs.SaveInt(Const.KEY_POINT, point);
        Sequence      seq  = DOTween.Sequence();
        RectTransform rect = reawrdedTextObj.GetComponent <RectTransform> ();

        seq.Append(rect.DOScaleX(1f, 0.5f).OnComplete(() => {
            pointText.text = point.ToString();
        }));
        seq.Append(rect.DOScaleX(0f, 0.5f).SetDelay(1f));
    }
Beispiel #3
0
    public void OnDead()
    {
        SoundController.Instance.PlaySe(SoundController.Instance.f1Se);
        moveCanvas.SetActive(false);

        EncryptedPlayerPrefs.SaveInt(Const.KEY_POINT, point);
        if (score > maxScore)
        {
            maxScore = score;
            EncryptedPlayerPrefs.SaveInt(Const.KEY_MAX_SCORE, score);
        }

        Application.CaptureScreenshot("screenShot.png");
        StartCoroutine("OnRetry");
    }
Beispiel #4
0
    //コインの保存とカウントアップ
    private void CountUpCoin(int currentCoin, int coin)
    {
        int finalVal = currentCoin + coin;

        if (finalVal > Const.MAX_COIN)
        {
            finalVal = Const.MAX_COIN;
        }
        EncryptedPlayerPrefs.SaveInt(Const.KEY_COIN, finalVal);
        TextMeshProUGUI text = currentCoinText.GetComponent <TextMeshProUGUI> ();

        DOVirtual.DelayedCall(1f, () => {
            DOTween.To(
                () => currentCoin,
                it => text.text = it.ToString(),
                finalVal,
                0.3f);
        });
    }
Beispiel #5
0
    public void OnClickBuyFixButton()
    {
        Sound.Instans.PlaySe(Sound.Instans.fixSound);
        buyPanel.SetActive(false);
        //コイン減らす playerPrefsに追加
        SelectPlayer sp          = buyChara.GetComponent <SelectPlayer> ();
        int          currentCoin = EncryptedPlayerPrefs.LoadInt(Const.KEY_COIN, 0);
        int          afterCoin   = currentCoin - sp.price;

        EncryptedPlayerPrefs.SaveInt(Const.KEY_COIN, afterCoin);
        int charaNo = sp.charaType + sp.charaSeq;

        AddEnableCharas(charaNo);
        coinText.GetComponent <TextMeshProUGUI>().text = afterCoin.ToString();

        Animator animator = buySelectChara.GetComponent <Animator> ();

        animator.enabled = true;
        if (sp.charaType == PlayerInfo.KOHAKU)
        {
            animator.SetBool("Win1", true);
        }
        else if (sp.charaType == PlayerInfo.YUKO)
        {
            animator.SetBool("Win2", true);
        }
        else if (sp.charaType == PlayerInfo.MISAKI)
        {
            animator.SetBool("Win3", true);
        }

        DOVirtual.DelayedCall(4f, () => {
            //UIを再構築
            EnableChara(ref kohaku1Array);
            EnableChara(ref yuko1Array);
            EnableChara(ref misaki1Array);
            EnableChara(ref kohaku2Array);
            EnableChara(ref yuko2Array);
            EnableChara(ref misaki2Array);
            CloseBuyPanel();
        });
    }
Beispiel #6
0
    //ランキング表示
    public void ViewRanking()
    {
        SoundController.Instance.PlaySe(SoundController.Instance.buttonSe);

        //ハイスコア更新
        if (maxScore > uploadScore)
        {
            Social.ReportScore(maxScore, Const.LEADERBOARD_ID, (bool success) => {
                if (success)
                {
                    EncryptedPlayerPrefs.SaveInt(Const.KEY_UPD_SCORE, maxScore);
                }
                ((PlayGamesPlatform)Social.Active).ShowLeaderboardUI(Const.LEADERBOARD_ID);
            });
        }
        else
        {
            ((PlayGamesPlatform)Social.Active).ShowLeaderboardUI(Const.LEADERBOARD_ID);
        }
    }
Beispiel #7
0
    //コインの保存とカウントアップ
    private void RewardCountUpCoin(int currentCoin, int coin)
    {
        int finalVal = currentCoin + coin;

        if (finalVal > Const.MAX_COIN)
        {
            finalVal = Const.MAX_COIN;
        }
        EncryptedPlayerPrefs.SaveInt(Const.KEY_COIN, finalVal);
        TextMeshProUGUI text = currentCoinText.GetComponent <TextMeshProUGUI> ();

        DOVirtual.DelayedCall(2.5f, () => {
            DOTween.To(
                () => currentCoin,
                it => text.text = it.ToString(),
                finalVal,
                0.3f);
        }).OnComplete(() => {
            rewardButtonObj.GetComponent <RectTransform>().DOScaleY(0, 0.5f);
            rewardImage.GetComponent <RectTransform>().DOScaleY(0, 0.5f);
        });
    }
Beispiel #8
0
 public void OnClickPosButton(int pos)
 {
     EncryptedPlayerPrefs.SaveInt(Const.KEY_PLAYERPOS, pos);
     SetPlayerPosImage(pos);
     Sound.Instans.PlaySe(Sound.Instans.pushSound);
 }
Beispiel #9
0
 public void OnClickLevelButton(int level)
 {
     EncryptedPlayerPrefs.SaveInt(Const.KEY_LEVEL, level);
     SetLevelImage(level);
     Sound.Instans.PlaySe(Sound.Instans.pushSound);
 }
Beispiel #10
0
    IEnumerator Restart()
    {
        yield return(new WaitForSeconds(1f));

        //結果判定
        PlayerInfo p1Info = player1.GetComponent <PlayerController>().playerInfo;
        PlayerInfo p2Info = player2.GetComponent <PlayerController>().playerInfo;

        if (p1Info.life <= 0 && p2Info.life <= 0)
        {
            //DROW 勝ち抜きモードの場合は負け
        }
        else if (p1Info.life <= 0)
        {
            //2pWIN
            GameMaster.Instance.p2Win += 1;
        }
        else if (p2Info.life <= 0)
        {
            //1pWIN
            GameMaster.Instance.p1Win += 1;
        }
        yield return(new WaitForSeconds(2f));

        if (GameMaster.Instance.mode != GameMaster.GameMode.EndlessMode)
        {
            if (GameMaster.Instance.p1Win == 1)
            {
                p1Win1.enabled = true;
            }
            if (GameMaster.Instance.p1Win == 2)
            {
                p1Win1.enabled = true;
                p1Win2.enabled = true;
            }
            if (GameMaster.Instance.p2Win == 1)
            {
                p2Win1.enabled = true;
            }
            if (GameMaster.Instance.p2Win == 2)
            {
                p2Win1.enabled = true;
                p2Win2.enabled = true;
            }
        }

        if (GameMaster.Instance.mode != GameMaster.GameMode.EndlessMode)
        {
            GameMaster.Instance.round += 1;
            if (GameMaster.Instance.p1Win == 2)
            {
                StartCoroutine("ShowEndCanvas", PlayerInfo.PlayerType.Player1);
            }
            else if (GameMaster.Instance.p2Win == 2)
            {
                StartCoroutine("ShowEndCanvas", PlayerInfo.PlayerType.Player2);
            }
            else
            {
                SceneManager.LoadScene("Main");
            }
        }
        else
        {
            //勝ち抜きモード
            if (IsPlayer(PlayerInfo.PlayerType.Player1) && p1Info.life <= 0)
            {
                //自分が1pかつ自分のライフが0
                if (!isContinue)
                {
                    //勝ち抜きモードの場合動画広告を見ると1度だけ回復できる
                    DOVirtual.DelayedCall(1.5f, () => {
                        katinukiContinuePanel.SetActive(true);
                    });
                }
                else
                {
                    StartCoroutine("ShowEndCanvas", PlayerInfo.PlayerType.Player1);
                }
            }
            else if (IsPlayer(PlayerInfo.PlayerType.Player2) && p2Info.life <= 0)
            {
                //自分が2pかつ自分のライフが0
                if (!isContinue)
                {
                    //勝ち抜きモードの場合動画広告を見ると1度だけ回復できる
                    DOVirtual.DelayedCall(1.5f, () => {
                        katinukiContinuePanel.SetActive(true);
                    });
                }
                else
                {
                    StartCoroutine("ShowEndCanvas", PlayerInfo.PlayerType.Player2);
                }
            }
            else
            {
                GameMaster.Instance.state  = GameMaster.GameState.Start;
                GameMaster.Instance.round += 1;
                //スコア更新
                katinukiScore.GetComponent <TextMeshProUGUI> ().text = string.Format("{0:D}にんぬき", GameMaster.Instance.round);
                int maxScore = EncryptedPlayerPrefs.LoadInt(Const.KEY_KATINUKI_MAX_SCORE, 0);
                if (maxScore < GameMaster.Instance.round)
                {
                    EncryptedPlayerPrefs.SaveInt(Const.KEY_KATINUKI_MAX_SCORE, GameMaster.Instance.round);
                    katinukiMaxScore.GetComponent <TextMeshProUGUI> ().text = string.Format("(さいこう{0:D})", EncryptedPlayerPrefs.LoadInt(Const.KEY_KATINUKI_MAX_SCORE, 0));
                }

                // 次の相手を投入
                if (p1Info.life <= 0)
                {
                    player1.GetComponent <InitPosition> ().enabled = false;
                    player1.transform.DOMoveX(-4.5f, 0.2f).OnComplete(() => {
                        Destroy(player1);
                    });

                    yield return(new WaitForSeconds(0.5f));

                    int random = Random.Range(0, playerList.Length);
                    int p1     = random;
                    GameMaster.Instance.player1Chara = p1;
                    player1 = Instantiate(playerList [p1], new Vector3(-4.5f, 0f, 0f), player1RRotate) as GameObject;
                    player1.SendMessage("Init", PlayerInfo.PlayerType.Player1);
                    enagyBar1.SendMessage("SetBar", Const.MAX_LIFE);

                    player1.transform.DOMove(player1RPos, 0.5f).OnComplete(() => {
                        player1.transform.position = player1RPos;
                        player1.transform.rotation = player1RRotate;
                        player1.SendMessage("OnStart", player1.transform);
                        player1.SendMessage("SetPlay");
                        player1.SendMessage("SetSgage", GameMaster.Instance.p1SGage);
                        sBar1.SendMessage("SetSuperBar", GameMaster.Instance.p1SGage);
                        name1.GetComponent <TextMeshProUGUI> ().text = GameMaster.GetCharaName(GameMaster.Instance.charaType1);
                    });
                }
                else if (p2Info.life <= 0)
                {
                    player2.GetComponent <InitPosition> ().enabled = false;
                    player2.transform.DOMoveX(4.5f, 0.2f).OnComplete(() => {
                        Destroy(player2);
                    });

                    yield return(new WaitForSeconds(0.5f));

                    int random = Random.Range(0, playerList.Length);
                    int p2     = random;
                    GameMaster.Instance.player2Chara = p2;
                    player2 = Instantiate(playerList [p2], new Vector3(4.5f, 0f, 0f), player2LRotate) as GameObject;
                    player2.SendMessage("Init", PlayerInfo.PlayerType.Player2);
                    enagyBar2.SendMessage("SetBar", Const.MAX_LIFE);

                    player2.transform.DOMove(player2LPos, 0.5f).OnComplete(() => {
                        player2.transform.position = player2LPos;
                        player2.transform.rotation = player2LRotate;
                        player2.SendMessage("OnStart", player2.transform);
                        player2.SendMessage("SetPlay");
                        player2.SendMessage("SetSgage", GameMaster.Instance.p2SGage);
                        sBar2.SendMessage("SetSuperBar", GameMaster.Instance.p2SGage);
                        name2.GetComponent <TextMeshProUGUI> ().text = GameMaster.GetCharaName(GameMaster.Instance.charaType2);;
                    });
                }
            }
        }
    }