using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;

public class gameSceneAreaGroupHandler : gridView
{
    //public float ItemWidth
    //{
    //    get { return ItemWidth; }
    //}
    //public float ItemHeight
    //{
    //    get { return itemHeight; }
    //}
    //public float ItemInterval
    //{
    //    get { return itemInterval; }
    //}

    // Start is called before the first frame update
    public float sceneShowSize = 6.0f;
    void Start()
    {
        RectTransform rectTransform = transform.parent.Find("bg").GetComponent<RectTransform>();
        utilsTools.DisplaySize = new Vector2(rectTransform.rect.width,rectTransform.rect.height);
    }

    // Update is called once per frame
    void Update(){
    }
    public void autoResetCellSize()
    {
        //float sceneWidth = utilsTools.DisplaySize.x;
        //GameObject gameObjectContext = GetComponent<ScrollRect>().content.gameObject;
        //var gridLayout = gameObjectContext.GetComponent<GridLayoutGroup>();
        //if (gridLayout != null)
        //{
        //    float width1 = sceneWidth / sceneShowSize - gridLayout.spacing.x;
        //    if(width1 * sceneShowSize > sceneWidth)
        //    {
        //        sceneShowSize = sceneShowSize - 1;
        //        autoResetCellSize();
        //        return;
        //    }
        //    float bet = gridLayout.cellSize.x / width1;
        //    float height1 = gridLayout.cellSize.y / bet;
        //    float desHeight = GetComponent<RectTransform>().rect.height;
        //    while (height1 > desHeight)
        //    {
        //        bet = bet * 0.90f;
        //        height1 = gridLayout.cellSize.y / bet;
        //    }
        //    width1 = gridLayout.cellSize.x / bet;
        //    gridLayout.cellSize = new Vector2(width1, height1);
        //}
    }
    public void setDataNoGrid(int cout, gradViewBack gradView)
    {
        setData(cout,(GameObject obj,int idx,ListViewBackTypeEnum lvb) =>
        {
            //var aa1 = obj.GetComponent<RectTransform>();
            //aa1.localScale = new Vector3(scale,scale);
            gradView(obj,idx,lvb);
        });
    }
}
