Exemplo n.º 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;
            }
        }
Exemplo n.º 2
0
        public int UseBuff(int avatarId)
        {
            int buffId = 0;
            int num2   = 0;
            int count  = this._galTouchInfoItems.Count;

            while (num2 < count)
            {
                if (this._galTouchInfoItems[num2].avatarId == avatarId)
                {
                    if ((this._galTouchInfoItems[num2].buffId > 0) && (this._galTouchInfoItems[num2].buffRestTime > 0))
                    {
                        buffId = this._galTouchInfoItems[num2].buffId;
                        GalTouchInfoItem local1 = this._galTouchInfoItems[num2];
                        local1.buffRestTime--;
                        if (this._galTouchInfoItems[num2].buffRestTime <= 0)
                        {
                            this._galTouchInfoItems[num2].buffId = 0;
                        }
                    }
                    return(buffId);
                }
                num2++;
            }
            return(buffId);
        }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
0
        private bool OnGetAvatarDataRsp(GetAvatarDataRsp rsp)
        {
            List <Avatar> list  = rsp.get_avatar_list();
            int           num   = 0;
            int           count = list.Count;

            while (num < count)
            {
                Avatar avatar = list[num];
                if (avatar.get_touch_goodfeelSpecified() && avatar.get_stage_goodfeelSpecified())
                {
                    GalTouchInfoItem item = null;
                    int num3 = 0;
                    int num4 = this._galTouchInfoItems.Count;
                    while (num3 < num4)
                    {
                        if (this._galTouchInfoItems[num3].avatarId == avatar.get_avatar_id())
                        {
                            item = this._galTouchInfoItems[num3];
                            break;
                        }
                        num3++;
                    }
                    if (item == null)
                    {
                        item = new GalTouchInfoItem {
                            avatarId = (int)avatar.get_avatar_id()
                        };
                        this._galTouchInfoItems.Add(item);
                    }
                    int feel  = 0;
                    int level = 1;
                    this.TotalToHeartLevelAndGoodFeel((int)(avatar.get_touch_goodfeel() + avatar.get_stage_goodfeel()), out feel, out level);
                    int num7 = 0;
                    this.TotalToHeartLevelAndGoodFeelBattle((int)avatar.get_stage_goodfeel(), level, out num7);
                    int num8 = feel - num7;
                    item.heartLevel     = level;
                    item.touchGoodFeel  = num8;
                    item.battleGoodFeel = num7;
                    if (avatar.get_today_has_add_goodfeelSpecified())
                    {
                        item.todayAddedFeel = (int)avatar.get_today_has_add_goodfeel();
                    }
                }
                num++;
            }
            return(false);
        }
Exemplo n.º 5
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);
     }
 }
Exemplo n.º 6
0
        public void SetHeartLevelAndGoodFeel(int id, int heartLevel, int touchGoodFeel, int battleGoodFeel)
        {
            int num   = 0;
            int count = this._galTouchInfoItems.Count;

            while (num < count)
            {
                GalTouchInfoItem item = this._galTouchInfoItems[num];
                if (item.avatarId == id)
                {
                    this.DoSetHeartLevelAndGoodFeel(item, heartLevel, touchGoodFeel, battleGoodFeel);
                    return;
                }
                num++;
            }
        }
Exemplo n.º 7
0
        public int GetCharacterTouchGoodFeel(int id)
        {
            int num   = 0;
            int count = this._galTouchInfoItems.Count;

            while (num < count)
            {
                GalTouchInfoItem item = this._galTouchInfoItems[num];
                if (item.avatarId == id)
                {
                    return(item.touchGoodFeel);
                }
                num++;
            }
            return(0);
        }
Exemplo n.º 8
0
 public void ChangeAvatar(int id)
 {
     if (this._galTouchInfoItems == null)
     {
         Debug.LogError("Gal Touch Module Not Setup");
     }
     else if ((this._currentGalTouchInfo == null) || (this._currentGalTouchInfo.avatarId != id))
     {
         GalTouchInfoItem item = null;
         int num   = 0;
         int count = this._galTouchInfoItems.Count;
         while (num < count)
         {
             if (this._galTouchInfoItems[num].avatarId == id)
             {
                 item = this._galTouchInfoItems[num];
                 break;
             }
             num++;
         }
         if (item == null)
         {
             Debug.LogError("Invalid Avatar Id");
         }
         else
         {
             if (this.CurrentAvatarChanged != null)
             {
                 this.CurrentAvatarChanged((this._currentGalTouchInfo != null) ? this._currentGalTouchInfo.avatarId : -1, item.avatarId);
             }
             this._currentGalTouchInfo = item;
             Singleton <MiHoYoGameData> .Instance.LocalData.LastGalAvatarId = this._currentGalTouchInfo.avatarId;
             Singleton <MiHoYoGameData> .Instance.Save();
         }
     }
 }