private void ClickEnterBtEvent(InputKillVirus.ButtonState val)
        {
            if (val == InputKillVirus.ButtonState.DOWN)
            {
                return;
            }

            switch (_buttonState)
            {
            case ButtonState.Enter:
            {
                int playerCoin = VirusGameDataAdapter.GetTotalCoin();
                if (playerCoin >= m_NeedCoin)
                {
                    //确认复活
                    RevivePlayer();
                    SubCoin();
                }
                else
                {
                    //需要充值
                    //VirusGameMrg.Instance.m_UIMrg.BuyCoinsPanel.Active();
                    if (IGamerProfile.Instance != null)
                    {
                        HiddenPanel();
                        RemoveEvent();
                        UiGameBuyCoins com = (UiGameBuyCoins)UiSceneUICamera.Instance.CreateAloneScene(UiSceneUICamera.UISceneId.Id_UIGameBuyCoins);
                        com.PlayerBuyCoins(m_NeedCoin);
                        com.AddEvent(CallBackEvent);
                        return;
                    }
                    else
                    {
                        RevivePlayer();
                    }
                }
                UnActive();
                break;
            }

            case ButtonState.Back:
            {
                ClosePanel();
                break;
            }
            }
        }
Пример #2
0
 private void Update()
 {
     if (_isLerp)
     {
         int totalCoin = VirusGameDataAdapter.GetTotalCoin();
         _lastCoin = Mathf.Lerp(_lastCoin, totalCoin, Time.deltaTime * 5);
         if (Mathf.Abs(_lastCoin - totalCoin) < 0.1f)
         {
             _isLerp = false;
             _isSet  = false;
         }
         _coinText.text = VirusTool.GetStrByIntger(Mathf.RoundToInt(_lastCoin));
         _totalTime    -= Time.deltaTime;
         if (_totalTime <= 0 && _num > 0)
         {
             _num--;
             VirusSoundMrg.Instance.PlaySound(VirusSoundType.TotalCoin);
             _totalTime = 0.15f;
         }
     }
 }
Пример #3
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);
        });
    }
 public void SetCoinText()
 {
     _coinText.text = VirusTool.GetStrByIntger(VirusGameDataAdapter.GetTotalCoin());
     //Debug.Log("test ======== " + _coinText.text);
 }
Пример #5
0
        private bool CheckCoin(int needCoin)
        {
            int coin = VirusGameDataAdapter.GetTotalCoin();

            return(coin >= needCoin);
        }
Пример #6
0
        public void SetCoinText()
        {
            string str = VirusTool.GetStrByIntger(VirusGameDataAdapter.GetTotalCoin());

            _coinText.text = str;
        }