public void ExchangeEnergy(float diamond)
        {
            if (diamond > this.diamond)
            {
                DispatchEvent(EventGameData.Action.Error, LTKey.EXCHANGE_DIAMOND_NOT_ENOUGH.LT());
                return;
            }

            localData.diamond -= diamond;
            var addEnergy = (int)diamond * CT.table.energyExchange;

            localData.energy += addEnergy;
            ResAddEffect.Play(ResAddView.ResType.Energy, addEnergy);

            SaveLocalData();
            DispatchEvent(EventGameData.Action.DataChange);

            // TODO: Analytics
            // Analytics.Event.Exchange(diamond, addCoin);
        }
        private void ShowGameEndPanel(bool isWin)
        {
            if (isWin)
            {
                this.DelayDo(0.5f, () =>
                {
                    mLevelPanelRect.DOAnchorPos(mLevelPanelRawPos + Vector2.down * 300, 0.25f);
                    mLevelPanelRect.DOScale(1, 0.25f);
                    progressCanvasGroup.DOFade(0, 0.25f);
                    ResAddEffect.Play(ResAddView.ResType.Energy, CT.table.energyRecoverWin);
                });

                this.DelayDo(1f, () =>
                {
                    Aircraft.ins.anima.PlayFlyAway();
                });

                this.DelayDo(2f, () =>
                {
                    UIManager.Open <NavigationView>(UILayer.Top);
                    gameLevelPanel.PlayLevelUp();
                });

                this.DelayDo(2.5f, () =>
                {
                    UIManager.Open <GameEndView>();
                });
            }
            else
            {
                this.DelayDo(0.5f, () =>
                {
                    Aircraft.ins.anima.PlayCrash();
                });

                this.DelayDo(1f, () =>
                {
                    UIManager.Open <GameEndView>();
                });
            }
        }
 private void AddDiamondWithEffect(float count)
 {
     AddDiamond(count);
     ResAddEffect.Play(ResAddView.ResType.Diamond, (int)count);
 }