// Token: 0x06001C47 RID: 7239 RVA: 0x00084580 File Offset: 0x00082780 public static string GetBestBodyNameColored(GameObject bodyObject) { if (bodyObject) { CharacterBody component = bodyObject.GetComponent <CharacterBody>(); if (component) { CharacterMaster master = component.master; if (master) { PlayerCharacterMasterController component2 = master.GetComponent <PlayerCharacterMasterController>(); if (component2) { GameObject networkUserObject = component2.networkUserObject; if (networkUserObject) { NetworkUser component3 = networkUserObject.GetComponent <NetworkUser>(); if (component3) { return(Util.GenerateColoredString(component3.userName, component3.userColor)); } } } } } IDisplayNameProvider component4 = bodyObject.GetComponent <IDisplayNameProvider>(); if (component4 != null) { return(component4.GetDisplayName()); } } return("???"); }
// Token: 0x06002342 RID: 9026 RVA: 0x000A5E0C File Offset: 0x000A400C public void RebuildPing() { base.transform.rotation = Util.QuaternionSafeLookRotation(this.pingNormal); base.transform.parent = (this.pingTarget ? this.pingTarget.transform : null); base.transform.position = (this.pingTarget ? this.pingTarget.transform.position : this.pingOrigin); this.positionIndicator.targetTransform = (this.pingTarget ? this.pingTarget.transform : null); this.positionIndicator.defaultPosition = base.transform.position; IDisplayNameProvider componentInParent = base.GetComponentInParent <IDisplayNameProvider>(); ModelLocator modelLocator = null; this.pingType = PingIndicator.PingType.Default; this.pingObjectScaleCurve.enabled = false; this.pingObjectScaleCurve.enabled = true; GameObject[] array = this.defaultPingGameObjects; for (int i = 0; i < array.Length; i++) { array[i].SetActive(false); } array = this.enemyPingGameObjects; for (int i = 0; i < array.Length; i++) { array[i].SetActive(false); } array = this.interactablePingGameObjects; for (int i = 0; i < array.Length; i++) { array[i].SetActive(false); } if (this.pingTarget) { Debug.LogFormat("Ping target {0}", new object[] { this.pingTarget }); modelLocator = this.pingTarget.GetComponent <ModelLocator>(); if (componentInParent != null) { CharacterBody component = this.pingTarget.GetComponent <CharacterBody>(); if (component) { this.pingType = PingIndicator.PingType.Enemy; base.transform.parent = component.coreTransform; base.transform.position = component.coreTransform.position; } else { this.pingType = PingIndicator.PingType.Interactable; } } } string displayName = this.pingOwner.GetComponent <PlayerCharacterMasterController>().GetDisplayName(); string text = (componentInParent != null) ? componentInParent.GetDisplayName() : ""; this.pingText.enabled = true; this.pingText.text = displayName; switch (this.pingType) { case PingIndicator.PingType.Default: this.pingColor = this.defaultPingColor; this.pingDuration = this.defaultPingDuration; this.pingHighlight.isOn = false; array = this.defaultPingGameObjects; for (int i = 0; i < array.Length; i++) { array[i].SetActive(true); } Chat.AddMessage(string.Format(Language.GetString("PLAYER_PING_DEFAULT"), displayName)); break; case PingIndicator.PingType.Enemy: this.pingColor = this.enemyPingColor; this.pingDuration = this.enemyPingDuration; array = this.enemyPingGameObjects; for (int i = 0; i < array.Length; i++) { array[i].SetActive(true); } if (modelLocator) { Transform modelTransform = modelLocator.modelTransform; if (modelTransform) { CharacterModel component2 = modelTransform.GetComponent <CharacterModel>(); if (component2) { bool flag = false; foreach (CharacterModel.RendererInfo rendererInfo in component2.rendererInfos) { if (!rendererInfo.ignoreOverlays && !flag) { this.pingHighlight.highlightColor = Highlight.HighlightColor.teleporter; this.pingHighlight.targetRenderer = rendererInfo.renderer; this.pingHighlight.strength = 1f; this.pingHighlight.isOn = true; flag = true; } } } } Chat.AddMessage(string.Format(Language.GetString("PLAYER_PING_ENEMY"), displayName, text)); } break; case PingIndicator.PingType.Interactable: { this.pingColor = this.interactablePingColor; this.pingDuration = this.interactablePingDuration; this.pingTargetPurchaseInteraction = this.pingTarget.GetComponent <PurchaseInteraction>(); Sprite sprite = Resources.Load <Sprite>("Textures/MiscIcons/texInventoryIconOutlined"); SpriteRenderer component3 = this.interactablePingGameObjects[0].GetComponent <SpriteRenderer>(); ShopTerminalBehavior component4 = this.pingTarget.GetComponent <ShopTerminalBehavior>(); if (component4) { PickupIndex pickupIndex = component4.CurrentPickupIndex(); text = string.Format(CultureInfo.InvariantCulture, "{0} ({1})", text, component4.pickupIndexIsHidden ? "?" : Language.GetString(pickupIndex.GetPickupNameToken())); } else if (this.pingTarget.gameObject.name.Contains("Shrine")) { sprite = Resources.Load <Sprite>("Textures/MiscIcons/texShrineIconOutlined"); } else if (this.pingTarget.GetComponent <GenericPickupController>()) { sprite = Resources.Load <Sprite>("Textures/MiscIcons/texLootIconOutlined"); this.pingDuration = 60f; } else if (this.pingTarget.GetComponent <TeleporterInteraction>()) { sprite = Resources.Load <Sprite>("Textures/MiscIcons/texTeleporterIconOutlined"); this.pingDuration = 60f; } else if (this.pingTarget.GetComponent <SummonMasterBehavior>()) { sprite = Resources.Load <Sprite>("Textures/MiscIcons/texDroneIconOutlined"); } array = this.interactablePingGameObjects; for (int i = 0; i < array.Length; i++) { array[i].SetActive(true); } base.transform.parent.GetComponentInChildren <Renderer>(); Renderer componentInChildren; if (modelLocator) { componentInChildren = modelLocator.modelTransform.GetComponentInChildren <Renderer>(); } else { componentInChildren = base.transform.parent.GetComponentInChildren <Renderer>(); } if (componentInChildren) { this.pingHighlight.highlightColor = Highlight.HighlightColor.interactive; this.pingHighlight.targetRenderer = componentInChildren; this.pingHighlight.strength = 1f; this.pingHighlight.isOn = true; } component3.sprite = sprite; Chat.AddMessage(string.Format(Language.GetString("PLAYER_PING_INTERACTABLE"), displayName, text)); break; } } this.pingText.color = this.textBaseColor * this.pingColor; this.fixedTimer = this.pingDuration; }
string IDisplayNameProvider.GetDisplayName(int key) => parentDisplayNameProvider.GetDisplayName(key);
public void DefaultProviderTest() { IDisplayNameProvider defaultProvider = DefaultDisplayNameProvider.Instance; Assert.AreEqual("0", defaultProvider.GetDisplayName(0)); Assert.AreEqual("1", defaultProvider.GetDisplayName(1)); Assert.AreEqual("2", defaultProvider.GetDisplayName(2)); Assert.AreEqual("3", defaultProvider.GetDisplayName(3)); Assert.AreEqual("4", defaultProvider.GetDisplayName(4)); Assert.AreEqual("5", defaultProvider.GetDisplayName(5)); Assert.AreEqual("6", defaultProvider.GetDisplayName(6)); Assert.AreEqual("7", defaultProvider.GetDisplayName(7)); Assert.AreEqual("8", defaultProvider.GetDisplayName(8)); Assert.AreEqual("9", defaultProvider.GetDisplayName(9)); Assert.AreEqual("10", defaultProvider.GetDisplayName(10)); Assert.AreEqual("-1", defaultProvider.GetDisplayName(-1)); }