mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 22:35:42 +00:00
Improve Province Info under-attack alert (#8451)
* Improve Province Info attack alert * Collapse inactive under-attack alert row * Move under-attack alert above province info
This commit is contained in:
@@ -9745,6 +9745,7 @@ GameObject:
|
||||
- component: {fileID: 296148958613372072}
|
||||
- component: {fileID: 1445788806017443158}
|
||||
- component: {fileID: 3391666280041911029}
|
||||
- component: {fileID: 900000000000000006}
|
||||
m_Layer: 0
|
||||
m_Name: Standard Left Column
|
||||
m_TagString: Untagged
|
||||
@@ -9764,6 +9765,7 @@ RectTransform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 900000000000000002}
|
||||
- {fileID: 8450970734016342464}
|
||||
- {fileID: 5448146937309441081}
|
||||
- {fileID: 6624731758075026335}
|
||||
@@ -13734,3 +13736,177 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 11e6c1f6549ca4d3b8f3b8d21085e5b2, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &900000000000000001
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 900000000000000002}
|
||||
- component: {fileID: 900000000000000005}
|
||||
- component: {fileID: 900000000000000003}
|
||||
- component: {fileID: 900000000000000004}
|
||||
m_Layer: 0
|
||||
m_Name: Province Under Attack Alert
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!224 &900000000000000002
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 900000000000000001}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8194435045387419553}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &900000000000000003
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 900000000000000001}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.55, g: 0.05, b: 0.04, a: 1}
|
||||
m_RaycastTarget: 0
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: UNDER ATTACK!
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: ec2736df0379a45bfa7349b652fd07d6, type: 2}
|
||||
m_sharedMaterial: {fileID: 1026247389042360723, guid: ec2736df0379a45bfa7349b652fd07d6,
|
||||
type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4278190335
|
||||
m_fontColor: {r: 0.55, g: 0.05, b: 0.04, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 24
|
||||
m_fontSizeBase: 24
|
||||
m_fontWeight: 700
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 2
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_characterHorizontalScale: 1
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_TextWrappingMode: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 1
|
||||
m_ActiveFontFeatures: 6e72656b
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_EmojiFallbackSupport: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 1
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!114 &900000000000000004
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 900000000000000001}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.LayoutElement
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: 34
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: 34
|
||||
m_FlexibleWidth: 1
|
||||
m_FlexibleHeight: 0
|
||||
m_LayoutPriority: 1
|
||||
--- !u!222 &900000000000000005
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 900000000000000001}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &900000000000000006
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7089574085975417824}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9e3a7cbe4e1f4e59a2a57ea40c9f5e29, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
provinceInfoPanelController: {fileID: 5448146937309441222}
|
||||
alertPanel: {fileID: 900000000000000001}
|
||||
alertText: {fileID: 900000000000000003}
|
||||
|
||||
+2
-2
@@ -790,12 +790,12 @@ GameObject:
|
||||
- component: {fileID: 159964988}
|
||||
- component: {fileID: 159964989}
|
||||
m_Layer: 0
|
||||
m_Name: Under Attack Field
|
||||
m_Name: Legacy Under Attack Field
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 2147483647
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!114 &159964988
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
+13
-6
@@ -16,6 +16,9 @@ namespace eagle {
|
||||
|
||||
public class ProvinceInfoPanelController : MonoBehaviour {
|
||||
private IGameModel _model;
|
||||
private bool underAttack;
|
||||
public bool UnderAttack => underAttack;
|
||||
public event Action<bool> UnderAttackChanged;
|
||||
public IGameModel Model { private
|
||||
get => _model;
|
||||
set {
|
||||
@@ -50,7 +53,6 @@ namespace eagle {
|
||||
public GameObject ProvinceDetailsContainer;
|
||||
public TextMeshProUGUI DiplomacyInfoField;
|
||||
public TextMeshProUGUI AsOfField;
|
||||
public TextMeshProUGUI UnderAttackField;
|
||||
|
||||
public TextMeshProUGUI GoldField;
|
||||
public TextMeshProUGUI FoodField;
|
||||
@@ -221,11 +223,8 @@ namespace eagle {
|
||||
x => x.FactionId != Model.PlayerId && x.HeroCount > 0);
|
||||
AsOfField.gameObject.SetActive(false);
|
||||
|
||||
if (ownProvince) {
|
||||
panel.GetComponent<Image>().color =
|
||||
underAttack ? GUIUtils.UnderAttackPanelColor : GUIUtils.PanelColor;
|
||||
UnderAttackField.gameObject.SetActive(underAttack);
|
||||
}
|
||||
panel.GetComponent<Image>().color = GUIUtils.PanelColor;
|
||||
SetUnderAttack(underAttack);
|
||||
|
||||
if (fullInfo.ProvinceOrders != ProvinceOrderType.UnknownOrders) {
|
||||
AsOfField.gameObject.SetActive(false);
|
||||
@@ -302,6 +301,7 @@ namespace eagle {
|
||||
DiplomacyInfoField.gameObject.SetActive(false);
|
||||
ProvinceDetailsContainer.SetActive(false);
|
||||
supportAndIndexContainer.SetActive(false);
|
||||
SetUnderAttack(false);
|
||||
|
||||
entrustImage.gameObject.SetActive(false);
|
||||
developImage.gameObject.SetActive(false);
|
||||
@@ -423,6 +423,13 @@ namespace eagle {
|
||||
}
|
||||
}
|
||||
|
||||
private void SetUnderAttack(bool value) {
|
||||
if (underAttack == value) { return; }
|
||||
|
||||
underAttack = value;
|
||||
UnderAttackChanged?.Invoke(underAttack);
|
||||
}
|
||||
|
||||
private void OnDestroy() { factionTextUpdater?.Dispose(); }
|
||||
}
|
||||
}
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace eagle {
|
||||
public class ProvinceUnderAttackAlertController : MonoBehaviour {
|
||||
private static readonly Color UnderAttackTextColor = new(0.55f, 0.05f, 0.04f);
|
||||
private static readonly Color UnderAttackTextPulseColor = new(1.0f, 0.2f, 0.08f);
|
||||
|
||||
[SerializeField]
|
||||
private ProvinceInfoPanelController provinceInfoPanelController;
|
||||
[SerializeField]
|
||||
private GameObject alertPanel;
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI alertText;
|
||||
|
||||
private void Awake() {
|
||||
provinceInfoPanelController.UnderAttackChanged += SetUnderAttack;
|
||||
SetUnderAttack(provinceInfoPanelController.UnderAttack);
|
||||
}
|
||||
|
||||
private void OnDestroy() {
|
||||
provinceInfoPanelController.UnderAttackChanged -= SetUnderAttack;
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
if (!alertPanel.activeSelf) { return; }
|
||||
|
||||
float pulse = (Mathf.Sin(Time.unscaledTime * Mathf.PI * 2f / 1.2f) + 1f) * 0.5f;
|
||||
alertText.color = Color.Lerp(UnderAttackTextColor, UnderAttackTextPulseColor, pulse);
|
||||
}
|
||||
|
||||
private void SetUnderAttack(bool underAttack) {
|
||||
alertPanel.SetActive(underAttack);
|
||||
if (underAttack) { alertText.color = UnderAttackTextColor; }
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e3a7cbe4e1f4e59a2a57ea40c9f5e29
|
||||
@@ -44,8 +44,6 @@ namespace EagleGUIUtils {
|
||||
public static readonly GUIStyle HeaderStyle;
|
||||
public static readonly Color PanelColor;
|
||||
public static readonly GUIStyle PanelStyle;
|
||||
public static readonly Color UnderAttackPanelColor;
|
||||
public static readonly GUIStyle UnderAttackPanelStyle;
|
||||
|
||||
private static Texture2D fromColor(Color color) {
|
||||
Color[] pix = new Color[1];
|
||||
@@ -79,10 +77,6 @@ namespace EagleGUIUtils {
|
||||
PanelColor = new Color(1.0f, 1.0f, 1.0f, 0.25f);
|
||||
PanelStyle = new GUIStyle();
|
||||
PanelStyle.normal.background = fromColor(PanelColor);
|
||||
|
||||
UnderAttackPanelColor = Color.magenta;
|
||||
UnderAttackPanelStyle = new GUIStyle();
|
||||
UnderAttackPanelStyle.normal.background = fromColor(UnderAttackPanelColor);
|
||||
}
|
||||
|
||||
public static void CenteredLabel(string text, GUIStyle style) {
|
||||
@@ -178,4 +172,4 @@ namespace EagleGUIUtils {
|
||||
return $"<color={colorString}>{province.Name}</color>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user