public static void AddOrUpdateShipment(WrapperCharacterShipment shipment)
 {
     if (PersistentShipmentData.instance.m_shipmentDictionary.ContainsKey(shipment.ShipmentID))
     {
         PersistentShipmentData.instance.m_shipmentDictionary.Remove(shipment.ShipmentID);
     }
     PersistentShipmentData.instance.m_shipmentDictionary.Add(shipment.ShipmentID, shipment);
 }
Exemple #2
0
        public void SetCharShipment(int charShipmentID, ulong shipmentDBID, int ownedGarrFollowerID, bool training, int iconFileDataID = 0)
        {
            CharShipmentRec record = StaticDB.charShipmentDB.GetRecord(charShipmentID);

            if (record == null)
            {
                Debug.LogError("Invalid Shipment ID: " + charShipmentID);
                return;
            }
            if (this.m_glowLoopHandle != null)
            {
                UiAnimation anim = this.m_glowLoopHandle.GetAnim();
                if (anim != null)
                {
                    anim.Stop(0.5f);
                }
                this.m_glowLoopHandle = null;
            }
            this.m_collected     = false;
            this.m_pendingCreate = false;
            this.m_collectingSpinner.SetActive(false);
            this.m_ownedGarrFollowerID = ownedGarrFollowerID;
            this.m_training            = training;
            this.m_shipmentDBID        = shipmentDBID;
            if (training)
            {
                if (!PersistentShipmentData.shipmentDictionary.ContainsKey(shipmentDBID))
                {
                    training = false;
                    Debug.LogWarning("Shipment not found in Persistent: " + charShipmentID);
                }
                else
                {
                    WrapperCharacterShipment wrapperCharacterShipment = PersistentShipmentData.shipmentDictionary[shipmentDBID];
                    this.m_shipmentCreationTime = wrapperCharacterShipment.CreationTime;
                    this.m_shipmentDuration     = wrapperCharacterShipment.ShipmentDuration;
                }
            }
            if (record.GarrFollowerID > 0)
            {
                this.SetCharShipmentTroop(record, iconFileDataID);
            }
            else if (record.DummyItemID > 0)
            {
                this.SetCharShipmentItem(record);
            }
            if (ownedGarrFollowerID != 0)
            {
                this.m_troopBuildEmptyRing.gameObject.SetActive(false);
                this.m_troopOwnedCheckmark.gameObject.SetActive(true);
                this.m_troopPortraitImage.gameObject.SetActive(true);
                this.m_timeRemainingText.gameObject.SetActive(false);
                return;
            }
            if (training)
            {
                this.m_troopBuildEmptyRing.gameObject.SetActive(true);
                this.m_troopOwnedCheckmark.gameObject.SetActive(false);
                this.m_troopPortraitImage.gameObject.SetActive(true);
                this.m_timeRemainingText.gameObject.SetActive(true);
                this.m_timeRemainingText.text = string.Empty;
                if (this.m_grayscaleShader != null)
                {
                    Material material = new Material(this.m_grayscaleShader);
                    this.m_troopPortraitImage.material = material;
                }
            }
            else
            {
                this.m_troopBuildEmptyRing.gameObject.SetActive(false);
                this.m_troopOwnedCheckmark.gameObject.SetActive(false);
                this.m_troopPortraitImage.gameObject.SetActive(false);
                this.m_timeRemainingText.gameObject.SetActive(false);
            }
        }