예제 #1
0
        private void InitAccountBar()
        {
            int level  = GameProxy.instance.AccountLevel;
            int exp    = GameProxy.instance.AccountExp;
            int oldExp = 0;

            _nextAccountLevel = level;

            //协议已经过来,账号经验已升级,所以需要计算old exp
            AccountExpData accountExpData = AccountExpData.GetAccountExpDataByLv(level - 1);
            int            expTotal       = 0;

            if (accountExpData != null)
            {
                expTotal = accountExpData.expTotal;
            }
            int            oldExpTotal = expTotal + exp - _addAcountExp;
            AccountExpData oldData     = AccountExpData.GetAccountExpDataByExp(oldExpTotal);
            bool           isMax       = oldData == null;

            if (isMax)
            {
                exp_profession_bar.ChangeValue(0);
                _curAccountLevel = _oldAccountLevel = level;
            }
            else
            {
                _curAccountLevel = _oldAccountLevel = oldData.lv;
                oldExp           = oldExpTotal - (oldData.expTotal - oldData.exp);
                float percent = (oldExp + 0.0f) / oldData.exp;
                exp_profession_bar.ChangeValue(percent);
            }
        }
예제 #2
0
        private IEnumerator ShowOneByOneActionCoroutine()
        {
            TransformUtil.ClearChildren(scrollContentRoot, true);
            sweepBtnOne.interactable = false;
            sweepBtnTen.interactable = false;
            scrollRect.vertical      = false;
            sweepButtonPrefab.gameObject.SetActive(false);
            _scrollBar.interactable = false;
            _scrollBar.value        = 1;

            List <int>     keys       = _rewardDic.GetKeys();
            int            count      = keys.Count;
            AccountExpData oldExpData = AccountExpData.GetAccountExpDataByLv(_oldAccountLv);

            int addExp = 0;

            for (int i = 0; i < count; i++)
            {
                int         key      = keys[i];
                SweepButton sweepBtn = Instantiate <SweepButton>(sweepButtonPrefab);
                sweepBtn.gameObject.SetActive(true);
                sweepBtn.transform.SetParent(scrollContentRoot, false);
                List <GameResData> rewardList = _rewardDic[key];
                //exp
                addExp += GetBaseResNum(rewardList, BaseResType.Account_Exp);
                int            totalexp       = addExp + _oldAccountExp + (oldExpData.expTotal - oldExpData.exp);
                AccountExpData accountExpData = AccountExpData.GetAccountExpDataByExp(totalexp);
                int            accountLv      = 0;
                int            accountExp     = 0;
                if (accountExpData == null)
                {
                    accountLv  = GameProxy.instance.AccountMaxLevel;
                    accountExp = 0;
                }
                else
                {
                    accountLv  = accountExpData.lv;
                    accountExp = totalexp - (accountExpData.expTotal - accountExpData.exp);
                }
                float percent = (addExp * 100.0f) / oldExpData.exp;
                sweepBtn.SetSweepData(Localization.Get(string.Format("ui.dungeon_sweep_view.sweep_{0}", key)), rewardList, accountLv, accountExp, percent);
                yield return(null);

                yield return(null);

                yield return(null);

                StartCoroutine(ScrollToBottomCoroutine(sweepShowInterval));
                if (count == 1)
                {
                    yield return(new WaitForSeconds(sweepShowDelay));
                }
                else
                {
                    yield return(new WaitForSeconds(sweepShowInterval + sweepShowDelay));
                }
            }
            yield return(null);

            //animation
            GameObject completeAni = Instantiate <GameObject>(sweepCompletePrefab);

            completeAni.SetActive(true);
            completeAni.transform.SetParent(sweepCompletePrefab.transform.parent, false);
            completeAni.transform.GetChild(0).gameObject.SetActive(true);


            _scrollBar.interactable = true;
            scrollRect.vertical     = true;
            yield return(new WaitForSeconds(0.25f));

            //shake
            LeanTween.moveLocalY(shakePanel, shakePanel.transform.localPosition.y - 6, 0.03f).setLoopPingPong(1);
            yield return(new WaitForSeconds(1f));

            sweepBtnOne.interactable = true;
            sweepBtnTen.interactable = true;
            completeAni.AddComponent <Logic.UI.CommonAnimations.CommonFadeToAnimation>().init(1, 0, 0.2f, 0);
            yield return(new WaitForSeconds(0.2f));

            GameObject.DestroyImmediate(completeAni);
        }