public static IEnumerable <LocalizableText> MapFromContactModelToAddress(ContactModel contact) { List <LocalizableText> addresses = new List <LocalizableText>(); LocalizableText addressRu = new LocalizableText { Lan = Languages.Ru, LocText = contact.Address_Ru }; if (addressRu.LocText == null) { addressRu.LocText = String.Empty; } LocalizableText addressEn = new LocalizableText { Lan = Languages.En, LocText = contact.Address_En }; if (addressEn.LocText == null) { addressEn.LocText = String.Empty; } addresses.Add(addressEn); addresses.Add(addressRu); return(addresses); }
public static void Postfix(LanceLoadoutMechItem __instance, MechDef mechDef, LocalizableText ___MechNameText) { if (__instance != null && MechNamesHelper.HasUiName(mechDef)) { ___MechNameText.SetText(mechDef.Description.UIName); } }
public static void Prefix(LocalizableText ___Description, object data, ref string __state) { var sim = UnityGameInstance.BattleTechGame.Simulation; if (Core.WarStatus == null || (sim.IsCampaign && !sim.CompanyTags.Contains("story_complete"))) { return; } var starSystem = (StarSystem)data; if (starSystem == null) { return; } //var tmp = ___Description.GetComponent<TextMeshProUGUI>(); //tmp.font = font; //tmp.fontSize = 10f; __state = starSystem.Def.Description.Details; var factionString = BuildInfluenceString(starSystem); Traverse.Create(starSystem.Def.Description).Property("Details").SetValue(factionString); }
static void Postfix(SG_HiringHall_Screen __instance, Pilot ___selectedPilot, LocalizableText ___MWInitialCostText, UIColorRefTracker ___MWCostColor, HBSDOTweenButton ___HireButton) { Mod.Log.Debug?.Write("Updating UpdateMoneySpot"); if (___selectedPilot != null) { Mod.Log.Debug?.Write(" -- pilot is selected"); // Account for the salary CrewDetails details = ModState.GetCrewDetails(___selectedPilot.pilotDef); int modifiedBonus = (int)Mathf.RoundToInt(details.AdjustedBonus); string bonus = new Text(Mod.LocalizedText.Labels[ModText.LT_Crew_Bonus_Label], new string[] { SimGameState.GetCBillString(Mathf.RoundToInt(modifiedBonus)) }) .ToString(); Mod.Log.Debug?.Write($" -- bonus will be: {bonus}"); ___MWInitialCostText.SetText(bonus); if (modifiedBonus > ModState.SimGameState.Funds) { Mod.Log.Debug?.Write(" -- Disabling hire."); ___MWCostColor.SetUIColor(UIColor.Red); ___HireButton.SetState(ButtonState.Disabled); } else { Mod.Log.Debug?.Write(" -- Enabling hire."); ___MWCostColor.SetUIColor(UIColor.White); ___HireButton.SetState(ButtonState.Enabled); } } }
public override void Update(object objectWithNewData) { var updateData = objectWithNewData as Algorithm; this.Name = updateData.Name; this.Description = updateData.Description; }
public static void MultiPurchasePopup_Refresh_Postfix(SG_Stores_MultiPurchasePopup __instance, int ___costPerUnit, int ___quantityBeingSold, LocalizableText ___TitleText, LocalizableText ___DescriptionText, string ___itemName, HBSDOTweenButton ___ConfirmButton) { Mod.Log.Debug("SG_S_MPP:R entered."); int value = ___costPerUnit * ___quantityBeingSold; Mod.Log.Debug($"SG_S_MPP:R value:{value} = costPerUnit:{___costPerUnit} x quantityBeingSold:{___quantityBeingSold}."); string actionS = "??"; if (State.StoreIsBuying) { actionS = "BUY"; } else if (State.StoreIsSelling) { actionS = "SELL"; } Text titleT = new Text($"{actionS}: {___itemName}"); ___TitleText.SetText(titleT.ToString(), new object[] { }); Text descT = new Text($"{actionS} FOR <color=#F79B26>{SimGameState.GetCBillString(value)}</color>"); ___DescriptionText.SetText(descT.ToString(), new object[] { }); ___ConfirmButton.SetText(actionS); }
public override GameObject CreateObject(Transform parent) { if (pageTemplate == null) { pageTemplate = Resources.FindObjectsOfTypeAll <ReleaseInfoViewController>().First().GetField <TextPageScrollView, ReleaseInfoViewController>("_textPageScrollView"); } TextPageScrollView scrollView = Object.Instantiate(pageTemplate, parent); scrollView.name = "BSMLTextPageScrollView"; scrollView.enabled = true; TextMeshProUGUI textMesh = scrollView.GetField <TextMeshProUGUI, TextPageScrollView>("_text"); textMesh.text = "Default Text"; LocalizableText localizedText = CreateLocalizableText(textMesh.gameObject); textMesh.gameObject.AddComponent <TextPageScrollViewRefresher>().scrollView = scrollView; List <Component> components = scrollView.gameObject.AddComponent <ExternalComponents>().components; components.Add(textMesh); components.Add(localizedText); return(scrollView.gameObject); }
static void Postfix(SimGameDifficultySettingsModule __instance, PreGameCareerModeSettingsTotalScoreDescAndBar ___difficultyBarAndMod) { if (__instance != null && ___difficultyBarAndMod != null) { ___difficultyBarAndMod.TotalScoreModifierLabel.SetText( new Text(Mod.LocalizedText.SimGameDifficultyStrings[ModText.SGDS_Desc], new object[] { }) ); GameObject difficultyTotalGO = __instance.gameObject.FindFirstChildNamed("OBJ_difficultyTotal"); if (difficultyTotalGO != null) { // Find difTotal-text GameObject diffTotalGO = difficultyTotalGO.FindFirstChildNamed("difTotal-text"); if (diffTotalGO != null) { // Use the label here LocalizableText localText = diffTotalGO.GetComponent <LocalizableText>(); if (localText != null) { Mod.Log.Info?.Write("UPDATED LABEL"); localText.SetText(Mod.LocalizedText.SimGameDifficultyStrings[ModText.SGDS_Label]); } else { Mod.Log.Warn?.Write("FAILED TO FIND LocalizableText COMP FOR `diffTotal-text`"); } } else { Mod.Log.Warn?.Write("FAILED TO FIND `diffTotal-text` CHILD OF `OBJ_difficultyTotal`!"); } } } }
public static List <LocalizableText> SetValue(string valueRu, string valueEn) { List <LocalizableText> valueList = new List <LocalizableText>(); LocalizableText resultRu = new LocalizableText { Lan = Languages.Ru, LocText = valueRu }; if (resultRu.LocText == null) { resultRu.LocText = String.Empty; } LocalizableText resultEn = new LocalizableText { Lan = Languages.En, LocText = valueEn }; if (resultEn.LocText == null) { resultEn.LocText = String.Empty; } valueList.Add(resultRu); valueList.Add(resultEn); return(valueList); }
public static void Awake(LocalizableText centerTorsoLabel) { var centerTorso = centerTorsoLabel.transform.parent.gameObject; void Setup(MechLabSlotsSettings.WidgetSettings settings) { var go = GetWidgetViaCenterTorso(settings, centerTorso); if (go != null) { return; } go = Object.Instantiate(centerTorso, null); go.name = settings.ShortLabel; // required for identification, needs to be unique var labelGo = go.transform.GetChild("CT-txt").gameObject; labelGo.name = go.name + "-txt"; labelGo.GetComponent <LocalizableText>().SetText(settings.ShortLabel); go.transform.SetParent(centerTorso.transform.parent, false); go.transform.SetAsFirstSibling(); } Setup(MechLabSlotsFeature.settings.TopLeftWidget); Setup(MechLabSlotsFeature.settings.TopRightWidget); }
public static void Postfix( MechComponentRef ___componentRef, SVGImage ___icon, LocalizableText ___nameText, LocalizableText ___bonusTextA, LocalizableText ___bonusTextB ) { try { // support no icon ___icon.gameObject.SetActive(!string.IsNullOrEmpty(___componentRef.Def.Description.Icon)); // support no name ___nameText.gameObject.SetActive(!string.IsNullOrEmpty(___componentRef.Def.Description.UIName)); // support null besides empty string ___bonusTextA.gameObject.SetActive(!string.IsNullOrEmpty(___componentRef.Def.BonusValueA)); ___bonusTextB.gameObject.SetActive(!string.IsNullOrEmpty(___componentRef.Def.BonusValueB)); } catch (Exception e) { Control.Logger.Error.Log(e); } }
public Dialogue(string id, string technicalName, LocalizableText displayName, LocalizableText text, Features features, Vector2 position, List <Pin> pins, List <string> references, bool isDocument = false) : base(id, technicalName, displayName, text, features, position) { this.pins = pins; this.references = references; this.isDocument = isDocument; }
private void Play() { this.sideStack.PanelFrame.gameObject.SetActive(true); if (this.currentMessage.DialogueSource.team.IsLocalPlayer) { //LogDebug($" Displaying pilot portrait"); this.sideStack.ShowPortrait(this.currentMessage.DialogueSource.GetPilot().GetPortraitSpriteThumb()); } else { //LogDebug($" Displaying castDef portrait"); this.sideStack.ShowPortrait(this.currentMessage.DialogueContent.CastDef.defaultEmotePortrait.LoadPortrait(false)); } try { Transform speakerNameFieldT = this.sideStack.gameObject.transform.Find("Representation/dialog-layout/Portrait/speakerNameField"); speakerNameFieldT.gameObject.SetActive(true); //LogDebug($" Setting SpeakerName to: '{this.currentMessage.DialogueContent.SpeakerName}' with callsign: '{this.currentMessage.DialogueContent.CastDef.callsign}'"); LocalizableText speakerNameLT = speakerNameFieldT.GetComponentInChildren <LocalizableText>(); speakerNameLT.SetText(this.currentMessage.DialogueContent.SpeakerName); speakerNameLT.gameObject.SetActive(true); speakerNameLT.alignment = TMPro.TextAlignmentOptions.Bottom; } catch (Exception e) { LogDebug(e); } this.activeDialog = this.sideStack.GetNextItem(); this.activeDialog.Init(this.currentMessage.ShowDuration, true, new Action(this.AfterDialogShow), new Action(this.AfterDialogHide)); //LogDebug($"CDS - Showing dialog: words: '{this.currentMessage.DialogueContent.words}' color: '{this.currentMessage.DialogueContent.wordsColor}' speakerName: '{this.currentMessage.DialogueContent.SpeakerName}' timeout: {this.currentMessage.ShowDuration}"); this.activeDialog.Show(this.currentMessage.DialogueContent.words, this.currentMessage.DialogueContent.wordsColor, this.currentMessage.DialogueContent.SpeakerName); }
public static bool ChatListViewItem_SetData_Prefix(ChatListViewItem __instance, ChatMessage message, LocalizableText ____chatMessage) { string expandedSender = message.SenderName.Replace(">", ">"); expandedSender = expandedSender.Replace("<", "<"); string senderText = $"{expandedSender}"; Mod.Log.Debug($"Message senderName: '{message.SenderName}' expandedSender: '{expandedSender}' senderText: '{senderText}'"); string messageColor = "#" + ColorUtility.ToHtmlStringRGBA(LazySingletonBehavior <UIManager> .Instance.UIColorRefs.whiteHalf); string expandedMessage = message.Message.Replace(">", ">"); expandedMessage = expandedMessage.Replace("<", "<"); string messageText = $"<{messageColor}>{expandedMessage}</color>"; Mod.Log.Debug($"Message text: '{expandedMessage}'"); Localize.Text translatedText = new Localize.Text("<size=-3>" + senderText + " " + messageText + "</size>"); ____chatMessage.text = translatedText.ToString(); DOTweenAnimation componentInChildren = ____chatMessage.GetComponentInChildren <DOTweenAnimation>(); if (componentInChildren != null) { componentInChildren.delay = 50; componentInChildren.CreateTween(); componentInChildren.DOPlay(); } return(false); }
static void Postfix(LanceHeaderWidget __instance, List <MechDef> mechs, LocalizableText ___simLanceTonnageText, LanceConfiguratorPanel ___LC) { try { if (___LC.IsSimGame) { DropCostManager.Instance.CalculateLanceCost(mechs); // longer strings interfere with messages about incorrect lance configurations ___simLanceTonnageText.SetText($"DROP COST: ¢{DropCostManager.Instance.FormattedCosts} LANCE WEIGHT: {DropCostManager.Instance.LanceTonnage} TONS"); if (DCECore.settings.diffMode != EDifficultyType.NotActive) { SGDifficultyIndicatorWidget lanceRatingWidget = (SGDifficultyIndicatorWidget)AccessTools .Field(typeof(LanceHeaderWidget), "lanceRatingWidget").GetValue(__instance); TextMeshProUGUI label = lanceRatingWidget.transform.parent .GetComponentsInChildren <TextMeshProUGUI>() .FirstOrDefault(t => t.transform.name == "label-lanceRating"); label.text = "Lance Rating"; int difficulty = DropCostManager.Instance.RawCost / DCECore.settings.valuePerHalfSkull; DCECore.modLog.Debug?.Write($"Calculated Drop Rating: {difficulty}, total value: {DropCostManager.Instance.RawCost}"); lanceRatingWidget.SetDifficulty(difficulty); } } } catch (Exception e) { DCECore.modLog.Error?.Write(e); } }
public static void SetHardpoints(object data, TooltipPrefab_Mech __instance, LocalizableText ___JumpjetHP) { try { //Control.Log("tooltip mech"); var handler = __instance.GetComponent <TooltipHPHandler>(); if (handler == null) { //Control.Log("creating"); handler = __instance.gameObject.AddComponent <TooltipHPHandler>(); handler.Init(__instance, ___JumpjetHP.transform.parent.gameObject); } var mech = data as MechDef; if (mech != null) { //Control.Log($"set data for {mech.Description.Id}"); var usage = mech.GetHardpointUsage(); handler.SetData(usage); handler.SetJJ(mech.GetJJCountByMechDef(), mech.GetJJMaxByMechDef()); } } catch (Exception e) { Control.LogError(e); } }
public Element() { id = string.Empty; technicalName = string.Empty; displayName = new LocalizableText(); text = new LocalizableText(); features = new Features(); }
public Element(string id, string technicalName, LocalizableText displayName, LocalizableText text, Features features) { this.id = id; this.technicalName = technicalName; this.displayName = displayName; this.text = text; this.features = features; }
public DialogueFragment() : base() { menuText = new LocalizableText(); stageDirections = new LocalizableText(); speakerIdRef = string.Empty; pins = new List <Pin>(); }
public Element(string id, string technicalName, LocalizableText displayName, LocalizableText text, Features features, Vector2 position) { this.id = id; this.technicalName = technicalName; this.displayName = displayName; this.text = text; this.features = features; this.position = position; }
public Element() { id = string.Empty; technicalName = string.Empty; displayName = new LocalizableText(); text = new LocalizableText(); features = new Features(); position = Vector2.zero; }
public DialogueFragment(string id, string technicalName, LocalizableText displayName, LocalizableText text, Features features, Vector2 position, LocalizableText menuText, LocalizableText stageDirections, string speakerIdRef, List <Pin> pins) : base(id, technicalName, displayName, text, features, position) { this.menuText = menuText; this.stageDirections = stageDirections; this.speakerIdRef = speakerIdRef; this.pins = pins; }
public MiniFactionPanelHelper(SG_Stores_MiniFactionWidget widget) { Widget = widget; MainTraverse = new Traverse(widget); FactionIcon = MainTraverse.Field <Image>("FactionIcon").Value; FactionTooltip = MainTraverse.Field <HBSTooltip>("FactionTooltip").Value; ratingIcon = MainTraverse.Field <SGReputationRatingIcon>("ratingIcon").Value; ReputationBonusText = MainTraverse.Field <LocalizableText>("ReputationBonusText").Value; }
public static void Postfix(SGBarracksServicePanel __instance, Pilot p) { string affinityDescriptors = PilotAffinityManager.Instance.getMechAffinityDescription(p); //Main.modLog.LogMessage(affinityDescriptors); LocalizableText bioText = (LocalizableText)finfo.GetValue(__instance); bioText.AppendTextAndRefresh(affinityDescriptors, (object[])Array.Empty <object>()); finfo.SetValue(__instance, bioText); methodRefreshPanel.Invoke(__instance, new object[] { }); }
public static void Postfix(LocalizableText ___centerTorsoLabel) { try { CustomWidgetsFixLanceMechEquipment.Awake(___centerTorsoLabel); } catch (Exception e) { Control.Logger.Error.Log(e); } }
static void Postfix(SGNavigationButton __instance, LocalizableText ___text, List <SGNavFlyoutButton> ___FlyoutButtonList, int ___flyoutButtonCount) { Mod.Log.Trace?.Write($"SGNB:RFTP - entered button {___text.GetParsedText()} with {___flyoutButtonCount} flyout buttons for ID: {__instance.ID}"); if (__instance.ID != DropshipLocation.CPT_QUARTER && !___text.text.Contains("CMD Staff")) { foreach (SGNavFlyoutButton flyoutButton in ___FlyoutButtonList) { flyoutButton.gameObject.SetActive(false); } } }
static void Postfix(CombatHUDActorNameDisplay __instance, LocalizableText ___MechNameText) { if (__instance.DisplayedCombatant != null && __instance.DisplayedCombatant is BattleTech.Building building && ModState.AmbushBuildingGUIDToTurrets.ContainsKey(building.GUID)) { Turret turret = ModState.AmbushBuildingGUIDToTurrets[building.GUID]; Text localText = new Text(turret.DisplayName); ___MechNameText.SetText(localText.ToString()); } }
public virtual void SetLocalization() { localized = true; if (FastMoveBtn != null) { FastMoveBtn.Switch(GameManager.FastStoneMove); } if (FastBackMoveBtn != null) { if (GameManager.FastStoneMove) { FastBackMoveBtn.Switch(true); } else { FastBackMoveBtn.Switch(GameManager.FastStoneBackMove); } } TextMeshProUGUI[] children = RootPanel.GetComponentsInChildren <TextMeshProUGUI>(true); foreach (var t in children) { if (t != null) { string newText = null; if (t.GetType() == typeof(LocalizableText)) { LocalizableText lc = t as LocalizableText; newText = getLocal(lc.Key, lc.text); } else { newText = getLocal(t.name, t.text); } if (t.transform.GetComponentInParent <TextSwitching>() != null) { t.transform.GetComponentInParent <TextSwitching>().Localize(); continue; } if (newText != null) { t.text = newText; } } } }
public static void Postfix(LocalizableText headerLabel) { try { // hides empty locations by default var container = headerLabel.transform.parent; container.gameObject.SetActive(container.transform.childCount > 2); } catch (Exception e) { Control.LogError(e); } }
// This method duplicates functionality of MechLabStockInfoPopup.StockMechDefLoaded static void OverrideStockMechDefLoaded(this MechLabStockInfoPopup __instance, string id, MechDef def) { Logger.Debug("[MechLabStockInfoPopup.OverrideStockMechDefLoaded] called."); MechDef ___stockMechDef = Traverse.Create(__instance).Field("stockMechDef").GetValue <MechDef>(); MechBayMechInfoWidget ___mechInfoWidget = Traverse.Create(__instance).Field("mechInfoWidget").GetValue <MechBayMechInfoWidget>(); DataManager ___dataManager = Traverse.Create(__instance).Field("dataManager").GetValue <DataManager>(); LocalizableText ___descriptionText = Traverse.Create(__instance).Field("descriptionText").GetValue <LocalizableText>(); ___stockMechDef = def; ___mechInfoWidget.SetData(___stockMechDef, ___dataManager); ___descriptionText.SetText(___stockMechDef.Description.Details, Array.Empty <object>()); }
public Dialogue(string id, string technicalName, LocalizableText displayName, LocalizableText text, Features features, List<Pin> pins, List<string> references) : base(id, technicalName, displayName, text, features) { this.pins = pins; this.references = references; }
public Entity(string id, string technicalName, LocalizableText displayName, LocalizableText text, Features features, string previewImage) : base(id, technicalName, displayName, text, features) { this.previewImage = previewImage; }
public Hub(string id, string technicalName, LocalizableText displayName, LocalizableText text, Features features, List<Pin> pins) : base(id, technicalName, displayName, text, features) { this.pins = pins; }
public DialogueFragment() : base() { menuText = new LocalizableText(); stageDirections = new LocalizableText(); speakerIdRef = string.Empty; pins = new List<Pin>(); }
public DialogueFragment(string id, string technicalName, LocalizableText displayName, LocalizableText text, Features features, LocalizableText menuText, LocalizableText stageDirections, string speakerIdRef, List<Pin> pins) : base(id, technicalName, displayName, text, features) { this.menuText = menuText; this.stageDirections = stageDirections; this.speakerIdRef = speakerIdRef; this.pins = pins; }
public Location(string id, string technicalName, LocalizableText displayName, LocalizableText text, Features features) : base(id, technicalName, displayName, text, features) { }
public Jump(string id, string technicalName, LocalizableText displayName, LocalizableText text, Features features, ConnectionRef target, List<Pin> pins) : base(id, technicalName, displayName, text, features) { this.target = target; this.pins = pins; }