zc
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -28,6 +28,8 @@ namespace WulaFallenEmpire.EventSystem.AI
|
||||
private int _expressionId = 2;
|
||||
private bool _overlayWindowOpen = false;
|
||||
private string _overlayWindowEventDefName = null;
|
||||
private float _overlayWindowX = -1f;
|
||||
private float _overlayWindowY = -1f;
|
||||
|
||||
private float _thinkingStartTime;
|
||||
private int _thinkingPhaseIndex = 1;
|
||||
@@ -106,6 +108,8 @@ You are 'The Legion', a super AI of the Wula Empire. Your personality is authori
|
||||
Scribe_Values.Look(ref _expressionId, "WulaAI_ExpressionId", 2);
|
||||
Scribe_Values.Look(ref _overlayWindowOpen, "WulaAI_OverlayWindowOpen", false);
|
||||
Scribe_Values.Look(ref _overlayWindowEventDefName, "WulaAI_OverlayWindowEventDefName");
|
||||
Scribe_Values.Look(ref _overlayWindowX, "WulaAI_OverlayWindowX", -1f);
|
||||
Scribe_Values.Look(ref _overlayWindowY, "WulaAI_OverlayWindowY", -1f);
|
||||
|
||||
if (Scribe.mode == LoadSaveMode.PostLoadInit)
|
||||
{
|
||||
@@ -129,7 +133,15 @@ You are 'The Legion', a super AI of the Wula Empire. Your personality is authori
|
||||
var eventDef = DefDatabase<EventDef>.GetNamedSilentFail(eventDefNameToRestore);
|
||||
if (eventDef != null)
|
||||
{
|
||||
Find.WindowStack.Add(new WulaFallenEmpire.EventSystem.AI.UI.Overlay_WulaLink(eventDef));
|
||||
var newWindow = new WulaFallenEmpire.EventSystem.AI.UI.Overlay_WulaLink(eventDef);
|
||||
Find.WindowStack.Add(newWindow);
|
||||
newWindow.ToggleMinimize(); // Start minimized
|
||||
// Force position after everything else
|
||||
if (_overlayWindowX >= 0f && _overlayWindowY >= 0f)
|
||||
{
|
||||
newWindow.windowRect.x = _overlayWindowX;
|
||||
newWindow.windowRect.y = _overlayWindowY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -142,7 +154,7 @@ You are 'The Legion', a super AI of the Wula Empire. Your personality is authori
|
||||
}
|
||||
}
|
||||
|
||||
public void SetOverlayWindowState(bool isOpen, string eventDefName = null)
|
||||
public void SetOverlayWindowState(bool isOpen, string eventDefName = null, float x = -1f, float y = -1f)
|
||||
{
|
||||
_overlayWindowOpen = isOpen;
|
||||
if (isOpen && !string.IsNullOrEmpty(eventDefName))
|
||||
@@ -153,6 +165,9 @@ You are 'The Legion', a super AI of the Wula Empire. Your personality is authori
|
||||
{
|
||||
_overlayWindowEventDefName = null;
|
||||
}
|
||||
// Always update position if provided
|
||||
if (x >= 0f) _overlayWindowX = x;
|
||||
if (y >= 0f) _overlayWindowY = y;
|
||||
}
|
||||
|
||||
public int ExpressionId => _expressionId;
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace WulaFallenEmpire.EventSystem.AI.UI
|
||||
private int _unreadCount = 0;
|
||||
private Vector2 _expandedSize;
|
||||
private Vector2 _minimizedSize = new Vector2(180f, 40f);
|
||||
private Vector2? _initialPosition = null;
|
||||
|
||||
// Layout Constants
|
||||
private const float HeaderHeight = 50f;
|
||||
@@ -72,6 +73,22 @@ namespace WulaFallenEmpire.EventSystem.AI.UI
|
||||
|
||||
public override Vector2 InitialSize => _isMinimized ? _minimizedSize : _expandedSize;
|
||||
|
||||
public void SetInitialPosition(float x, float y)
|
||||
{
|
||||
_initialPosition = new Vector2(x, y);
|
||||
}
|
||||
|
||||
protected override void SetInitialSizeAndPosition()
|
||||
{
|
||||
base.SetInitialSizeAndPosition();
|
||||
// Override position if we have a saved position
|
||||
if (_initialPosition.HasValue)
|
||||
{
|
||||
windowRect.x = _initialPosition.Value.x;
|
||||
windowRect.y = _initialPosition.Value.y;
|
||||
}
|
||||
}
|
||||
|
||||
public void ToggleMinimize()
|
||||
{
|
||||
_isMinimized = !_isMinimized;
|
||||
@@ -128,7 +145,8 @@ namespace WulaFallenEmpire.EventSystem.AI.UI
|
||||
_core.OnMessageReceived -= OnMessageReceived;
|
||||
_core.OnThinkingStateChanged -= OnThinkingStateChanged;
|
||||
_core.OnExpressionChanged -= OnExpressionChanged;
|
||||
_core.SetOverlayWindowState(false);
|
||||
// Save position before closing
|
||||
_core.SetOverlayWindowState(false, null, windowRect.x, windowRect.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user