using System.Collections;
using System.Collections.Generic;
using EasyButtons;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
using UnityEngine.EventSystems;

public class ChipBoard : MonoBehaviour
{
    public static ChipBoard instance;
    public Transform numberGridParent;
    public Color redColor,blackColor;
    public EventTrigger eventTrigger;
    public float DistanceThreshold = 10;

    [Button]
    void Config(){
        for(int i= 1; i < RouletteManager.RouletteNumbers.Length-1; i++){
            GameObject newItem= Instantiate(numberGridParent.GetChild(0).gameObject, numberGridParent);
            newItem.GetComponent<Image>().color = RouletteManager.Reds.Contains(i+1) ? redColor : blackColor;
            newItem.GetComponentInChildren<TMP_Text>().text = (i+1).ToString();
            newItem.GetComponent<BettingSpace>().Number = i+1;
        }
    }
    void Awake()
    {
        instance = this;
        EventTrigger.Entry OnEnter = new EventTrigger.Entry();
        OnEnter.eventID = EventTriggerType.PointerEnter;
        OnEnter.callback.AddListener(onEnter);

        EventTrigger.Entry OnExit = new EventTrigger.Entry();
        OnExit.eventID = EventTriggerType.PointerExit;
        OnExit.callback.AddListener(onExit);

        eventTrigger.triggers.Add(OnEnter);
        eventTrigger.triggers.Add(OnExit);
    }

    bool mouseIn = false;
    void onEnter(BaseEventData e){
        mouseIn= true;
    }

    void onExit(BaseEventData e){
        mouseIn=false;
    }

  
    
}
