Example #1
0
        private void UpgradeMainSpeed()
        {
            int needCoin = VirusTool.GetUpgradeCoin(VirusPlayerDataAdapter.GetShootSpeed());

            VirusGameDataAdapter.MinusTotalCoin(needCoin);
            VirusPlayerDataAdapter.AddShootSpeed();
        }
Example #2
0
        private void UpgradeMainFire()
        {
            int needCoin = VirusTool.GetUpgradeCoin(VirusPlayerDataAdapter.GetShootLevel());

            VirusGameDataAdapter.MinusTotalCoin(needCoin);
            VirusPlayerDataAdapter.AddShootPower(1);
        }
Example #3
0
        private void RefreshMainPanelUIInfo()
        {
            int fireNeedCoin  = VirusTool.GetUpgradeCoin(VirusPlayerDataAdapter.GetShootLevel());
            int speedNeedCoin = VirusTool.GetUpgradeCoin(VirusPlayerDataAdapter.GetShootSpeed());

            textMainFireLv.text    = $"[Lv{VirusPlayerDataAdapter.GetShootLevel()}]";
            textMainFireValue.text = $"{VirusPlayerDataAdapter.GetShootLevel()*10}";
            textMainFireCoin.text  = $"x{fireNeedCoin}";

            textMainSpeedLv.text    = $"[Lv{VirusPlayerDataAdapter.GetShootSpeed()}]";
            textMainSpeedValue.text = $"{VirusPlayerDataAdapter.GetShootSpeed()*10}";
            textMainSpeedCoin.text  = $"x{speedNeedCoin}";

            btnMainFire.interactable  = CheckCoin(fireNeedCoin);
            btnMainSpeed.interactable = CheckCoin(speedNeedCoin);
        }
Example #4
0
        private void RefreshWeaponPanelUIInfo()
        {
            var lv     = VirusPlayerDataAdapter.GetCurWeaponLevel();
            var weapon = VirusPlayerDataAdapter.GetWeaponData(lv);

            int fireNeedCoin  = VirusTool.GetUpgradeCoin(weapon.fire);
            int speedNeedCoin = VirusTool.GetUpgradeCoin(weapon.speed);

            textWeaponFireLv.text    = $"[Lv{weapon.fire}]";
            textWeaponFireValue.text = $"{weapon.fire*10}";
            textWeaponFireCoin.text  = $"x{fireNeedCoin}";

            textWeaponSpeedLv.text    = $"[Lv{weapon.speed}]";
            textWeaponSpeedValue.text = $"{weapon.speed*10}";
            textWeaponSpeedCoin.text  = $"x{speedNeedCoin}";

            btnWeaponFire.interactable  = CheckCoin(fireNeedCoin);
            btnWeaponSpeed.interactable = CheckCoin(speedNeedCoin);
        }
Example #5
0
    private void OnUpgradeEnter()
    {
        //这里是对玩家武器进行升级
        bool   isUpdgrade = false;
        string tipStr     = "";

        if (IGamerProfile.Instance == null)
        {
            int coin     = VirusGameDataAdapter.GetTotalCoin();
            int needCoin = VirusTool.GetUpgradeCoin(VirusPlayerDataAdapter.GetWeaponLevel());
            //coin = 50 * needCoin; //testSyq
            while (true)
            {
                if (coin >= needCoin)
                {
                    isUpdgrade = true;
                    int value = VirusPlayerDataAdapter.GetUpgradeValue();
                    //扣除玩家金币
                    VirusGameDataAdapter.MinusTotalCoin(needCoin);
                    //增加武器等级
                    VirusPlayerDataAdapter.AddWeaponLevel();
                    //增加武器伤害
                    VirusPlayerDataAdapter.AddShootPower(value);
                    //增加子弹射速,暂时无用
                    VirusPlayerDataAdapter.AddShootSpeed();

                    bool b1 = VirusPlayerDataAdapter.GetShootNum() <= VirusPlayerDataAdapter.GetMaxShootNum();
                    bool b2 = VirusPlayerDataAdapter.UpgradeShoot();
                    if (b1 && b2)
                    {
                        //增加武器发射的子弹数量
                        VirusPlayerDataAdapter.AddShootNum(1);
                    }

                    coin = VirusGameDataAdapter.GetTotalCoin();
                    //升级需要的金币数
                    needCoin = VirusTool.GetUpgradeCoin(VirusPlayerDataAdapter.GetWeaponLevel());
                }
                else
                {
                    break;
                }
            }

            if (isUpdgrade)
            {
                _uiMrg.CoinPanel.SetCoinText();
                _virusPlayer.Upgrade();
                VirusSoundMrg.Instance.PlaySound(VirusSoundType.UpgradeGun);
                tipStr = "火力升级";
            }
        }
        else
        {
            //对于玩家的武器属性进行配置
            int indexWeapon = (int)UiSceneSelectGameCharacter.CharacterId.MainWeapon;
            //int levelA = IGamerProfile.Instance.playerdata.characterData[indexWeapon].levelA;
            int levelB = IGamerProfile.Instance.playerdata.characterData[indexWeapon].levelB;
        }

        float delayTime = 0.1f;
        //int level = VirusTool.UnlockViceWeapon(VirusGameDataAdapter.GetLevel());
        int level = 0;

        //获取玩家选择的副武器
        if (IGamerProfile.Instance != null)
        {
            level = IGamerProfile.Instance.gameEviroment.characterIndex;
        }
        //level = 8; //testSyq
        if (level > 0)
        {
            if (_virusPlayer.WeaponLevel != level)
            {
                _virusPlayer.WeaponLevel = level;
                //这里是升级副武器的
                delayTime = 0.1f;
                _virusPlayer.InitiViceWeapon(level);
                tipStr = "装备升级";
            }
        }

        if (!string.IsNullOrEmpty(tipStr))
        {
            var tip = EffectPools.Instance.Spawn("FloatTip");
            tip.transform.position   = _virusPlayer.transform.position;
            tip.transform.localScale = new Vector3(1.5f, 1.5f, 1);
            tip.GetComponent <FastlaneFloatTip>().Float(tipStr, () => { EffectPools.Instance.DeSpawn(tip); });
        }

        DOVirtual.DelayedCall(delayTime, _uiMrg.FadeOut).OnComplete(() =>
        {
            _fsm.ChangeState(VirusGameState.GamePlay);
        });
    }