// EffectorEntry private void DecorCardEntry(HoverTextDrawer hoverTextDrawer, EffectorEntry entry) { string text = string.Empty; if (entry.count > 1) { text = string.Format(UI.OVERLAYS.DECOR.COUNT, entry.count); } text = string.Format(UI.OVERLAYS.DECOR.ENTRY, GameUtil.GetFormattedDecor(entry.value, false), entry.name, text); hoverTextDrawer.DrawIcon(__this.iconDash, 18); hoverTextDrawer.DrawText(text, __this.Styles_BodyText.Standard); }
private void DecorCardDetail(HoverTextDrawer hoverTextDrawer) { List <EffectorEntry> positiveEffector = new List <EffectorEntry>(); List <EffectorEntry> negativeEffector = new List <EffectorEntry>(); // Decorの影響を集計する。同時に、影響を与えたもののハイライト表示をする List <DecorProvider> list = new List <DecorProvider>(); GameScenePartitioner.Instance.TriggerEvent(cellPos, GameScenePartitioner.Instance.decorProviderLayer, list); foreach (DecorProvider decorProvider in list) { float decorForCell = decorProvider.GetDecorForCell(cellPos); if (decorForCell == 0f) { continue; } string decorProviderName = decorProvider.GetName(); // Decorに関係するオブジェクトをハイライト表示する KMonoBehaviour component = decorProvider.GetComponent <KMonoBehaviour>(); if (component != null && component.gameObject != null) { SelectToolHoverTextCard.highlightedObjects.Add(component.gameObject); // 完成したモニュメントの場合 if (component.GetComponent <MonumentPart>() != null && component.GetComponent <MonumentPart>().IsMonumentCompleted()) { // 名前をoverrideする decorProviderName = MISC.MONUMENT_COMPLETE.NAME; // 連結したものも全てハイライトする SelectToolHoverTextCard.highlightedObjects.AddRange( AttachableBuilding.GetAttachedNetwork(component.GetComponent <AttachableBuilding>()) ); } } List <EffectorEntry> pos_or_neg = (decorForCell > 0f) ? positiveEffector : negativeEffector; EffectorEntry effector = pos_or_neg.FirstOrDefault(e => e.name == decorProviderName); if (effector == null) { effector = new EffectorEntry(decorProviderName); pos_or_neg.Add(effector); } effector.count++; effector.value += decorForCell; } // 光源効果 int lightDecorBonus = DecorProvider.GetLightDecorBonus(cellPos); if (lightDecorBonus > 0) { positiveEffector.Add(new EffectorEntry(UI.OVERLAYS.DECOR.LIGHTING, (float)lightDecorBonus)); } if (positiveEffector.Count > 0) { hoverTextDrawer.NewLine(26); hoverTextDrawer.DrawText(UI.OVERLAYS.DECOR.HEADER_POSITIVE, __this.Styles_BodyText.Standard); } foreach (EffectorEntry entry in positiveEffector.OrderByDescending(e => e.value)) { hoverTextDrawer.NewLine(18); DecorCardEntry(hoverTextDrawer, entry); } if (negativeEffector.Count > 0) { hoverTextDrawer.NewLine(26); hoverTextDrawer.DrawText(UI.OVERLAYS.DECOR.HEADER_NEGATIVE, __this.Styles_BodyText.Standard); } foreach (EffectorEntry entry in negativeEffector.OrderBy(e => e.value)) { hoverTextDrawer.NewLine(18); DecorCardEntry(hoverTextDrawer, entry); } }