2024-11-26 02:09:38 +08:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
public class Conversion : BaseUIPanel
|
|
|
|
{
|
|
|
|
public Button Button1;
|
|
|
|
public Button Button2;
|
|
|
|
public GameObject game;
|
|
|
|
void Start()
|
|
|
|
{
|
2024-11-26 02:59:54 +08:00
|
|
|
Button1.onClick.AddListener(() =>ButtononClick(ConversionItem.mode.ShellToEgg, Button1));
|
|
|
|
Button2.onClick.AddListener(() =>ButtononClick(ConversionItem.mode.EggToShell, Button2));
|
2024-11-26 02:09:38 +08:00
|
|
|
}
|
|
|
|
|
2024-11-26 02:59:54 +08:00
|
|
|
void ButtononClick(ConversionItem.mode mymode, Button button)
|
2024-11-26 02:09:38 +08:00
|
|
|
{
|
2024-11-26 02:59:54 +08:00
|
|
|
ButtonClickAnimationAsync(button.gameObject);
|
2024-11-26 02:09:38 +08:00
|
|
|
Canvas canvas = GetComponentInParent<Canvas>();
|
|
|
|
GameObject conver = Instantiate(game, canvas.transform);
|
|
|
|
conver.GetComponentInChildren<ConversionItem>().mymode = mymode;
|
|
|
|
}
|
|
|
|
}
|