using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;  // Pastikan untuk import namespace UI

public class CanvasController : MonoBehaviour
{
    public GameObject canvasGagal;
    public GameObject canvasBerhasil;
    
    // Komponen Image yang akan di-reset
    public Image displayImage;
    
    // Sprite awal sesuai dengan yang diassign di Inspector
    public Sprite initialDisplaySprite;

    public void CloseGagal()
    {
        canvasGagal.SetActive(false);
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }

    public void Closed()
    {
        canvasGagal.SetActive(false);
        // Reset komponen displayImage ke sprite awal
        if (displayImage != null && initialDisplaySprite != null)
        {
            displayImage.sprite = initialDisplaySprite;
        }
    }
}
