UI update 02
This commit is contained in:
@@ -0,0 +1,234 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
[AddComponentMenu("Layout/Flow Layout Group")]
|
||||
public class FlowLayoutGroup : LayoutGroup
|
||||
{
|
||||
[SerializeField] private float spacingX = 10f;
|
||||
[SerializeField] private float spacingY = 10f;
|
||||
[SerializeField] private bool expandChildHeight = false;
|
||||
[SerializeField] private float forcedChildHeight = 120f;
|
||||
|
||||
private readonly List<RowInfo> rows = new List<RowInfo>();
|
||||
private float calculatedPreferredHeight;
|
||||
|
||||
private struct RowInfo
|
||||
{
|
||||
public int startIndex;
|
||||
public int endIndex;
|
||||
public float width;
|
||||
public float height;
|
||||
}
|
||||
|
||||
public float SpacingX
|
||||
{
|
||||
get => spacingX;
|
||||
set => SetProperty(ref spacingX, value);
|
||||
}
|
||||
|
||||
public float SpacingY
|
||||
{
|
||||
get => spacingY;
|
||||
set => SetProperty(ref spacingY, value);
|
||||
}
|
||||
|
||||
public bool ExpandChildHeight
|
||||
{
|
||||
get => expandChildHeight;
|
||||
set => SetProperty(ref expandChildHeight, value);
|
||||
}
|
||||
|
||||
public float ForcedChildHeight
|
||||
{
|
||||
get => forcedChildHeight;
|
||||
set => SetProperty(ref forcedChildHeight, value);
|
||||
}
|
||||
|
||||
public override void CalculateLayoutInputHorizontal()
|
||||
{
|
||||
base.CalculateLayoutInputHorizontal();
|
||||
CalculateRows();
|
||||
float minWidth = padding.horizontal;
|
||||
float preferredWidth = rectTransform.rect.width > 0f ? rectTransform.rect.width : minWidth;
|
||||
SetLayoutInputForAxis(minWidth, preferredWidth, -1f, 0);
|
||||
}
|
||||
|
||||
public override void CalculateLayoutInputVertical()
|
||||
{
|
||||
CalculateRows();
|
||||
SetLayoutInputForAxis(calculatedPreferredHeight, calculatedPreferredHeight, -1f, 1);
|
||||
}
|
||||
|
||||
public override void SetLayoutHorizontal()
|
||||
{
|
||||
CalculateRows();
|
||||
SetChildrenAlongAxis();
|
||||
}
|
||||
|
||||
public override void SetLayoutVertical()
|
||||
{
|
||||
CalculateRows();
|
||||
SetChildrenAlongAxis();
|
||||
}
|
||||
|
||||
private void CalculateRows()
|
||||
{
|
||||
rows.Clear();
|
||||
|
||||
float availableWidth = GetAvailableWidth();
|
||||
|
||||
float currentRowWidth = 0f;
|
||||
float currentRowHeight = 0f;
|
||||
int currentRowStart = 0;
|
||||
bool hasRow = false;
|
||||
|
||||
for (int i = 0; i < rectChildren.Count; i++)
|
||||
{
|
||||
RectTransform child = rectChildren[i];
|
||||
if (child == null) continue;
|
||||
|
||||
float childWidth = Mathf.Max(LayoutUtility.GetPreferredSize(child, 0), LayoutUtility.GetMinSize(child, 0), child.rect.width);
|
||||
float childHeight = expandChildHeight
|
||||
? forcedChildHeight
|
||||
: Mathf.Max(LayoutUtility.GetPreferredSize(child, 1), LayoutUtility.GetMinSize(child, 1), child.rect.height);
|
||||
|
||||
float requiredWidth = hasRow ? currentRowWidth + spacingX + childWidth : childWidth;
|
||||
bool shouldWrap = hasRow && requiredWidth > availableWidth;
|
||||
|
||||
if (shouldWrap)
|
||||
{
|
||||
rows.Add(new RowInfo
|
||||
{
|
||||
startIndex = currentRowStart,
|
||||
endIndex = i - 1,
|
||||
width = currentRowWidth,
|
||||
height = currentRowHeight
|
||||
});
|
||||
|
||||
currentRowStart = i;
|
||||
currentRowWidth = childWidth;
|
||||
currentRowHeight = childHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentRowWidth = hasRow ? requiredWidth : childWidth;
|
||||
currentRowHeight = Mathf.Max(currentRowHeight, childHeight);
|
||||
hasRow = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasRow)
|
||||
{
|
||||
rows.Add(new RowInfo
|
||||
{
|
||||
startIndex = currentRowStart,
|
||||
endIndex = rectChildren.Count - 1,
|
||||
width = currentRowWidth,
|
||||
height = currentRowHeight
|
||||
});
|
||||
}
|
||||
|
||||
calculatedPreferredHeight = padding.vertical;
|
||||
for (int i = 0; i < rows.Count; i++)
|
||||
{
|
||||
calculatedPreferredHeight += rows[i].height;
|
||||
if (i < rows.Count - 1)
|
||||
{
|
||||
calculatedPreferredHeight += spacingY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetChildrenAlongAxis()
|
||||
{
|
||||
float availableWidth = GetAvailableWidth();
|
||||
float y = padding.top;
|
||||
|
||||
for (int rowIndex = 0; rowIndex < rows.Count; rowIndex++)
|
||||
{
|
||||
RowInfo row = rows[rowIndex];
|
||||
float startX = GetRowStartX(availableWidth, row.width);
|
||||
float x = startX;
|
||||
|
||||
for (int i = row.startIndex; i <= row.endIndex; i++)
|
||||
{
|
||||
RectTransform child = rectChildren[i];
|
||||
if (child == null) continue;
|
||||
|
||||
float childWidth = Mathf.Max(LayoutUtility.GetPreferredSize(child, 0), LayoutUtility.GetMinSize(child, 0), child.rect.width);
|
||||
float childHeight = expandChildHeight
|
||||
? forcedChildHeight
|
||||
: Mathf.Max(LayoutUtility.GetPreferredSize(child, 1), LayoutUtility.GetMinSize(child, 1), child.rect.height);
|
||||
|
||||
float offsetY = GetChildVerticalOffset(row.height, childHeight);
|
||||
SetChildAlongAxis(child, 0, x, childWidth);
|
||||
SetChildAlongAxis(child, 1, y + offsetY, childHeight);
|
||||
x += childWidth + spacingX;
|
||||
}
|
||||
|
||||
y += row.height + spacingY;
|
||||
}
|
||||
}
|
||||
|
||||
private float GetRowStartX(float availableWidth, float rowWidth)
|
||||
{
|
||||
TextAnchor anchor = childAlignment;
|
||||
switch (anchor)
|
||||
{
|
||||
case TextAnchor.UpperCenter:
|
||||
case TextAnchor.MiddleCenter:
|
||||
case TextAnchor.LowerCenter:
|
||||
return padding.left + Mathf.Max(0f, (availableWidth - rowWidth) * 0.5f);
|
||||
|
||||
case TextAnchor.UpperRight:
|
||||
case TextAnchor.MiddleRight:
|
||||
case TextAnchor.LowerRight:
|
||||
return padding.left + Mathf.Max(0f, availableWidth - rowWidth);
|
||||
|
||||
default:
|
||||
return padding.left;
|
||||
}
|
||||
}
|
||||
|
||||
private float GetChildVerticalOffset(float rowHeight, float childHeight)
|
||||
{
|
||||
TextAnchor anchor = childAlignment;
|
||||
switch (anchor)
|
||||
{
|
||||
case TextAnchor.MiddleLeft:
|
||||
case TextAnchor.MiddleCenter:
|
||||
case TextAnchor.MiddleRight:
|
||||
return Mathf.Max(0f, (rowHeight - childHeight) * 0.5f);
|
||||
|
||||
case TextAnchor.LowerLeft:
|
||||
case TextAnchor.LowerCenter:
|
||||
case TextAnchor.LowerRight:
|
||||
return Mathf.Max(0f, rowHeight - childHeight);
|
||||
|
||||
default:
|
||||
return 0f;
|
||||
}
|
||||
}
|
||||
|
||||
private float GetAvailableWidth()
|
||||
{
|
||||
float availableWidth = rectTransform.rect.width - padding.horizontal;
|
||||
if (availableWidth > 0f)
|
||||
{
|
||||
return availableWidth;
|
||||
}
|
||||
|
||||
RectTransform parentRect = rectTransform.parent as RectTransform;
|
||||
if (parentRect != null)
|
||||
{
|
||||
availableWidth = parentRect.rect.width - padding.horizontal;
|
||||
if (availableWidth > 0f)
|
||||
{
|
||||
return availableWidth;
|
||||
}
|
||||
}
|
||||
|
||||
return float.PositiveInfinity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24c5b6ddd04e710409080eb450a8a928
|
||||
@@ -7,9 +7,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using DG.Tweening;
|
||||
using JetBrains.Annotations;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Bansonic;
|
||||
@@ -17,26 +15,43 @@ using Bansonic;
|
||||
class UI_Panel_Character : MonoBehaviour
|
||||
{
|
||||
[SerializeField] float anim_Time = 0.5f;
|
||||
[SerializeField, Range(0f, 1f)] float illustrationFadeStartAlpha = 0.25f;
|
||||
float Anim_Speed => 1f / anim_Time;
|
||||
|
||||
[SerializeField] List<Animator> ui_Anim;
|
||||
[SerializeField] Transform content_Character_Slot;
|
||||
[SerializeField] Button button_Character_Slot_Prefab;
|
||||
[SerializeField] GameObject button_Character_Slot_Prefab;
|
||||
[SerializeField] Text text_Character_Name;
|
||||
[SerializeField] Text text_char_name;
|
||||
[SerializeField] Image Image_Character_Illustration;
|
||||
[SerializeField] Image Image_Character_Illustration_BG;
|
||||
|
||||
//[Header("")]
|
||||
|
||||
[Header("buttons")]
|
||||
public Button change_thisHero_skin;
|
||||
public Button thisHero_detail;
|
||||
public Button confirm_thisHero;
|
||||
|
||||
[Header("quit")]
|
||||
[SerializeField] Button quitButton;
|
||||
|
||||
[Header("Data Paths")]
|
||||
[Tooltip("Path relative to Resources folder for Editor mode")]
|
||||
public string editorResourcePath = "so/ally";
|
||||
[Tooltip("Path relative to Resources folder for Runtime mode")]
|
||||
public string runtimeResourcePath = "so/ally";
|
||||
|
||||
private List<AllyHero_SO> allyHeroList = new List<AllyHero_SO>();
|
||||
private readonly List<AllyHero_SO> allyHeroList = new List<AllyHero_SO>();
|
||||
private readonly List<uiui_character_displayPrefab> heroDisplayPrefabs = new List<uiui_character_displayPrefab>();
|
||||
private Vector2 originalIllustrationPos;
|
||||
private Vector2 originalIllustrationBGPos;
|
||||
private bool hasCachedPositions;
|
||||
private Coroutine c_Character_Illustration_Anim;
|
||||
private int previewCharacterIndex = -1;
|
||||
private CanvasGroup illustrationCanvasGroup;
|
||||
|
||||
private const string SAVED_HERO_ID_KEY = "SelectedMainHeroID";
|
||||
|
||||
private void Update()
|
||||
{
|
||||
@@ -45,135 +60,129 @@ class UI_Panel_Character : MonoBehaviour
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
private Vector2 originalIllustrationPos;
|
||||
private Vector2 originalIllustrationBGPos;
|
||||
private bool hasCachedPositions = false;
|
||||
private const string SAVED_HERO_ID_KEY = "SelectedMainHeroID";
|
||||
|
||||
void Start()
|
||||
{
|
||||
UnityEngine.Debug.Log($"[UI_Panel_Character] Start called. Illustration: {Image_Character_Illustration}");
|
||||
|
||||
// 初始化按钮监听
|
||||
if (change_thisHero_skin != null)
|
||||
change_thisHero_skin.onClick.AddListener(() => gNotice.warning.display("此版本未开放皮肤切换功能"));
|
||||
|
||||
change_thisHero_skin.onClick.AddListener(() => gNotice.warning.display("\u6b64\u7248\u672c\u672a\u5f00\u653e\u76ae\u80a4\u5207\u6362\u529f\u80fd"));
|
||||
|
||||
if (thisHero_detail != null)
|
||||
thisHero_detail.onClick.AddListener(() => gNotice.warning.display("此版本未开放详情查看功能"));
|
||||
|
||||
thisHero_detail.onClick.AddListener(() => gNotice.warning.display("\u6b64\u7248\u672c\u672a\u5f00\u653e\u8be6\u60c5\u67e5\u770b\u529f\u80fd"));
|
||||
|
||||
if (confirm_thisHero != null)
|
||||
confirm_thisHero.onClick.AddListener(OnConfirmHeroClicked);
|
||||
|
||||
if (quitButton != null)
|
||||
quitButton.onClick.AddListener(() => gameObject.SetActive(false));
|
||||
|
||||
if (Image_Character_Illustration != null)
|
||||
{
|
||||
// 设置为图示的数值:Pos X: 376, Pos Y: -306
|
||||
Image_Character_Illustration.rectTransform.anchoredPosition = new Vector2(376, -306);
|
||||
|
||||
originalIllustrationPos = Image_Character_Illustration.rectTransform.anchoredPosition;
|
||||
if (Image_Character_Illustration.transform.parent.TryGetComponent(out CanvasGroup canvasGroup))
|
||||
|
||||
if (Image_Character_Illustration.transform.parent != null &&
|
||||
Image_Character_Illustration.transform.parent.TryGetComponent(out CanvasGroup canvasGroup))
|
||||
{
|
||||
canvasGroup.alpha = 0;
|
||||
illustrationCanvasGroup = canvasGroup;
|
||||
illustrationCanvasGroup.alpha = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Image_Character_Illustration_BG != null)
|
||||
{
|
||||
// 设置运行时 X 值为 376
|
||||
Vector2 pos = Image_Character_Illustration_BG.rectTransform.anchoredPosition;
|
||||
pos.x = 376;
|
||||
Image_Character_Illustration_BG.rectTransform.anchoredPosition = pos;
|
||||
|
||||
originalIllustrationBGPos = Image_Character_Illustration_BG.rectTransform.anchoredPosition;
|
||||
}
|
||||
|
||||
hasCachedPositions = true;
|
||||
|
||||
foreach (var item in ui_Anim)
|
||||
{
|
||||
if (item != null) item.speed = Anim_Speed;
|
||||
if (item != null)
|
||||
item.speed = Anim_Speed;
|
||||
}
|
||||
|
||||
|
||||
if (content_Character_Slot != null)
|
||||
content_Character_Slot.Get_Childrens_Component<UI_Button_Character_Head_Slot>(true, true);
|
||||
|
||||
// Load AllyHero_SO data
|
||||
string path = Application.isEditor ? editorResourcePath : runtimeResourcePath;
|
||||
var loadedData = Resources.LoadAll<AllyHero_SO>(path);
|
||||
allyHeroList = new List<AllyHero_SO>(loadedData);
|
||||
|
||||
UnityEngine.Debug.Log($"[UI_Panel_Character] Loaded {allyHeroList.Count} heroes from {path}");
|
||||
var loadedData = RuntimeResourcesCache.LoadAllAllyHeroes();
|
||||
allyHeroList.Clear();
|
||||
allyHeroList.AddRange(loadedData);
|
||||
heroDisplayPrefabs.Clear();
|
||||
|
||||
UnityEngine.Debug.Log($"[UI_Panel_Character] Loaded {allyHeroList.Count} heroes");
|
||||
|
||||
// Ensure consistent order with UI_Panel_Main
|
||||
allyHeroList.Sort((a, b) => a.ally_heroID.CompareTo(b.ally_heroID));
|
||||
|
||||
// 读取保存的角色 ID
|
||||
int savedHeroID = PlayerPrefs.GetInt(SAVED_HERO_ID_KEY, -1);
|
||||
int initialIndex = 0;
|
||||
|
||||
for (int i = 0; i < allyHeroList.Count; i++)
|
||||
{
|
||||
var obj = Instantiate(button_Character_Slot_Prefab, content_Character_Slot);
|
||||
|
||||
// Register UI sounds for the newly instantiated button
|
||||
UISystemBootstrap.RegisterHierarchy(obj.gameObject);
|
||||
var slotObject = Instantiate(button_Character_Slot_Prefab, content_Character_Slot);
|
||||
var displayPrefab = slotObject.GetComponent<uiui_character_displayPrefab>();
|
||||
var slotButton = displayPrefab != null ? displayPrefab.characterProfileButton : slotObject.GetComponent<Button>();
|
||||
if (slotButton == null && slotObject.transform.parent != null)
|
||||
{
|
||||
slotButton = slotObject.transform.parent.GetComponent<Button>();
|
||||
}
|
||||
|
||||
UISystemBootstrap.RegisterHierarchy(slotObject);
|
||||
|
||||
var data = allyHeroList[i];
|
||||
|
||||
// 如果 ID 匹配,设置初始索引
|
||||
if (savedHeroID != -1 && data.ally_heroID == savedHeroID)
|
||||
{
|
||||
initialIndex = i;
|
||||
}
|
||||
|
||||
if (obj.image != null)
|
||||
if (displayPrefab != null)
|
||||
{
|
||||
obj.image.sprite = data.ally_heroSelectIcon;
|
||||
obj.image.preserveAspect = true; // 保持比例,防止拉伸变形
|
||||
obj.image.type = Image.Type.Simple; // 确保是普通显示模式
|
||||
|
||||
// 确保 RectTransform 撑满父物体并居中
|
||||
obj.image.rectTransform.anchorMin = Vector2.zero;
|
||||
obj.image.rectTransform.anchorMax = Vector2.one;
|
||||
obj.image.rectTransform.sizeDelta = Vector2.zero;
|
||||
obj.image.rectTransform.anchoredPosition = Vector2.zero;
|
||||
displayPrefab.SetDisplay(data.ally_heroSelectIcon, data.ally_heroID);
|
||||
}
|
||||
heroDisplayPrefabs.Add(displayPrefab);
|
||||
|
||||
if (obj.TryGetComponent(out UI_Button_Character_Head_Slot head_Slot))
|
||||
if (slotObject.TryGetComponent(out UI_Button_Character_Head_Slot head_Slot))
|
||||
{
|
||||
head_Slot.index = i;
|
||||
int capturedIndex = i;
|
||||
obj.onClick.AddListener(() => Set_Character_Index(capturedIndex));
|
||||
if (slotButton != null)
|
||||
{
|
||||
slotButton.onClick.AddListener(() => Set_Character_Index(capturedIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 应用初始索引(来自保存的 ID 或默认 0)
|
||||
|
||||
previewCharacterIndex = initialIndex;
|
||||
UI_Panel_Main.Singleton.Character_Index = initialIndex;
|
||||
|
||||
// Initial character display
|
||||
Set_Character();
|
||||
RefreshSelectedState(false);
|
||||
}
|
||||
|
||||
public void Set_Character_Index(int index)
|
||||
{
|
||||
if (UI_Panel_Main.Singleton.Character_Index == index) return;
|
||||
UI_Panel_Main.Singleton.Character_Index = index;
|
||||
if (previewCharacterIndex == index)
|
||||
return;
|
||||
|
||||
previewCharacterIndex = index;
|
||||
Set_Character();
|
||||
|
||||
// 人性化逻辑:点击头像即自动设为看板并保存,并显示提示内容
|
||||
SaveCurrentCharacter(true);
|
||||
RefreshSelectedState(true);
|
||||
}
|
||||
|
||||
private void OnConfirmHeroClicked()
|
||||
{
|
||||
if (SaveCurrentCharacter(true))
|
||||
{
|
||||
// 确认按钮逻辑:保存后禁用自身物体(隐藏面板)
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private bool SaveCurrentCharacter(bool showNotice)
|
||||
{
|
||||
int currentIndex = UI_Panel_Main.Singleton.Character_Index;
|
||||
int currentIndex = GetCurrentPreviewIndex();
|
||||
if (allyHeroList != null && currentIndex >= 0 && currentIndex < allyHeroList.Count)
|
||||
{
|
||||
int heroID = allyHeroList[currentIndex].ally_heroID;
|
||||
@@ -182,57 +191,104 @@ class UI_Panel_Character : MonoBehaviour
|
||||
|
||||
if (showNotice)
|
||||
{
|
||||
gNotice.alarm.display($"已将 {allyHeroList[currentIndex].ally_heroName} 设置为记录对象。");
|
||||
gNotice.alarm.display($"\u5df2\u5c06 {allyHeroList[currentIndex].ally_heroName} \u8bbe\u7f6e\u4e3a\u770b\u677f\u5bf9\u8c61\u3002");
|
||||
}
|
||||
|
||||
// 同步更新主面板的看板图
|
||||
previewCharacterIndex = currentIndex;
|
||||
UI_Panel_Main.Singleton.Character_Index = currentIndex;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
previewCharacterIndex = UI_Panel_Main.Singleton != null ? UI_Panel_Main.Singleton.Character_Index : previewCharacterIndex;
|
||||
Set_Character();
|
||||
RefreshSelectedState(false);
|
||||
}
|
||||
Coroutine c_Character_Illustration_Anim;
|
||||
|
||||
private void RefreshSelectedState(bool animated)
|
||||
{
|
||||
int selectedIndex = GetCurrentPreviewIndex();
|
||||
for (int i = 0; i < heroDisplayPrefabs.Count; i++)
|
||||
{
|
||||
if (heroDisplayPrefabs[i] != null)
|
||||
{
|
||||
heroDisplayPrefabs[i].SetSelected(i == selectedIndex, animated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int GetCurrentPreviewIndex()
|
||||
{
|
||||
if (previewCharacterIndex >= 0 && previewCharacterIndex < allyHeroList.Count)
|
||||
{
|
||||
return previewCharacterIndex;
|
||||
}
|
||||
|
||||
if (UI_Panel_Main.Singleton != null)
|
||||
{
|
||||
return UI_Panel_Main.Singleton.Character_Index;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void Set_Character()
|
||||
{
|
||||
if (Image_Character_Illustration == null || illustrationCanvasGroup == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (c_Character_Illustration_Anim != null)
|
||||
{
|
||||
StopCoroutine(c_Character_Illustration_Anim);
|
||||
c_Character_Illustration_Anim = null;
|
||||
}
|
||||
if (Image_Character_Illustration.transform.parent.TryGetComponent(out CanvasGroup canvasGroup))
|
||||
{
|
||||
c_Character_Illustration_Anim = StartCoroutine(C_Character_Illustration_Anim(canvasGroup, Set_Character_Show));
|
||||
}
|
||||
|
||||
illustrationCanvasGroup.DOKill();
|
||||
Set_Character_Show();
|
||||
illustrationCanvasGroup.alpha = illustrationFadeStartAlpha;
|
||||
illustrationCanvasGroup.DOFade(1f, anim_Time * 0.6f)
|
||||
.SetEase(Ease.OutCubic)
|
||||
.SetLink(illustrationCanvasGroup.gameObject);
|
||||
}
|
||||
|
||||
public void Set_Character_Show()
|
||||
{
|
||||
int index = UI_Panel_Main.Singleton.Character_Index;
|
||||
if (allyHeroList == null || index < 0 || index >= allyHeroList.Count) return;
|
||||
int index = GetCurrentPreviewIndex();
|
||||
if (allyHeroList.Count == 0 || index < 0 || index >= allyHeroList.Count)
|
||||
return;
|
||||
|
||||
// 停止之前的 Tween 以防冲突
|
||||
Image_Character_Illustration.rectTransform.DOKill();
|
||||
Image_Character_Illustration_BG.rectTransform.DOKill();
|
||||
text_Character_Name.DOKill();
|
||||
if (text_char_name != null)
|
||||
{
|
||||
text_char_name.DOKill();
|
||||
}
|
||||
|
||||
var data = allyHeroList[index];
|
||||
|
||||
// 使用初始缓存的坐标,防止频繁点击导致的偏移累积
|
||||
Vector2 targetPos1 = hasCachedPositions ? originalIllustrationPos : Image_Character_Illustration.rectTransform.anchoredPosition;
|
||||
|
||||
Vector2 targetPos1 = hasCachedPositions
|
||||
? originalIllustrationPos
|
||||
: Image_Character_Illustration.rectTransform.anchoredPosition;
|
||||
Image_Character_Illustration.sprite = data.ally_hero_HD_image;
|
||||
|
||||
// 动画:从左侧 200 像素滑入到目标位置
|
||||
|
||||
float startX1 = targetPos1.x - 200;
|
||||
Image_Character_Illustration.rectTransform.anchoredPosition = new Vector2(startX1, targetPos1.y);
|
||||
Image_Character_Illustration.rectTransform.DOAnchorPos(targetPos1, anim_Time)
|
||||
.SetEase(Ease.OutCubic)
|
||||
.SetLink(Image_Character_Illustration.gameObject);
|
||||
|
||||
Vector2 targetPosBG = hasCachedPositions ? originalIllustrationBGPos : Image_Character_Illustration_BG.rectTransform.anchoredPosition;
|
||||
Vector2 targetPosBG = hasCachedPositions
|
||||
? originalIllustrationBGPos
|
||||
: Image_Character_Illustration_BG.rectTransform.anchoredPosition;
|
||||
Image_Character_Illustration_BG.sprite = data.ally_hero_HD_image;
|
||||
|
||||
|
||||
float startXBG = targetPosBG.x - 200;
|
||||
Image_Character_Illustration_BG.rectTransform.anchoredPosition = new Vector2(startXBG, targetPosBG.y);
|
||||
Image_Character_Illustration_BG.rectTransform.DOAnchorPos(targetPosBG, anim_Time)
|
||||
@@ -246,19 +302,13 @@ class UI_Panel_Character : MonoBehaviour
|
||||
text_Character_Name.DOText(text, anim_Time)
|
||||
.SetEase(Ease.Linear)
|
||||
.SetLink(text_Character_Name.gameObject);
|
||||
}
|
||||
IEnumerator C_Character_Illustration_Anim(CanvasGroup canvasGroup, Action onHide)
|
||||
{
|
||||
while (canvasGroup.alpha > 0)
|
||||
|
||||
if (text_char_name != null)
|
||||
{
|
||||
canvasGroup.alpha -= Anim_Speed * Time.deltaTime;
|
||||
yield return null;
|
||||
}
|
||||
onHide?.Invoke();
|
||||
while (canvasGroup.alpha < 1)
|
||||
{
|
||||
canvasGroup.alpha += Anim_Speed * Time.deltaTime;
|
||||
yield return null;
|
||||
text_char_name.text = string.Empty;
|
||||
text_char_name.DOText(text, anim_Time)
|
||||
.SetEase(Ease.Linear)
|
||||
.SetLink(text_char_name.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +160,12 @@ public class UI_Panel_Mail : MonoBehaviour
|
||||
if (slot.mailTitle != null) slot.mailTitle.text = mail.mail_title;
|
||||
if (slot.mailSender != null) slot.mailSender.text = mail.mail_sender;
|
||||
if (slot.mailTime != null) slot.mailTime.text = mail.mail_date;
|
||||
if (slot.mailImage != null) slot.mailImage.sprite = mail.mail_image;
|
||||
if (slot.mailImage != null)
|
||||
{
|
||||
slot.mailImage.sprite = mail.mail_image;
|
||||
}
|
||||
slot.RefreshRewardsWithMailText(mail);
|
||||
slot.RefreshRewardPreviews(mail);
|
||||
TryBindServerMailImage(mail, slot);
|
||||
UpdateSlotVisuals(slot, mail);
|
||||
SetSelectedState(slot, false);
|
||||
@@ -295,7 +300,8 @@ public class UI_Panel_Mail : MonoBehaviour
|
||||
reward_description = rewardEntry.reward_description ?? string.Empty,
|
||||
reward_key = rewardEntry.reward_key ?? string.Empty,
|
||||
reward_store_item_id = rewardEntry.reward_store_item_id,
|
||||
reward_image = null
|
||||
reward_image = null,
|
||||
reward_icon_url = rewardEntry.reward_icon_url ?? string.Empty
|
||||
};
|
||||
MailRewardGrantService.PopulateRewardDisplay(reward);
|
||||
mail.rewardList.Add(reward);
|
||||
@@ -418,10 +424,7 @@ public class UI_Panel_Mail : MonoBehaviour
|
||||
var go = Instantiate(rewardSlotPrefab, content_Reward_Slot);
|
||||
var slot = go.GetComponent<rewardSlotPrefab>();
|
||||
if (slot == null) continue;
|
||||
if (slot.rewardName != null) slot.rewardName.text = reward.rewardName;
|
||||
if (slot.rewardAmount != null) slot.rewardAmount.text = reward.reward_ammount == 1 ? string.Empty : reward.reward_ammount.ToString();
|
||||
if (slot.rewardIcon != null) slot.rewardIcon.sprite = reward.reward_image;
|
||||
if (slot.detailText != null) slot.detailText.text = reward.reward_description;
|
||||
slot.BindReward(reward);
|
||||
if (slot.detailBtm != null) slot.detailBtm.SetActive(false);
|
||||
}
|
||||
|
||||
@@ -486,17 +489,20 @@ public class UI_Panel_Mail : MonoBehaviour
|
||||
if (mail.mail_image != null)
|
||||
{
|
||||
slot.mailImage.sprite = mail.mail_image;
|
||||
SetMailImageVisible(slot, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_serverMailImageUrls.TryGetValue(mail.mail_id, out string url) || string.IsNullOrWhiteSpace(url))
|
||||
{
|
||||
SetMailImageVisible(slot, false);
|
||||
return;
|
||||
}
|
||||
|
||||
string normalizedUrl = NormalizeMailImageUrl(url);
|
||||
if (string.IsNullOrWhiteSpace(normalizedUrl))
|
||||
{
|
||||
SetMailImageVisible(slot, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -504,6 +510,7 @@ public class UI_Panel_Mail : MonoBehaviour
|
||||
{
|
||||
mail.mail_image = cachedSprite;
|
||||
slot.mailImage.sprite = cachedSprite;
|
||||
SetMailImageVisible(slot, true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -512,6 +519,7 @@ public class UI_Panel_Mail : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
SetMailImageVisible(slot, false);
|
||||
StartCoroutine(LoadServerMailImageRoutine(normalizedUrl, mail, slot));
|
||||
}
|
||||
|
||||
@@ -547,6 +555,7 @@ public class UI_Panel_Mail : MonoBehaviour
|
||||
if (slot != null && slot.mailImage != null)
|
||||
{
|
||||
slot.mailImage.sprite = sprite;
|
||||
SetMailImageVisible(slot, true);
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -556,6 +565,20 @@ public class UI_Panel_Mail : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetMailImageVisible(mailSlotPrefab slot, bool visible)
|
||||
{
|
||||
if (slot == null || slot.mailImage == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject imageObject = slot.mailImage.gameObject;
|
||||
if (imageObject != null && imageObject.activeSelf != visible)
|
||||
{
|
||||
imageObject.SetActive(visible);
|
||||
}
|
||||
}
|
||||
|
||||
string NormalizeMailImageUrl(string imageUrl)
|
||||
{
|
||||
string trimmed = imageUrl?.Trim() ?? string.Empty;
|
||||
@@ -1287,6 +1310,53 @@ public static class MailRewardGrantService
|
||||
}
|
||||
}
|
||||
|
||||
public static bool TryGetRewardRarity(mail_so.rewardItem reward, out ItemRarity rarity)
|
||||
{
|
||||
rarity = ItemRarity.None;
|
||||
if (reward == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
EnsureAssetsLoaded();
|
||||
int amount = Mathf.Max(1, reward.reward_ammount);
|
||||
string rewardKey = string.IsNullOrWhiteSpace(reward.reward_key) ? string.Empty : reward.reward_key.Trim();
|
||||
string rewardName = string.IsNullOrWhiteSpace(reward.rewardName) ? string.Empty : reward.rewardName.Trim();
|
||||
|
||||
if (TryFindStoreItemReference(reward, rewardKey, rewardName, out storeItemSO storeItem) && storeItem != null)
|
||||
{
|
||||
rarity = storeItem.itemRarity;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (reward.reward_Type == mail_so.reward_type.expBottles_allies)
|
||||
{
|
||||
if (TryResolveExpBottle(reward, rewardKey, rewardName, amount, out ResolvedReward resolved) && resolved != null && resolved.ExpBottleAsset != null)
|
||||
{
|
||||
rarity = resolved.ExpBottleAsset.itemRarity;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (reward.reward_Type == mail_so.reward_type.growth_material)
|
||||
{
|
||||
if (TryResolveGrowthMaterial(reward, rewardKey, rewardName, amount, out ResolvedReward resolved) && resolved != null && resolved.GrowthMaterialAsset != null)
|
||||
{
|
||||
rarity = resolved.GrowthMaterialAsset.itemRarity;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (reward.reward_Type == mail_so.reward_type.equipment_consumable)
|
||||
{
|
||||
if (TryResolveEquipmentConsumable(reward, rewardKey, rewardName, amount, out ResolvedReward resolved) && resolved != null && resolved.EquipmentConsumableAsset != null)
|
||||
{
|
||||
rarity = resolved.EquipmentConsumableAsset.itemRarity;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool TryGrantAll(mail_so mail, out string failureMessage)
|
||||
{
|
||||
failureMessage = string.Empty;
|
||||
@@ -1482,6 +1552,21 @@ public static class MailRewardGrantService
|
||||
{
|
||||
StoreItemsByName[item.name] = item;
|
||||
}
|
||||
|
||||
// expBottlesSO / growthMaterialSO / equipmentConsumableSO live outside Resources,
|
||||
// so Resources.LoadAll returns nothing. Backfill from storeItemSO direct references instead.
|
||||
if (item.associatedExpBottle != null && !ExpBottleAssets.ContainsKey(item.associatedExpBottle.bottleKind))
|
||||
{
|
||||
ExpBottleAssets[item.associatedExpBottle.bottleKind] = item.associatedExpBottle;
|
||||
}
|
||||
if (item.associatedGrowthMaterial != null && !GrowthMaterialAssets.ContainsKey(item.associatedGrowthMaterial.materialKind))
|
||||
{
|
||||
GrowthMaterialAssets[item.associatedGrowthMaterial.materialKind] = item.associatedGrowthMaterial;
|
||||
}
|
||||
if (item.associatedEquipmentConsumable != null && !EquipmentConsumableAssets.ContainsKey(item.associatedEquipmentConsumable.consumableKind))
|
||||
{
|
||||
EquipmentConsumableAssets[item.associatedEquipmentConsumable.consumableKind] = item.associatedEquipmentConsumable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
|
||||
private IEnumerator InitDataRoutine()
|
||||
{
|
||||
var rawData = Resources.LoadAll<AllyHero_SO>("so/ally");
|
||||
var rawData = RuntimeResourcesCache.LoadAllAllyHeroes();
|
||||
data_List = new List<AllyHero_SO>(rawData);
|
||||
|
||||
data_List.Sort((a, b) => a.ally_heroID.CompareTo(b.ally_heroID));
|
||||
@@ -318,7 +318,7 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
button_Story.onClick.AddListener(
|
||||
() =>
|
||||
{
|
||||
gNotice.warning.display("此版本未开放该功能");
|
||||
gNotice.error.display("功能未开放");
|
||||
//Try_Open_Panel(ui_Panel_Story);
|
||||
});
|
||||
if (button_Idol != null)
|
||||
@@ -486,10 +486,19 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
|
||||
IEnumerator LoadSelectSceneAsync()
|
||||
{
|
||||
if (gTransition.LoadScene(ui_Select_Music_Scene_Name, LoadSceneMode.Single))
|
||||
{
|
||||
while (gTransition.IsBusy)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(ui_Select_Music_Scene_Name, LoadSceneMode.Single);
|
||||
|
||||
// Documentation text normalized.
|
||||
while (!asyncLoad.isDone)
|
||||
while (asyncLoad != null && !asyncLoad.isDone)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
@@ -1538,7 +1538,7 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 8cdc81ed9eb4f4a41bdad444afbea4c2, type: 3}
|
||||
m_Type: 3
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 1
|
||||
@@ -5956,7 +5956,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreReversedGraphics: 1
|
||||
m_IgnoreReversedGraphics: 0
|
||||
m_BlockingObjects: 0
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -124,12 +124,15 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
private Coroutine musicPicFade;
|
||||
private bool musicPicVisible = true;
|
||||
private bool navSceneLoading = false;
|
||||
private Coroutine deferredUiRefreshRoutine;
|
||||
private bool lastSettingsVisibilityState;
|
||||
private bool lastOverlayPanelsVisibilityState;
|
||||
private readonly Dictionary<string, int> guideIndexByScene = new Dictionary<string, int>();
|
||||
private string currentGuideScene = string.Empty;
|
||||
private static btmandtopController activeInstance;
|
||||
private RectTransform topNavigationRoot;
|
||||
private bool topNavigationGeometryDirty = true;
|
||||
private int lastTopNavigationParentChildCount = -1;
|
||||
|
||||
private static readonly List<string> sceneHistory = new List<string>();
|
||||
private static bool sceneHistoryHooked = false;
|
||||
@@ -203,6 +206,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
|
||||
BindNewBackButtons();
|
||||
EnsureTopNavigationFront();
|
||||
ScheduleDeferredUiRefresh();
|
||||
|
||||
EnsureMusicPicRoot();
|
||||
SetupMusicPicDefault();
|
||||
@@ -279,14 +283,11 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
if (userInfoInstance == null)
|
||||
{
|
||||
userInfoInstance = Instantiate(userInfo_prefab, putPrefabsHere.transform);
|
||||
TryAssignCanvasCamera(userInfoInstance);
|
||||
PlacePanelBelowSettings(userInfoInstance);
|
||||
userInfoInstance.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
userInfoInstance.transform.SetParent(putPrefabsHere.transform, false);
|
||||
PlacePanelBelowSettings(userInfoInstance);
|
||||
userInfoInstance.SetActive(false);
|
||||
}
|
||||
}
|
||||
@@ -874,43 +875,16 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
|
||||
private void ToggleUserInfoPrefab()
|
||||
{
|
||||
if (userInfo_prefab == null || putPrefabsHere == null) return;
|
||||
|
||||
if (userInfoInstance == null)
|
||||
if (ToggleIfAlreadyOpen(ref userInfoInstance))
|
||||
{
|
||||
userInfoInstance = Instantiate(userInfo_prefab, putPrefabsHere.transform);
|
||||
TryAssignCanvasCamera(userInfoInstance);
|
||||
PlacePanelBelowSettings(userInfoInstance);
|
||||
userInfoInstance.SetActive(true);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
RegisterManagedPanel(userInfoInstance, () =>
|
||||
{
|
||||
if (userInfoInstance != null)
|
||||
{
|
||||
userInfoInstance.SetActive(false);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
}
|
||||
});
|
||||
EnsureTopNavigationFront();
|
||||
return;
|
||||
}
|
||||
|
||||
userInfoInstance.transform.SetParent(putPrefabsHere.transform, false);
|
||||
userInfoInstance.SetActive(!userInfoInstance.activeSelf);
|
||||
if (userInfoInstance.activeSelf)
|
||||
if (OpenPrefab(userInfo_prefab, ref userInfoInstance))
|
||||
{
|
||||
PlacePanelBelowSettings(userInfoInstance);
|
||||
RegisterManagedPanel(userInfoInstance, () =>
|
||||
{
|
||||
if (userInfoInstance != null)
|
||||
{
|
||||
userInfoInstance.SetActive(false);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
}
|
||||
});
|
||||
CloseInfoPanels(userInfoInstance);
|
||||
RegisterManagedPanel(userInfoInstance, () => CloseManagedOverlay(userInfoInstance));
|
||||
}
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
EnsureTopNavigationFront();
|
||||
}
|
||||
|
||||
private void BroadcastSettingsVisibility(bool visible)
|
||||
@@ -951,6 +925,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
lastOverlayPanelsVisibilityState = visible;
|
||||
CurrentOverlayPanelsVisible = visible;
|
||||
GlobalOverlayPanelVisibilityChanged?.Invoke(visible);
|
||||
topNavigationGeometryDirty = true;
|
||||
EnsureTopNavigationFront();
|
||||
}
|
||||
|
||||
@@ -1079,7 +1054,6 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
if (instance == null)
|
||||
{
|
||||
instance = Instantiate(prefab, putPrefabsHere.transform);
|
||||
TryAssignCanvasCamera(instance);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1097,7 +1071,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
instance.SetActive(true);
|
||||
}
|
||||
|
||||
PlacePanelBelowSettings(instance);
|
||||
TryAssignCanvasCamera(instance);
|
||||
BroadcastOverlayPanelsVisibility();
|
||||
EnsureTopNavigationFront();
|
||||
return true;
|
||||
@@ -1114,30 +1088,9 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
settingsInstance.transform.SetAsLastSibling();
|
||||
}
|
||||
|
||||
private void PlacePanelBelowSettings(GameObject instance)
|
||||
{
|
||||
if (instance == null || putPrefabsHere == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
instance.transform.SetParent(putPrefabsHere.transform, false);
|
||||
|
||||
if (settingsInstance == null || instance == settingsInstance)
|
||||
{
|
||||
instance.transform.SetAsLastSibling();
|
||||
return;
|
||||
}
|
||||
|
||||
EnsureSettingsLastSibling();
|
||||
int settingsIndex = settingsInstance.transform.GetSiblingIndex();
|
||||
int targetIndex = Mathf.Clamp(settingsIndex, 0, putPrefabsHere.transform.childCount - 1);
|
||||
instance.transform.SetSiblingIndex(targetIndex);
|
||||
EnsureSettingsLastSibling();
|
||||
}
|
||||
|
||||
private void CloseInfoPanels(GameObject keep)
|
||||
{
|
||||
CloseInstance(ref userInfoInstance, keep);
|
||||
CloseInstance(ref storeInstance, keep);
|
||||
CloseInstance(ref showLevelInstance, keep);
|
||||
CloseInstance(ref emailInstance, keep);
|
||||
@@ -1292,9 +1245,27 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
if (topNavigationRoot.GetSiblingIndex() != parent.childCount - 1)
|
||||
{
|
||||
topNavigationRoot.SetAsLastSibling();
|
||||
topNavigationGeometryDirty = true;
|
||||
}
|
||||
|
||||
RefreshTopNavigationGeometry();
|
||||
// The parent's child count changing means a panel was shown/hidden, which can
|
||||
// shift the top-bar layout. Use it as a cheap heuristic to re-settle geometry.
|
||||
if (parent.childCount != lastTopNavigationParentChildCount)
|
||||
{
|
||||
lastTopNavigationParentChildCount = parent.childCount;
|
||||
topNavigationGeometryDirty = true;
|
||||
}
|
||||
|
||||
if (topNavigationGeometryDirty)
|
||||
{
|
||||
topNavigationGeometryDirty = false;
|
||||
RefreshTopNavigationGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
public void MarkTopNavigationGeometryDirty()
|
||||
{
|
||||
topNavigationGeometryDirty = true;
|
||||
}
|
||||
|
||||
private void ResolveTopNavigationRoot()
|
||||
@@ -1411,6 +1382,40 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
}
|
||||
}
|
||||
trackedCurrentScene = incoming;
|
||||
|
||||
if (activeInstance != null)
|
||||
{
|
||||
activeInstance.topNavigationGeometryDirty = true;
|
||||
activeInstance.EnsureTopNavigationFront();
|
||||
activeInstance.ScheduleDeferredUiRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
private void ScheduleDeferredUiRefresh()
|
||||
{
|
||||
if (!isActiveAndEnabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (deferredUiRefreshRoutine != null)
|
||||
{
|
||||
StopCoroutine(deferredUiRefreshRoutine);
|
||||
}
|
||||
|
||||
deferredUiRefreshRoutine = StartCoroutine(DeferredUiRefreshRoutine());
|
||||
}
|
||||
|
||||
private System.Collections.IEnumerator DeferredUiRefreshRoutine()
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
yield return null;
|
||||
topNavigationGeometryDirty = true;
|
||||
EnsureTopNavigationFront();
|
||||
}
|
||||
|
||||
deferredUiRefreshRoutine = null;
|
||||
}
|
||||
|
||||
private static string PopPreviousSceneName(string currentScene)
|
||||
@@ -1490,11 +1495,23 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
|
||||
navSceneLoading = true;
|
||||
Time.timeScale = 1f;
|
||||
|
||||
if (gTransition.LoadScene(sceneName, LoadSceneMode.Single))
|
||||
{
|
||||
while (gTransition.IsBusy)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
navSceneLoading = false;
|
||||
yield break;
|
||||
}
|
||||
|
||||
AsyncOperation op = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Single);
|
||||
while (op != null && !op.isDone)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
navSceneLoading = false;
|
||||
}
|
||||
|
||||
@@ -1570,4 +1587,3 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Collections;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using GameServer.Client;
|
||||
using Bansonic;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
@@ -613,8 +614,15 @@ public class PauseManager : MonoBehaviour
|
||||
|
||||
private IEnumerator LoadSceneAsync(string sceneName)
|
||||
{
|
||||
if (gTransition.LoadScene(sceneName, LoadSceneMode.Single))
|
||||
{
|
||||
while (gTransition.IsBusy)
|
||||
yield return null;
|
||||
yield break;
|
||||
}
|
||||
|
||||
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneName);
|
||||
while (!asyncLoad.isDone)
|
||||
while (asyncLoad != null && !asyncLoad.isDone)
|
||||
yield return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user