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); }); } }
private void OnSettleEnter() { ScenePropMrg.Instance.RemoveAll(); TimerManager.Instance.FinishTimers(); VirusGameDataAdapter.AddLevel(); float y = 15f - _virusPlayer.transform.localPosition.y; _virusPlayer.SetPlayerState(false, false); _virusPlayer.Invincible = true; Sequence sq = DOTween.Sequence(); sq.Append(_virusPlayer.transform.DOMoveY(15f, y / 15f)); sq.AppendInterval(1.0f); sq.AppendCallback(() => { _uiMrg.MainPanel.UnActive(); }); sq.AppendInterval(1.0f); sq.AppendCallback(() => { VirusSoundMrg.Instance.PlaySound(VirusSoundType.Clear); _uiMrg.SettlePanel.Active(); _uiMrg.SettlePanel.SetCoinText(VirusGameDataAdapter.GetCurLevelCoin()); _uiMrg.CoinPanel.Active(); }); sq.AppendInterval(0.5f); sq.AppendCallback(() => { _isSettle = true; }); }
private void Update() { if (_isLerp) { int totalCoin = VirusGameDataAdapter.GetCurLevelCoin(); _lastCoin = Mathf.Lerp(_lastCoin, totalCoin, Time.deltaTime * 5); if (Mathf.Abs(_lastCoin - totalCoin) < 0.1f) { _isLerp = false; } _coinText.text = VirusTool.GetStrByIntger(Mathf.CeilToInt(_lastCoin)); } }
public override void Active() { _resultBg.transform.localScale = Vector3.zero; _resultBg.transform.DOScale(Vector3.one, 0.5f).SetEase(Ease.OutBounce); gameObject.SetActive(true); _index = 0; _count = 0; _isActive = true; coinImage.sprite = _coinSheets[_index]; int i = UnityEngine.Random.Range(0, _tipStrList.Count); _tipText.text = _tipStrList[i]; _coinText.text = VirusGameDataAdapter.GetCurLevelCoin().ToString(); }
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 = UnityEngine.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); }