예제 #1
0
    public static int GetNumReadyShipments()
    {
        int         num        = 0;
        IEnumerator enumerator = PersistentShipmentData.shipmentDictionary.Values.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                object obj = enumerator.Current;
                JamCharacterShipment jamCharacterShipment = (JamCharacterShipment)obj;
                if (PersistentShipmentData.ShipmentTypeForShipmentIsAvailable(jamCharacterShipment.ShipmentRecID))
                {
                    long num2 = GarrisonStatus.CurrentTime() - (long)jamCharacterShipment.CreationTime;
                    long num3 = (long)jamCharacterShipment.ShipmentDuration - num2;
                    if (num3 <= 0L)
                    {
                        num++;
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
        return(num);
    }
예제 #2
0
 private void MobileClientShipmentTypesHandler(MobileClientShipmentTypes msg)
 {
     PersistentShipmentData.SetAvailableShipmentTypes(msg.Shipment);
     if (this.ShipmentTypesUpdatedAction != null)
     {
         this.ShipmentTypesUpdatedAction.Invoke();
     }
 }
예제 #3
0
 private void MobileClientShipmentsUpdateHandler(MobileClientShipmentsUpdate msg)
 {
     PersistentShipmentData.ClearData();
     JamCharacterShipment[] shipment = msg.Shipment;
     for (int i = 0; i < shipment.Length; i++)
     {
         JamCharacterShipment jamCharacterShipment = shipment[i];
         PersistentShipmentData.AddOrUpdateShipment(jamCharacterShipment);
         if (this.ShipmentAddedAction != null)
         {
             this.ShipmentAddedAction.Invoke(jamCharacterShipment.ShipmentRecID, jamCharacterShipment.ShipmentID);
         }
     }
 }
예제 #4
0
    private void Update()
    {
        switch (this.m_navButtonType)
        {
        case OrderHallNavButton.NavButtonType.missions:
        {
            int numCompletedMissions = PersistentMissionData.GetNumCompletedMissions(true);
            if (numCompletedMissions == 0 && this.m_notificationBadgeRoot.activeSelf)
            {
                this.m_notificationBadgeRoot.SetActive(false);
            }
            else if (numCompletedMissions > 0)
            {
                if (!this.m_notificationBadgeRoot.activeSelf)
                {
                    this.m_notificationBadgeRoot.SetActive(true);
                }
                if (this.m_notificationPulseHandle == null)
                {
                    this.m_notificationPulseHandle = UiAnimMgr.instance.PlayAnim("MinimapLoopPulseAnim", this.m_notificationBadgeRoot.transform, Vector3.zero, 1f, 0f);
                }
                this.m_notificationBadgeText.text = string.Empty + numCompletedMissions;
            }
            break;
        }

        case OrderHallNavButton.NavButtonType.recruit:
        {
            int num = PersistentShipmentData.GetNumReadyShipments();
            if (ArtifactKnowledgeData.s_artifactKnowledgeInfo != null && ArtifactKnowledgeData.s_artifactKnowledgeInfo.CurrentLevel < ArtifactKnowledgeData.s_artifactKnowledgeInfo.MaxLevel)
            {
                num += ArtifactKnowledgeData.s_artifactKnowledgeInfo.ItemsInBags;
            }
            if (num == 0 && this.m_notificationBadgeRoot.activeSelf)
            {
                this.m_notificationBadgeRoot.SetActive(false);
            }
            else if (num > 0)
            {
                if (!this.m_notificationBadgeRoot.activeSelf)
                {
                    this.m_notificationBadgeRoot.SetActive(true);
                }
                if (this.m_notificationPulseHandle == null)
                {
                    this.m_notificationPulseHandle = UiAnimMgr.instance.PlayAnim("MinimapLoopPulseAnim", this.m_notificationBadgeRoot.transform, Vector3.zero, 1f, 0f);
                }
                this.m_notificationBadgeText.text = string.Empty + num;
            }
            break;
        }

        case OrderHallNavButton.NavButtonType.talents:
        {
            bool flag = AllPanels.instance.m_talentTreePanel.TalentIsReadyToPlayGreenCheckAnim();
            if (!flag && this.m_notificationBadgeRoot.activeSelf)
            {
                this.m_notificationBadgeRoot.SetActive(false);
            }
            else if (flag && !this.m_notificationBadgeRoot.activeSelf)
            {
                this.m_notificationBadgeRoot.SetActive(true);
                this.m_notificationBadgeText.text = "1";
                if (this.m_notificationPulseHandle == null)
                {
                    this.m_notificationPulseHandle = UiAnimMgr.instance.PlayAnim("MinimapLoopPulseAnim", this.m_notificationBadgeRoot.transform, Vector3.zero, 1f, 0f);
                }
            }
            break;
        }
        }
    }
예제 #5
0
 private void InitList()
 {
     MobileClientShipmentType[] availableShipmentTypes = PersistentShipmentData.GetAvailableShipmentTypes();
     if (availableShipmentTypes == null || availableShipmentTypes.Length == 0)
     {
         this.m_noRecruitsYetMessage.get_gameObject().SetActive(true);
     }
     else
     {
         this.m_noRecruitsYetMessage.get_gameObject().SetActive(false);
     }
     TroopsListItem[] componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>();
     TroopsListItem[] array = componentsInChildren;
     for (int i = 0; i < array.Length; i++)
     {
         TroopsListItem troopsListItem = array[i];
         bool           flag           = true;
         if (availableShipmentTypes != null)
         {
             MobileClientShipmentType[] array2 = availableShipmentTypes;
             for (int j = 0; j < array2.Length; j++)
             {
                 MobileClientShipmentType mobileClientShipmentType = array2[j];
                 if (troopsListItem.GetCharShipmentTypeID() == mobileClientShipmentType.CharShipmentID)
                 {
                     flag = false;
                     break;
                 }
             }
         }
         if (flag)
         {
             Object.DestroyImmediate(troopsListItem.get_gameObject());
         }
     }
     if (availableShipmentTypes == null)
     {
         return;
     }
     componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>();
     for (int k = 0; k < availableShipmentTypes.Length; k++)
     {
         bool             flag2  = false;
         TroopsListItem[] array3 = componentsInChildren;
         for (int l = 0; l < array3.Length; l++)
         {
             TroopsListItem troopsListItem2 = array3[l];
             if (troopsListItem2.GetCharShipmentTypeID() == availableShipmentTypes[k].CharShipmentID)
             {
                 flag2 = true;
                 break;
             }
         }
         if (!flag2)
         {
             GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab);
             gameObject.get_transform().SetParent(this.m_troopsListContents.get_transform(), false);
             TroopsListItem component = gameObject.GetComponent <TroopsListItem>();
             component.SetCharShipment(availableShipmentTypes[k]);
             FancyEntrance component2 = component.GetComponent <FancyEntrance>();
             component2.m_timeToDelayEntrance = this.m_listItemInitialEntranceDelay + this.m_listItemEntranceDelay * (float)k;
             component2.Activate();
         }
     }
 }
예제 #6
0
    private void UpdateRecruitButtonState()
    {
        bool flag = GarrisonStatus.Resources() >= this.m_shipmentCost;

        this.m_itemResourceCostText.color = ((!flag) ? Color.red : Color.white);
        bool flag2 = true;

        if (this.m_charShipmentRec != null && !PersistentShipmentData.CanOrderShipmentType(this.m_charShipmentRec.ID))
        {
            flag2 = false;
        }
        if (this.m_isArtifactResearch && ArtifactKnowledgeData.s_artifactKnowledgeInfo != null)
        {
            if (this.m_akResearchDisabled)
            {
                this.m_recruitTroopsButton.gameObject.SetActive(false);
            }
            if (!flag2 || ArtifactKnowledgeData.s_artifactKnowledgeInfo.CurrentLevel >= ArtifactKnowledgeData.s_artifactKnowledgeInfo.MaxLevel)
            {
                this.m_recruitButtonText.text           = StaticDB.GetString("PLACE_ORDER", null);
                this.m_recruitButtonText.color          = new Color(0.5f, 0.5f, 0.5f, 1f);
                this.m_recruitTroopsButton.interactable = false;
                return;
            }
        }
        TroopSlot[] componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true);
        bool        flag3 = false;

        foreach (TroopSlot troopSlot in componentsInChildren)
        {
            if (troopSlot.IsEmpty())
            {
                flag3 = true;
                break;
            }
        }
        this.m_recruitButtonText.color = new Color(1f, 0.82f, 0f, 1f);
        if (!flag3)
        {
            this.m_recruitButtonText.text  = StaticDB.GetString("SLOTS_FULL", null);
            this.m_recruitButtonText.color = new Color(0.5f, 0.5f, 0.5f, 1f);
        }
        else if (!flag)
        {
            this.m_recruitButtonText.text  = StaticDB.GetString("CANT_AFFORD", "Can't Afford");
            this.m_recruitButtonText.color = new Color(0.5f, 0.5f, 0.5f, 1f);
        }
        else if (this.m_isTroop)
        {
            this.m_recruitButtonText.text = StaticDB.GetString("RECRUIT", null);
        }
        else
        {
            this.m_recruitButtonText.text = StaticDB.GetString("PLACE_ORDER", null);
        }
        if (flag3 && flag && flag2)
        {
            this.m_recruitTroopsButton.interactable = true;
        }
        else
        {
            this.m_recruitTroopsButton.interactable = false;
            this.m_recruitButtonText.color          = new Color(0.5f, 0.5f, 0.5f, 1f);
        }
    }
예제 #7
0
    private void UpdateItemSlots()
    {
        if (this.m_isArtifactResearch && this.m_akResearchDisabled)
        {
            TroopSlot[] componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true);
            for (int i = 0; i < componentsInChildren.Length; i++)
            {
                Object.DestroyImmediate(componentsInChildren[i].gameObject);
            }
            return;
        }
        bool flag = true;

        if (this.m_charShipmentRec != null && !PersistentShipmentData.CanPickupShipmentType(this.m_charShipmentRec.ID))
        {
            flag = false;
        }
        int         num        = 0;
        IEnumerator enumerator = PersistentShipmentData.shipmentDictionary.Values.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                object obj = enumerator.Current;
                JamCharacterShipment jamCharacterShipment = (JamCharacterShipment)obj;
                if (jamCharacterShipment.ShipmentRecID == this.m_charShipmentRec.ID)
                {
                    num++;
                    break;
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
        if ((num > 0 && !flag) || (this.m_isArtifactResearch && ArtifactKnowledgeData.s_artifactKnowledgeInfo != null && ArtifactKnowledgeData.s_artifactKnowledgeInfo.CurrentLevel >= ArtifactKnowledgeData.s_artifactKnowledgeInfo.MaxLevel))
        {
            this.m_troopSlotsCanvasGroup.alpha          = 0f;
            this.m_troopSlotsCanvasGroup.interactable   = false;
            this.m_troopSlotsCanvasGroup.blocksRaycasts = false;
        }
        else
        {
            this.m_troopSlotsCanvasGroup.alpha          = 1f;
            this.m_troopSlotsCanvasGroup.interactable   = true;
            this.m_troopSlotsCanvasGroup.blocksRaycasts = true;
        }
        int num2 = (int)this.m_charShipmentRec.MaxShipments;

        if (this.m_isArtifactResearch && ArtifactKnowledgeData.s_artifactKnowledgeInfo != null)
        {
            int num3 = ArtifactKnowledgeData.s_artifactKnowledgeInfo.MaxLevel - ArtifactKnowledgeData.s_artifactKnowledgeInfo.CurrentLevel;
            if (num3 > 0 && num3 < num2)
            {
                num2 = num3;
            }
        }
        TroopSlot[] componentsInChildren2 = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true);
        if (componentsInChildren2.Length < num2)
        {
            for (int j = componentsInChildren2.Length; j < num2; j++)
            {
                GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopSlotPrefab);
                gameObject.transform.SetParent(this.m_troopSlotsRootObject.transform, false);
                TroopSlot component = gameObject.GetComponent <TroopSlot>();
                component.SetCharShipment(this.m_charShipmentRec.ID, 0UL, 0, false, 0);
            }
        }
        if (componentsInChildren2.Length > num2)
        {
            for (int k = num2; k < componentsInChildren2.Length; k++)
            {
                Object.DestroyImmediate(componentsInChildren2[k].gameObject);
            }
        }
        componentsInChildren2 = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true);
        foreach (TroopSlot troopSlot in componentsInChildren2)
        {
            if (troopSlot.GetDBID() != 0UL && !PersistentShipmentData.shipmentDictionary.ContainsKey(troopSlot.GetDBID()))
            {
                troopSlot.SetCharShipment(this.m_charShipmentRec.ID, 0UL, 0, false, 0);
            }
        }
        IEnumerator enumerator2 = PersistentShipmentData.shipmentDictionary.Values.GetEnumerator();

        try
        {
            while (enumerator2.MoveNext())
            {
                object obj2 = enumerator2.Current;
                JamCharacterShipment jamCharacterShipment2 = (JamCharacterShipment)obj2;
                if (jamCharacterShipment2.ShipmentRecID == this.m_charShipmentRec.ID)
                {
                    this.SetTroopSlotForPendingShipment(componentsInChildren2, jamCharacterShipment2.ShipmentID);
                }
            }
        }
        finally
        {
            IDisposable disposable2;
            if ((disposable2 = (enumerator2 as IDisposable)) != null)
            {
                disposable2.Dispose();
            }
        }
    }
예제 #8
0
    private void Update()
    {
        switch (this.m_navButtonType)
        {
        case OrderHallNavButton.NavButtonType.missions:
        {
            int numCompletedMissions = PersistentMissionData.GetNumCompletedMissions(true);
            if (numCompletedMissions == 0 && this.m_notificationBadgeRoot.get_activeSelf())
            {
                this.m_notificationBadgeRoot.SetActive(false);
            }
            else if (numCompletedMissions > 0)
            {
                if (!this.m_notificationBadgeRoot.get_activeSelf())
                {
                    this.m_notificationBadgeRoot.SetActive(true);
                }
                if (this.m_notificationPulseHandle == null)
                {
                    this.m_notificationPulseHandle = UiAnimMgr.instance.PlayAnim("MinimapLoopPulseAnim", this.m_notificationBadgeRoot.get_transform(), Vector3.get_zero(), 1f, 0f);
                }
                this.m_notificationBadgeText.set_text(string.Empty + numCompletedMissions);
            }
            break;
        }

        case OrderHallNavButton.NavButtonType.recruit:
        {
            int numReadyShipments = PersistentShipmentData.GetNumReadyShipments();
            if (numReadyShipments == 0 && this.m_notificationBadgeRoot.get_activeSelf())
            {
                this.m_notificationBadgeRoot.SetActive(false);
            }
            else if (numReadyShipments > 0)
            {
                if (!this.m_notificationBadgeRoot.get_activeSelf())
                {
                    this.m_notificationBadgeRoot.SetActive(true);
                }
                if (this.m_notificationPulseHandle == null)
                {
                    this.m_notificationPulseHandle = UiAnimMgr.instance.PlayAnim("MinimapLoopPulseAnim", this.m_notificationBadgeRoot.get_transform(), Vector3.get_zero(), 1f, 0f);
                }
                this.m_notificationBadgeText.set_text(string.Empty + numReadyShipments);
            }
            break;
        }

        case OrderHallNavButton.NavButtonType.talents:
        {
            bool flag = AllPanels.instance.m_talentTreePanel.TalentIsReadyToPlayGreenCheckAnim();
            if (!flag && this.m_notificationBadgeRoot.get_activeSelf())
            {
                this.m_notificationBadgeRoot.SetActive(false);
            }
            else if (flag && !this.m_notificationBadgeRoot.get_activeSelf())
            {
                this.m_notificationBadgeRoot.SetActive(true);
                this.m_notificationBadgeText.set_text("1");
                if (this.m_notificationPulseHandle == null)
                {
                    this.m_notificationPulseHandle = UiAnimMgr.instance.PlayAnim("MinimapLoopPulseAnim", this.m_notificationBadgeRoot.get_transform(), Vector3.get_zero(), 1f, 0f);
                }
            }
            break;
        }
        }
    }
예제 #9
0
    private void InitList()
    {
        MobileClientShipmentType[] availableShipmentTypes = PersistentShipmentData.GetAvailableShipmentTypes();
        if (availableShipmentTypes == null || availableShipmentTypes.Length == 0)
        {
            this.m_noRecruitsYetMessage.gameObject.SetActive(true);
        }
        else
        {
            this.m_noRecruitsYetMessage.gameObject.SetActive(false);
        }
        TroopsListItem[] componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true);
        foreach (TroopsListItem troopsListItem in componentsInChildren)
        {
            bool flag = true;
            if (availableShipmentTypes != null)
            {
                foreach (MobileClientShipmentType mobileClientShipmentType in availableShipmentTypes)
                {
                    if (troopsListItem.GetCharShipmentTypeID() == mobileClientShipmentType.CharShipmentID)
                    {
                        flag = false;
                        break;
                    }
                }
            }
            if (flag)
            {
                Object.DestroyImmediate(troopsListItem.gameObject);
            }
        }
        if (availableShipmentTypes == null)
        {
            return;
        }
        componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true);
        for (int k = 0; k < availableShipmentTypes.Length; k++)
        {
            bool flag2 = false;
            foreach (TroopsListItem troopsListItem2 in componentsInChildren)
            {
                if (troopsListItem2.GetCharShipmentTypeID() == availableShipmentTypes[k].CharShipmentID)
                {
                    flag2 = true;
                    break;
                }
            }
            if (!flag2)
            {
                GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab);
                gameObject.transform.SetParent(this.m_troopsListContents.transform, false);
                TroopsListItem component = gameObject.GetComponent <TroopsListItem>();
                component.SetCharShipment(availableShipmentTypes[k], false, null);
                FancyEntrance component2 = component.GetComponent <FancyEntrance>();
                component2.m_timeToDelayEntrance = this.m_listItemInitialEntranceDelay + this.m_listItemEntranceDelay * (float)k;
                component2.Activate();
            }
        }
        IEnumerator enumerator = PersistentShipmentData.shipmentDictionary.Values.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                object obj = enumerator.Current;
                JamCharacterShipment jamCharacterShipment = (JamCharacterShipment)obj;
                if (!PersistentShipmentData.ShipmentTypeForShipmentIsAvailable(jamCharacterShipment.ShipmentRecID))
                {
                    bool flag3 = true;
                    bool flag4 = false;
                    if (jamCharacterShipment.ShipmentRecID < 372 || jamCharacterShipment.ShipmentRecID > 383)
                    {
                        flag3 = false;
                    }
                    if (jamCharacterShipment.ShipmentRecID == 178 || jamCharacterShipment.ShipmentRecID == 179 || jamCharacterShipment.ShipmentRecID == 180 || jamCharacterShipment.ShipmentRecID == 192 || jamCharacterShipment.ShipmentRecID == 194 || jamCharacterShipment.ShipmentRecID == 195)
                    {
                        flag4 = true;
                    }
                    if (flag3 || flag4)
                    {
                        CharShipmentRec record = StaticDB.charShipmentDB.GetRecord(jamCharacterShipment.ShipmentRecID);
                        if (record != null)
                        {
                            GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab);
                            gameObject2.transform.SetParent(this.m_troopsListContents.transform, false);
                            TroopsListItem component3 = gameObject2.GetComponent <TroopsListItem>();
                            component3.SetCharShipment(null, true, record);
                        }
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
    }
예제 #10
0
    private void InitList()
    {
        MobileClientShipmentType[] availableShipmentTypes = PersistentShipmentData.GetAvailableShipmentTypes();
        if (availableShipmentTypes == null || availableShipmentTypes.Length == 0)
        {
            this.m_noRecruitsYetMessage.get_gameObject().SetActive(true);
        }
        else
        {
            this.m_noRecruitsYetMessage.get_gameObject().SetActive(false);
        }
        TroopsListItem[] componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true);
        TroopsListItem[] array = componentsInChildren;
        for (int i = 0; i < array.Length; i++)
        {
            TroopsListItem troopsListItem = array[i];
            bool           flag           = true;
            if (availableShipmentTypes != null)
            {
                MobileClientShipmentType[] array2 = availableShipmentTypes;
                for (int j = 0; j < array2.Length; j++)
                {
                    MobileClientShipmentType mobileClientShipmentType = array2[j];
                    if (troopsListItem.GetCharShipmentTypeID() == mobileClientShipmentType.CharShipmentID)
                    {
                        flag = false;
                        break;
                    }
                }
            }
            if (flag)
            {
                Object.DestroyImmediate(troopsListItem.get_gameObject());
            }
        }
        if (availableShipmentTypes == null)
        {
            return;
        }
        componentsInChildren = this.m_troopsListContents.GetComponentsInChildren <TroopsListItem>(true);
        for (int k = 0; k < availableShipmentTypes.Length; k++)
        {
            bool             flag2  = false;
            TroopsListItem[] array3 = componentsInChildren;
            for (int l = 0; l < array3.Length; l++)
            {
                TroopsListItem troopsListItem2 = array3[l];
                if (troopsListItem2.GetCharShipmentTypeID() == availableShipmentTypes[k].CharShipmentID)
                {
                    flag2 = true;
                    break;
                }
            }
            if (!flag2)
            {
                GameObject gameObject = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab);
                gameObject.get_transform().SetParent(this.m_troopsListContents.get_transform(), false);
                TroopsListItem component = gameObject.GetComponent <TroopsListItem>();
                component.SetCharShipment(availableShipmentTypes[k], false, null);
                FancyEntrance component2 = component.GetComponent <FancyEntrance>();
                component2.m_timeToDelayEntrance = this.m_listItemInitialEntranceDelay + this.m_listItemEntranceDelay * (float)k;
                component2.Activate();
            }
        }
        IEnumerator enumerator = PersistentShipmentData.shipmentDictionary.get_Values().GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                JamCharacterShipment jamCharacterShipment = (JamCharacterShipment)enumerator.get_Current();
                if (!PersistentShipmentData.ShipmentTypeForShipmentIsAvailable(jamCharacterShipment.ShipmentRecID))
                {
                    CharShipmentRec record = StaticDB.charShipmentDB.GetRecord(jamCharacterShipment.ShipmentRecID);
                    if (record != null)
                    {
                        GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_troopsListItemPrefab);
                        gameObject2.get_transform().SetParent(this.m_troopsListContents.get_transform(), false);
                        TroopsListItem component3 = gameObject2.GetComponent <TroopsListItem>();
                        component3.SetCharShipment(null, true, record);
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable = enumerator as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
    }