Ejemplo n.º 1
0
    /* Static Methods */
    public static AbilityDisplay Create(RectTransform parent, Ability subject)
    {
        GameObject pref = ABU.LoadAsset <GameObject> (PREF_DIR, "AbilityDisplay");
        GameObject inst = Instantiate <GameObject> (pref, parent, false);

        AbilityDisplay ad = inst.GetComponent <AbilityDisplay> ();

        ad.SetSubject(subject);

        //fill charge list
        GameObject c_pref = ABU.LoadAsset <GameObject>(PREF_DIR, "ChargeIndicator");

        for (int i = 0; i < subject.ChargesMax; i++)
        {
            GameObject c_inst = Instantiate <GameObject> (c_pref, ad.chargeList, false);
            Image      icon   = c_inst.GetComponent <Image> ();
            if (i < subject.Charges)
            {
                icon.fillAmount = 1f;
            }
            else if (i == subject.Charges)
            {
                icon.fillAmount = 1 - subject.CooldownPercentage;
            }
            else
            {
                icon.fillAmount = 0f;
            }
        }

        return(ad);
    }
Ejemplo n.º 2
0
    private void AddAbility(Ability a, int index)
    {
        AbilityDisplay ad = AbilityDisplay.Create(abilListRoot, a);

        ad.ChangeCDColor(Bullet.DamageTypeToColor(subject.DefaultDT));
        ad.transform.SetSiblingIndex(index);
    }
 private void HandleUseEquipmentResult(JamGarrisonFollower oldFollower, JamGarrisonFollower newFollower)
 {
     if (this.m_garrFollowerID != newFollower.GarrFollowerID)
     {
         return;
     }
     int[] abilityID = newFollower.AbilityID;
     for (int i = 0; i < abilityID.Length; i++)
     {
         int            num    = abilityID[i];
         GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(num);
         if ((record.Flags & 1u) != 0u)
         {
             bool  flag       = true;
             int[] abilityID2 = oldFollower.AbilityID;
             for (int j = 0; j < abilityID2.Length; j++)
             {
                 int num2 = abilityID2[j];
                 if (num2 == num)
                 {
                     flag = false;
                     break;
                 }
             }
             if (flag)
             {
                 AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true);
                 AbilityDisplay[] array = componentsInChildren;
                 for (int k = 0; k < array.Length; k++)
                 {
                     AbilityDisplay abilityDisplay = array[k];
                     bool           flag2          = true;
                     int[]          abilityID3     = newFollower.AbilityID;
                     for (int l = 0; l < abilityID3.Length; l++)
                     {
                         int num3 = abilityID3[l];
                         if (abilityDisplay.GetAbilityID() == num3)
                         {
                             flag2 = false;
                             break;
                         }
                     }
                     if (flag2)
                     {
                         Debug.Log(string.Concat(new object[]
                         {
                             "New ability is ",
                             num,
                             " replacing ability ID ",
                             abilityDisplay.GetAbilityID()
                         }));
                         abilityDisplay.SetAbility(num, true, true, this);
                         Main.instance.m_UISound.Play_UpgradeEquipment();
                         UiAnimMgr.instance.PlayAnim("FlameGlowPulse", abilityDisplay.get_transform(), Vector3.get_zero(), 2f, 0f);
                     }
                 }
             }
         }
     }
 }
    private void InitEquipmentSlots(JamGarrisonFollower follower)
    {
        AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true);
        for (int i = 0; i < componentsInChildren.Length; i++)
        {
            Object.DestroyImmediate(componentsInChildren[i].get_gameObject());
        }
        bool flag  = false;
        bool flag2 = true;

        for (int j = 0; j < follower.AbilityID.Length; j++)
        {
            GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(follower.AbilityID[j]);
            if ((record.Flags & 1u) != 0u)
            {
                flag = true;
                GameObject gameObject = Object.Instantiate <GameObject>(this.m_equipmentSlotPrefab);
                gameObject.get_transform().SetParent(this.m_equipmentSlotsRootObject.get_transform(), false);
                AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>();
                component.SetAbility(follower.AbilityID[j], true, true, this);
            }
        }
        bool            flag3   = (follower.Flags & 8) != 0;
        GarrFollowerRec record2 = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);

        if (flag3 || follower.FollowerLevel < MissionDetailView.GarrisonFollower_GetMaxFollowerLevel((int)record2.GarrFollowerTypeID))
        {
            flag2 = false;
        }
        this.m_equipmentSlotsText.get_gameObject().SetActive(flag || flag2);
    }
    private void SetCharShipmentTroop(MobileClientShipmentType shipmentType, CharShipmentRec charShipmentRec)
    {
        this.m_isTroop      = true;
        this.m_shipmentType = shipmentType;
        this.m_troopSpecificArea.SetActive(true);
        this.m_itemSpecificArea.SetActive(false);
        this.m_troopName.get_gameObject().SetActive(true);
        this.m_itemName.get_gameObject().SetActive(false);
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord((int)charShipmentRec.GarrFollowerID);

        if (record == null)
        {
            Debug.LogError("Invalid Follower ID: " + charShipmentRec.GarrFollowerID);
            this.m_troopName.set_text("Invalid Follower ID: " + charShipmentRec.GarrFollowerID);
            return;
        }
        this.m_followerRec = record;
        int         num     = (GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID;
        CreatureRec record2 = StaticDB.creatureDB.GetRecord(num);

        if (record2 == null)
        {
            Debug.LogError("Invalid Creature ID: " + num);
            this.m_troopName.set_text("Invalid Creature ID: " + num);
            return;
        }
        string text   = "Assets/BundleAssets/PortraitIcons/cid_" + record2.ID.ToString("D8") + ".png";
        Sprite sprite = AssetBundleManager.portraitIcons.LoadAsset <Sprite>(text);

        if (sprite != null)
        {
            this.m_troopSnapshotImage.set_sprite(sprite);
        }
        for (int i = 0; i < record.Vitality; i++)
        {
            GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopHeartPrefab);
            gameObject.get_transform().SetParent(this.m_troopHeartContainer.get_transform(), false);
        }
        this.m_troopName.set_text(record2.Name);
        StaticDB.garrFollowerXAbilityDB.EnumRecordsByParentID((int)charShipmentRec.GarrFollowerID, delegate(GarrFollowerXAbilityRec xAbilityRec)
        {
            if (xAbilityRec.FactionIndex == (int)GarrisonStatus.Faction())
            {
                GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab);
                gameObject2.get_transform().SetParent(this.m_traitsAndAbilitiesRootObject.get_transform(), false);
                AbilityDisplay component = gameObject2.GetComponent <AbilityDisplay>();
                component.SetAbility(xAbilityRec.GarrAbilityID, true, true, null);
            }
            return(true);
        });
        this.UpdateTroopSlots();
        this.m_troopResourceCostText.set_text(string.Empty + shipmentType.CurrencyCost);
        Sprite sprite2 = GeneralHelpers.LoadCurrencyIcon(shipmentType.CurrencyTypeID);

        if (sprite2 != null)
        {
            this.m_troopResourceIcon.set_sprite(sprite2);
        }
        this.UpdateRecruitButtonState();
    }
 public void UpdateMechanicPreview(bool missionInProgress, JamGarrisonMobileMission mission)
 {
     if (this.m_previewMechanicsGroup != null)
     {
         AbilityDisplay[] componentsInChildren = this.m_previewMechanicsGroup.GetComponentsInChildren <AbilityDisplay>(true);
         for (int i = 0; i < componentsInChildren.Length; i++)
         {
             if (componentsInChildren[i] != null)
             {
                 Object.DestroyImmediate(componentsInChildren[i].get_gameObject());
             }
         }
     }
     if (!missionInProgress)
     {
         for (int j = 0; j < mission.Encounter.Length; j++)
         {
             int             id     = (mission.Encounter[j].MechanicID.Length <= 0) ? 0 : mission.Encounter[j].MechanicID[0];
             GarrMechanicRec record = StaticDB.garrMechanicDB.GetRecord(id);
             if (record != null && record.GarrAbilityID != 0)
             {
                 GameObject gameObject = Object.Instantiate <GameObject>(this.m_previewMechanicEffectPrefab);
                 gameObject.get_transform().SetParent(this.m_previewMechanicsGroup.get_transform(), false);
                 AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>();
                 component.SetAbility(record.GarrAbilityID, false, false, null);
                 FollowerCanCounterMechanic canCounterStatus = GeneralHelpers.HasFollowerWhoCanCounter((int)record.GarrMechanicTypeID);
                 component.SetCanCounterStatus(canCounterStatus);
             }
         }
     }
 }
Ejemplo n.º 7
0
    public void UpdateUsefulAbilitiesDisplay(int currentGarrMissionID)
    {
        AbilityDisplay[] componentsInChildren = this.usefulAbilitiesGroup.GetComponentsInChildren <AbilityDisplay>(true);
        for (int i = 0; i < componentsInChildren.Length; i++)
        {
            Object.DestroyImmediate(componentsInChildren[i].get_gameObject());
        }
        List <int> list = new List <int>();
        JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary.get_Item(currentGarrMissionID);

        for (int j = 0; j < jamGarrisonMobileMission.Encounter.Length; j++)
        {
            int             num    = (jamGarrisonMobileMission.Encounter[j].MechanicID.Length <= 0) ? 0 : jamGarrisonMobileMission.Encounter[j].MechanicID[0];
            GarrMechanicRec record = StaticDB.garrMechanicDB.GetRecord(num);
            if (record == null)
            {
                Debug.LogWarning(string.Concat(new object[]
                {
                    "INVALID garrMechanic ID ",
                    num,
                    " in mission ",
                    jamGarrisonMobileMission.MissionRecID
                }));
            }
            else
            {
                int abilityToCounterMechanicType = MissionMechanic.GetAbilityToCounterMechanicType((int)record.GarrMechanicTypeID);
                if (!list.Contains(abilityToCounterMechanicType))
                {
                    list.Add(abilityToCounterMechanicType);
                }
            }
        }
        List <int>          usefulBuffAbilitiesForFollower = MissionMechanic.GetUsefulBuffAbilitiesForFollower(this.m_followerID);
        List <int>          list2 = Enumerable.ToList <int>(Enumerable.Union <int>(list, usefulBuffAbilitiesForFollower));
        JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary.get_Item(this.m_followerID);

        int[] abilityID = jamGarrisonFollower.AbilityID;
        for (int k = 0; k < abilityID.Length; k++)
        {
            int num2 = abilityID[k];
            using (List <int> .Enumerator enumerator = list2.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    int current = enumerator.get_Current();
                    if (num2 == current)
                    {
                        GameObject gameObject = Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab);
                        gameObject.get_transform().SetParent(this.usefulAbilitiesGroup.get_transform(), false);
                        AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>();
                        component.SetAbility(num2, true, false, null);
                        component.m_abilityNameText.get_gameObject().SetActive(false);
                    }
                }
            }
        }
    }
Ejemplo n.º 8
0
    public void UpdateUsefulAbilitiesDisplay(int currentGarrMissionID)
    {
        if (!PersistentFollowerData.followerDictionary.ContainsKey(this.m_followerID))
        {
            return;
        }
        AbilityDisplay[] componentsInChildren = this.usefulAbilitiesGroup.GetComponentsInChildren <AbilityDisplay>(true);
        for (int i = 0; i < componentsInChildren.Length; i++)
        {
            Object.DestroyImmediate(componentsInChildren[i].gameObject);
        }
        List <int> list = new List <int>();
        JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary[currentGarrMissionID];

        for (int j = 0; j < jamGarrisonMobileMission.Encounter.Length; j++)
        {
            int             num    = (jamGarrisonMobileMission.Encounter[j].MechanicID.Length <= 0) ? 0 : jamGarrisonMobileMission.Encounter[j].MechanicID[0];
            GarrMechanicRec record = StaticDB.garrMechanicDB.GetRecord(num);
            if (record == null)
            {
                Debug.LogWarning(string.Concat(new object[]
                {
                    "INVALID garrMechanic ID ",
                    num,
                    " in mission ",
                    jamGarrisonMobileMission.MissionRecID
                }));
            }
            else
            {
                int abilityToCounterMechanicType = MissionMechanic.GetAbilityToCounterMechanicType((int)record.GarrMechanicTypeID);
                if (!list.Contains(abilityToCounterMechanicType))
                {
                    list.Add(abilityToCounterMechanicType);
                }
            }
        }
        List <int>          usefulBuffAbilitiesForFollower = MissionMechanic.GetUsefulBuffAbilitiesForFollower(this.m_followerID);
        List <int>          list2 = list.Union(usefulBuffAbilitiesForFollower).ToList <int>();
        JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary[this.m_followerID];

        foreach (int num2 in jamGarrisonFollower.AbilityID)
        {
            foreach (int num3 in list2)
            {
                if (num2 == num3)
                {
                    GameObject gameObject = Object.Instantiate <GameObject>(this.m_abilityDisplayPrefab);
                    gameObject.transform.SetParent(this.usefulAbilitiesGroup.transform, false);
                    AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>();
                    component.SetAbility(num2, true, false, null);
                    component.m_abilityNameText.gameObject.SetActive(false);
                }
            }
        }
    }
Ejemplo n.º 9
0
    public void ShowAbility(AbilityDisplay _display, bool _bool)
    {
        _display.GetComponent <Image>().enabled = _bool;
        var _texte = _display.GetComponentsInChildren <Text>();

        foreach (Text _text in _texte)
        {
            _text.enabled = _bool;
        }
    }
Ejemplo n.º 10
0
 private void ChangeDamageType(DamageType dt)
 {
     for (int i = 0; i < abilListRoot.childCount; i++)
     {
         AbilityDisplay ad = abilListRoot.GetChild(i).GetComponent <AbilityDisplay> ();
         if (ad != null)
         {
             ad.ChangeCDColor(Bullet.DamageTypeToColor(dt));
         }
     }
 }
Ejemplo n.º 11
0
    public void SetCharShipment(MobileClientShipmentType shipmentType, bool isSealOfFateHack = false, CharShipmentRec sealOfFateHackCharShipmentRec = null)
    {
        if (isSealOfFateHack)
        {
            this.m_shipmentCost = 0;
        }
        else
        {
            this.m_shipmentCost = shipmentType.CurrencyCost;
        }
        Transform[] componentsInChildren = this.m_troopHeartContainer.GetComponentsInChildren <Transform>(true);
        Transform[] array = componentsInChildren;
        for (int i = 0; i < array.Length; i++)
        {
            Transform transform = array[i];
            if (transform != this.m_troopHeartContainer.get_transform())
            {
                Object.DestroyImmediate(transform.get_gameObject());
            }
        }
        AbilityDisplay[] componentsInChildren2 = this.m_traitsAndAbilitiesRootObject.GetComponentsInChildren <AbilityDisplay>(true);
        AbilityDisplay[] array2 = componentsInChildren2;
        for (int j = 0; j < array2.Length; j++)
        {
            AbilityDisplay abilityDisplay = array2[j];
            Object.DestroyImmediate(abilityDisplay.get_gameObject());
        }
        TroopSlot[] componentsInChildren3 = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true);
        TroopSlot[] array3 = componentsInChildren3;
        for (int k = 0; k < array3.Length; k++)
        {
            TroopSlot troopSlot = array3[k];
            Object.DestroyImmediate(troopSlot.get_gameObject());
        }
        CharShipmentRec charShipmentRec = (!isSealOfFateHack) ? StaticDB.charShipmentDB.GetRecord(shipmentType.CharShipmentID) : sealOfFateHackCharShipmentRec;

        if (charShipmentRec == null)
        {
            Debug.LogError("Invalid Shipment ID: " + shipmentType.CharShipmentID);
            this.m_troopName.set_text("Invalid Shipment ID: " + shipmentType.CharShipmentID);
            return;
        }
        if (charShipmentRec.GarrFollowerID > 0u)
        {
            this.SetCharShipmentTroop(shipmentType, charShipmentRec);
        }
        else if (charShipmentRec.DummyItemID > 0)
        {
            this.SetCharShipmentItem(shipmentType, (!isSealOfFateHack) ? charShipmentRec : sealOfFateHackCharShipmentRec, isSealOfFateHack);
        }
    }
Ejemplo n.º 12
0
    public void SetEncounter(int garrEncounterID, int garrMechanicID)
    {
        this.m_garrEncounterID = garrEncounterID;
        this.m_garrMechanicID  = garrMechanicID;
        GarrEncounterRec record = StaticDB.garrEncounterDB.GetRecord(garrEncounterID);

        if (record == null)
        {
            this.nameText.text = string.Empty + garrEncounterID;
            return;
        }
        this.nameText.text = record.Name;
        Sprite sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.PortraitIcons, record.PortraitFileDataID);

        if (sprite != null)
        {
            this.portraitImage.sprite = sprite;
        }
        else
        {
            this.missingIconText.gameObject.SetActive(true);
            this.missingIconText.text = string.Empty + record.PortraitFileDataID;
        }
        if (this.m_missionMechanicPrefab != null)
        {
            GameObject gameObject = Object.Instantiate <GameObject>(this.m_missionMechanicPrefab);
            gameObject.transform.SetParent(this.m_mechanicRoot.transform, false);
            MissionMechanic component = gameObject.GetComponent <MissionMechanic>();
            component.SetMechanicTypeWithMechanicID(garrMechanicID, false);
        }
        if (this.m_mechanicEffectDisplayPrefab != null)
        {
            GarrMechanicRec record2 = StaticDB.garrMechanicDB.GetRecord(garrMechanicID);
            if (record2 == null)
            {
                this.m_mechanicRoot.SetActive(false);
            }
            if (record2 != null && record2.GarrAbilityID != 0)
            {
                GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_mechanicEffectDisplayPrefab);
                gameObject2.transform.SetParent(this.m_mechanicEffectRoot.transform, false);
                AbilityDisplay component2 = gameObject2.GetComponent <AbilityDisplay>();
                component2.SetAbility(record2.GarrAbilityID, false, false, null);
            }
        }
    }
Ejemplo n.º 13
0
 private void InitEquipmentSlots(JamGarrisonFollower follower)
 {
     AbilityDisplay[] componentsInChildren = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true);
     for (int i = 0; i < componentsInChildren.Length; i++)
     {
         Object.DestroyImmediate(componentsInChildren[i].get_gameObject());
     }
     this.m_equipmentSlotsHeader.get_gameObject().SetActive(false);
     for (int j = 0; j < follower.AbilityID.Length; j++)
     {
         GarrAbilityRec record = StaticDB.garrAbilityDB.GetRecord(follower.AbilityID[j]);
         if ((record.Flags & 1u) != 0u)
         {
             this.m_equipmentSlotsHeader.get_gameObject().SetActive(true);
             GameObject gameObject = Object.Instantiate <GameObject>(this.m_equipmentSlotPrefab);
             gameObject.get_transform().SetParent(this.m_equipmentSlotsRootObject.get_transform(), false);
             AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>();
             component.SetAbility(follower.AbilityID[j], true, true, this);
         }
     }
 }
Ejemplo n.º 14
0
    // Change the Entity from which the HUD will pull values
    public void SetSubject(Entity subject)
    {
        //clear old subject data
        if (subject != null)
        {
            //clear old misc
            subject.damageTypeChanged -= ChangeDamageType;

            //clear old ability list
            subject.abilityAdded   -= AddAbility;
            subject.abilityRemoved -= RemoveAbility;
            subject.abilitySwapped -= SwapAbilities;

            for (int i = 0; i < abilListRoot.childCount; i++)
            {
                Destroy(abilListRoot.GetChild(i).gameObject);
            }

            //clear old status list
            for (int i = 0; i < statListRoot.childCount; i++)
            {
                Destroy(statListRoot.GetChild(i).gameObject);
            }

            subject.statusAdded   -= AddStatus;
            subject.statusRemoved -= RemoveStatus;
        }

        //set up new subject
        this.subject = subject;
        if (subject == null)
        {
            return;
        }

        //setup ability list
        for (int i = 0; i < subject.AbilityCap; i++)
        {
            if (subject.GetAbility(i) != null)
            {
                AbilityDisplay.Create(abilListRoot, subject.GetAbility(i));
            }
        }

        subject.abilityAdded   += AddAbility;
        subject.abilityRemoved += RemoveAbility;
        subject.abilitySwapped += SwapAbilities;

        //setup status list
        foreach (Status s in subject.GetStatusList())
        {
            AddStatus(s);
        }

        subject.statusAdded   += AddStatus;
        subject.statusRemoved += RemoveStatus;

        //misc
        subject.damageTypeChanged += ChangeDamageType;
        ChangeDamageType(subject.DefaultDT);

        //TODO other clearing and resetting of elements?
    }
Ejemplo n.º 15
0
    public void ShowMissionResults(int garrMissionID, int missionResultType, bool awardOvermax)
    {
        this.m_missionResultsDisplayCanvasGroupAutoFadeOut.Reset();
        this.m_currentResultType = (MissionResultType)missionResultType;
        this.m_followerExperienceDisplayArea.SetActive(false);
        this.m_attemptedAutoComplete = false;
        this.m_garrMissionID         = garrMissionID;
        this.m_darknessBG.SetActive(true);
        this.m_popupView.SetActive(true);
        this.m_bonusLootDisplay.SetActive(false);
        if (this.missionFollowerSlotGroup != null)
        {
            MissionFollowerSlot[] componentsInChildren = this.missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
            for (int i = 0; i < componentsInChildren.Length; i++)
            {
                if (componentsInChildren[i] != null && componentsInChildren[i] != this.missionFollowerSlotGroup.get_transform())
                {
                    Object.DestroyImmediate(componentsInChildren[i].get_gameObject());
                }
            }
        }
        MissionEncounter[] componentsInChildren2 = this.enemyPortraitsGroup.GetComponentsInChildren <MissionEncounter>(true);
        for (int j = 0; j < componentsInChildren2.Length; j++)
        {
            if (componentsInChildren2[j] != null && componentsInChildren2[j] != this.enemyPortraitsGroup.get_transform())
            {
                Object.DestroyImmediate(componentsInChildren2[j].get_gameObject());
            }
        }
        if (this.treasureChestHorde != null && this.treasureChestAlliance != null)
        {
            if (GarrisonStatus.Faction() == PVP_FACTION.HORDE)
            {
                this.treasureChestHorde.SetActive(true);
                this.treasureChestAlliance.SetActive(false);
            }
            else
            {
                this.treasureChestHorde.SetActive(false);
                this.treasureChestAlliance.SetActive(true);
            }
        }
        JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary.get_Item(garrMissionID);

        this.m_missionStartedTime       = jamGarrisonMobileMission.StartTime;
        this.m_missionDurationInSeconds = jamGarrisonMobileMission.MissionDuration;
        for (int k = 0; k < jamGarrisonMobileMission.Encounter.Length; k++)
        {
            GameObject gameObject = Object.Instantiate <GameObject>(this.missionEncounterPrefab);
            gameObject.get_transform().SetParent(this.enemyPortraitsGroup.get_transform(), false);
            MissionEncounter component = gameObject.GetComponent <MissionEncounter>();
            int garrMechanicID         = (jamGarrisonMobileMission.Encounter[k].MechanicID.Length <= 0) ? 0 : jamGarrisonMobileMission.Encounter[k].MechanicID[0];
            component.SetEncounter(jamGarrisonMobileMission.Encounter[k].EncounterID, garrMechanicID);
        }
        GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(garrMissionID);

        this.missionNameText.set_text(record.Name);
        this.missionLocationText.set_text(record.Location);
        this.missioniLevelText.set_text(StaticDB.GetString("ITEM_LEVEL_ABBREVIATION", null) + " " + record.TargetItemLevel);
        GarrMissionTypeRec record2 = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID);

        this.missionTypeImage.set_overrideSprite(TextureAtlas.instance.GetAtlasSprite((int)record2.UiTextureAtlasMemberID));
        if (this.missionFollowerSlotGroup != null)
        {
            int num = 0;
            while ((long)num < (long)((ulong)record.MaxFollowers))
            {
                GameObject gameObject2 = Object.Instantiate <GameObject>(this.missionFollowerSlotPrefab);
                gameObject2.get_transform().SetParent(this.missionFollowerSlotGroup.get_transform(), false);
                MissionFollowerSlot component2 = gameObject2.GetComponent <MissionFollowerSlot>();
                component2.m_enemyPortraitsGroup = this.enemyPortraitsGroup;
                num++;
            }
        }
        if (record.UiTextureKitID > 0u)
        {
            UiTextureKitRec record3 = StaticDB.uiTextureKitDB.GetRecord((int)record.UiTextureKitID);
            this.m_scrollingEnvironment_Back.set_enabled(false);
            this.m_scrollingEnvironment_Mid.set_enabled(false);
            this.m_scrollingEnvironment_Fore.set_enabled(false);
            int uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Back");
            if (uITextureAtlasMemberID > 0)
            {
                Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite(uITextureAtlasMemberID);
                if (atlasSprite != null)
                {
                    this.m_scrollingEnvironment_Back.set_enabled(true);
                    this.m_scrollingEnvironment_Back.set_sprite(atlasSprite);
                }
            }
            int uITextureAtlasMemberID2 = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Mid");
            if (uITextureAtlasMemberID2 > 0)
            {
                Sprite atlasSprite2 = TextureAtlas.instance.GetAtlasSprite(uITextureAtlasMemberID2);
                if (atlasSprite2 != null)
                {
                    this.m_scrollingEnvironment_Mid.set_enabled(true);
                    this.m_scrollingEnvironment_Mid.set_sprite(atlasSprite2);
                }
            }
            int uITextureAtlasMemberID3 = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Fore");
            if (uITextureAtlasMemberID3 > 0)
            {
                Sprite atlasSprite3 = TextureAtlas.instance.GetAtlasSprite(uITextureAtlasMemberID3);
                if (atlasSprite3 != null)
                {
                    this.m_scrollingEnvironment_Fore.set_enabled(true);
                    this.m_scrollingEnvironment_Fore.set_sprite(atlasSprite3);
                }
            }
        }
        else
        {
            Debug.LogWarning(string.Concat(new object[]
            {
                "DATA ERROR: Mission UITextureKit Not Set for mission ID:",
                record.ID,
                " - ",
                record.Name
            }));
            Debug.LogWarning("This means the scrolling background images will show the wrong location");
        }
        if (this.m_lootGroupObj == null || this.m_missionRewardDisplayPrefab == null)
        {
            return;
        }
        MissionRewardDisplay[] componentsInChildren3 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
        for (int l = 0; l < componentsInChildren3.Length; l++)
        {
            if (componentsInChildren3[l] != null)
            {
                Object.DestroyImmediate(componentsInChildren3[l].get_gameObject());
            }
        }
        MissionFollowerSlot[] componentsInChildren4 = this.missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
        int num2 = 0;

        using (Dictionary <int, JamGarrisonFollower> .ValueCollection.Enumerator enumerator = PersistentFollowerData.followerDictionary.get_Values().GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                JamGarrisonFollower current = enumerator.get_Current();
                if (current.CurrentMissionID == garrMissionID)
                {
                    componentsInChildren4[num2++].SetFollower(current.GarrFollowerID);
                    if (missionResultType == 1)
                    {
                        PersistentFollowerData.CachePreMissionFollower(current);
                    }
                }
            }
        }
        this.UpdateMissionStatus(garrMissionID);
        MissionFollowerSlot[] array = componentsInChildren4;
        for (int m = 0; m < array.Length; m++)
        {
            MissionFollowerSlot missionFollowerSlot = array[m];
            missionFollowerSlot.InitHeartPanel();
        }
        MissionRewardDisplay.InitMissionRewards(this.m_missionRewardDisplayPrefab.get_gameObject(), this.m_lootGroupObj.get_transform(), jamGarrisonMobileMission.Reward);
        if (record.OvermaxRewardPackID > 0 && jamGarrisonMobileMission.OvermaxReward.Length > 0)
        {
            this.m_bonusLootDisplay.SetActive(true);
            JamGarrisonMissionReward jamGarrisonMissionReward = jamGarrisonMobileMission.OvermaxReward[0];
            if (jamGarrisonMissionReward.ItemID > 0)
            {
                this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.item, jamGarrisonMissionReward.ItemID, (int)jamGarrisonMissionReward.ItemQuantity, 0, jamGarrisonMissionReward.ItemFileDataID);
            }
            else if (jamGarrisonMissionReward.FollowerXP > 0u)
            {
                this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.followerXP, 0, (int)jamGarrisonMissionReward.FollowerXP, 0, 0);
            }
            else if (jamGarrisonMissionReward.CurrencyQuantity > 0u)
            {
                if (jamGarrisonMissionReward.CurrencyType == 0)
                {
                    this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.gold, 0, (int)(jamGarrisonMissionReward.CurrencyQuantity / 10000u), 0, 0);
                }
                else
                {
                    CurrencyTypesRec record4 = StaticDB.currencyTypesDB.GetRecord(jamGarrisonMissionReward.CurrencyType);
                    int rewardQuantity       = (int)((ulong)jamGarrisonMissionReward.CurrencyQuantity / (ulong)(((record4.Flags & 8u) == 0u) ? 1L : 100L));
                    this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.currency, jamGarrisonMissionReward.CurrencyType, rewardQuantity, 0, 0);
                }
            }
        }
        this.m_timeUntilFadeOutMissionDetailsDisplay   = this.m_missionDetailsFadeOutDelay;
        this.m_timeUntilShowFollowerExperienceDisplays = this.m_experienceDisplayInitialEntranceDelay;
        if (missionResultType == 2)
        {
            this.InitFollowerExperienceDisplays();
            Main.instance.m_UISound.Play_MissionSuccess();
            this.m_missionInProgressMessage.SetActive(false);
            this.m_missionSuccessMessage.SetActive(true);
            this.m_missionFailMessage.SetActive(false);
            if (this.m_fancyEntrance != null)
            {
                Object.DestroyImmediate(this.m_fancyEntrance);
                iTween.Stop(this.m_missionSuccessMessage);
                this.m_missionSuccessMessage.get_transform().set_localScale(Vector3.get_one());
                iTween.Stop(this.m_missionFailMessage);
                this.m_missionFailMessage.get_transform().set_localScale(Vector3.get_one());
            }
            this.m_missionSuccessMessage.SetActive(false);
            this.m_fancyEntrance = this.m_missionSuccessMessage.AddComponent <FancyEntrance>();
            this.m_fancyEntrance.m_fadeInCanvasGroup   = this.m_missionSuccessMessage.GetComponent <CanvasGroup>();
            this.m_fancyEntrance.m_fadeInTime          = this.m_messageFadeInTime;
            this.m_fancyEntrance.m_punchScale          = this.m_messagePunchScale;
            this.m_fancyEntrance.m_punchScaleAmount    = this.m_messagePunchScaleAmount;
            this.m_fancyEntrance.m_punchScaleDuration  = this.m_messagePunchScaleDuration;
            this.m_fancyEntrance.m_timeToDelayEntrance = this.m_messageTimeToDelayEntrance;
            this.m_missionSuccessMessage.SetActive(true);
            MissionRewardDisplay[] componentsInChildren5 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
            for (int n = 0; n < componentsInChildren5.Length; n++)
            {
                componentsInChildren5[n].ShowResultSuccess(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)n);
            }
            if (awardOvermax)
            {
                this.m_bonusMissionRewardDisplay.ShowResultSuccess(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)componentsInChildren5.Length);
            }
            else
            {
                this.m_bonusMissionRewardDisplay.ShowResultFail(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)componentsInChildren5.Length);
            }
        }
        if (missionResultType == 3)
        {
            this.InitFollowerExperienceDisplays();
            Main.instance.m_UISound.Play_MissionFailure();
            this.m_missionInProgressMessage.SetActive(false);
            this.m_missionSuccessMessage.SetActive(false);
            this.m_missionFailMessage.SetActive(true);
            if (this.m_fancyEntrance != null)
            {
                Object.DestroyImmediate(this.m_fancyEntrance);
                iTween.Stop(this.m_missionSuccessMessage);
                this.m_missionSuccessMessage.get_transform().set_localScale(Vector3.get_one());
                iTween.Stop(this.m_missionFailMessage);
                this.m_missionFailMessage.get_transform().set_localScale(Vector3.get_one());
            }
            this.m_missionFailMessage.SetActive(false);
            this.m_fancyEntrance = this.m_missionFailMessage.AddComponent <FancyEntrance>();
            this.m_fancyEntrance.m_fadeInCanvasGroup   = this.m_missionFailMessage.GetComponent <CanvasGroup>();
            this.m_fancyEntrance.m_fadeInTime          = this.m_messageFadeInTime;
            this.m_fancyEntrance.m_punchScale          = this.m_messagePunchScale;
            this.m_fancyEntrance.m_punchScaleAmount    = this.m_messagePunchScaleAmount;
            this.m_fancyEntrance.m_punchScaleDuration  = this.m_messagePunchScaleDuration;
            this.m_fancyEntrance.m_timeToDelayEntrance = this.m_messageTimeToDelayEntrance;
            this.m_missionFailMessage.SetActive(true);
            MissionRewardDisplay[] componentsInChildren6 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
            for (int num3 = 0; num3 < componentsInChildren6.Length; num3++)
            {
                componentsInChildren6[num3].ShowResultFail(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)num3);
            }
            this.m_bonusMissionRewardDisplay.ShowResultFail(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)componentsInChildren6.Length);
        }
        if (missionResultType == 0)
        {
            this.m_missionInProgressMessage.SetActive(true);
            this.m_missionSuccessMessage.SetActive(false);
            this.m_missionFailMessage.SetActive(false);
            this.m_bonusMissionRewardDisplay.ClearResults();
        }
        if (missionResultType == 1)
        {
            this.m_missionInProgressMessage.SetActive(false);
            this.m_missionSuccessMessage.SetActive(false);
            this.m_missionFailMessage.SetActive(false);
            FollowerExperienceDisplay[] componentsInChildren7 = this.m_followerExperienceDisplayArea.GetComponentsInChildren <FollowerExperienceDisplay>(true);
            FollowerExperienceDisplay[] array2 = componentsInChildren7;
            for (int num4 = 0; num4 < array2.Length; num4++)
            {
                FollowerExperienceDisplay followerExperienceDisplay = array2[num4];
                Object.DestroyImmediate(followerExperienceDisplay.get_gameObject());
            }
        }
        if (this.m_partyBuffGroup != null)
        {
            AbilityDisplay[] componentsInChildren8 = this.m_partyBuffGroup.GetComponentsInChildren <AbilityDisplay>(true);
            AbilityDisplay[] array3 = componentsInChildren8;
            for (int num5 = 0; num5 < array3.Length; num5++)
            {
                AbilityDisplay abilityDisplay = array3[num5];
                Object.DestroyImmediate(abilityDisplay.get_gameObject());
            }
        }
        int num6 = 0;

        using (Dictionary <int, JamGarrisonFollower> .ValueCollection.Enumerator enumerator2 = PersistentFollowerData.followerDictionary.get_Values().GetEnumerator())
        {
            while (enumerator2.MoveNext())
            {
                JamGarrisonFollower current2 = enumerator2.get_Current();
                if (current2.CurrentMissionID == garrMissionID)
                {
                    int[] buffsForCurrentMission = GeneralHelpers.GetBuffsForCurrentMission(current2.GarrFollowerID, garrMissionID, this.missionFollowerSlotGroup);
                    num6 += buffsForCurrentMission.Length;
                    int[] array4 = buffsForCurrentMission;
                    for (int num7 = 0; num7 < array4.Length; num7++)
                    {
                        int        garrAbilityID = array4[num7];
                        GameObject gameObject3   = Object.Instantiate <GameObject>(this.m_mechanicEffectDisplayPrefab);
                        gameObject3.get_transform().SetParent(this.m_partyBuffGroup.get_transform(), false);
                        AbilityDisplay component3 = gameObject3.GetComponent <AbilityDisplay>();
                        component3.SetAbility(garrAbilityID, false, false, null);
                    }
                }
            }
        }
        this.m_partyBuffGroup.SetActive(num6 > 0);
    }
    public void UpdateMechanicPreview(bool missionInProgress, JamGarrisonMobileMission mission)
    {
        int num = 0;

        if (!missionInProgress)
        {
            for (int i = 0; i < mission.Encounter.Length; i++)
            {
                int             id     = (mission.Encounter[i].MechanicID.Length <= 0) ? 0 : mission.Encounter[i].MechanicID[0];
                GarrMechanicRec record = StaticDB.garrMechanicDB.GetRecord(id);
                if (record != null && record.GarrAbilityID != 0)
                {
                    this.m_previewAbilityID[num]        = record.GarrAbilityID;
                    this.m_previewCanCounterStatus[num] = GeneralHelpers.HasFollowerWhoCanCounter((int)record.GarrMechanicTypeID);
                    num++;
                }
            }
            bool             flag = true;
            AbilityDisplay[] componentsInChildren = this.m_previewMechanicsGroup.GetComponentsInChildren <AbilityDisplay>(true);
            if (num != componentsInChildren.Length)
            {
                flag = false;
            }
            if (flag)
            {
                for (int j = 0; j < componentsInChildren.Length; j++)
                {
                    if (componentsInChildren[j] == null)
                    {
                        flag = false;
                        break;
                    }
                    if (componentsInChildren[j].GetAbilityID() != this.m_previewAbilityID[j])
                    {
                        flag = false;
                        break;
                    }
                    if (componentsInChildren[j].GetCanCounterStatus() != this.m_previewCanCounterStatus[j])
                    {
                        flag = false;
                        break;
                    }
                }
            }
            if (!flag)
            {
                for (int k = 0; k < componentsInChildren.Length; k++)
                {
                    if (componentsInChildren[k] != null)
                    {
                        Object.DestroyImmediate(componentsInChildren[k].get_gameObject());
                    }
                }
                for (int l = 0; l < num; l++)
                {
                    GameObject gameObject = Object.Instantiate <GameObject>(this.m_previewMechanicEffectPrefab);
                    gameObject.get_transform().SetParent(this.m_previewMechanicsGroup.get_transform(), false);
                    AbilityDisplay component = gameObject.GetComponent <AbilityDisplay>();
                    component.SetAbility(this.m_previewAbilityID[l], false, false, null);
                    component.SetCanCounterStatus(this.m_previewCanCounterStatus[l]);
                }
            }
        }
    }
Ejemplo n.º 17
0
    public void ShowMissionResults(int garrMissionID, int missionResultType, bool awardOvermax)
    {
        GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(garrMissionID);

        if (record == null)
        {
            return;
        }
        this.m_missionResultsDisplayCanvasGroupAutoFadeOut.Reset();
        this.m_currentResultType = (MissionResultType)missionResultType;
        this.m_followerExperienceDisplayArea.SetActive(false);
        this.m_attemptedAutoComplete = false;
        this.m_garrMissionID         = garrMissionID;
        this.m_darknessBG.SetActive(true);
        this.m_popupView.SetActive(true);
        this.m_bonusLootDisplay.SetActive(false);
        if (this.missionFollowerSlotGroup != null)
        {
            MissionFollowerSlot[] componentsInChildren = this.missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
            for (int i = 0; i < componentsInChildren.Length; i++)
            {
                if (componentsInChildren[i] != null && componentsInChildren[i] != this.missionFollowerSlotGroup.transform)
                {
                    Object.DestroyImmediate(componentsInChildren[i].gameObject);
                }
            }
        }
        MissionEncounter[] componentsInChildren2 = this.enemyPortraitsGroup.GetComponentsInChildren <MissionEncounter>(true);
        for (int j = 0; j < componentsInChildren2.Length; j++)
        {
            if (componentsInChildren2[j] != null && componentsInChildren2[j] != this.enemyPortraitsGroup.transform)
            {
                Object.DestroyImmediate(componentsInChildren2[j].gameObject);
            }
        }
        if (this.treasureChestHorde != null && this.treasureChestAlliance != null)
        {
            if (GarrisonStatus.Faction() == PVP_FACTION.HORDE)
            {
                this.treasureChestHorde.SetActive(true);
                this.treasureChestAlliance.SetActive(false);
            }
            else
            {
                this.treasureChestHorde.SetActive(false);
                this.treasureChestAlliance.SetActive(true);
            }
        }
        JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary[garrMissionID];

        this.m_missionStartedTime       = jamGarrisonMobileMission.StartTime;
        this.m_missionDurationInSeconds = jamGarrisonMobileMission.MissionDuration;
        for (int k = 0; k < jamGarrisonMobileMission.Encounter.Length; k++)
        {
            GameObject gameObject = Object.Instantiate <GameObject>(this.missionEncounterPrefab);
            gameObject.transform.SetParent(this.enemyPortraitsGroup.transform, false);
            MissionEncounter component = gameObject.GetComponent <MissionEncounter>();
            int garrMechanicID         = (jamGarrisonMobileMission.Encounter[k].MechanicID.Length <= 0) ? 0 : jamGarrisonMobileMission.Encounter[k].MechanicID[0];
            component.SetEncounter(jamGarrisonMobileMission.Encounter[k].EncounterID, garrMechanicID);
        }
        this.missionNameText.text     = record.Name;
        this.missionLocationText.text = record.Location;
        this.missioniLevelText.text   = StaticDB.GetString("ITEM_LEVEL_ABBREVIATION", null) + " " + record.TargetItemLevel;
        GarrMissionTypeRec record2 = StaticDB.garrMissionTypeDB.GetRecord((int)record.GarrMissionTypeID);

        this.missionTypeImage.overrideSprite = TextureAtlas.instance.GetAtlasSprite((int)record2.UiTextureAtlasMemberID);
        if (this.missionFollowerSlotGroup != null)
        {
            int num = 0;
            while ((long)num < (long)((ulong)record.MaxFollowers))
            {
                GameObject gameObject2 = Object.Instantiate <GameObject>(this.missionFollowerSlotPrefab);
                gameObject2.transform.SetParent(this.missionFollowerSlotGroup.transform, false);
                MissionFollowerSlot component2 = gameObject2.GetComponent <MissionFollowerSlot>();
                component2.m_enemyPortraitsGroup = this.enemyPortraitsGroup;
                num++;
            }
        }
        if (record.UiTextureKitID > 0u)
        {
            UiTextureKitRec record3 = StaticDB.uiTextureKitDB.GetRecord((int)record.UiTextureKitID);
            this.m_scrollingEnvironment_Back.enabled = false;
            this.m_scrollingEnvironment_Mid.enabled  = false;
            this.m_scrollingEnvironment_Fore.enabled = false;
            int uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Back");
            if (uitextureAtlasMemberID > 0)
            {
                Sprite atlasSprite = TextureAtlas.instance.GetAtlasSprite(uitextureAtlasMemberID);
                if (atlasSprite != null)
                {
                    this.m_scrollingEnvironment_Back.enabled = true;
                    this.m_scrollingEnvironment_Back.sprite  = atlasSprite;
                }
            }
            int uitextureAtlasMemberID2 = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Mid");
            if (uitextureAtlasMemberID2 > 0)
            {
                Sprite atlasSprite2 = TextureAtlas.instance.GetAtlasSprite(uitextureAtlasMemberID2);
                if (atlasSprite2 != null)
                {
                    this.m_scrollingEnvironment_Mid.enabled = true;
                    this.m_scrollingEnvironment_Mid.sprite  = atlasSprite2;
                }
            }
            int uitextureAtlasMemberID3 = TextureAtlas.GetUITextureAtlasMemberID("_" + record3.KitPrefix + "-Fore");
            if (uitextureAtlasMemberID3 > 0)
            {
                Sprite atlasSprite3 = TextureAtlas.instance.GetAtlasSprite(uitextureAtlasMemberID3);
                if (atlasSprite3 != null)
                {
                    this.m_scrollingEnvironment_Fore.enabled = true;
                    this.m_scrollingEnvironment_Fore.sprite  = atlasSprite3;
                }
            }
        }
        else
        {
            Debug.LogWarning(string.Concat(new object[]
            {
                "DATA ERROR: Mission UITextureKit Not Set for mission ID:",
                record.ID,
                " - ",
                record.Name
            }));
            Debug.LogWarning("This means the scrolling background images will show the wrong location");
        }
        if (this.m_lootGroupObj == null || this.m_missionRewardDisplayPrefab == null)
        {
            return;
        }
        MissionRewardDisplay[] componentsInChildren3 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
        for (int l = 0; l < componentsInChildren3.Length; l++)
        {
            if (componentsInChildren3[l] != null)
            {
                Object.DestroyImmediate(componentsInChildren3[l].gameObject);
            }
        }
        if (missionResultType == 1)
        {
            PersistentFollowerData.ClearPreMissionFollowerData();
        }
        List <JamGarrisonFollower> list = new List <JamGarrisonFollower>();

        MissionFollowerSlot[] componentsInChildren4 = this.missionFollowerSlotGroup.GetComponentsInChildren <MissionFollowerSlot>(true);
        int num2 = 0;

        foreach (JamGarrisonFollower jamGarrisonFollower in PersistentFollowerData.followerDictionary.Values)
        {
            if (jamGarrisonFollower.CurrentMissionID == garrMissionID)
            {
                componentsInChildren4[num2++].SetFollower(jamGarrisonFollower.GarrFollowerID);
                if (missionResultType == 1)
                {
                    PersistentFollowerData.CachePreMissionFollower(jamGarrisonFollower);
                }
                list.Add(jamGarrisonFollower);
            }
        }
        this.UpdateMissionStatus(garrMissionID);
        foreach (MissionFollowerSlot missionFollowerSlot in componentsInChildren4)
        {
            missionFollowerSlot.InitHeartPanel();
        }
        MissionRewardDisplay.InitMissionRewards(this.m_missionRewardDisplayPrefab.gameObject, this.m_lootGroupObj.transform, jamGarrisonMobileMission.Reward);
        if (record.OvermaxRewardPackID > 0 && jamGarrisonMobileMission.OvermaxReward.Length > 0)
        {
            this.m_bonusLootDisplay.SetActive(true);
            JamGarrisonMissionReward jamGarrisonMissionReward = jamGarrisonMobileMission.OvermaxReward[0];
            if (jamGarrisonMissionReward.ItemID > 0)
            {
                this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.item, jamGarrisonMissionReward.ItemID, (int)jamGarrisonMissionReward.ItemQuantity, 0, jamGarrisonMissionReward.ItemFileDataID);
            }
            else if (jamGarrisonMissionReward.FollowerXP > 0u)
            {
                this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.followerXP, 0, (int)jamGarrisonMissionReward.FollowerXP, 0, 0);
            }
            else if (jamGarrisonMissionReward.CurrencyQuantity > 0u)
            {
                if (jamGarrisonMissionReward.CurrencyType == 0)
                {
                    this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.gold, 0, (int)(jamGarrisonMissionReward.CurrencyQuantity / 10000u), 0, 0);
                }
                else
                {
                    CurrencyTypesRec record4 = StaticDB.currencyTypesDB.GetRecord(jamGarrisonMissionReward.CurrencyType);
                    int rewardQuantity       = (int)((ulong)jamGarrisonMissionReward.CurrencyQuantity / (ulong)(((record4.Flags & 8u) == 0u) ? 1L : 100L));
                    this.m_bonusMissionRewardDisplay.InitReward(MissionRewardDisplay.RewardType.currency, jamGarrisonMissionReward.CurrencyType, rewardQuantity, 0, 0);
                }
            }
        }
        this.m_timeUntilFadeOutMissionDetailsDisplay   = this.m_missionDetailsFadeOutDelay;
        this.m_timeUntilShowFollowerExperienceDisplays = this.m_experienceDisplayInitialEntranceDelay;
        if (missionResultType == 2)
        {
            this.InitFollowerExperienceDisplays();
            this.m_missionInProgressMessage.SetActive(false);
            this.m_missionSuccessMessage.SetActive(true);
            this.m_missionFailMessage.SetActive(false);
            if (this.m_fancyEntrance != null)
            {
                Object.DestroyImmediate(this.m_fancyEntrance);
                iTween.Stop(this.m_missionSuccessMessage);
                this.m_missionSuccessMessage.transform.localScale = Vector3.one;
                iTween.Stop(this.m_missionFailMessage);
                this.m_missionFailMessage.transform.localScale = Vector3.one;
            }
            this.m_missionSuccessMessage.SetActive(false);
            this.m_fancyEntrance = this.m_missionSuccessMessage.AddComponent <FancyEntrance>();
            this.m_fancyEntrance.m_fadeInCanvasGroup         = this.m_missionSuccessMessage.GetComponent <CanvasGroup>();
            this.m_fancyEntrance.m_fadeInTime                = this.m_messageFadeInTime;
            this.m_fancyEntrance.m_punchScale                = this.m_messagePunchScale;
            this.m_fancyEntrance.m_punchScaleAmount          = this.m_messagePunchScaleAmount;
            this.m_fancyEntrance.m_punchScaleDuration        = this.m_messagePunchScaleDuration;
            this.m_fancyEntrance.m_timeToDelayEntrance       = this.m_messageTimeToDelayEntrance;
            this.m_fancyEntrance.m_activateOnEnable          = true;
            this.m_fancyEntrance.m_objectToNotifyOnBegin     = base.gameObject;
            this.m_fancyEntrance.m_notifyOnBeginCallbackName = "OnShowSuccessMessage";
            this.m_missionSuccessMessage.SetActive(true);
            MissionRewardDisplay[] componentsInChildren5 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
            for (int n = 0; n < componentsInChildren5.Length; n++)
            {
                componentsInChildren5[n].ShowResultSuccess(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)n);
            }
            if (this.m_bonusLootChance > 0)
            {
                iTween.ValueTo(base.gameObject, iTween.Hash(new object[]
                {
                    "name",
                    "ShakeIt",
                    "from",
                    0.3f,
                    "to",
                    1f,
                    "delay",
                    this.m_bonusLootShakeInitialDelay,
                    "time",
                    this.m_bonusLootShakeDuration,
                    "onupdate",
                    "OnBonusLootShakeUpdate",
                    "oncomplete",
                    "OnBonusLootShakeComplete"
                }));
            }
            if (awardOvermax)
            {
                this.m_bonusMissionRewardDisplay.ShowResultSuccess(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)componentsInChildren5.Length);
            }
            else
            {
                this.m_bonusMissionRewardDisplay.ShowResultFail(this.m_lootEffectInitialDelay + this.m_lootEffectDelay * (float)componentsInChildren5.Length);
            }
        }
        if (missionResultType == 3)
        {
            this.InitFollowerExperienceDisplays();
            this.m_missionInProgressMessage.SetActive(false);
            this.m_missionSuccessMessage.SetActive(false);
            this.m_missionFailMessage.SetActive(true);
            if (this.m_fancyEntrance != null)
            {
                Object.DestroyImmediate(this.m_fancyEntrance);
                iTween.Stop(this.m_missionSuccessMessage);
                this.m_missionSuccessMessage.transform.localScale = Vector3.one;
                iTween.Stop(this.m_missionFailMessage);
                this.m_missionFailMessage.transform.localScale = Vector3.one;
            }
            this.m_missionFailMessage.SetActive(false);
            this.m_fancyEntrance = this.m_missionFailMessage.AddComponent <FancyEntrance>();
            this.m_fancyEntrance.m_fadeInCanvasGroup         = this.m_missionFailMessage.GetComponent <CanvasGroup>();
            this.m_fancyEntrance.m_fadeInTime                = this.m_messageFadeInTime;
            this.m_fancyEntrance.m_punchScale                = this.m_messagePunchScale;
            this.m_fancyEntrance.m_punchScaleAmount          = this.m_messagePunchScaleAmount;
            this.m_fancyEntrance.m_punchScaleDuration        = this.m_messagePunchScaleDuration;
            this.m_fancyEntrance.m_timeToDelayEntrance       = this.m_messageTimeToDelayEntrance;
            this.m_fancyEntrance.m_activateOnEnable          = true;
            this.m_fancyEntrance.m_objectToNotifyOnBegin     = base.gameObject;
            this.m_fancyEntrance.m_notifyOnBeginCallbackName = "OnShowFailMessage";
            this.m_missionFailMessage.SetActive(true);
            MissionRewardDisplay[] componentsInChildren6 = this.m_lootGroupObj.GetComponentsInChildren <MissionRewardDisplay>(true);
            for (int num3 = 0; num3 < componentsInChildren6.Length; num3++)
            {
                componentsInChildren6[num3].ShowResultFail(this.m_lootEffectInitialDelay);
            }
            this.m_bonusMissionRewardDisplay.ShowResultFail(this.m_lootEffectInitialDelay);
        }
        if (missionResultType == 0)
        {
            this.m_missionInProgressMessage.SetActive(true);
            this.m_missionSuccessMessage.SetActive(false);
            this.m_missionFailMessage.SetActive(false);
            this.m_bonusMissionRewardDisplay.ClearResults();
        }
        if (missionResultType == 1)
        {
            this.m_missionInProgressMessage.SetActive(false);
            this.m_missionSuccessMessage.SetActive(false);
            this.m_missionFailMessage.SetActive(false);
            FollowerExperienceDisplay[] componentsInChildren7 = this.m_followerExperienceDisplayArea.GetComponentsInChildren <FollowerExperienceDisplay>(true);
            foreach (FollowerExperienceDisplay followerExperienceDisplay in componentsInChildren7)
            {
                Object.DestroyImmediate(followerExperienceDisplay.gameObject);
            }
        }
        if (this.m_partyBuffGroup == null)
        {
            return;
        }
        AbilityDisplay[] componentsInChildren8 = this.m_partyBuffGroup.GetComponentsInChildren <AbilityDisplay>(true);
        foreach (AbilityDisplay abilityDisplay in componentsInChildren8)
        {
            Object.DestroyImmediate(abilityDisplay.gameObject);
        }
        int adjustedMissionDuration = GeneralHelpers.GetAdjustedMissionDuration(record, list, this.enemyPortraitsGroup);
        int num6 = 0;

        foreach (JamGarrisonFollower jamGarrisonFollower2 in PersistentFollowerData.followerDictionary.Values)
        {
            if (jamGarrisonFollower2.CurrentMissionID == garrMissionID)
            {
                int[] buffsForCurrentMission = GeneralHelpers.GetBuffsForCurrentMission(jamGarrisonFollower2.GarrFollowerID, garrMissionID, this.missionFollowerSlotGroup, adjustedMissionDuration);
                num6 += buffsForCurrentMission.Length;
                foreach (int garrAbilityID in buffsForCurrentMission)
                {
                    GameObject gameObject3 = Object.Instantiate <GameObject>(this.m_mechanicEffectDisplayPrefab);
                    gameObject3.transform.SetParent(this.m_partyBuffGroup.transform, false);
                    AbilityDisplay component3 = gameObject3.GetComponent <AbilityDisplay>();
                    component3.SetAbility(garrAbilityID, false, false, null);
                }
            }
        }
        if (num6 > 8)
        {
            this.m_partyBuffsText.text = string.Empty;
        }
        else
        {
            this.m_partyBuffsText.text = StaticDB.GetString("PARTY_BUFFS", null);
        }
        HorizontalLayoutGroup component4 = this.m_partyBuffGroup.GetComponent <HorizontalLayoutGroup>();

        if (component4 != null)
        {
            if (num6 > 10 && Main.instance.IsNarrowScreen())
            {
                component4.spacing = 3f;
            }
            else
            {
                component4.spacing = 6f;
            }
        }
        this.m_partyBuffGroup.SetActive(num6 > 0);
    }
    public void SetFollower(int followerID)
    {
        this.m_garrFollowerID = followerID;
        if (followerID == 0)
        {
            RectTransform[] componentsInChildren = this.traitsAndAbilitiesRootObject.GetComponentsInChildren <RectTransform>(true);
            for (int i = 0; i < componentsInChildren.Length; i++)
            {
                if (componentsInChildren[i] != null && componentsInChildren[i] != this.traitsAndAbilitiesRootObject.get_transform())
                {
                    Object.DestroyImmediate(componentsInChildren[i].get_gameObject());
                }
            }
            AbilityDisplay[] componentsInChildren2 = this.m_equipmentSlotsRootObject.GetComponentsInChildren <AbilityDisplay>(true);
            for (int j = 0; j < componentsInChildren2.Length; j++)
            {
                Object.DestroyImmediate(componentsInChildren2[j].get_gameObject());
            }
        }
        if (!PersistentFollowerData.followerDictionary.ContainsKey(followerID))
        {
            return;
        }
        GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(followerID);

        if (record == null)
        {
            return;
        }
        CreatureRec record2 = StaticDB.creatureDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.HORDE) ? record.AllianceCreatureID : record.HordeCreatureID);

        if (record2 == null)
        {
            return;
        }
        JamGarrisonFollower jamGarrisonFollower = PersistentFollowerData.followerDictionary.get_Item(followerID);
        string text   = "Assets/BundleAssets/PortraitIcons/cid_" + record2.ID.ToString("D8") + ".png";
        Sprite sprite = AssetBundleManager.portraitIcons.LoadAsset <Sprite>(text);

        if (sprite != null)
        {
            this.followerSnapshot.set_sprite(sprite);
        }
        RectTransform[] componentsInChildren3 = this.traitsAndAbilitiesRootObject.GetComponentsInChildren <RectTransform>(true);
        for (int k = 0; k < componentsInChildren3.Length; k++)
        {
            if (componentsInChildren3[k] != null && componentsInChildren3[k] != this.traitsAndAbilitiesRootObject.get_transform())
            {
                Object.DestroyImmediate(componentsInChildren3[k].get_gameObject());
            }
        }
        bool flag = false;

        for (int l = 0; l < jamGarrisonFollower.AbilityID.Length; l++)
        {
            GarrAbilityRec record3 = StaticDB.garrAbilityDB.GetRecord(jamGarrisonFollower.AbilityID[l]);
            if ((record3.Flags & 512u) != 0u)
            {
                if (!flag)
                {
                    GameObject gameObject = Object.Instantiate <GameObject>(this.specializationHeaderPrefab);
                    gameObject.get_transform().SetParent(this.traitsAndAbilitiesRootObject.get_transform(), false);
                    flag = true;
                    Text component = gameObject.GetComponent <Text>();
                    if (component != null)
                    {
                        component.set_text(StaticDB.GetString("SPECIALIZATION", null));
                    }
                }
                GameObject gameObject2 = Object.Instantiate <GameObject>(this.abilityDisplayPrefab);
                gameObject2.get_transform().SetParent(this.traitsAndAbilitiesRootObject.get_transform(), false);
                AbilityDisplay component2 = gameObject2.GetComponent <AbilityDisplay>();
                component2.SetAbility(record3.ID, false, false, null);
            }
        }
        bool flag2 = false;

        for (int m = 0; m < jamGarrisonFollower.AbilityID.Length; m++)
        {
            GarrAbilityRec record4 = StaticDB.garrAbilityDB.GetRecord(jamGarrisonFollower.AbilityID[m]);
            if ((record4.Flags & 1u) == 0u)
            {
                if ((record4.Flags & 512u) == 0u)
                {
                    if (!flag2)
                    {
                        GameObject gameObject3 = Object.Instantiate <GameObject>(this.abilitiesHeaderPrefab);
                        gameObject3.get_transform().SetParent(this.traitsAndAbilitiesRootObject.get_transform(), false);
                        flag2 = true;
                        Text component3 = gameObject3.GetComponent <Text>();
                        if (component3 != null)
                        {
                            component3.set_text(StaticDB.GetString("ABILITIES", null));
                        }
                    }
                    GameObject gameObject4 = Object.Instantiate <GameObject>(this.abilityDisplayPrefab);
                    gameObject4.get_transform().SetParent(this.traitsAndAbilitiesRootObject.get_transform(), false);
                    AbilityDisplay component4 = gameObject4.GetComponent <AbilityDisplay>();
                    component4.SetAbility(jamGarrisonFollower.AbilityID[m], false, false, null);
                }
            }
        }
        if (jamGarrisonFollower.ZoneSupportSpellID > 0)
        {
            GameObject gameObject5 = Object.Instantiate <GameObject>(this.zoneSupportAbilityHeaderPrefab);
            gameObject5.get_transform().SetParent(this.traitsAndAbilitiesRootObject.get_transform(), false);
            GameObject gameObject6 = Object.Instantiate <GameObject>(this.m_spellDisplayPrefab);
            gameObject6.get_transform().SetParent(this.traitsAndAbilitiesRootObject.get_transform(), false);
            SpellDisplay component5 = gameObject6.GetComponent <SpellDisplay>();
            component5.SetSpell(jamGarrisonFollower.ZoneSupportSpellID);
            Text componentInChildren = gameObject5.GetComponentInChildren <Text>();
            if (componentInChildren != null)
            {
                componentInChildren.set_text(StaticDB.GetString("COMBAT_ALLY", null));
            }
        }
        bool flag3 = (jamGarrisonFollower.Flags & 8) != 0;

        if (flag3)
        {
            GarrStringRec record5 = StaticDB.garrStringDB.GetRecord((GarrisonStatus.Faction() != PVP_FACTION.ALLIANCE) ? record.HordeFlavorGarrStringID : record.AllianceFlavorGarrStringID);
            if (record5 != null)
            {
                Text text2 = Object.Instantiate <Text>(this.m_troopDescriptionPrefab);
                text2.get_transform().SetParent(this.traitsAndAbilitiesRootObject.get_transform(), false);
                text2.set_text(record5.Text);
            }
        }
        this.InitEquipmentSlots(jamGarrisonFollower);
        this.UpdateChampionButtons(jamGarrisonFollower);
    }
Ejemplo n.º 19
0
 private void OnTileMouseEnter(AbilityDisplay point)
 {
     this.MouseOnTile = true;
 }
Ejemplo n.º 20
0
 private void OnTileMouseExit(AbilityDisplay point)
 {
     this.MouseOnTile = false;
 }