任务隐藏和显示的动画

This commit is contained in:
huyulong 2024-12-06 16:24:45 +08:00
parent 8bb12d1eb3
commit 76b7259a13
5 changed files with 117 additions and 127 deletions

Binary file not shown.

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1a7a55d241f8b6341a53f0698f686bf3 guid: b4bc8a6718ad365439657b4dace25c94
ModelImporter: ModelImporter:
serializedVersion: 21300 serializedVersion: 21300
internalIDToNameTable: [] internalIDToNameTable: []
@ -24,7 +24,7 @@ ModelImporter:
animationDoRetargetingWarnings: 0 animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0 importAnimatedCustomProperties: 0
importConstraints: 0 importConstraints: 0
animationCompression: 1 animationCompression: 3
animationRotationError: 0.5 animationRotationError: 0.5
animationPositionError: 0.5 animationPositionError: 0.5
animationScaleError: 0.5 animationScaleError: 0.5
@ -92,13 +92,13 @@ ModelImporter:
globalScale: 1 globalScale: 1
rootMotionBoneName: rootMotionBoneName:
hasTranslationDoF: 0 hasTranslationDoF: 0
hasExtraRoot: 0 hasExtraRoot: 1
skeletonHasParents: 1 skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0} lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1 autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2 animationType: 3
humanoidOversampling: 1 humanoidOversampling: 1
avatarSetup: 0 avatarSetup: 1
addHumanoidExtraRootOnlyWhenUsingAvatar: 1 addHumanoidExtraRootOnlyWhenUsingAvatar: 1
remapMaterialsIfMaterialImportModeIsNone: 0 remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0 additionalBone: 0

View File

@ -20,19 +20,46 @@ public class TaskPanel : Base
public Dictionary<int, Language> taskDic = new Dictionary<int, Language>(); public Dictionary<int, Language> taskDic = new Dictionary<int, Language>();
public Button closeBtn; public RectTransform buttonRect; // 你的按钮 RectTransform
public Button hideBtn;
private bool isHidden = false; // 用来判断按钮是否已经隐藏
public float moveDuration = 0.5f; // 动画持续时间
public float hidePositionX = 125f; // 隐藏到右边的 X 坐标值,具体值根据屏幕大小调整
public float showPositionX = -198f; // 显示时按钮的 X 坐标值
private bool isOpen = false;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
instance = this; instance = this;
closeBtn.onClick.AddListener(CloseBtn);
hideBtn.onClick.AddListener(OnClickHideButton);
} }
public void OnClickHideButton()
{
// 如果按钮已隐藏,点击后显示
if (isHidden)
{
// 恢复按钮到原位置
buttonRect.DOAnchorPosX(showPositionX, moveDuration).SetEase(Ease.InOutCubic);
isHidden = false; // 更新状态为未隐藏
}
else
{
// 隐藏按钮
buttonRect.DOAnchorPosX(hidePositionX, moveDuration).SetEase(Ease.InOutCubic);
isHidden = true; // 更新状态为隐藏
}
}
public async void InitTask() public async void InitTask()
{ {
@ -69,21 +96,6 @@ public class TaskPanel : Base
} }
public void CloseBtn()
{
if (isOpen)//关闭任务面板
{
isOpen = false;
}
else//打开任务面板
{
isOpen = true;
}
}

View File

@ -1917,10 +1917,76 @@ Transform:
m_CorrespondingSourceObject: {fileID: 4210062203274906, guid: f83b67b7106d46a4089e1d7e2e7ad86d, type: 3} m_CorrespondingSourceObject: {fileID: 4210062203274906, guid: f83b67b7106d46a4089e1d7e2e7ad86d, type: 3}
m_PrefabInstance: {fileID: 246032604} m_PrefabInstance: {fileID: 246032604}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1 &247468502 stripped --- !u!1001 &272025129
GameObject: PrefabInstance:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3} m_ObjectHideFlags: 0
m_PrefabInstance: {fileID: 2015577397} serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 382802812}
m_Modifications:
- target: {fileID: -8679921383154817045, guid: b4bc8a6718ad365439657b4dace25c94, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b4bc8a6718ad365439657b4dace25c94, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b4bc8a6718ad365439657b4dace25c94, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b4bc8a6718ad365439657b4dace25c94, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b4bc8a6718ad365439657b4dace25c94, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b4bc8a6718ad365439657b4dace25c94, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b4bc8a6718ad365439657b4dace25c94, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b4bc8a6718ad365439657b4dace25c94, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b4bc8a6718ad365439657b4dace25c94, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b4bc8a6718ad365439657b4dace25c94, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: b4bc8a6718ad365439657b4dace25c94, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: b4bc8a6718ad365439657b4dace25c94, type: 3}
propertyPath: m_Name
value: boyy
objectReference: {fileID: 0}
- target: {fileID: 5866666021909216657, guid: b4bc8a6718ad365439657b4dace25c94, type: 3}
propertyPath: m_Controller
value:
objectReference: {fileID: 9100000, guid: b6b0af1684cf4a3459f82fde7a3622e6, type: 2}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b4bc8a6718ad365439657b4dace25c94, type: 3}
--- !u!4 &272025130 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: b4bc8a6718ad365439657b4dace25c94, type: 3}
m_PrefabInstance: {fileID: 272025129}
m_PrefabAsset: {fileID: 0}
--- !u!95 &272025131 stripped
Animator:
m_CorrespondingSourceObject: {fileID: 5866666021909216657, guid: b4bc8a6718ad365439657b4dace25c94, type: 3}
m_PrefabInstance: {fileID: 272025129}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1001 &285549842 --- !u!1001 &285549842
PrefabInstance: PrefabInstance:
@ -2848,7 +2914,7 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1948499802} - {fileID: 1948499802}
- {fileID: 2015577398} - {fileID: 272025130}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 26 m_RootOrder: 26
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -2877,7 +2943,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ea9eb82687dfa674e883273cd7c73386, type: 3} m_Script: {fileID: 11500000, guid: ea9eb82687dfa674e883273cd7c73386, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
ain: {fileID: 1948499803} ain: {fileID: 272025131}
characterState: 0 characterState: 0
PlayerCollider: {fileID: 382802810} PlayerCollider: {fileID: 382802810}
--- !u!114 &382802815 --- !u!114 &382802815
@ -2969,7 +3035,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b0e8bb916545c834b8981bdf116ec889, type: 3} m_Script: {fileID: 11500000, guid: b0e8bb916545c834b8981bdf116ec889, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
CharacterAnimator: {fileID: 1948499803} CharacterAnimator: {fileID: 272025131}
player: {fileID: 382802812} player: {fileID: 382802812}
relativePosition: {x: 0, y: 0, z: 0} relativePosition: {x: 0, y: 0, z: 0}
relativeRotation: {x: 0, y: 0, z: 0} relativeRotation: {x: 0, y: 0, z: 0}
@ -6816,7 +6882,11 @@ MonoBehaviour:
contentTrans: {fileID: 1889829591} contentTrans: {fileID: 1889829591}
taskPrefab: {fileID: 3645880154619645306, guid: 1a0185fc1549da647943a21145debe29, type: 3} taskPrefab: {fileID: 3645880154619645306, guid: 1a0185fc1549da647943a21145debe29, type: 3}
JSONReader: {fileID: 1526740604} JSONReader: {fileID: 1526740604}
closeBtn: {fileID: 0} buttonRect: {fileID: 814718671}
hideBtn: {fileID: 670223750}
moveDuration: 0.5
hidePositionX: 125
showPositionX: -198
--- !u!1001 &825899810 --- !u!1001 &825899810
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -7767,7 +7837,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b7a13aa85436e3a43a8f10019d0c1316, type: 3} m_Script: {fileID: 11500000, guid: b7a13aa85436e3a43a8f10019d0c1316, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
redColor: {r: 1, g: 0, b: 0, a: 0} redColor: {r: 1, g: 0, b: 0.042701244, a: 1}
--- !u!114 &983774418 --- !u!114 &983774418
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -21492,7 +21562,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 6def8c21980f20945bbf5eeab570702a, type: 3} - target: {fileID: 919132149155446097, guid: 6def8c21980f20945bbf5eeab570702a, type: 3}
propertyPath: m_IsActive propertyPath: m_IsActive
value: 1 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5866666021909216657, guid: 6def8c21980f20945bbf5eeab570702a, type: 3} - target: {fileID: 5866666021909216657, guid: 6def8c21980f20945bbf5eeab570702a, type: 3}
propertyPath: m_Controller propertyPath: m_Controller
@ -21509,11 +21579,6 @@ Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 6def8c21980f20945bbf5eeab570702a, type: 3} m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 6def8c21980f20945bbf5eeab570702a, type: 3}
m_PrefabInstance: {fileID: 1948499801} m_PrefabInstance: {fileID: 1948499801}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!95 &1948499803 stripped
Animator:
m_CorrespondingSourceObject: {fileID: 5866666021909216657, guid: 6def8c21980f20945bbf5eeab570702a, type: 3}
m_PrefabInstance: {fileID: 1948499801}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1953218132 --- !u!1001 &1953218132
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -22109,93 +22174,6 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 69a55f19217e42746bdaf0c10a7cbc80, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 69a55f19217e42746bdaf0c10a7cbc80, type: 3}
--- !u!1001 &2015577397
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 382802812}
m_Modifications:
- target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3}
propertyPath: m_Name
value: boy
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3}
--- !u!4 &2015577398 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 1a7a55d241f8b6341a53f0698f686bf3, type: 3}
m_PrefabInstance: {fileID: 2015577397}
m_PrefabAsset: {fileID: 0}
--- !u!95 &2015577399
Animator:
serializedVersion: 5
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 247468502}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 0}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_StabilizeFeet: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
--- !u!1001 &2025302170 --- !u!1001 &2025302170
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0