更新了红点系统

This commit is contained in:
wulongxiao 2024-11-27 14:26:45 +08:00
parent 13f5d2cdf8
commit 0fe86e62cb
5 changed files with 226 additions and 8 deletions

View File

@ -58,15 +58,19 @@ public class mainBTN :main_game
// 添加按钮点击事件 // 添加按钮点击事件
BTN_0.GetComponent<Button>().onClick.AddListener(() => { BTN_0.GetComponent<Button>().onClick.AddListener(() => {
MovePanel(0); MovePanel(0);
BTN_0.transform.GetComponent<main_RedDot>().HideRedDot();
}); });
BTN_1.GetComponent<Button>().onClick.AddListener(() => { BTN_1.GetComponent<Button>().onClick.AddListener(() => {
MovePanel(-2100); MovePanel(-2100);
BTN_1.transform.GetComponent<main_RedDot>().HideRedDot();
}); });
BTN_2.GetComponent<Button>().onClick.AddListener(() => { BTN_2.GetComponent<Button>().onClick.AddListener(() => {
MovePanel(-3760); MovePanel(-3760);
BTN_2.transform.GetComponent<main_RedDot>().HideRedDot();
}); });
BTN_3.GetComponent<Button>().onClick.AddListener(() => { BTN_3.GetComponent<Button>().onClick.AddListener(() => {
MovePanel(-5350); MovePanel(-5350);
BTN_3.transform.GetComponent<main_RedDot>().HideRedDot();
}); });

View File

@ -41,12 +41,15 @@ public class main_game :Base
{ {
await ButtonClickAnimationAsync(BTN.gameObject); await ButtonClickAnimationAsync(BTN.gameObject);
BTN.transform.GetComponent<main_RedDot>().HideRedDot();
if (_panel == null) if (_panel == null)
{ {
addEventPopUp("未开放", 3f); addEventPopUp("未开放", 3f);
return; return;
} }
// 实例化 Panel 并设置缩放为 0.5 // 实例化 Panel 并设置缩放为 0.5
GameObject newPanel = GameObject.Instantiate(_panel, canvas.transform); GameObject newPanel = GameObject.Instantiate(_panel, canvas.transform);
newPanel.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); newPanel.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);

View File

@ -29,6 +29,8 @@ public class ui_huodong :main_BaseShowPanel
int currentIndex = index; // 创建一个局部变量来捕获当前的index int currentIndex = index; // 创建一个局部变量来捕获当前的index
btns[currentIndex].onClick.AddListener(() => btns[currentIndex].onClick.AddListener(() =>
{ {
btns[currentIndex].transform.GetComponent<main_RedDot>().HideRedDot();
if (panels[currentIndex] == null) if (panels[currentIndex] == null)
{ {
Debug.LogError("panel is null"); Debug.LogError("panel is null");

View File

@ -543,7 +543,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c95363cad8b348746bb23e5c2999c90d, type: 3} m_Script: {fileID: 11500000, guid: c95363cad8b348746bb23e5c2999c90d, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_canvas: {fileID: 0}
_panel: {fileID: 499058876202855932} _panel: {fileID: 499058876202855932}
btns: btns:
- {fileID: 589695940868190867} - {fileID: 589695940868190867}
@ -641,6 +640,7 @@ GameObject:
- component: {fileID: 499058876109961376} - component: {fileID: 499058876109961376}
- component: {fileID: 499058876109961439} - component: {fileID: 499058876109961439}
- component: {fileID: 589695940868190867} - component: {fileID: 589695940868190867}
- component: {fileID: 4730256282848022697}
m_Layer: 5 m_Layer: 5
m_Name: t2 m_Name: t2
m_TagString: Untagged m_TagString: Untagged
@ -741,6 +741,19 @@ MonoBehaviour:
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
--- !u!114 &4730256282848022697
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 499058876109961379}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9cdd24b678761ff4a945ba07d88461bc, type: 3}
m_Name:
m_EditorClassIdentifier:
redDot: {fileID: 1915269117}
--- !u!1 &499058876167891745 --- !u!1 &499058876167891745
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -975,6 +988,7 @@ GameObject:
- component: {fileID: 8879021915959974125} - component: {fileID: 8879021915959974125}
- component: {fileID: 8044630059487427399} - component: {fileID: 8044630059487427399}
- component: {fileID: 7321123989325159614} - component: {fileID: 7321123989325159614}
- component: {fileID: 5540662508404471263}
m_Layer: 5 m_Layer: 5
m_Name: t3 m_Name: t3
m_TagString: Untagged m_TagString: Untagged
@ -1075,6 +1089,19 @@ MonoBehaviour:
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
--- !u!114 &5540662508404471263
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 737395417232846308}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9cdd24b678761ff4a945ba07d88461bc, type: 3}
m_Name:
m_EditorClassIdentifier:
redDot: {fileID: 3200087760010533031}
--- !u!1 &743420519794011153 --- !u!1 &743420519794011153
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1104,7 +1131,8 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children:
- {fileID: 2258259280583268780}
m_Father: {fileID: 7887763884358934968} m_Father: {fileID: 7887763884358934968}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -1163,6 +1191,7 @@ GameObject:
- component: {fileID: 6439638315203938387} - component: {fileID: 6439638315203938387}
- component: {fileID: 5254693992088958375} - component: {fileID: 5254693992088958375}
- component: {fileID: 2047883622368478094} - component: {fileID: 2047883622368478094}
- component: {fileID: 8210243463619510369}
m_Layer: 5 m_Layer: 5
m_Name: t4 m_Name: t4
m_TagString: Untagged m_TagString: Untagged
@ -1263,6 +1292,171 @@ MonoBehaviour:
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
--- !u!114 &8210243463619510369
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2454270055691179675}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9cdd24b678761ff4a945ba07d88461bc, type: 3}
m_Name:
m_EditorClassIdentifier:
redDot: {fileID: 3408327329922145714}
--- !u!1 &3200087760010533031
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2258259280583268780}
- component: {fileID: 4472219369316430167}
- component: {fileID: 8742262597287911292}
m_Layer: 5
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2258259280583268780
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3200087760010533031}
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: 7837524829471097554}
m_RootOrder: 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_AnchoredPosition: {x: 424, y: 147}
m_SizeDelta: {x: 84, y: 84}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4472219369316430167
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3200087760010533031}
m_CullTransparentMesh: 1
--- !u!114 &8742262597287911292
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3200087760010533031}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, 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_Sprite: {fileID: 21300000, guid: 35d4dff8dfd63094ba4b0ed588f8128c, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &3408327329922145714
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6770581052661560288}
- component: {fileID: 3393798107076216697}
- component: {fileID: 4742422053347914386}
m_Layer: 5
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6770581052661560288
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3408327329922145714}
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: 9179869187773123173}
m_RootOrder: 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_AnchoredPosition: {x: 424, y: 154}
m_SizeDelta: {x: 84, y: 84}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3393798107076216697
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3408327329922145714}
m_CullTransparentMesh: 1
--- !u!114 &4742422053347914386
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3408327329922145714}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, 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_Sprite: {fileID: 21300000, guid: 35d4dff8dfd63094ba4b0ed588f8128c, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &3941312822989608268 --- !u!1 &3941312822989608268
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1369,7 +1563,8 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children:
- {fileID: 6770581052661560288}
m_Father: {fileID: 7732135253984477920} m_Father: {fileID: 7732135253984477920}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@ -636,6 +636,7 @@ GameObject:
- component: {fileID: 499058876109961376} - component: {fileID: 499058876109961376}
- component: {fileID: 499058876109961439} - component: {fileID: 499058876109961439}
- component: {fileID: 5838319156628403795} - component: {fileID: 5838319156628403795}
- component: {fileID: 5264235081646673674}
m_Layer: 5 m_Layer: 5
m_Name: t2 m_Name: t2
m_TagString: Untagged m_TagString: Untagged
@ -736,6 +737,19 @@ MonoBehaviour:
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
--- !u!114 &5264235081646673674
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 499058876109961379}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9cdd24b678761ff4a945ba07d88461bc, type: 3}
m_Name:
m_EditorClassIdentifier:
redDot: {fileID: 1915269117}
--- !u!1 &499058876167891745 --- !u!1 &499058876167891745
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0