修复optionUI一系列表现bug

This commit is contained in:
Alienjack 2025-05-20 00:02:19 +08:00
parent c8f0d77b34
commit 235dc0ed39
4 changed files with 118 additions and 50 deletions

View File

@ -682,9 +682,9 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 25, y: 25}
m_SizeDelta: {x: 50, y: 50} m_SizeDelta: {x: 50, y: 50}
m_Pivot: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7825136160635457043 --- !u!222 &7825136160635457043
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1171,9 +1171,9 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 25, y: 25}
m_SizeDelta: {x: 50, y: 50} m_SizeDelta: {x: 50, y: 50}
m_Pivot: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6387250980529666459 --- !u!222 &6387250980529666459
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1377,10 +1377,10 @@ RectTransform:
m_Children: [] m_Children: []
m_Father: {fileID: 1100500336380202360} m_Father: {fileID: 1100500336380202360}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 170, y: -333} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 300, y: 26} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7910447946506517051 --- !u!222 &7910447946506517051
CanvasRenderer: CanvasRenderer:
@ -1477,9 +1477,9 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 25, y: 25}
m_SizeDelta: {x: 50, y: 50} m_SizeDelta: {x: 50, y: 50}
m_Pivot: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6018890508858230420 --- !u!222 &6018890508858230420
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1667,10 +1667,10 @@ RectTransform:
- {fileID: 905458728127029103} - {fileID: 905458728127029103}
m_Father: {fileID: 1100500336380202360} m_Father: {fileID: 1100500336380202360}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 170, y: -160} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 300, y: 300} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2558056583130529771 --- !u!114 &2558056583130529771
MonoBehaviour: MonoBehaviour:
@ -3058,9 +3058,9 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 25, y: 25}
m_SizeDelta: {x: 50, y: 50} m_SizeDelta: {x: 50, y: 50}
m_Pivot: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6969397185295608833 --- !u!222 &6969397185295608833
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3116,7 +3116,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!224 &1100500336380202360 --- !u!224 &1100500336380202360
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3134,10 +3134,10 @@ RectTransform:
- {fileID: 6878964193873653430} - {fileID: 6878964193873653430}
m_Father: {fileID: 4478785627166277610} m_Father: {fileID: 4478785627166277610}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 165, y: -443} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 330, y: 356} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &20405450890320071 --- !u!114 &20405450890320071
MonoBehaviour: MonoBehaviour:

View File

@ -40,7 +40,8 @@ namespace AxibugEmuOnline.Client.Filters
public FloatParameter hardScan = -8.0f; public FloatParameter hardScan = -8.0f;
[Range(-3f, 1f)] [Range(-3f, 1f)]
public FloatParameter hardPix = -3.0f; public FloatParameter hardPix = -3.0f;
public Vector2Parameter warp = new Vector2(0.03125f, 0.04166f); public FloatParameter warpX = 0.03125f;
public FloatParameter warpY = 0.04166f;
[Range(1f, 16f)] [Range(1f, 16f)]
public FloatParameter resScale = 4f; public FloatParameter resScale = 4f;
[Range(0.5f, 5f)] [Range(0.5f, 5f)]
@ -131,14 +132,14 @@ namespace AxibugEmuOnline.Client.Filters
m_tvEffectMat.EnableKeyword("_CubicDistortion"); break; m_tvEffectMat.EnableKeyword("_CubicDistortion"); break;
} }
m_tvEffectMat.SetFloat("maskDark", maskDark.GetValue()); m_tvEffectMat.SetFloat("maskDark", maskDark);
m_tvEffectMat.SetFloat("maskLight", maskLight.GetValue()); m_tvEffectMat.SetFloat("maskLight", maskLight);
m_tvEffectMat.SetFloat("hardScan", hardScan.GetValue()); m_tvEffectMat.SetFloat("hardScan", hardScan);
m_tvEffectMat.SetFloat("hardPix", hardPix.GetValue()); m_tvEffectMat.SetFloat("hardPix", hardPix);
m_tvEffectMat.SetVector("warp", warp.GetValue()); m_tvEffectMat.SetVector("warp", new Vector4(warpX, warpY));
m_tvEffectMat.SetFloat("resScale", resScale.GetValue()); m_tvEffectMat.SetFloat("resScale", resScale);
m_tvEffectMat.SetFloat("scale", scale.GetValue()); m_tvEffectMat.SetFloat("scale", scale);
m_tvEffectMat.SetFloat("fade", fade.GetValue()); m_tvEffectMat.SetFloat("fade", fade);
Graphics.Blit(src, rt, m_tvEffectMat); Graphics.Blit(src, rt, m_tvEffectMat);

View File

@ -1,5 +1,7 @@
using AxibugEmuOnline.Client.ClientCore; using AxibugEmuOnline.Client.ClientCore;
using DG.Tweening; using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
@ -84,8 +86,34 @@ namespace AxibugEmuOnline.Client
private void UpdateMenuState() private void UpdateMenuState()
{ {
if (!m_bPoped) return;
if (checkDirty()) if (checkDirty())
{ {
Canvas.ForceUpdateCanvases();
if (m_popTween != null)
{
Vector2 end = new Vector2(-MenuRoot.rect.width, MenuRoot.anchoredPosition.y);
m_popTween.ChangeEndValue(end, false);
}
else
{
Vector2 end = new Vector2(-MenuRoot.rect.width, MenuRoot.anchoredPosition.y);
var topParent = m_parent;
while (topParent != null && topParent.m_parent != null)
{
topParent = topParent.m_parent;
}
if (topParent != null)
{
topParent.MenuRoot.anchoredPosition = end;
}
else
{
MenuRoot.anchoredPosition = end;
}
}
RebuildSelectIndex(); RebuildSelectIndex();
} }
} }
@ -146,8 +174,10 @@ namespace AxibugEmuOnline.Client
} }
return dirty; return dirty;
} }
private TweenerCore<Vector2, Vector2, VectorOptions> m_popTween;
private TweenerCore<Vector2, Vector2, VectorOptions> m_hideTween;
CommandListener.ScheduleType? m_lastCS; CommandListener.ScheduleType? m_lastCS;
private Action m_onClose; private Action m_onClose;
@ -167,8 +197,14 @@ namespace AxibugEmuOnline.Client
SelectBorder.Target = optionUI_MenuItem.transform as RectTransform; SelectBorder.Target = optionUI_MenuItem.transform as RectTransform;
} }
public void Pop<T>(List<T> menus, int defaultIndex = 0, Action onClose = null) where T : InternalOptionMenu public void Pop<T>(List<T> menus, int defaultIndex = 0, Action onClose = null) where T : InternalOptionMenu
{ {
if (m_hideTween != null)
{
m_hideTween.Kill(true);
}
m_onClose = onClose; m_onClose = onClose;
ReleaseRuntimeMenus(); ReleaseRuntimeMenus();
foreach (var menu in menus) CreateRuntimeMenuItem(menu); foreach (var menu in menus) CreateRuntimeMenuItem(menu);
@ -187,10 +223,11 @@ namespace AxibugEmuOnline.Client
if (!m_bPoped) if (!m_bPoped)
{ {
m_bPoped = true; m_bPoped = true;
Vector2 start = new Vector2(0, MenuRoot.anchoredPosition.y); Vector2 start = new Vector2(0, MenuRoot.anchoredPosition.y);
Vector2 end = new Vector2(-MenuRoot.rect.width, MenuRoot.anchoredPosition.y); Vector2 end = new Vector2(-MenuRoot.rect.width, MenuRoot.anchoredPosition.y);
DOTween.To( m_popTween = DOTween.To(
() => start, () => start,
(value) => (value) =>
{ {
@ -214,6 +251,7 @@ namespace AxibugEmuOnline.Client
end, end,
0.3f 0.3f
).SetEase(Ease.OutCubic); ).SetEase(Ease.OutCubic);
m_popTween.onComplete = () => m_popTween = null;
m_lastCS = CommandDispatcher.Instance.Mode; m_lastCS = CommandDispatcher.Instance.Mode;
CommandDispatcher.Instance.Mode = CommandListener.ScheduleType.Normal; CommandDispatcher.Instance.Mode = CommandListener.ScheduleType.Normal;
@ -236,15 +274,17 @@ namespace AxibugEmuOnline.Client
Vector2 start = new Vector2(-MenuRoot.rect.width, MenuRoot.anchoredPosition.y); Vector2 start = new Vector2(-MenuRoot.rect.width, MenuRoot.anchoredPosition.y);
Vector2 end = new Vector2(0, MenuRoot.anchoredPosition.y); Vector2 end = new Vector2(0, MenuRoot.anchoredPosition.y);
ReleaseRuntimeMenus();
m_runtimeMenuItems.Clear();
SelectBorder.gameObject.SetActiveEx(false); SelectBorder.gameObject.SetActiveEx(false);
CommandDispatcher.Instance.UnRegistController(this); CommandDispatcher.Instance.UnRegistController(this);
Canvas.ForceUpdateCanvases(); Canvas.ForceUpdateCanvases();
DOTween.To( if (m_popTween != null)
{
m_popTween.Kill(true);
}
m_hideTween = DOTween.To(
() => start, () => start,
(value) => (value) =>
{ {
@ -268,6 +308,12 @@ namespace AxibugEmuOnline.Client
end, end,
0.3f 0.3f
).SetEase(Ease.OutCubic); ).SetEase(Ease.OutCubic);
m_hideTween.onComplete = () =>
{
ReleaseRuntimeMenus();
m_runtimeMenuItems.Clear();
m_hideTween = null;
};
m_bPoped = false; m_bPoped = false;

View File

@ -15,7 +15,6 @@ namespace AxibugEmuOnline.Client
private RectTransform m_rect => transform as RectTransform; private RectTransform m_rect => transform as RectTransform;
private RectTransform m_target; private RectTransform m_target;
private TweenerCore<Vector3, Vector3, VectorOptions> m_trackTween;
public RectTransform Target public RectTransform Target
{ {
@ -37,7 +36,6 @@ namespace AxibugEmuOnline.Client
var itemUIRect = m_target.transform as RectTransform; var itemUIRect = m_target.transform as RectTransform;
m_rect.pivot = itemUIRect.pivot; m_rect.pivot = itemUIRect.pivot;
m_rect.sizeDelta = itemUIRect.rect.size;
m_rect.SetAsLastSibling(); m_rect.SetAsLastSibling();
animator.SetTrigger("reactive"); animator.SetTrigger("reactive");
@ -47,12 +45,30 @@ namespace AxibugEmuOnline.Client
m_trackTween.Kill(); m_trackTween.Kill();
m_trackTween = null; m_trackTween = null;
} }
m_trackTween = DOTween.To(() => m_rect.position, (_value) => m_rect.position = _value, itemUIRect.position, 0.125f);
m_trackTween.onComplete = () => m_trackTween = null; var startSize = m_rect.sizeDelta;
var startPos = m_rect.position;
m_trackTween = DOTween.To(
() => 0f,
(_value) =>
{
var progress = _value;
m_rect.position = Vector3.Lerp(startPos, itemUIRect.position, progress);
m_rect.sizeDelta = Vector2.Lerp(startSize, itemUIRect.rect.size, progress);
},
1f,
0.125f);
m_trackTween.onComplete = () =>
{
m_trackTween = null;
};
} }
} }
private bool m_active; private bool m_active;
private TweenerCore<float, float, FloatOptions> m_trackTween;
public bool Active public bool Active
{ {
get => m_active; get => m_active;
@ -73,12 +89,17 @@ namespace AxibugEmuOnline.Client
} }
} }
private void LateUpdate() struct TrackTarget
{ {
if (m_trackTween != null && m_trackTween.endValue != Target.position) Vector3 pos;
{ Vector2 size;
m_trackTween.ChangeEndValue(Target.position, true); }
}
struct TrackTargetOption : IPlugOptions
{
public void Reset()
{
}
} }
} }
} }