added full characte creation support

This commit is contained in:
Sebastian Bularca
2026-04-06 01:05:20 +02:00
parent 419201f2a5
commit 50832c491c
20 changed files with 1037 additions and 265 deletions

View File

@@ -1,3 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@@ -12,6 +13,8 @@ namespace Jovian.InGameLogging.UI {
IGameLogStore store;
LogChannel? channelFilter;
bool autoScroll = true;
bool scrollingToBottom;
Coroutine scrollCoroutine;
readonly List<LogEntryView> activeEntries = new();
readonly Stack<LogEntryView> pool = new();
@@ -76,11 +79,27 @@ namespace Jovian.InGameLogging.UI {
activeEntries.Add(view);
if(autoScroll) {
Canvas.ForceUpdateCanvases();
scrollRect.verticalNormalizedPosition = 0f;
RequestScrollToBottom();
}
}
void RequestScrollToBottom() {
if(scrollCoroutine != null) {
StopCoroutine(scrollCoroutine);
}
scrollCoroutine = StartCoroutine(ScrollToBottomRoutine());
}
IEnumerator ScrollToBottomRoutine() {
scrollingToBottom = true;
yield return null;
LayoutRebuilder.ForceRebuildLayoutImmediate(content);
scrollRect.verticalNormalizedPosition = 0f;
yield return null;
scrollingToBottom = false;
scrollCoroutine = null;
}
void HandleCleared() {
for(int i = activeEntries.Count - 1; i >= 0; i--) {
ReturnToPool(activeEntries[i]);
@@ -104,12 +123,14 @@ namespace Jovian.InGameLogging.UI {
}
if(autoScroll) {
Canvas.ForceUpdateCanvases();
scrollRect.verticalNormalizedPosition = 0f;
RequestScrollToBottom();
}
}
void HandleScrollChanged(Vector2 position) {
if(scrollingToBottom) {
return;
}
autoScroll = position.y <= 0.01f;
}
}