private void Update()
 {
     if (this.m_lootDisplayPending && this.m_contributeButton.interactable)
     {
         this.m_delayBeforeShowingLoot -= Time.deltaTime;
         if (this.m_delayBeforeShowingLoot > 0f)
         {
             return;
         }
     }
     if (this.m_delayBeforeShowingLoot <= 0f && this.m_lootDisplayTimeRemaining > 0f && this.m_lootItemQuantity > 0)
     {
         if (!this.m_gotLootArea.activeSelf)
         {
             Main.instance.m_UISound.Play_GetItem();
             this.m_gotLootArea.SetActive(true);
             this.m_lootAreaCanvasGroup.alpha = 0f;
             iTween.ValueTo(base.gameObject, iTween.Hash(new object[] { "name", "Fade Loot In", "from", 0f, "to", 1f, "easeType", "easeOutCubic", "time", 0.5f, "onupdate", "FadeLootInCallback", "oncomplete", "FadeLootInCompleteCallback" }));
         }
         ItemRec record = StaticDB.itemDB.GetRecord(this.m_lootItemID);
         if (record == null)
         {
             this.m_gotLootItemName.text = string.Concat("???", (this.m_lootItemQuantity != 1 ? string.Concat(" (", this.m_lootItemQuantity, "x)") : string.Empty));
         }
         else
         {
             this.m_gotLootItemName.text = string.Concat(record.Display, (this.m_lootItemQuantity != 1 ? string.Concat(" (", this.m_lootItemQuantity, "x)") : string.Empty));
         }
         this.m_rewardDisplay.InitReward(MissionRewardDisplay.RewardType.item, this.m_lootItemID, 1, 0, 0);
         this.m_lootDisplayTimeRemaining -= Time.deltaTime;
     }
     else if (this.m_lootDisplayTimeRemaining <= 0f && this.m_lootDisplayPending)
     {
         if (this.m_gotLootArea.activeSelf)
         {
             iTween.ValueTo(base.gameObject, iTween.Hash(new object[] { "name", "Fade Loot Out", "from", 0f, "to", 1f, "easeType", "easeOutCubic", "time", 0.5f, "onupdate", "FadeLootOutCallback", "oncomplete", "FadeLootOutCompleteCallback" }));
         }
         this.m_lootDisplayPending = false;
     }
     if (LegionfallData.legionfallDictionary.ContainsKey(this.m_contributionID))
     {
         LegionfallData.ContributionData item = LegionfallData.legionfallDictionary[this.m_contributionID];
         WrapperContribution             wrapperContribution = item.contribution;
         if (wrapperContribution.State == 3)
         {
             if (item.underAttackExpireTime <= DateTime.UtcNow)
             {
                 DateTime dateTime = GarrisonStatus.CurrentTime();
                 item.underAttackExpireTime = dateTime.AddSeconds((double)item.contribution.CurrentValue);
             }
             TimeSpan timeSpan = item.underAttackExpireTime - GarrisonStatus.CurrentTime();
             timeSpan = (timeSpan.TotalSeconds <= 0 ? TimeSpan.Zero : timeSpan);
             this.m_healthText.text            = string.Concat(StaticDB.GetString("TIME_LEFT", null), " ", timeSpan.GetDurationString(false));
             this.m_progressFillBar.fillAmount = wrapperContribution.CurrentValue / wrapperContribution.UpperValue;
         }
     }
 }
Esempio n. 2
0
 public static void AddOrUpdateLegionfallBuilding(WrapperContribution contribution)
 {
     if (LegionfallData.instance.m_legionfallDictionary.ContainsKey(contribution.ContributionID))
     {
         LegionfallData.instance.m_legionfallDictionary.Remove(contribution.ContributionID);
     }
     LegionfallData.ContributionData value = default(LegionfallData.ContributionData);
     value.contribution          = contribution;
     value.underAttackExpireTime = DateTime.MaxValue;
     LegionfallData.instance.m_legionfallDictionary.Add(contribution.ContributionID, value);
 }
 public static void AddOrUpdateLegionfallBuilding(WrapperContribution contribution)
 {
     if (LegionfallData.instance.m_legionfallDictionary.ContainsKey(contribution.ContributionID))
     {
         LegionfallData.instance.m_legionfallDictionary.Remove(contribution.ContributionID);
     }
     LegionfallData.ContributionData contributionDatum = new LegionfallData.ContributionData()
     {
         contribution          = contribution,
         underAttackExpireTime = DateTime.MaxValue
     };
     LegionfallData.instance.m_legionfallDictionary.Add(contribution.ContributionID, contributionDatum);
 }