public void Update(Message message, int index) { m_MessageIndex = index; m_Subject.SetNewText(message != null ? GuiBaseUtils.TrimLongText(message.GetSubject(), MAX_SUBJECT_LENGTH) : ""); m_Date.SetNewText(message != null ? message.m_SendTime.ToLongRegionalString() : ""); m_Text.SetNewText(message != null ? message.GetMessage() : TextDatabase.instance[0104112]); bool showReply = m_MessageIndex >= 0 && message is FriendMessage ? true : false; if (showReply != m_Reply.Widget.Visible) { m_Reply.Widget.Show(showReply, true); } }
protected void Update(PPIDailyRewards.Reward reward) { string text; switch (reward.Type) { case PPIDailyRewards.E_RewardType.Chips: int textId = reward.Value == 1 ? 00502095 : 00502076; text = string.Format(TextDatabase.instance[textId], reward.Value); break; case PPIDailyRewards.E_RewardType.Gold: text = string.Format(TextDatabase.instance[00502077], reward.Value); break; case PPIDailyRewards.E_RewardType.Item: if (reward.Value >= 0) { var item = ItemSettingsManager.Instance.FindByGUID(reward.Id); text = item != null ? TextDatabase.instance[item.Name] : string.Empty; if (item != null) { m_ItemImage.Widget.CopyMaterialSettings(item.ShopWidget); m_ItemCountLabel.SetNewText((reward.Value > 0 ? reward.Value : item.Count).ToString()); } } else if (reward.Value < 0) { text = TextDatabase.instance[00502101]; } else { text = string.Empty; } break; default: text = string.Empty; break; } m_TextLabel.SetNewText(text.ToUpper()); ShowWidget(m_GoldImage.Widget, reward.Type == PPIDailyRewards.E_RewardType.Gold); ShowWidget(m_ChipsImage.Widget, reward.Type == PPIDailyRewards.E_RewardType.Chips); ShowWidget(m_ItemImage.Widget, reward.Type == PPIDailyRewards.E_RewardType.Item && reward.Value >= 0); ShowWidget(m_MagicImage.Widget, reward.Type == PPIDailyRewards.E_RewardType.Item && reward.Value < 0); }
public void Update(FtueAction.Base action, int actionsFinished, int actionsTotal) { if (m_Root.Visible == true) { m_Caption.SetNewText(string.Format("{0}: {1}/{2}", TextDatabase.instance[9900000], Mathf.Min(actionsFinished + 1, actionsTotal), actionsTotal )); string label = action.IsIdle == true?string.Format(TextDatabase.instance[9900003], action.Label) : action.Label; m_Text.SetNewText(label); } m_ShowInfo.IsDisabled = Alpha < 0.8f ? true : false; //action.IsIdle; }
protected override void OnUpdate() { base.OnUpdate(); // TODO: update time left to the next match if (m_WaitTime != null) { // float timeLeft = // int minutes = Mathf.FloorToInt( timeLeft / 60.0f ); // int seconds = Mathf.CeilToInt( timeLeft - 60.0f * minutes ); int minutes = 59; int seconds = 59; m_WaitTime.SetNewText(minutes.ToString("D2") + ":" + seconds.ToString("D2")); } }
//------------------------------------------------------------------------------------------------------------------ void InitModeAndName() { // name... GUIBase_Label name = m_MapParent.transform.GetChildComponent <GUIBase_Label>("MapName_Label"); if (name != null) { if (Client.Instance != null) { name.SetNewText(Client.Instance.GameState.LevelName); } else { name.SetNewText("Unknown"); } } // mode... GUIBase_Label mode = m_MapParent.transform.GetChildComponent <GUIBase_Label>("MapMode_Label"); if (mode != null) { string text = "Unknown"; if (Client.Instance != null) { switch (Client.Instance.GameState.GameType) { case E_MPGameType.DeathMatch: text = TextDatabase.instance[TextID_DeathMatch]; break; case E_MPGameType.ZoneControl: text = TextDatabase.instance[TextID_Domination]; break; default: Debug.LogWarning("Unknown type of game! " + Client.Instance.GameState.GameType); break; } } mode.SetNewText(text); } }
// ------ public void SetItem(IResearchItem item, int upgradeIndex) { m_ResearchItem = item; m_UpgradeIndex = upgradeIndex; m_Caption_Label.SetNewText(TextDatabase.instance[item.GetUpgradeName(upgradeIndex)]); m_Value_Label.SetNewText(item.GetUpgradeValueText(upgradeIndex)); if (m_Cost != null) { m_Cost.Show(true); WeaponSettings.Upgrade upgrade = m_ResearchItem.GetUpgrade(upgradeIndex); int cost; bool hasEnoughFunds; if (upgrade.MoneyCost > 0) { cost = upgrade.MoneyCost; hasEnoughFunds = ResearchSupport.Instance.HasPlayerEnoughFunds(cost, false); m_Cost.SetValue(cost, false); } else { cost = upgrade.GoldCost; hasEnoughFunds = ResearchSupport.Instance.HasPlayerEnoughFunds(cost, true); m_Cost.SetValue(cost, true); } if (!hasEnoughFunds) { m_AcceptButton.SetDisabled(upgrade.GoldCost > 0 ? false : true); m_Cost.SetMissingFunds(true); } else { m_AcceptButton.SetDisabled(false); m_Cost.SetMissingFunds(false); } } m_UpgradeIcon.SetUpgradeType(item.GetUpgrade(upgradeIndex).ID); m_UpgradeIcon.SetStatus(UpgradeIcon.Status.Active); m_UpgradeIcon.Show(); }
protected override void OnViewInit() { base.OnViewInit(); if (m_ScreenLayout == null) { Debug.LogError("GuiPopupGamepadConfig<" + name + "> :: There is not any layout specified!"); return; } m_TitleLabel = GuiBaseUtils.GetControl <GUIBase_Label>(Layout, TITLE_LABEL); PrepareButton(m_ScreenLayout, "Reset_Button", null, OnResetButton); PrepareButton(m_ScreenLayout, "Close_Button", null, OnCloseButton); m_ActionButtons = new List <GUIBase_Button>(); for (int i = 0; i < s_GActions.Length; i++) { GUIBase_Button bt = PrepareButton(m_ScreenLayout, s_ActionButtonName + (i + 1), null, OnActionButton); m_ActionButtons.Add(bt); //setup action name GUIBase_Label lb = GuiBaseUtils.GetChildLabel(bt.Widget, "Action_Label", false); lb.SetNewText(s_GActions[i].textID); if (i == PAUSE_ACTION) { m_PauseActionLabel = lb; } else if (i == VIEW_RIGHT_ACTION) { m_ViewRightActionLabel = lb; } else if (i == MOVE_RIGHT_ACTION) { m_MoveRightActionLabel = lb; } } //hide the rest of buttons HideUnusedButtons(); // UpdateAllLabels(); SetKeyboardDisabledInput(); }
public override void Show(ShopItemId id, bool locked, bool waiting, bool premium) { m_RootWidget.Show(true, false); //get info for weapon: if (id == ShopItemId.EmptyId) //tady by melo byt ve vsech typech slotu if(id == ShopItemId.EmptyId || locked) { ShowEmpty(locked, waiting, premium); } else { ShopItemInfo inf = ShopDataBridge.Instance.GetItemInfo(id); m_NameLabel.SetNewText(inf.NameText); m_WeaponSprite.Widget.CopyMaterialSettings(inf.SpriteWidget); m_WeaponTypeSprite.Widget.CopyMaterialSettings(inf.WeaponTypeWidget); UpdateVisibility(false, locked, waiting, premium); } }
void ShowNewMessage() { m_Parent.Show(true, true); m_Caption.SetNewText(CurrentMessage.Caption); m_Caption.Widget.transform.localScale = new Vector3(CurrentMessage.CaptionScale, CurrentMessage.CaptionScale, CurrentMessage.CaptionScale); m_Text.SetNewText(CurrentMessage.Text); m_Text.Widget.transform.localScale = new Vector3(CurrentMessage.TextScale, CurrentMessage.TextScale, CurrentMessage.TextScale); m_Progress = 0; if (CurrentMessage.Type == Client.E_MessageType.ExclusiveKill) { Client.Instance.PlaySoundCombatMessageGold(); } else { Client.Instance.PlaySoundCombatMessage(); } }
void SetTimeLabel(GUIBase_Label label, ref AccountInfo acct) { int hours = Mathf.RoundToInt((float)acct.Duration.TotalHours); int days = Mathf.RoundToInt((float)acct.Duration.TotalDays); int weeks = Mathf.RoundToInt(days / 7.0f); int months = Mathf.RoundToInt(weeks / 4.0f); if (hours == 1) { label.SetNewText(01140022); } else if (hours < 24) { label.SetNewText(01140007); } else if (days == 1) { label.SetNewText(01140023); } else if (days < 7) { label.SetNewText(01140008); } else if (weeks == 1) { label.SetNewText(01140009); } else if (weeks < 4) { label.SetNewText(01140024); } else if (months == 1) { label.SetNewText(01140010); } else { label.SetNewText(01140011); } }
protected override void OnUpdate() { base.OnUpdate(); PlayerPersistantInfo playerPPI = PPIManager.Instance.GetLocalPlayerPPI(); if (playerPPI == null) { return; } // colect data... int blueScore = Client.Instance.GameState.ZCInfo.TeamScore[E_Team.Good]; int redScore = Client.Instance.GameState.ZCInfo.TeamScore[E_Team.Bad]; string goodCourse = TextDatabase.instance[playerPPI.Team == E_Team.Good ? TextID_YourTeam : TextID_EnemyTeam] + " - "; string badCourse = TextDatabase.instance[playerPPI.Team == E_Team.Bad ? TextID_YourTeam : TextID_EnemyTeam] + " - "; if (blueScore > redScore) { goodCourse += TextDatabase.instance[TextID_Winning]; badCourse += TextDatabase.instance[TextID_Losing]; } else if (blueScore < redScore) { goodCourse += TextDatabase.instance[TextID_Losing]; badCourse += TextDatabase.instance[TextID_Winning]; } else { goodCourse += TextDatabase.instance[TextID_Draw]; badCourse += TextDatabase.instance[TextID_Draw]; } // update gui... m_GoodCourse.SetNewText(goodCourse); m_GoodSpawns.SetNewText(blueScore.ToString("D2")); m_BadCourse.SetNewText(badCourse); m_BadSpawns.SetNewText(redScore.ToString("D2")); }
// PUBLIC METHOD public void Update() { if (m_Timer != null && Client.Instance != null) { int timeLeft = Client.Instance.GameState.DMInfo.RestTimeSeconds; int minutes = timeLeft / 60; int seconds = timeLeft - 60 * minutes; m_Timer.SetNewText(string.Format("{0:00}:{1:00}", minutes, seconds)); m_Timer.Widget.Color = timeLeft <= 5 && seconds % 2 == 1 ? RED : BLUE; if (timeLeft <= 5) { if (m_Audio != null && m_Audio.isPlaying == false) { m_Audio.Play(); } } } }
void SetLabelValue(GUIBase_Label label, int oldValue, int newValue, bool animate) { if (oldValue == newValue) { return; } if (animate == false) { label.SetNewText(newValue.ToString()); } else { var animation = MFGuiManager.AnimateWidget(label, oldValue, newValue); if (animation != null) { animation.AudioClip = m_CountDownSound; } } }
void UpdateXp(PlayerPersistantInfo ppi, bool reset) { if (GuiFrontendMain.IsVisible == false) { return; } int xp = ppi != null ? ppi.Experience : 0; int level = PlayerPersistantInfo.GetPlayerRankFromExperience(xp); if (reset == false) { SetLabelValue(m_LevelLabel, m_Rank, level, AnimateRank); m_Rank = level; } else { m_LevelLabel.SetNewText(level.ToString()); } int minXp = PlayerPersistantInfo.GetPlayerMinExperienceForRank(Mathf.Clamp(level, 1, PlayerPersistantInfo.MAX_RANK)); int maxXp = PlayerPersistantInfo.GetPlayerMinExperienceForRank(Mathf.Clamp(level + 1, 1, PlayerPersistantInfo.MAX_RANK)); m_LevelPic.State = string.Format("Rank_{0}", Mathf.Min(level, m_LevelPic.Count - 1).ToString("D2")); m_XPLabel.SetNewText(xp.ToString() + "/" + maxXp.ToString()); Transform emptyTrans = m_EmptyBar.transform; Vector3 pos = emptyTrans.localPosition; Vector3 scale = emptyTrans.localScale; float width = m_EmptyBar.GetWidth(); float ratio = minXp != maxXp?Mathf.Clamp((xp - minXp) / (float)(maxXp - minXp), 0.01f, 1.0f) : 0.0f; pos.x -= (width - width * ratio) * scale.x * 0.5f; scale.x *= ratio; Transform fullTrans = m_FullBar.transform; fullTrans.localScale = scale; fullTrans.localPosition = pos; m_FullBar.SetModify(); }
public void Update(RoundFinalResult.PlayerResult player, RoundFinalResult.PreyNightmare data) { if (player == null) { return; } m_Root.Show(true, true); int rank = PlayerPersistantInfo.GetPlayerRankFromExperience(player.Experience); bool isFriend = GameCloudManager.friendList.friends.FindIndex(obj => obj.PrimaryKey == player.PrimaryKey) != -1; m_FriendIcon.Show(isFriend, true); AnimateWidget(m_NicknameLabel, GuiBaseUtils.FixNameForGui(player.NickName)); AnimateWidget(m_KilledByMeLabel, 0, data.KilledByMe); AnimateWidget(m_KilledMeLabel, 0, data.KilledMe); m_RankLabel.SetNewText(rank.ToString()); m_RankIcon.State = string.Format("Rank_{0}", Mathf.Min(rank, m_RankIcon.Count - 1).ToString("D2")); }
public override void Show(ShopItemId id, bool locked, bool waiting, bool premium) { m_RootWidget.Show(true, false); //Debug.Log("Showing Item Slot: " + id + " lck: " + locked); //get info for weapon: if (id == ShopItemId.EmptyId) { ShowEmpty(locked, waiting, premium); } else { ShopItemInfo inf = ShopDataBridge.Instance.GetItemInfo(id); m_NameLabel.SetNewText(inf.NameText); m_ItemSprite.Widget.CopyMaterialSettings(inf.SpriteWidget); m_CountText.SetNewText(inf.OwnedCount.ToString()); UpdateVisibility(false, locked, waiting, premium, inf.Consumable); } }
public void Update(PlayerPersistantInfo inPPI, int inOrder) { if (m_OrederLabel != null) { m_OrederLabel.SetNewText(inOrder.ToString()); } if (m_RankLabel != null) { m_RankLabel.SetNewText(inPPI.Rank.ToString()); } m_NameLabel.SetNewText(inPPI.NameForGui); m_ScoreLabel.SetNewText(inPPI.Score.Score.ToString()); m_KillsLabel.SetNewText(inPPI.Score.Kills.ToString()); m_DeathLabel.SetNewText(inPPI.Score.Deaths.ToString()); m_PingLabel.SetNewText(inPPI.Ping.ToString()); //Debug.Log("show PPI " + inPPI.Name + " " + inPPI.Score.Score.ToString()); }
// SPOLECNY ITERFACE PRO VSECHNY PAGE public override void OnItemChange(ShopItemId itemId, bool forceUpdateView) { base.OnItemChange(itemId, forceUpdateView); ShopItemInfo itemInf = ShopDataBridge.Instance.GetItemInfo(itemId); string strYouHave = TextDatabase.instance[02900050]; strYouHave = strYouHave.Replace("%i1", itemInf.OwnedCount.ToString()); m_CountLabel.SetNewText(strYouHave); m_CountLabel.Widget.Show(itemInf.Consumable, true); string strAddCount = TextDatabase.instance[02900051]; strAddCount = strAddCount.Replace("%i1", itemInf.AddCount.ToString()); m_AddLabel.SetNewText(strAddCount); m_AddLabel.Widget.Show(itemInf.Consumable, true); string strDuration = TextDatabase.instance[02900052]; strDuration = strDuration.Replace("%i1", itemInf.BoostDuration.ToString()); m_DurationLabel.SetNewText(strDuration); m_DurationLabel.Widget.Show(itemInf.Consumable && itemInf.BoostDuration > 0, true); // hack na zobrazeni boost midifikatoru jen pro nektere itemy //pokud je boost 0 nebo male cislo (napr invisibilita) tak to ignorujeme. //pokud je vetsi jak 1 tak to znamena jen jiny typ zapisu, takze pak odecitame 100%. string strBoostModif = TextDatabase.instance[02900053]; int boostMod = Mathf.CeilToInt(itemInf.BoostModifier * 100); if (itemInf.BoostModifier > 1.0f) { boostMod -= 100; } strBoostModif = strBoostModif.Replace("%i1", boostMod.ToString()); m_BoostModLabel.SetNewText(strBoostModif); m_BoostModLabel.Widget.Show(itemInf.Consumable && itemInf.BoostModifier >= 0.25f, true); }
public void Update(PendingFriendInfo inFriend) { m_FriendInfo = inFriend; // update GUI... { m_FacebookIcon.Show(false, false); m_FacebookName.Widget.Show(false, false); m_Username.Widget.Show(true, false); string username = string.IsNullOrEmpty(m_FriendInfo.Username_New) ? m_FriendInfo.PrimaryKey : m_FriendInfo.Username_New; string nickname = string.IsNullOrEmpty(m_FriendInfo.Nickname) ? username : m_FriendInfo.Nickname; m_Username.SetNewText(GuiBaseUtils.FixNameForGui(nickname)); } string added = GetLastOnlineInfo(m_FriendInfo); m_Added.SetNewText(added); bool beMyFriendRequest = m_FriendInfo.IsItRequest; string message = string.IsNullOrEmpty(m_FriendInfo.Message) ? TextDatabase.instance[FS_REQUEST] : m_FriendInfo.Message; string status = beMyFriendRequest ? message : TextDatabase.instance[FS_PENDING]; if (status.Length > MESSAGE_MAX_LENGTH) { status = status.Substring(0, MESSAGE_MAX_LENGTH - 3) + "..."; } m_Status.SetNewText(status); m_Accept.Widget.Show((beMyFriendRequest ? true : false), true); m_Reject.Widget.Show((beMyFriendRequest ? true : false), true); m_Remove.Widget.Show((beMyFriendRequest ? false : true), true); //Debug.Log("show PPI " + inPPI.Name + " " + inPPI.Score.Score.ToString()); }
// ------ public void SetCurrentWeapon() { if (LocalPlayer == null || LocalPlayer.Owner == null || LocalPlayer.Owner.WeaponComponent == null) { return; } E_WeaponID w = LocalPlayer.Owner.WeaponComponent.CurrentWeapon; if (w == E_WeaponID.None || CurrentWeapon == w) { return; } CurrentWeapon = w; WeaponSettings s = WeaponSettingsManager.Instance.Get(w); WeaponLabel.SetNewText(s.Name); WeaponIcon.CopyMaterialSettings(s.HudWidget); UpdateAmmoDisplay(); UpdatePlayerWeapons(); }
void RefreshControls() { for (int idx = 0; idx < m_Rows.Length; ++idx) { RefreshListItem(idx, m_Rows[idx].FriendIndex); } m_FriendList.MaxItems = m_Friends.Length; var friend = string.IsNullOrEmpty(m_Master) == false?GameCloudManager.friendList.friends.Find(obj => obj.PrimaryKey == m_Master) : null; string nickname = friend != null?GuiBaseUtils.FixNameForGui(friend.Nickname) : null; string caption = string.IsNullOrEmpty(nickname) == false ? string.Format(TextDatabase.instance[109052], nickname) : TextDatabase.instance[109053]; m_CaptionLabel.SetNewText(caption); m_ReadyButton.IsDisabled = m_Master == null ? true : false; m_ReadyButton.isHighlighted = string.IsNullOrEmpty(m_Master) == false ? m_IsReady : false; m_GametypeRoller.Selection = (int)m_Gametype; }
protected override void OnViewUpdate() { base.OnViewUpdate(); if (m_Score.IsVisible == true) { m_Score.UpdateView(); } if (WaitingForSpawn == false) { int minutes = Client.TimeToRespawn / 60; int seconds = Client.TimeToRespawn % 60; string time = string.Format("{0:00}:{1:00}", minutes, seconds); // Get time to next spawn... m_NextSpawn_Label.SetNewText(time); if (m_NextSpawn_Label.Widget.Visible == false) { UpdateControlsVisibility(); } } // update following player name if (FollowingPlayer == true) { m_PlayerName_Label.SetNewText(GuiBaseUtils.FixNameForGui(SpectatorCamera.GetSpectatedPlayerName())); } // update state of 'follow player' and 'free' spectator buttons UpdateButtonsState(); UpdateZoneControlState(); UpdateDeathMatchState(); SetAnticheatButtonVisibility(SecurityTools.UserHasAnticheatManagementPermissions()); }
void ShowResultText(RoundFinalResult results, E_Team winners) { GUIBase_Label resultText = GuiBaseUtils.GetControl <GUIBase_Label>(Layout, "ResultText_Label"); GUIBase_Label resultShadow = GuiBaseUtils.GetControl <GUIBase_Label>(Layout, "ResultShadow_Label"); if (results.GameType == E_MPGameType.ZoneControl) { Color color = results.Team == E_Team.Good ? m_TeamGoodColor : m_TeamBadColor; int[] textIds = results.Team == winners ? m_YouWonTextIds : m_YouLoseTextIds; int textId = textIds[Random.Range(0, textIds.Length)]; resultText.SetNewText(textId); resultText.Widget.Color = color; resultText.Widget.Show(true, true); resultShadow.SetNewText(textId); resultShadow.Widget.Show(true, false); } else { resultText.Widget.Show(false, true); resultShadow.Widget.Show(false, true); } }
protected override void OnViewShow() { base.OnViewShow(); Debug.Log("Not Funds Show"); //Show fund info if (!ShopDataBridge.Instance.IsIAPFund(AddFundsID)) { Debug.LogError("Selected funds is not IAP: " + AddFundsID); } ShopItemInfo inf = ShopDataBridge.Instance.GetItemInfo(AddFundsID); string strBuy = TextDatabase.instance[02030093]; strBuy = strBuy.Replace("%d1", inf.AddGold.ToString()); string productId = FundSettingsManager.Instance.Get((E_FundID)(AddFundsID.Id)).GUID.ToString(); InAppInventory inventory = InAppPurchaseMgr.Instance.Inventory; InAppProduct product = null; if (inventory != null) { product = inventory.Product(productId); } if (product != null) { // add price to the buy label string strBuy += " (" + product.Price + " " + product.CurrencyCode + ")"; } GUIBase_Label buyLabel = GuiBaseUtils.PrepareLabel(m_ScreenLayout, "Buy_Label"); buyLabel.SetNewText(strBuy); }
// private string dbgName; public SpawnZoneButtonEx(GUIBase_Button inButton, string inZoneName, int inZoneIndex, ZoneControlFlag inZoneControl, SetSpawnZoneIndexDelegate inDelegate) { m_Button = inButton; m_Zone = inZoneControl; m_ZoneIndex = inZoneIndex; m_SetSpawnIndex = inDelegate; // dbgName = inZoneName; if (m_Button != null) { m_Button.RegisterTouchDelegate2(OnSelect); // Capa: temporary ?!? solution GUIBase_Label label = m_Button.transform.GetChildComponent <GUIBase_Label>("Spawn_Label"); if (label != null) { label.SetNewText(ButtonLabels[m_ZoneIndex]); } } }
public void Update(PlayerPersistantInfo inPPI, int inKilledMe, int inKilledByMe) { if (m_RankSprite != null) { m_RankSprite.State = "Rank_" + Mathf.Min(inPPI.Rank, m_RankSprite.Count - 1).ToString("D2"); } if (m_RankLabel != null) { m_RankLabel.SetNewText(inPPI.Rank.ToString()); } if (m_NameLabel != null) { m_NameLabel.SetNewText(inPPI.NameForGui); } if (m_KilledMeLabel != null) { m_KilledMeLabel.SetNewText(inKilledMe.ToString()); } if (m_KilledByMeLabel != null) { m_KilledByMeLabel.SetNewText(inKilledByMe.ToString()); } if (m_FriendIcon != null) { bool isFriend = GameCloudManager.friendList.friends.FindIndex(obj => obj.PrimaryKey == inPPI.PrimaryKey) != -1; if (m_FriendIcon.Visible != isFriend) { m_FriendIcon.Show(isFriend, true); } } }
void SetText(string name, string text) { GUIBase_Label label = GuiBaseUtils.GetControl <GUIBase_Label>(Layout, name); label.SetNewText(text); }
// ----- public void SetItem(IResearchItem item) { m_ResearchItem = item; m_Name.SetNewText(m_ResearchItem.GetName()); m_Description.SetNewText(m_ResearchItem.GetDescription()); bool isGold; // TODO : PROBABLY NOT CORRECT, FUND TYPE IS NOT PROPERLY TESTED: m_Price.SetNewText(m_ResearchItem.GetPrice(out isGold).ToString()); m_Image.Widget.CopyMaterialSettings(m_ResearchItem.GetImage()); int maxParams = item.GetNumOfParams(); for (int i = 0; i < maxParams; i++) { m_Params[i].Name.SetNewText(item.GetParamName(i)); m_Params[i].Value.SetNewText(item.GetParamValue(i)); m_Params[i].Value.Widget.Color = item.UpgradeIsAppliedOnParam(i) ? m_UpgradedValueColor : Color.white; ShowWidget(m_Params[i].Parent, true); } for (int i = maxParams; i < ResearchItem.MAX_PARAMS; i++) { ShowWidget(m_Params[i].Parent, false); } int maxUpgrades = item.GetNumOfUpgrades(); if (m_ResearchItem.GetState() == ResearchState.Active) { ShowWidget(m_UpgradeArea, maxUpgrades > 0); ShowWidget(m_PriceArea, false); } else { ShowWidget(m_UpgradeArea, false); ShowWidget(m_PriceArea, true); } if (m_ResearchItem.GetState() == ResearchState.Active) { for (int i = 0; i < maxUpgrades; i++) { bool ownsUpgrade = item.OwnsUpgrade(i); WeaponSettings.Upgrade upgrade = item.GetUpgrade(i); m_Upgrades[i].m_UpgradeIcon.SetUpgradeType(upgrade.ID); m_Upgrades[i].m_UpgradeIcon.Show(); isGold = upgrade.GoldCost > 0; bool hasEnoughMoney = ResearchSupport.Instance.HasPlayerEnoughFunds(isGold ? upgrade.GoldCost : upgrade.MoneyCost, isGold); if (!ownsUpgrade) { m_Upgrades[i].m_Name.Widget.Color = Color.white; m_Upgrades[i].m_CostVal.SetNewText(isGold ? upgrade.GoldCost.ToString() : upgrade.MoneyCost.ToString()); if (!hasEnoughMoney) { GuiBaseUtils.PendingHint = E_Hint.Money; m_Upgrades[i].m_Parent.Color = m_ActiveUpgradeBtnColor; m_Upgrades[i].m_CostVal.Widget.Color = Color.red; m_Upgrades[i].m_UpgradeIcon.SetStatus(UpgradeIcon.Status.Inactive); } else { m_Upgrades[i].m_Parent.Color = m_ActiveUpgradeBtnColor; m_Upgrades[i].m_CostVal.Widget.Color = Color.white; m_Upgrades[i].m_UpgradeIcon.SetStatus(UpgradeIcon.Status.Active); } ShowWidget(m_Upgrades[i].m_Researched, false); ShowWidget(m_Upgrades[i].m_CostGold, isGold); ShowWidget(m_Upgrades[i].m_CostMoney, !isGold); } else { m_Upgrades[i].m_UpgradeIcon.SetStatus(UpgradeIcon.Status.Active); m_Upgrades[i].m_CostVal.Widget.Color = m_UpgradedValueColor; m_Upgrades[i].m_Name.Widget.Color = Color.white; m_Upgrades[i].m_Parent.Color = m_InactiveUpgradeBtnColor; m_Upgrades[i].m_CostVal.SetNewText(item.GetUpgradeValueText(i)); ShowWidget(m_Upgrades[i].m_Researched, true); ShowWidget(m_Upgrades[i].m_CostGold, false); ShowWidget(m_Upgrades[i].m_CostMoney, false); } m_Upgrades[i].m_Name.SetNewText(item.GetUpgradeName(i)); ShowWidget(m_Upgrades[i].m_Name.Widget, true); ShowWidget(m_Upgrades[i].m_CostVal.Widget, true); m_Upgrades[i].m_Button.SetDisabled(ownsUpgrade); ShowWidget(m_Upgrades[i].m_Button.Widget, true); } for (int i = maxUpgrades; i < ResearchItem.MAX_UPGRADES; i++) { m_Upgrades[i].m_UpgradeIcon.Hide(); ShowWidget(m_Upgrades[i].m_Name.Widget, false); ShowWidget(m_Upgrades[i].m_CostGold, false); ShowWidget(m_Upgrades[i].m_CostMoney, false); ShowWidget(m_Upgrades[i].m_CostVal.Widget, false); ShowWidget(m_Upgrades[i].m_Parent, false); } } else { for (int i = 0; i < ResearchItem.MAX_UPGRADES; i++) { m_Upgrades[i].m_UpgradeIcon.Hide(); ShowWidget(m_Upgrades[i].m_Name.Widget, false); ShowWidget(m_Upgrades[i].m_CostVal.Widget, false); ShowWidget(m_Upgrades[i].m_CostGold, false); ShowWidget(m_Upgrades[i].m_CostMoney, false); } } bool unavailable = m_ResearchItem.GetState() == ResearchState.Unavailable; int cost = m_ResearchItem.GetPrice(out isGold); bool notEnoughMoney = !ResearchSupport.Instance.HasPlayerEnoughFunds(cost, isGold); if (unavailable || notEnoughMoney && (m_ResearchItem.GetState() != ResearchState.Active)) { string explanation = item.GetCantBuyExplanation(); if ((explanation == "") && notEnoughMoney) { explanation = TextDatabase.instance[0113080]; } m_Explanation.SetNewText(explanation); ShowWidget(m_Explanation.Widget, true); ShowWidget(m_ResearchButton.Widget, false); m_Price.Widget.Color = notEnoughMoney ? Color.red : Color.white; if (notEnoughMoney) { GuiBaseUtils.PendingHint = E_Hint.Money; } } else { ShowWidget(m_Explanation.Widget, false); if (m_ResearchItem.GetState() == ResearchState.Active) { ShowWidget(m_ResearchButton.Widget, false); } else { ShowWidget(m_ResearchButton.Widget, true); } m_Price.Widget.Color = Color.white; } m_ResearchButton.SetDisabled(unavailable || notEnoughMoney); }
public override void SetText(string inText) { m_Message.SetNewText(inText); }
public override void SetCaption(string inCaption) { m_Caption.SetNewText(inCaption); }