Exemple #1
0
    private void OnSettleUpdate()
    {
        if (_isClickSpace && !_isGetAward && _isSettle)
        {
            Sequence sq = DOTween.Sequence();
            _isGetAward   = true;
            _isClickSpace = false;
            _isSettle     = false;

            if (VirusGameDataAdapter.GetCurLevelCoin() > 0)
            {
                int     count  = UnityEngine.Random.Range(10, 20);
                Vector3 pos    = new Vector2(0f, -96f);
                float   offset = 360f / count;
                for (int i = 0; i < count; i++)
                {
                    float   angle  = offset * i - 180;
                    bool    isP    = angle > -45f && angle < 135;
                    float   radius = UnityEngine.Random.Range(200f, 250f);
                    Vector2 uiPos  = pos + Quaternion.Euler(0, 0, angle) * Vector2.right * radius;
                    EventManager.TriggerEvent(new UIVirusAddTotalCoinEvent(uiPos, isP));
                }
                VirusGameDataAdapter.AddTotalCoin(VirusGameDataAdapter.GetCurLevelCoin());
                VirusGameDataAdapter.ResetLevelCoin();
                sq.AppendCallback(() => { _uiMrg.SettlePanel.UnActive(); });
                sq.AppendInterval(1.5f);
                sq.AppendCallback(() => { _fsm.ChangeState(VirusGameState.ShowTitle); });
                return;
            }
            sq.AppendCallback(() => { _uiMrg.SettlePanel.UnActive(); });
            sq.AppendInterval(0.5f);
            sq.AppendCallback(() => { _fsm.ChangeState(VirusGameState.ShowTitle); });
        }
    }
Exemple #2
0
    private void OnSettleUpdate()
    {
        if (IGamerProfile.Instance == null)
        {
            if (Input.GetKeyUp(KeyCode.KeypadEnter) ||
                Input.GetKeyUp(KeyCode.Return) ||
                Input.GetKeyUp(KeyCodeTV.PadEnter01) ||
                Input.GetKeyUp(KeyCodeTV.PadEnter02) ||
                Input.GetKeyUp(KeyCode.JoystickButton0))
            {
                //监听遥控器确定键消息
                //_isClickSpace = true;
                EventManager.TriggerEvent(new FirstByteClick5DownEvent());
            }
        }

        if (_isClickSpace && !_isGetAward && _isSettle)
        {
            Sequence sq = DOTween.Sequence();
            _isGetAward   = true;
            _isClickSpace = false;
            _isSettle     = false;

            if (VirusGameDataAdapter.GetCurLevelCoin() > 0)
            {
                int     count  = UnityEngine.Random.Range(10, 20);
                Vector3 pos    = new Vector2(0f, -96f);
                float   offset = 360f / count;
                for (int i = 0; i < count; i++)
                {
                    float   angle  = offset * i - 180;
                    bool    isP    = angle > -45f && angle < 135;
                    float   radius = UnityEngine.Random.Range(200f, 250f);
                    Vector2 uiPos  = pos + Quaternion.Euler(0, 0, angle) * Vector2.right * radius;
                    EventManager.TriggerEvent(new UIVirusAddTotalCoinEvent(uiPos, isP));
                }
                VirusGameDataAdapter.AddTotalCoin(VirusGameDataAdapter.GetCurLevelCoin());
                VirusGameDataAdapter.ResetLevelCoin();
                sq.AppendCallback(() => { _uiMrg.SettlePanel.UnActive(); });
                sq.AppendInterval(1.5f);
                sq.AppendCallback(() => { _fsm.ChangeState(VirusGameState.ShowTitle); });
                return;
            }
            sq.AppendCallback(() => { _uiMrg.SettlePanel.UnActive(); });
            sq.AppendInterval(0.5f);
            sq.AppendCallback(() => { _fsm.ChangeState(VirusGameState.ShowTitle); });
        }
    }
        void ShowCoinData()
        {
            int coin     = VirusGameDataAdapter.GetCurLevelCoin();
            int jiaCheng = Random.Range(10, 100);

            if (IGamerProfile.Instance != null)
            {
                UiSceneSelectGameCharacter.CharacterId     id = UiSceneSelectGameCharacter.CharacterId.ShouYi;
                IGamerProfile.PlayerData.PlayerChacterData dt = IGamerProfile.Instance.playerdata.characterData[(int)id];
                GameCharacter.CharacterData characterDt       = IGamerProfile.gameCharacter.characterDataList[(int)id];
                jiaCheng = characterDt.LevelBToVal.GetValue(dt.levelB); //关卡加成
            }

            int jiaChengCoin = Mathf.CeilToInt(jiaCheng * coin / 100f);
            int totalCoin    = coin + jiaChengCoin;

            _coinData.CoinText.text         = VirusTool.GetStrByIntger(coin);
            _coinData.TotalCoinText.text    = VirusTool.GetStrByIntger(totalCoin);
            _coinData.JiaChengText.text     = jiaCheng.ToString() + "%:";
            _coinData.JiaChengCoinText.text = VirusTool.GetStrByIntger(jiaChengCoin);
            VirusGameDataAdapter.AddTotalCoin(totalCoin);
        }