This commit is contained in:
舒荣森 2024-11-26 16:40:57 +08:00
parent 96f26f2bca
commit 5e34df456e
4 changed files with 29 additions and 21 deletions

View File

@ -11,17 +11,17 @@ public class DonatePanelItem : BaseUIPanel
public Text NumberOfFreeSnailShells; public Text NumberOfFreeSnailShells;
public Text Fees; public Text Fees;
public Text Total; public Text Total;
public Button Button;
void Start() void Start()
{ {
Recipient.onValueChanged.AddListener((userInput) => GetInputData(userInput, Recipient));
GiftQuantity.onValueChanged.AddListener((userInput) => GetInputData(userInput, GiftQuantity));
GiftQuantity.onValueChanged.AddListener(GiftQuantityData); GiftQuantity.onValueChanged.AddListener(GiftQuantityData);
Button.onClick.AddListener(buttonOnClick);
testLogo();
} }
void GetInputData(string userInput, TMP_InputField tmp) void buttonOnClick()
{ {
//ButtonClickAnimationAsync(tmp.gameObject,1.01f);
} }
async void GiftQuantityData(string userInput) async void GiftQuantityData(string userInput)
{ {

View File

@ -10,6 +10,15 @@ using UnityEngine.UI;
public class Base : MonoBehaviour public class Base : MonoBehaviour
{ {
public Button retbutton; public Button retbutton;
public GameObject ClosureObj;
private void Awake()
{
if (retbutton != null)
{
retbutton.onClick.AddListener(() => CancelOnClick(retbutton, ClosureObj));
}
}
public async Task ButtonClickAnimationAsync(GameObject button,float max=1.25f)//°´Å¥¶¯»­ public async Task ButtonClickAnimationAsync(GameObject button,float max=1.25f)//°´Å¥¶¯»­
{ {
TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(); TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
@ -64,9 +73,17 @@ public class Base : MonoBehaviour
return regex.IsMatch(text); return regex.IsMatch(text);
} }
public async void CancelOnClick(Button button)//È¡Ïû°´Å¥ public async void CancelOnClick(Button button,GameObject my_gameObject = null)//È¡Ïû°´Å¥
{ {
await ButtonClickAnimationAsync(button.gameObject); await ButtonClickAnimationAsync(button.gameObject);
if (my_gameObject != null)
{
Destroy(my_gameObject);
return;
}
Destroy(gameObject); Destroy(gameObject);
} }
} }

View File

@ -166,6 +166,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ee75c61d57c722e468ed4011fa66bea8, type: 3} m_Script: {fileID: 11500000, guid: ee75c61d57c722e468ed4011fa66bea8, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
retbutton: {fileID: 0}
Panel: {fileID: 158567709692854181} Panel: {fileID: 158567709692854181}
CloseBTN: {fileID: 0} CloseBTN: {fileID: 0}
inputField: {fileID: 6168167768698745100} inputField: {fileID: 6168167768698745100}

View File

@ -121,19 +121,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 3410210057816977128} m_TargetGraphic: {fileID: 3410210057816977128}
m_OnClick: m_OnClick:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls: []
- m_Target: {fileID: 4509579862271681879}
m_TargetAssemblyTypeName: BaseUIPanel, Assembly-CSharp
m_MethodName:
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!1 &821927266036662165 --- !u!1 &821927266036662165
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1327,13 +1315,15 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 02ca8bd802049024389ac844292ef713, type: 3} m_Script: {fileID: 11500000, guid: 02ca8bd802049024389ac844292ef713, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Panel: {fileID: 0} retbutton: {fileID: 3568963963287766741}
Panel: {fileID: 4509579862240682304}
CloseBTN: {fileID: 0} CloseBTN: {fileID: 0}
Recipient: {fileID: 5167839042553029366} Recipient: {fileID: 5167839042553029366}
GiftQuantity: {fileID: 8527512286296714387} GiftQuantity: {fileID: 8527512286296714387}
NumberOfFreeSnailShells: {fileID: 4509579860519678074} NumberOfFreeSnailShells: {fileID: 4509579860519678074}
Fees: {fileID: 8527512285347044353} Fees: {fileID: 8527512285347044353}
Total: {fileID: 8527512286273835625} Total: {fileID: 8527512286273835625}
Button: {fileID: 3364760182085171127}
--- !u!1 &5167839042247917623 --- !u!1 &5167839042247917623
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0