改动与优化
This commit is contained in:
@@ -362,6 +362,7 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
enterAnim.enabled = true;
|
||||
}
|
||||
panel.SetActive(true);
|
||||
Ensure_Panel_Popup_If_Needed(panel);
|
||||
RegisterManagedPanel(panel);
|
||||
return true;
|
||||
}
|
||||
@@ -375,7 +376,7 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
|
||||
if (panel.activeSelf)
|
||||
{
|
||||
panel.SetActive(false);
|
||||
ClosePanelWithExitAnim(panel);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -388,8 +389,9 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
}
|
||||
|
||||
panel.SetActive(true);
|
||||
Ensure_Panel_Popup_If_Needed(panel);
|
||||
RegisterManagedPanel(panel);
|
||||
}
|
||||
}
|
||||
|
||||
GameObject Try_Open_Prefab(GameObject prefab, ref GameObject instance)
|
||||
{
|
||||
@@ -414,6 +416,7 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
}
|
||||
|
||||
panel.SetActive(true);
|
||||
Ensure_Panel_Popup_If_Needed(panel);
|
||||
RegisterManagedPanel(panel);
|
||||
}
|
||||
|
||||
@@ -431,7 +434,7 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
{
|
||||
if (panel != null)
|
||||
{
|
||||
panel.SetActive(false);
|
||||
ClosePanelWithExitAnim(panel);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -473,6 +476,40 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
rect.DOScale(Vector3.one, prefab_Enter_Time).SetEase(prefab_Enter_Ease);
|
||||
cg.DOFade(1f, prefab_Enter_Time).SetEase(prefab_Enter_Ease);
|
||||
}
|
||||
|
||||
void Ensure_Panel_Popup_If_Needed(GameObject panel)
|
||||
{
|
||||
if (panel == null || panel == ui_Panel_Setting)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (panel.GetComponent<UI_SettingsPanelEnterAnim>() != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UI_PanelPopupTween tween = panel.GetComponent<UI_PanelPopupTween>();
|
||||
if (tween == null)
|
||||
{
|
||||
panel.AddComponent<UI_PanelPopupTween>();
|
||||
}
|
||||
}
|
||||
void ClosePanelWithExitAnim(GameObject panel)
|
||||
{
|
||||
if (panel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UI_PanelExitUtility.PlayExitThen(panel, () =>
|
||||
{
|
||||
if (panel != null)
|
||||
{
|
||||
panel.SetActive(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
void Try_Load_Select_Scene()
|
||||
{
|
||||
if (selectScene_Loading)
|
||||
@@ -1499,14 +1536,20 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (cached_Pos.TryGetValue(rect, out Vector2 pos))
|
||||
{
|
||||
rect.anchoredPosition = pos;
|
||||
}
|
||||
if (cached_Scale.TryGetValue(rect, out Vector3 scale))
|
||||
{
|
||||
rect.localScale = scale;
|
||||
}
|
||||
if (cached_Pos.TryGetValue(rect, out Vector2 pos))
|
||||
{
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(rect))
|
||||
{
|
||||
rect.anchoredPosition = pos;
|
||||
}
|
||||
}
|
||||
if (cached_Scale.TryGetValue(rect, out Vector3 scale))
|
||||
{
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(rect))
|
||||
{
|
||||
rect.localScale = scale;
|
||||
}
|
||||
}
|
||||
if (cached_RotationZ.TryGetValue(rect, out float rotZ))
|
||||
{
|
||||
Vector3 euler = rect.localEulerAngles;
|
||||
@@ -1516,19 +1559,23 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
}
|
||||
if (group_Top != null)
|
||||
{
|
||||
group_Top.anchoredPosition = pos_Top + Vector2.up * enter_Offset_Y;
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(group_Top))
|
||||
group_Top.anchoredPosition = pos_Top + Vector2.up * enter_Offset_Y;
|
||||
}
|
||||
if (group_Bottom != null)
|
||||
{
|
||||
group_Bottom.anchoredPosition = pos_Bottom - Vector2.up * enter_Offset_Y;
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(group_Bottom))
|
||||
group_Bottom.anchoredPosition = pos_Bottom - Vector2.up * enter_Offset_Y;
|
||||
}
|
||||
if (group_DailyTasks != null)
|
||||
{
|
||||
group_DailyTasks.anchoredPosition = pos_Daily + Vector2.left * enter_Offset_X;
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(group_DailyTasks))
|
||||
group_DailyTasks.anchoredPosition = pos_Daily + Vector2.left * enter_Offset_X;
|
||||
}
|
||||
if (group_StartButton != null)
|
||||
{
|
||||
group_StartButton.anchoredPosition = pos_Start;
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(group_StartButton))
|
||||
group_StartButton.anchoredPosition = pos_Start;
|
||||
}
|
||||
|
||||
for (int i = 0; i < top_Items.Count; i++)
|
||||
@@ -1644,15 +1691,18 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
|
||||
if (group_Top != null)
|
||||
{
|
||||
enter_Sequence.Insert(uiStart, group_Top.DOAnchorPos(pos_Top, enter_Bar_Time_Runtime).SetEase(enter_Move_Ease));
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(group_Top))
|
||||
enter_Sequence.Insert(uiStart, group_Top.DOAnchorPos(pos_Top, enter_Bar_Time_Runtime).SetEase(enter_Move_Ease));
|
||||
}
|
||||
if (group_Bottom != null)
|
||||
{
|
||||
enter_Sequence.Insert(uiStart, group_Bottom.DOAnchorPos(pos_Bottom, enter_Bar_Time_Runtime).SetEase(enter_Move_Ease));
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(group_Bottom))
|
||||
enter_Sequence.Insert(uiStart, group_Bottom.DOAnchorPos(pos_Bottom, enter_Bar_Time_Runtime).SetEase(enter_Move_Ease));
|
||||
}
|
||||
if (group_DailyTasks != null)
|
||||
{
|
||||
enter_Sequence.Insert(uiStart, group_DailyTasks.DOAnchorPos(pos_Daily, enter_Bar_Time_Runtime).SetEase(enter_Move_Ease));
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(group_DailyTasks))
|
||||
enter_Sequence.Insert(uiStart, group_DailyTasks.DOAnchorPos(pos_Daily, enter_Bar_Time_Runtime).SetEase(enter_Move_Ease));
|
||||
}
|
||||
|
||||
float topItemsStart = uiStart + enter_Bar_Time_Runtime * 0.6f;
|
||||
@@ -1837,11 +1887,13 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
|
||||
if (group_Top != null)
|
||||
{
|
||||
group_Top.anchoredPosition = pos_Top + Vector2.up * enter_Offset_Y;
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(group_Top))
|
||||
group_Top.anchoredPosition = pos_Top + Vector2.up * enter_Offset_Y;
|
||||
}
|
||||
if (group_Bottom != null)
|
||||
{
|
||||
group_Bottom.anchoredPosition = pos_Bottom - Vector2.up * enter_Offset_Y;
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(group_Bottom))
|
||||
group_Bottom.anchoredPosition = pos_Bottom - Vector2.up * enter_Offset_Y;
|
||||
}
|
||||
|
||||
for (int i = 0; i < top_Items.Count; i++)
|
||||
@@ -1865,7 +1917,8 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
bars_Sequence.SetUpdate(true);
|
||||
bars_Sequence.SetAutoKill(false);
|
||||
bars_Sequence.OnKill(() => bars_Sequence = null);
|
||||
bars_Sequence.Append(group_Top.DOAnchorPos(pos_Top, enter_Bar_Time_Runtime).SetEase(enter_Move_Ease));
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(group_Top))
|
||||
bars_Sequence.Append(group_Top.DOAnchorPos(pos_Top, enter_Bar_Time_Runtime).SetEase(enter_Move_Ease));
|
||||
|
||||
float topItemsStart = bars_Sequence.Duration();
|
||||
for (int i = 0; i < top_Items.Count; i++)
|
||||
@@ -1886,7 +1939,8 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
}
|
||||
|
||||
float bottomStart = topItemsStart + enter_Bar_Time_Runtime * 0.5f;
|
||||
bars_Sequence.Insert(bottomStart, group_Bottom.DOAnchorPos(pos_Bottom, enter_Bar_Time_Runtime).SetEase(enter_Move_Ease));
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(group_Bottom))
|
||||
bars_Sequence.Insert(bottomStart, group_Bottom.DOAnchorPos(pos_Bottom, enter_Bar_Time_Runtime).SetEase(enter_Move_Ease));
|
||||
|
||||
float bottomItemsStart = bottomStart + enter_Bar_Time_Runtime;
|
||||
for (int i = 0; i < bottomItems.Count; i++)
|
||||
@@ -1911,6 +1965,10 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (UI_OrderedEntryAnimator.IsLayoutSensitive(rect))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!cached_Pos.TryGetValue(rect, out Vector2 origin))
|
||||
{
|
||||
origin = rect.anchoredPosition;
|
||||
@@ -1946,11 +2004,13 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
}
|
||||
if (cached_Pos.TryGetValue(rect, out Vector2 pos))
|
||||
{
|
||||
rect.anchoredPosition = pos;
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(rect))
|
||||
rect.anchoredPosition = pos;
|
||||
}
|
||||
if (cached_Scale.TryGetValue(rect, out Vector3 scale))
|
||||
{
|
||||
rect.localScale = scale;
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(rect))
|
||||
rect.localScale = scale;
|
||||
}
|
||||
if (cached_RotationZ.TryGetValue(rect, out float rotZ))
|
||||
{
|
||||
@@ -2053,8 +2113,11 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
float rotate = Mathf.Lerp(-bg_Deco_Rotate, bg_Deco_Rotate, Hash01(seed, 3));
|
||||
float scaleMul = Mathf.Lerp(bg_Deco_Scale_From, bg_Deco_Scale_From + 0.15f, Hash01(seed, 4));
|
||||
|
||||
rect.anchoredPosition = cached_Pos[rect] + new Vector2(offsetX, offsetY);
|
||||
rect.localScale = cached_Scale[rect] * Mathf.Max(0.01f, scaleMul);
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(rect))
|
||||
{
|
||||
rect.anchoredPosition = cached_Pos[rect] + new Vector2(offsetX, offsetY);
|
||||
rect.localScale = cached_Scale[rect] * Mathf.Max(0.01f, scaleMul);
|
||||
}
|
||||
Vector3 euler = rect.localEulerAngles;
|
||||
euler.z = cached_RotationZ[rect] + rotate;
|
||||
rect.localEulerAngles = euler;
|
||||
@@ -2079,11 +2142,13 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
}
|
||||
if (cached_Pos.TryGetValue(rect, out Vector2 targetPos))
|
||||
{
|
||||
sequence.Insert(at, rect.DOAnchorPos(targetPos, bg_Deco_Time_Runtime).SetEase(bg_Deco_Ease));
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(rect))
|
||||
sequence.Insert(at, rect.DOAnchorPos(targetPos, bg_Deco_Time_Runtime).SetEase(bg_Deco_Ease));
|
||||
}
|
||||
if (cached_Scale.TryGetValue(rect, out Vector3 targetScale))
|
||||
{
|
||||
sequence.Insert(at, rect.DOScale(targetScale, bg_Deco_Time_Runtime).SetEase(bg_Deco_Ease));
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(rect))
|
||||
sequence.Insert(at, rect.DOScale(targetScale, bg_Deco_Time_Runtime).SetEase(bg_Deco_Ease));
|
||||
}
|
||||
if (cached_RotationZ.TryGetValue(rect, out float targetRotZ))
|
||||
{
|
||||
@@ -2101,7 +2166,10 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
return;
|
||||
}
|
||||
Cache_Pos(rect);
|
||||
rect.anchoredPosition = cached_Pos[rect] + offset;
|
||||
if (!UI_OrderedEntryAnimator.IsLayoutSensitive(rect))
|
||||
{
|
||||
rect.anchoredPosition = cached_Pos[rect] + offset;
|
||||
}
|
||||
if (fade)
|
||||
{
|
||||
CanvasGroup group = Ensure_CanvasGroup(rect.gameObject);
|
||||
@@ -2127,12 +2195,16 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
{
|
||||
return;
|
||||
}
|
||||
bool layoutSensitive = UI_OrderedEntryAnimator.IsLayoutSensitive(rect);
|
||||
if (!cached_Pos.TryGetValue(rect, out Vector2 target))
|
||||
{
|
||||
target = rect.anchoredPosition;
|
||||
}
|
||||
float duration = enter_Item_Time_Runtime > 0f ? enter_Item_Time_Runtime : enter_Item_Time;
|
||||
sequence.Insert(at, rect.DOAnchorPos(target, duration).SetEase(enter_Move_Ease));
|
||||
if (!layoutSensitive)
|
||||
{
|
||||
sequence.Insert(at, rect.DOAnchorPos(target, duration).SetEase(enter_Move_Ease));
|
||||
}
|
||||
if (rect.TryGetComponent(out CanvasGroup group))
|
||||
{
|
||||
sequence.Insert(at, group.DOFade(1f, duration).SetEase(enter_Move_Ease));
|
||||
@@ -2957,6 +3029,10 @@ public class UI_Panel_Main : Singleton_Mono<UI_Panel_Main>
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (UI_OrderedEntryAnimator.IsLayoutSensitive(rect))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Vector2 pos = rect.anchoredPosition;
|
||||
pos.y += delta;
|
||||
rect.anchoredPosition = pos;
|
||||
|
||||
Reference in New Issue
Block a user