return按钮添加脚本
This commit is contained in:
parent
09018ea210
commit
0ad92ee3f4
@ -6246,6 +6246,7 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 1535452030}
|
||||
- component: {fileID: 1535452032}
|
||||
- component: {fileID: 1535452033}
|
||||
m_Layer: 5
|
||||
m_Name: t2_shop
|
||||
m_TagString: Untagged
|
||||
@ -6297,6 +6298,24 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1535452029}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1535452033
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1535452029}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4819444941766254cb5bde5ba335d38e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
retbutton: {fileID: 0}
|
||||
ClosureObj: {fileID: 0}
|
||||
Panel: {fileID: 6389689318277710002, guid: 21918674044dc0640af7d47f2617dca5, type: 3}
|
||||
CloseBTN: {fileID: 0}
|
||||
btn: {fileID: 1588445222}
|
||||
canvas: {fileID: 278122028}
|
||||
--- !u!1 &1546589077
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -7342,7 +7361,6 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1769459764}
|
||||
- component: {fileID: 1769459765}
|
||||
m_Layer: 5
|
||||
m_Name: scene_main
|
||||
m_TagString: Untagged
|
||||
@ -7375,21 +7393,6 @@ RectTransform:
|
||||
m_AnchoredPosition: {x: -3760, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1769459765
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1769459763}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4819444941766254cb5bde5ba335d38e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Panel: {fileID: 1588445218}
|
||||
CloseBTN: {fileID: 0}
|
||||
shop_btn: {fileID: 1588445222}
|
||||
--- !u!1 &1789658826
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -7,12 +7,13 @@ using DG.Tweening;
|
||||
|
||||
public class main_shop :BaseUIPanel
|
||||
{
|
||||
public Button shop_btn;
|
||||
|
||||
[Header("一个按钮,按下有逻辑")]
|
||||
public Button btn;
|
||||
[Header("canvas,当动态生成的父节点")]
|
||||
public Canvas canvas;
|
||||
public override void Start()
|
||||
{
|
||||
shop_btn.onClick.AddListener(() =>asyncOnShopBTN(shop_btn));
|
||||
btn.onClick.AddListener(() =>asyncOnShopBTN(btn));
|
||||
}
|
||||
|
||||
|
||||
@ -28,6 +29,8 @@ public class main_shop :BaseUIPanel
|
||||
|
||||
public override void ShopPanel()
|
||||
{
|
||||
GameObject.Instantiate(Panel, canvas.transform);
|
||||
// 实例化 Panel 并设置缩放为 0.5
|
||||
GameObject newPanel = GameObject.Instantiate(Panel, canvas.transform);
|
||||
newPanel.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
}
|
||||
|
16
TheStrongestSnail/Assets/Scripts/Scene_main/retrun_BTN.cs
Normal file
16
TheStrongestSnail/Assets/Scripts/Scene_main/retrun_BTN.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using DG.Tweening;
|
||||
|
||||
public class retrun_BTN :Base
|
||||
{
|
||||
private void Start()
|
||||
{
|
||||
ClosureObj.transform.DOScale(1f,0.3f);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74de365fa92f06a49a17acc53c84dc6c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -10,7 +10,7 @@ using System.Threading.Tasks;
|
||||
//请将panel挂载一个空节点上,将这个脚本放空节点
|
||||
public class BaseUIPanel : Base
|
||||
{
|
||||
[Header("显示隐藏的面板,根据重写,可以不给")]
|
||||
[Header("显示or消失的面板,根据重写,可以不给")]
|
||||
public GameObject Panel;
|
||||
|
||||
[Header("CloseBTN,根据重写,可以不给")]
|
||||
@ -43,7 +43,7 @@ public class BaseUIPanel : Base
|
||||
Panel.gameObject.SetActive(true);
|
||||
if (CloseBTN != null)
|
||||
{
|
||||
CloseBTN.gameObject.SetActive(false);
|
||||
CloseBTN.gameObject.SetActive(true);
|
||||
}
|
||||
Panel.transform.DOScale(1f, 0.3f);
|
||||
}
|
||||
|
20
TheStrongestSnail/Assets/Scripts/Scene_shop/shopPanel.cs
Normal file
20
TheStrongestSnail/Assets/Scripts/Scene_shop/shopPanel.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
|
||||
public class shopPanel :MonoBehaviour
|
||||
{
|
||||
|
||||
|
||||
public void Start()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e3c192bd726c790488c8fe8895226742
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -12,6 +12,7 @@ GameObject:
|
||||
- component: {fileID: 4894555910357792272}
|
||||
- component: {fileID: 4894555910357792271}
|
||||
- component: {fileID: 4894555910357792270}
|
||||
- component: {fileID: 5044707777241721125}
|
||||
m_Layer: 5
|
||||
m_Name: retrun_BTN
|
||||
m_TagString: Untagged
|
||||
@ -134,6 +135,21 @@ MonoBehaviour:
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!114 &5044707777241721125
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4894555910357792268}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 74de365fa92f06a49a17acc53c84dc6c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
retbutton: {fileID: 0}
|
||||
btn: {fileID: 4894555910357792270}
|
||||
panel: {fileID: 0}
|
||||
--- !u!1 &4894555911772163770
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -11,6 +11,7 @@ GameObject:
|
||||
- component: {fileID: 6389689318277710001}
|
||||
- component: {fileID: 6389689318277710007}
|
||||
- component: {fileID: 6389689318277710000}
|
||||
- component: {fileID: 6226148154816690396}
|
||||
m_Layer: 5
|
||||
m_Name: shopPanel
|
||||
m_TagString: Untagged
|
||||
@ -77,6 +78,18 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &6226148154816690396
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6389689318277710002}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e3c192bd726c790488c8fe8895226742, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1001 &6389689319143782425
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -84,6 +97,18 @@ PrefabInstance:
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 6389689318277710001}
|
||||
m_Modifications:
|
||||
- target: {fileID: 499184974058266952, guid: 4e48ee49e456fad4887407d7ee921b35, type: 3}
|
||||
propertyPath: panel
|
||||
value:
|
||||
objectReference: {fileID: 6389689318277710002}
|
||||
- target: {fileID: 499184974058266952, guid: 4e48ee49e456fad4887407d7ee921b35, type: 3}
|
||||
propertyPath: retbutton
|
||||
value:
|
||||
objectReference: {fileID: 6606596862899521146}
|
||||
- target: {fileID: 499184974058266952, guid: 4e48ee49e456fad4887407d7ee921b35, type: 3}
|
||||
propertyPath: ClosureObj
|
||||
value:
|
||||
objectReference: {fileID: 6389689318277710002}
|
||||
- target: {fileID: 5126270615579512174, guid: 4e48ee49e456fad4887407d7ee921b35, type: 3}
|
||||
propertyPath: m_Pivot.x
|
||||
value: 0.5
|
||||
@ -179,3 +204,14 @@ RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 5126270615579512174, guid: 4e48ee49e456fad4887407d7ee921b35, type: 3}
|
||||
m_PrefabInstance: {fileID: 6389689319143782425}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &6606596862899521146 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 217268183994351203, guid: 4e48ee49e456fad4887407d7ee921b35, type: 3}
|
||||
m_PrefabInstance: {fileID: 6389689319143782425}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
|
Loading…
Reference in New Issue
Block a user