Beispiel #1
0
        // Token: 0x060010BE RID: 4286
        private void UpdateRelicViewHUDState(CollectibleEntityView view)
        {
            // MOD: remove artifact views that are moved off the map
            if (view.Entity.GetComponent(10).Position2D.X > Fixed64.FromInt(100000))
            {
                this.DespawnAndRemoveRelicView(view.Entity, view);
                return;
            }
            // MOD

            SimStateFrame currentSimFrame = ShipbreakersMain.CurrentSimFrame;

            if (currentSimFrame == null)
            {
                return;
            }
            RelicState relicState = currentSimFrame.FindObject <RelicState>(view.Entity);

            if (relicState == null)
            {
                return;
            }
            CollectibleState collectibleState = currentSimFrame.FindObject <CollectibleState>(view.Entity);

            if (collectibleState == null)
            {
                return;
            }
            DetectionState visibility = relicState.Visibility;

            if (ReplayPanelController.RevealAll || SimController.sSpectatorModeEnabled)
            {
                visibility = DetectionState.Sensed;
            }
            bool flag = relicState.HasTimer && relicState.TimerDirection == TimerDirection.Countup && !relicState.TimerCompleted;

            if (collectibleState.AvailableForCollection)
            {
                this.UpdateRelicDefaultIconSprite(view, visibility, flag);
            }
            else
            {
                this.UpdateRelicAttachedIconSprite(view, DetectionState.Sensed, false);
            }
            this.UpdateRelicIconTrackOnScreenEdge(view, !flag);
            bool flag2 = view.ShouldShowIcon();

            view.ShowIcon(flag2);
            if (!flag2 && this.mShowingTooltipForEntity != Entity.None && this.mShowingTooltipForEntity == view.Entity)
            {
                this.mShowingTooltipForEntity = Entity.None;
                UISystem.HideTooltip();
            }
        }
        // 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);
        }