コード例 #1
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();
            }
        }
    }
コード例 #2
0
    private void Update()
    {
        int         num        = 0;
        IEnumerator enumerator = PersistentShipmentData.shipmentDictionary.Values.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                object obj = enumerator.Current;
                JamCharacterShipment jamCharacterShipment = (JamCharacterShipment)obj;
                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();
            }
        }
        if (num != this.m_numReadyTroops)
        {
            if (num == 0 || num < this.m_numReadyTroops)
            {
                this.ClearEffects();
            }
            if (num > this.m_numReadyTroops)
            {
                this.ClearEffects();
                this.m_glowHandle     = UiAnimMgr.instance.PlayAnim("MinimapPulseAnim", base.transform, Vector3.zero, 3f, 0f);
                this.m_glowLoopHandle = UiAnimMgr.instance.PlayAnim("MinimapLoopPulseAnim", base.transform, Vector3.zero, 3f, 0f);
                iTween.PunchScale(this.m_theActualButton, iTween.Hash(new object[]
                {
                    "name",
                    "RecruitWobble",
                    "x",
                    this.amount,
                    "y",
                    this.amount,
                    "time",
                    this.duration,
                    "delay",
                    0.1f,
                    "looptype",
                    iTween.LoopType.none
                }));
                iTween.PunchScale(this.m_theActualButton, iTween.Hash(new object[]
                {
                    "name",
                    "RecruitWobbleL",
                    "x",
                    this.amount,
                    "y",
                    this.amount,
                    "time",
                    this.duration,
                    "delay",
                    this.delay,
                    "looptype",
                    iTween.LoopType.loop
                }));
                iTween.PunchRotation(this.m_theActualButton, iTween.Hash(new object[]
                {
                    "name",
                    "RecruitButtonSwing",
                    "z",
                    30f,
                    "time",
                    2f
                }));
                iTween.PunchRotation(this.m_numReadyTroopsTextBG, iTween.Hash(new object[]
                {
                    "name",
                    "RecruitNumSwing",
                    "z",
                    50f,
                    "time",
                    3f
                }));
            }
            this.m_numReadyTroops          = num;
            this.m_numReadyTroopsText.text = string.Empty + ((this.m_numReadyTroops <= 0) ? string.Empty : (string.Empty + this.m_numReadyTroops));
            this.m_numReadyTroopsTextBG.SetActive(this.m_numReadyTroops > 0);
        }
    }
コード例 #3
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();
            }
        }
    }