// Token: 0x06001491 RID: 5265 RVA: 0x00083F90 File Offset: 0x00082190 private void UpdateUnitHUDState(UnitView view) { if (view.PresentationControlOnly) { if (view.SensorView != null) { view.SensorView.Enabled = false; } view.UnderlayActive = false; view.AltitudeIndicatorActive = false; return; } SimStateFrame currentSimFrame = ShipbreakersMain.CurrentSimFrame; if (currentSimFrame == null) { return; } UnitState nonInterpolatedTickState = view.NonInterpolatedTickState; if (nonInterpolatedTickState == null || nonInterpolatedTickState.IsDocked) { return; } CommanderRelationship relationship = this.mInteractionProvider.GetRelationship(this.mCommanderManager.LocalCommanderID, nonInterpolatedTickState.OwnerCommander); bool flag = relationship != CommanderRelationship.Self; bool flag2 = relationship == CommanderRelationship.Enemy; DetectionState detectionState = nonInterpolatedTickState.Visibility; if (ReplayPanelController.RevealAll || SimController.sSpectatorModeEnabled) { detectionState = DetectionState.Sensed; } bool flag3 = detectionState == DetectionState.Sensed; bool sTacticalOverlayEnabled = TacticalOverlayController.sTacticalOverlayEnabled; bool underlayActive = Cursor.visible && (view.Selected || view.IsHovered) && sTacticalOverlayEnabled && !this.mSensorsActive && flag3; view.UnderlayActive = underlayActive; bool altitudeIndicatorActive = (view.Selected || this.mSensorsActive || sTacticalOverlayEnabled) && flag3; view.AltitudeIndicatorActive = altitudeIndicatorActive; if (view.SensorView != null) { // MOD bool enabled = !view.IsDriverDead && flag3 && (!flag || !flag2 || (ShipbreakersMain.ReplayMode == ReplayMode.ReplayingGame || mCommanderManager.GetCommanderFromID(mCommanderManager.LocalCommanderID).CommanderAttributes.Name == "SPECTATOR") && MapModManager.EnableEnemySensors); // Check if the player is spectating view.SensorView.IsFriendly = (relationship == CommanderRelationship.Self || relationship == CommanderRelationship.Ally); //MOD view.SensorView.Enabled = enabled; view.SensorView.Mode = (this.mSensorsActive ? UnitSensorView.SensorMode.SensorsView : UnitSensorView.SensorMode.GameView); } view.ForceIconOnlyMode = (this.mSensorsActive && view.ViewAttrs.LODTunings.ForceIconOnlyInSensors); UnitIconController iconControllerForView = this.GetIconControllerForView(view); if (iconControllerForView != null) { iconControllerForView.UpdateIconVisibilityAndSize(currentSimFrame); } }
// Token: 0x06000C54 RID: 3156 RVA: 0x00056D54 File Offset: 0x00054F54 private void PopulatePanelForUnit(Entity entity) { string typeName = entity.GetTypeName(); if (string.IsNullOrEmpty(typeName)) { return; } UnitHUDAttributes entityTypeAttributes = ShipbreakersMain.GetEntityTypeAttributes <UnitHUDAttributes>(typeName); if (entityTypeAttributes == null) { Log.Error(Log.Channel.UI, "Unable to get HUD attributes for entity {0}", new object[] { entity.ToFriendlyString() }); } this.mSettings.UnitNameLabel.text = this.mSettings.UnitNameLocID.TokenFormat(new object[] { (entityTypeAttributes == null) ? typeName : entityTypeAttributes.UnitLocalizedNameStringID }, this.mLocMan); if (this.mSettings.UnitIcon != null) { this.mSettings.UnitIcon.spriteName = ((entityTypeAttributes == null) ? string.Empty : entityTypeAttributes.IconSettings.UnitInfoPanelIconName); } else { Log.Warn(Log.Channel.UI, "Unit Icon is missing from the info panel.", new object[0]); } if (this.mSettings.UnitShortDescriptionValueLabel != null) { this.mLastExperienceState = null; this.mSettings.UnitShortDescriptionValueLabel.text = this.mSettings.UnitNameLocID.TokenFormat(new object[] { (entityTypeAttributes == null) ? string.Empty : entityTypeAttributes.UnitLocalizedShortDescriptionStringID }, this.mLocMan); } else { Log.Warn(Log.Channel.UI, "ShortDescription Value Label is missing from the info panel.", new object[0]); } if (this.mSettings.UnitHealthBar != null && this.mInteractionProvider != null && this.mInteractionProvider != null) { SimStateFrame currentSimFrame = ShipbreakersMain.CurrentSimFrame; UnitState unitState = currentSimFrame.FindObject <UnitState>(entity); CommanderRelationship relationship = this.mInteractionProvider.GetRelationship(unitState.OwnerCommander, this.mCommanderManager.LocalCommanderID); if (relationship != CommanderRelationship.Ally) { if (relationship != CommanderRelationship.Enemy) { this.mSettings.UnitHealthBar.foregroundWidget.color = this.mUnitInteractionAttributes.PlayerIconColours.SelectedColour; } else { this.mSettings.UnitHealthBar.foregroundWidget.color = this.mUnitInteractionAttributes.EnemyIconColours.SelectedColour; } } else { this.mSettings.UnitHealthBar.foregroundWidget.color = this.mUnitInteractionAttributes.AllyIconColours.SelectedColour; } } if (this.mSettings.UnitLongDescriptionValueLabel != null) { this.mSettings.UnitLongDescriptionValueLabel.text = this.mSettings.UnitNameLocID.TokenFormat(new object[] { (entityTypeAttributes == null) ? string.Empty : entityTypeAttributes.UnitLocalizedLongDescriptionStringID }, this.mLocMan); } else { Log.Warn(Log.Channel.UI, "LongDescription Value Label is missing from the info panel.", new object[0]); } this.mSelectedEntity = entity; this.UpdateDynamicDataForUnit(entity); }