用户改名界面 修复错误卡死的情况

main
Yuntao Hu 2024-10-15 15:28:21 +08:00
parent 5aeb5556f2
commit 95962b29cb
5 changed files with 92 additions and 137 deletions

View File

@ -1,5 +1,77 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &517276863347880109
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8149004367530831718}
- component: {fileID: 7805589769316278865}
- component: {fileID: 858482857538399830}
m_Layer: 5
m_Name: GaussianBlurMask
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8149004367530831718
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 517276863347880109}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6414022954167894992}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7805589769316278865
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 517276863347880109}
m_CullTransparentMesh: 1
--- !u!114 &858482857538399830
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 517276863347880109}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.49803922, g: 0.49803922, b: 0.49803922, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Texture: {fileID: 0}
m_UVRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
--- !u!1 &1644303470962577917
GameObject:
m_ObjectHideFlags: 0
@ -169,8 +241,8 @@ RectTransform:
- {fileID: 7445189891608745899}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
@ -923,132 +995,3 @@ MonoBehaviour:
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1001 &4213204939696825897
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 6414022954167894992}
m_Modifications:
- target: {fileID: 4419705794936444548, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_Name
value: GaussianBlurMask
objectReference: {fileID: 0}
- target: {fileID: 4419705794936444548, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6d0b789364fd35642bc27c89b8f8adef, type: 3}
--- !u!224 &8149004367530831718 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5435664284086749519, guid: 6d0b789364fd35642bc27c89b8f8adef,
type: 3}
m_PrefabInstance: {fileID: 4213204939696825897}
m_PrefabAsset: {fileID: 0}

View File

@ -129,7 +129,7 @@ public partial class UIManager
_WindowMeta(UINameConst.UI_GuideTip, UIWindowLayer.Guide);
_WindowMeta(UINameConst.UI_ChoosePerson, UIWindowLayer.Normal, UIOpenType.FullScreen);
_WindowMeta(UINameConst.UI_WriteName, UIWindowLayer.Normal, UIOpenType.FullScreen, false, true);
_WindowMeta(UINameConst.UI_NameConfirmWindow, UIWindowLayer.Normal, UIOpenType.Pop, false, true);
_WindowMeta(UINameConst.UI_NameConfirmWindow, UIWindowLayer.Normal, UIOpenType.FullScreen);
//其他
_WindowMeta(UINameConst.UI_PlayerLevelUp, UIWindowLayer.Normal, UIOpenType.Pop, false, true);

View File

@ -217,7 +217,7 @@ public class UIPosterAndSkillInfoController : UIWindow
{
if (_data is CharacterDataInfo data)
{
var path = CommonUtils.GetCharacterPicPath(data.Cfg.RoleID,CommonUtils.ECharacterPicPathType.LevelUp);
var path = CommonUtils.GetCharacterPicPath(data.Cfg.RoleID, CommonUtils.ECharacterPicPathType.LevelUp, (int)data.SkinID);
_AsyncSetSprite(Image_Paintting, path);
}
return;

View File

@ -16,11 +16,11 @@ public class UI_NameConfirmWindowController : UIWindow
/// 打开改名确认界面
/// </summary>
/// <returns></returns>
public static async UniTask<UIWindow> Open(string content, Action confirm = null)
public static async UniTask<UIWindow> Open(string content, Action confirm = null, Action cancel = null)
{
CommonUtils.CaptureScreenshot(); // 截取当前屏幕截图
WindowData WindowData = new(content, confirm);
WindowData WindowData = new(content, confirm, cancel);
return await UIManager.Instance.CreateAndOpenWindow(UINameConst.UI_NameConfirmWindow, WindowData);
}
@ -39,10 +39,13 @@ public class UI_NameConfirmWindowController : UIWindow
/// </summary>
public Action ConfirmAction { get;private set; }
public WindowData(string content, Action confirm)
public Action CancelAction { get; private set; }
public WindowData(string content, Action confirm, Action cancelAction)
{
Content = content;
ConfirmAction = confirm;
CancelAction = cancelAction;
}
}
@ -70,6 +73,7 @@ public class UI_NameConfirmWindowController : UIWindow
#endregion
private Action confirmAction;
private Action cancelAction;
public override void OnInit()
{
@ -94,6 +98,7 @@ public class UI_NameConfirmWindowController : UIWindow
{
textContent.text = windowData.Content;
confirmAction = windowData.ConfirmAction;
cancelAction = windowData.CancelAction;
}
}
@ -105,6 +110,13 @@ public class UI_NameConfirmWindowController : UIWindow
private void OnClose()
{
cancelAction?.Invoke();
CloseWindow();
}
public override UniTask<bool> OnBack(object data = null)
{
cancelAction?.Invoke();
return base.OnBack(data);
}
}

View File

@ -130,7 +130,7 @@ public class UI_WriteNameController : UIWindow
}
isChangeName = true;
await UI_NameConfirmWindowController.Open($"确定取名'{inputField.text}'吗?", () => { SetName(inputField.text); });
await UI_NameConfirmWindowController.Open($"确定取名'{inputField.text}'吗?", () => { SetName(inputField.text); }, () => { isChangeName = false; });
//UITipsManager.ShowConfirmTwo("tis", $"确定取名'{inputField.text}'吗?", (Action)(() => { SetName(inputField.text); }), null);
}