예제 #1
0
        public void IncreaseBattleGoodFeel(int avatarId, int amount)
        {
            GalTouchInfoItem item = null;
            int num   = 0;
            int count = this._galTouchInfoItems.Count;

            while (num < count)
            {
                if (this._galTouchInfoItems[num].avatarId == avatarId)
                {
                    item = this._galTouchInfoItems[num];
                    break;
                }
                num++;
            }
            if (item != null)
            {
                amount = Mathf.Clamp(amount, -item.battleGoodFeel, this.GetTodayRemainGoodFeel());
                int b    = GalTouchData.QueryLevelUpFeelNeedBattle(item.heartLevel);
                int num4 = Mathf.Min(item.battleGoodFeel + amount, b);
                amount = num4 - item.battleGoodFeel;
                Singleton <NetworkManager> .Instance.RequestGalAddGoodFeel(item.avatarId, amount, 2);

                item.todayAddedFeel += amount;
                item.battleGoodFeel  = num4;
            }
        }
예제 #2
0
        public void OnGalTouchInfoChanged(int oldGoodFeel, int oldHeartLevel, int newGoodFeel, int newHeartLevel, GoodFeelLimitType limitType)
        {
            if (this._galTouchView != null)
            {
                this.UpdateHint(limitType);
                int   num        = GalTouchData.QueryLevelUpFeelNeed(oldHeartLevel);
                float sliderFrom = 0f;
                if (num != 0)
                {
                    sliderFrom = ((float)oldGoodFeel) / ((float)num);
                }
                sliderFrom += oldHeartLevel;
                int   num3     = GalTouchData.QueryLevelUpFeelNeed(newHeartLevel);
                float sliderTo = 0f;
                if (num3 != 0)
                {
                    sliderTo = ((float)newGoodFeel) / ((float)num3);
                }
                sliderTo += newHeartLevel;
                string additionalText       = string.Empty;
                int    avatarGalTouchBuffId = Singleton <GalTouchModule> .Instance.GetAvatarGalTouchBuffId(Singleton <GalTouchModule> .Instance.GetCurrentTouchAvatarID());

                if (avatarGalTouchBuffId != 0)
                {
                    TouchBuffItem touchBuffItem = GalTouchData.GetTouchBuffItem(avatarGalTouchBuffId);
                    if (touchBuffItem != null)
                    {
                        object[] replaceParams = new object[] { GalTouchBuffData.GetCalculatedParam(touchBuffItem.param1, touchBuffItem.param1Add, newHeartLevel).ToString(), GalTouchBuffData.GetCalculatedParam(touchBuffItem.param2, touchBuffItem.param2Add, newHeartLevel).ToString(), GalTouchBuffData.GetCalculatedParam(touchBuffItem.param3, touchBuffItem.param3Add, newHeartLevel).ToString() };
                        additionalText = LocalizationGeneralLogic.GetText(touchBuffItem.detail, replaceParams);
                    }
                }
                this._galTouchView.Show(sliderFrom, sliderTo, newGoodFeel, additionalText);
            }
        }
예제 #3
0
        private void SetGoodFeelText(float ratio)
        {
            int   level = (int)ratio;
            float num2  = ratio - level;
            int   num3  = GalTouchData.QueryLevelUpFeelNeed(level);
            int   num4  = (int)(num3 * num2);

            this.goodFeelLabel.text = string.Format("{0}/{1}", (ratio != this._toPer) ? num4.ToString() : this._finalExp.ToString(), num3.ToString());
        }
예제 #4
0
 private void TotalToHeartLevelAndGoodFeelBattle(int total, int level, out int feel)
 {
     total = (total >= 0) ? total : 0;
     for (int i = 1; i < level; i++)
     {
         total -= GalTouchData.QueryLevelUpFeelNeedBattle(i);
     }
     feel = (total >= 0) ? total : 0;
 }
예제 #5
0
        private bool IsLimitedByMission(GalTouchInfoItem item)
        {
            TouchMissionItem touchMissionItem = GalTouchData.GetTouchMissionItem(item.avatarId, item.heartLevel);

            if (touchMissionItem == null)
            {
                return(false);
            }
            MissionDataItem missionDataItem = Singleton <MissionModule> .Instance.GetMissionDataItem(touchMissionItem.missionId);

            return((missionDataItem == null) || (missionDataItem.status == 2));
        }
예제 #6
0
        private void HeartLevelAndGoodFeelToTotalTouch(int feel, int level, out int total)
        {
            int num = 0;

            level = Mathf.Clamp(level, 1, 5);
            for (int i = 2; i <= level; i++)
            {
                num += GalTouchData.QueryLevelUpFeelNeedTouch(i - 1);
            }
            if (level != 5)
            {
                num += feel;
            }
            total = num;
        }
예제 #7
0
        private int GetLevelTotalTouchLimit(int level)
        {
            int num = 0;

            level = Mathf.Clamp(level, 1, 5);
            for (int i = 1; i < level; i++)
            {
                num += GalTouchData.QueryLevelUpFeelNeed(i);
            }
            if (level != 5)
            {
                num += GalTouchData.QueryLevelUpFeelNeedTouch(level);
            }
            return(num);
        }
예제 #8
0
 private void DoSetHeartLevelAndGoodFeel(GalTouchInfoItem item, int heartLevel, int touchGoodFeel, int battleGoodFeel)
 {
     if (item != null)
     {
         int num = touchGoodFeel + battleGoodFeel;
         heartLevel = Mathf.Clamp(heartLevel, 0, 5);
         int num2 = GalTouchData.QueryLevelUpFeelNeed(heartLevel);
         if (num2 != 0)
         {
             num = Mathf.Clamp(num, 0, num2 - 1);
         }
         item.heartLevel     = heartLevel;
         item.touchGoodFeel  = Mathf.Min(touchGoodFeel, num);
         item.battleGoodFeel = Mathf.Max(num - item.touchGoodFeel, 0);
     }
 }
예제 #9
0
        private void TotalToHeartLevelAndGoodFeel(int total, out int feel, out int level)
        {
            total = (total >= 0) ? total : 0;
            int num = 1;

            while (true)
            {
                if (num == 5)
                {
                    total = GalTouchData.QueryLevelUpFeelNeed(4);
                    break;
                }
                int num2 = GalTouchData.QueryLevelUpFeelNeed(num);
                if (total < num2)
                {
                    break;
                }
                total -= num2;
                num++;
            }
            feel  = total;
            level = num;
        }
예제 #10
0
        public void IncreaseTouchGoodFeel(int amount)
        {
            if ((this._currentGalTouchInfo != null) && !this._waitingForResponse)
            {
                GoodFeelLimitType none = GoodFeelLimitType.None;
                bool flag = amount <= 0;
                amount = Mathf.Clamp(amount, -this._currentGalTouchInfo.touchGoodFeel, this.GetTodayRemainGoodFeel());
                if (this._currentGalTouchInfo.heartLevel > 4)
                {
                    if (this.GalTouchInfoChanged != null)
                    {
                        this.GalTouchInfoChanged(this._currentGalTouchInfo.touchGoodFeel + this._currentGalTouchInfo.battleGoodFeel, this._currentGalTouchInfo.heartLevel, this._currentGalTouchInfo.touchGoodFeel + this._currentGalTouchInfo.battleGoodFeel, this._currentGalTouchInfo.heartLevel, GoodFeelLimitType.ReachMax);
                    }
                }
                else
                {
                    int num  = GalTouchData.QueryLevelUpFeelNeedTouch(this._currentGalTouchInfo.heartLevel);
                    int num2 = GalTouchData.QueryLevelUpFeelNeedBattle(this._currentGalTouchInfo.heartLevel);
                    if ((this._currentGalTouchInfo.battleGoodFeel >= num2) && !this.IsLimitedByMission(this._currentGalTouchInfo))
                    {
                        int total = 0;
                        int feel  = 0;
                        int level = 1;
                        this.HeartLevelAndGoodFeelToTotal(this._currentGalTouchInfo.touchGoodFeel + this._currentGalTouchInfo.battleGoodFeel, this._currentGalTouchInfo.heartLevel, out total);
                        int num6 = total + amount;
                        this.TotalToHeartLevelAndGoodFeel(num6, out feel, out level);
                        if (this._currentGalTouchInfo.heartLevel != level)
                        {
                            num6 = Mathf.Min(num6, this.GetLevelTotalTouchLimit(this._currentGalTouchInfo.heartLevel + 1));
                            this.TotalToHeartLevelAndGoodFeel(num6, out feel, out level);
                        }
                        this.HeartLevelAndGoodFeelToTotal(feel, level, out num6);
                        this._currentGalTouchInfo.todayAddedFeel += num6 - total;
                        if ((amount == 0) && (this.GetTodayRemainGoodFeel() == 0))
                        {
                            none = GoodFeelLimitType.DialyGoodFeel;
                        }
                        if (this.GalTouchInfoChanged != null)
                        {
                            this.GalTouchInfoChanged(this._currentGalTouchInfo.touchGoodFeel + this._currentGalTouchInfo.battleGoodFeel, this._currentGalTouchInfo.heartLevel, feel, level, none);
                        }
                        if (level != this._currentGalTouchInfo.heartLevel)
                        {
                            this._currentGalTouchInfo.battleGoodFeel = 0;
                        }
                        this._currentGalTouchInfo.touchGoodFeel = feel - this._currentGalTouchInfo.battleGoodFeel;
                        this._currentGalTouchInfo.heartLevel    = level;
                        Singleton <NetworkManager> .Instance.RequestGalAddGoodFeel(this._currentGalTouchInfo.avatarId, num6 - total, 1);

                        this._waitingForResponse = true;
                    }
                    else
                    {
                        int num7 = Mathf.Clamp(this._currentGalTouchInfo.touchGoodFeel + amount, 0, num - 1);
                        amount = num7 - this._currentGalTouchInfo.touchGoodFeel;
                        if ((amount == 0) && !flag)
                        {
                            if (this.GetTodayRemainGoodFeel() == 0)
                            {
                                none = GoodFeelLimitType.DialyGoodFeel;
                            }
                            else if (this._currentGalTouchInfo.battleGoodFeel < num2)
                            {
                                none = GoodFeelLimitType.Battle;
                            }
                            else if (this.IsLimitedByMission(this._currentGalTouchInfo))
                            {
                                none = GoodFeelLimitType.Mission;
                            }
                        }
                        else
                        {
                            none = GoodFeelLimitType.None;
                        }
                        if (this.GalTouchInfoChanged != null)
                        {
                            this.GalTouchInfoChanged(this._currentGalTouchInfo.touchGoodFeel + this._currentGalTouchInfo.battleGoodFeel, this._currentGalTouchInfo.heartLevel, num7 + this._currentGalTouchInfo.battleGoodFeel, this._currentGalTouchInfo.heartLevel, none);
                        }
                        Singleton <NetworkManager> .Instance.RequestGalAddGoodFeel(this._currentGalTouchInfo.avatarId, amount, 1);

                        this._currentGalTouchInfo.todayAddedFeel += amount;
                        this._waitingForResponse = true;
                        this._currentGalTouchInfo.touchGoodFeel = num7;
                    }
                }
            }
        }