public int Compare(KeyValuePair <int, JamGarrisonFollower> follower1, KeyValuePair <int, JamGarrisonFollower> follower2)
        {
            JamGarrisonFollower value           = follower1.Value;
            JamGarrisonFollower value2          = follower2.Value;
            FollowerStatus      followerStatus  = GeneralHelpers.GetFollowerStatus(value);
            FollowerStatus      followerStatus2 = GeneralHelpers.GetFollowerStatus(value2);
            bool flag  = (value.Flags & 8) != 0;
            bool flag2 = (value2.Flags & 8) != 0;
            bool flag3 = !flag && followerStatus != FollowerStatus.inactive;
            bool flag4 = !flag2 && followerStatus2 != FollowerStatus.inactive;

            if (flag3 != flag4)
            {
                return((!flag3) ? 1 : -1);
            }
            if (followerStatus != followerStatus2)
            {
                return(followerStatus - followerStatus2);
            }
            int num  = (value.ItemLevelArmor + value.ItemLevelWeapon) / 2;
            int num2 = (value2.ItemLevelArmor + value2.ItemLevelWeapon) / 2;

            if (num2 != num)
            {
                return(num2 - num);
            }
            if (value.Quality != value2.Quality)
            {
                return(value2.Quality - value.Quality);
            }
            return(0);
        }
    private FollowerListItem InsertFollowerIntoListView(JamGarrisonFollower follower)
    {
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);

        if (record == null)
        {
            return(null);
        }
        if (record.GarrFollowerTypeID != 4u)
        {
            return(null);
        }
        if (this.m_isCombatAllyList)
        {
            bool           flag           = (follower.Flags & 8) != 0;
            FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(follower);
            if (flag || follower.ZoneSupportSpellID <= 0 || followerStatus == FollowerStatus.inactive || followerStatus == FollowerStatus.fatigued || followerStatus == FollowerStatus.inBuilding)
            {
                return(null);
            }
        }
        GameObject gameObject = Object.Instantiate <GameObject>(this.m_followerListItemPrefab);

        gameObject.get_transform().SetParent(this.m_followerListViewContents.get_transform());
        gameObject.get_transform().set_localScale(Vector3.get_one());
        gameObject.get_transform().set_localPosition(Vector3.get_zero());
        FollowerListItem component = gameObject.GetComponent <FollowerListItem>();

        component.SetFollower(follower);
        AutoHide autoHide = gameObject.AddComponent <AutoHide>();

        autoHide.m_clipRT = base.get_gameObject().GetComponent <RectTransform>();
        return(component);
    }
    private FollowerListItem InsertFollowerIntoListView(JamGarrisonFollower follower)
    {
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);

        if (record == null)
        {
            return(null);
        }
        if (record.GarrFollowerTypeID != 4u)
        {
            return(null);
        }
        if (this.m_isCombatAllyList)
        {
            bool           flag           = (follower.Flags & 8) != 0;
            FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(follower);
            if (flag || follower.ZoneSupportSpellID <= 0 || followerStatus == FollowerStatus.inactive || followerStatus == FollowerStatus.fatigued || followerStatus == FollowerStatus.inBuilding)
            {
                return(null);
            }
        }
        GameObject gameObject = Object.Instantiate <GameObject>(this.m_followerListItemPrefab);

        gameObject.get_transform().SetParent(this.m_followerListViewContents.get_transform(), false);
        FollowerListItem component = gameObject.GetComponent <FollowerListItem>();

        component.SetFollower(follower);
        return(component);
    }
Exemple #4
0
    private void MobileClientChangeFollowerActiveResultHandler(MobileClientChangeFollowerActiveResult msg)
    {
        GARRISON_RESULT result = (GARRISON_RESULT)msg.Result;

        if (result == GARRISON_RESULT.SUCCESS)
        {
            PersistentFollowerData.AddOrUpdateFollower(msg.Follower);
            FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(msg.Follower);
            if (followerStatus == FollowerStatus.inactive)
            {
                Debug.Log("Follower is now inactive. " + msg.ActivationsRemaining + " activations remain for the day.");
            }
            else
            {
                Debug.Log("Follower is now active. " + msg.ActivationsRemaining + " activations remain for the day.");
            }
            if (this.FollowerDataChangedAction != null)
            {
                this.FollowerDataChangedAction.Invoke();
            }
            MobilePlayerFollowerActivationDataRequest mobilePlayerFollowerActivationDataRequest = new MobilePlayerFollowerActivationDataRequest();
            mobilePlayerFollowerActivationDataRequest.GarrTypeID = 3;
            Login.instance.SendToMobileServer(mobilePlayerFollowerActivationDataRequest);
        }
        else
        {
            Debug.Log("Follower activation/deactivation failed for reason " + result.ToString());
        }
    }
    private void InsertFollowerIntoListView(JamGarrisonFollower follower, FollowerCategory followerCategory)
    {
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);

        if (record == null)
        {
            return;
        }
        if (record.GarrFollowerTypeID != 4u)
        {
            return;
        }
        bool           flag           = (follower.Flags & 8) != 0;
        bool           flag2          = !flag;
        FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(follower);

        switch (followerCategory)
        {
        case FollowerCategory.ActiveChampion:
            if (!flag2 || followerStatus == FollowerStatus.inactive)
            {
                return;
            }
            break;

        case FollowerCategory.InactiveChampion:
            if (!flag2 || followerStatus != FollowerStatus.inactive)
            {
                return;
            }
            break;

        case FollowerCategory.Troop:
            if (!flag || follower.Durability <= 0)
            {
                return;
            }
            break;

        default:
            return;
        }
        FollowerListItem followerListItem = Object.Instantiate <FollowerListItem>(this.m_followerDetailListItemPrefab);

        followerListItem.get_transform().SetParent(this.m_followerDetailListContent.get_transform(), false);
        followerListItem.SetFollower(follower);
        AutoHide autoHide = followerListItem.m_followerDetailView.get_gameObject().AddComponent <AutoHide>();

        autoHide.m_clipRT = this.m_panelViewRT;
        AutoHide autoHide2 = followerListItem.m_listItemArea.get_gameObject().AddComponent <AutoHide>();

        autoHide2.m_clipRT = this.m_panelViewRT;
    }
Exemple #6
0
 private void CreateCombatAllyItems(int combatAllyMissionID, int combatAllyMissionCost)
 {
     foreach (JamGarrisonFollower jamGarrisonFollower in PersistentFollowerData.followerDictionary.Values)
     {
         FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(jamGarrisonFollower);
         if (jamGarrisonFollower.ZoneSupportSpellID > 0 && (followerStatus == FollowerStatus.available || followerStatus == FollowerStatus.onMission))
         {
             FollowerInventoryListItem followerInventoryListItem = Object.Instantiate <FollowerInventoryListItem>(this.m_combatAllyChampionListItemPrefab);
             followerInventoryListItem.transform.SetParent(this.m_combatAllyListContent.transform, false);
             followerInventoryListItem.SetCombatAllyChampion(jamGarrisonFollower, combatAllyMissionID, combatAllyMissionCost);
         }
     }
 }
    private void InsertFollowerIntoListView(JamGarrisonFollower follower, FollowerCategory followerCategory)
    {
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);

        if (record == null)
        {
            return;
        }
        if (record.GarrFollowerTypeID != 4u)
        {
            return;
        }
        bool           flag           = (follower.Flags & 8) != 0;
        bool           flag2          = !flag;
        FollowerStatus followerStatus = GeneralHelpers.GetFollowerStatus(follower);

        switch (followerCategory)
        {
        case FollowerCategory.ActiveChampion:
            if (!flag2 || followerStatus == FollowerStatus.inactive)
            {
                return;
            }
            break;

        case FollowerCategory.InactiveChampion:
            if (!flag2 || followerStatus != FollowerStatus.inactive)
            {
                return;
            }
            break;

        case FollowerCategory.Troop:
            if (!flag || follower.Durability <= 0)
            {
                return;
            }
            break;

        default:
            return;
        }
        FollowerListItem followerListItem = Object.Instantiate <FollowerListItem>(this.m_followerDetailListItemPrefab);

        followerListItem.transform.SetParent(this.m_followerDetailListContent.transform, false);
        followerListItem.SetFollower(follower);
    }
Exemple #8
0
 private void CreateCombatAllyItems(int combatAllyMissionID, int combatAllyMissionCost)
 {
     using (Dictionary <int, JamGarrisonFollower> .ValueCollection.Enumerator enumerator = PersistentFollowerData.followerDictionary.get_Values().GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             JamGarrisonFollower current        = enumerator.get_Current();
             FollowerStatus      followerStatus = GeneralHelpers.GetFollowerStatus(current);
             if (current.ZoneSupportSpellID > 0 && (followerStatus == FollowerStatus.available || followerStatus == FollowerStatus.onMission))
             {
                 FollowerInventoryListItem followerInventoryListItem = Object.Instantiate <FollowerInventoryListItem>(this.m_combatAllyChampionListItemPrefab);
                 followerInventoryListItem.get_transform().SetParent(this.m_combatAllyListContent.get_transform(), false);
                 followerInventoryListItem.SetCombatAllyChampion(current, combatAllyMissionID, combatAllyMissionCost);
             }
         }
     }
 }
        public int Compare(KeyValuePair <int, JamGarrisonFollower> follower1, KeyValuePair <int, JamGarrisonFollower> follower2)
        {
            JamGarrisonFollower value           = follower1.get_Value();
            JamGarrisonFollower value2          = follower2.get_Value();
            FollowerStatus      followerStatus  = GeneralHelpers.GetFollowerStatus(value);
            FollowerStatus      followerStatus2 = GeneralHelpers.GetFollowerStatus(value2);

            if (followerStatus != followerStatus2)
            {
                return(followerStatus - followerStatus2);
            }
            bool flag  = this.HasUsefulAbility(value);
            bool flag2 = this.HasUsefulAbility(value2);

            if (flag != flag2)
            {
                return((!flag) ? 1 : -1);
            }
            int num  = (value.ItemLevelArmor + value.ItemLevelWeapon) / 2;
            int num2 = (value2.ItemLevelArmor + value2.ItemLevelWeapon) / 2;

            if (num2 != num)
            {
                return(num2 - num);
            }
            if (value.Quality != value2.Quality)
            {
                return(value2.Quality - value.Quality);
            }
            bool flag3 = (value.Flags & 8) != 0;
            bool flag4 = (value2.Flags & 8) != 0;

            if (flag3 != flag4)
            {
                return((!flag4) ? 1 : -1);
            }
            return(0);
        }