using System.Collections.Generic;
using DG.Tweening;
using FairyGUI;
using BingoBrain;
using BingoBrain.Core;
using BingoBrain.HotFix;
using UnityEngine;

public static class BingoCell
{
    public static Transform root;

    public static int bingoCount = 5;

    public static int FixedNum = 12;

    public static List<Tween> tweens = new List<Tween>();

    public static List<int> FixedCallIndexList = new List<int>
    {
        0, 6, 24, 18, 15, 5, 4, 10, 20
    };

    public static bool isFirstGame;
    
    public static Vector2 CenterUIPos
    {
        get
        {
            Vector2 size = GRoot.inst.size / 2;
            return new Vector2(size.x, size.y);
        }
    }

    public static bool IsPauseGame => PauseSum > 0;

    public static bool IsGuiding => false;
    
    public static bool IsInGame = false;
    
    public static bool isVictory = false;
    
    public static int PauseSum;

    public static bool isProcedure;

    #region 叫号逻辑

    public static int MaxAddCallSum;

    public static int AddCallSum;

    public static int MaxCallSum;

    private static int callSpeed = 1;

    public static bool isGameOver = false;

    public static int CallSpeed
    {
        get => callSpeed;
        set
        {
            callSpeed = value;
            GameDispatcher.Instance.Dispatch(BingoInfo.CallSpeedChange, callSpeed);
        }
    }

    #endregion

    #region Bingo逻辑

    public static int CardBoardCount
    {
        get
        {
            if (PreferencesMgr.Instance.CardBoardIndex < 0 || PreferencesMgr.Instance.CardBoardIndex > 2)
            {
                PreferencesMgr.Instance.CardBoardIndex = 0;
            }

            return cardBoardNumList[PreferencesMgr.Instance.CardBoardIndex];
        }
    }

    public static int MaxCoinCount
    {
        get { return GameHelper.GetCommonModel().Initialprop[1]; }
    }

    public static int MinCoinCount
    {
        get { return GameHelper.GetCommonModel().Initialprop[0]; }
    }

    public static int MaxCashCount
    {
        get { return GameHelper.GetCommonModel().Initialprop[3]; }
    }

    public static int MinCashCount
    {
        get { return GameHelper.GetCommonModel().Initialprop[2]; }
    }

    #region 能量道具

    public static int curEnergy;

    public static float EnergyPrg
    {
        get { return BingoCell.curEnergy * 1F / BingoCell.FullEnergy; }
    }
    
    public static int FullEnergy
    {
        get { return GameHelper.GetCommonModel().Activateprop[PreferencesMgr.Instance.CardBoardIndex]; }
    }

    public static bool IsFullEnergy
    {
        get { return curEnergy == FullEnergy; }
    }

    #endregion

    public static List<CardBoardEntity> cardBoardList = new List<CardBoardEntity>();

    public static Dictionary<int, List<int>> bingoDic = new Dictionary<int, List<int>>();

    public static List<int> calledList = new List<int>();
    
    private static int[] cardBoardNumList = new[]
    {
        1, 2, 4
    };
    
    public static bool isCallFinish;

    public static bool isPropRewarding;

    public static int bingoCardboardIndex = -1;

    #endregion

    #region 卡牌

    public static int KeyCardSum { get; set; }

    public static void AddKeyCardSum(int sum)
    {
        KeyCardSum += sum;

        GameDispatcher.Instance.Dispatch(BingoInfo.KeyCardSumChane);
    }

    public static void OpenActivityUI(object o = null)
    {
        KeyCardSum -= 3;

        GameDispatcher.Instance.Dispatch(BingoInfo.KeyCardSumChane);
        UICtrlDispatcher.Instance.Dispatch(SkinInfo.BingoCardUI_Open);
    }

    #endregion

    #region 奖励

    public static decimal GetCoinSum;

    public static decimal GetCashSum;
    
    public static void AddReadSum(int id, decimal Sum)
    {
        if (id == 101)
        {
            GetCoinSum += Sum;
        }

        if (id == 102)
        {
            GetCashSum += Sum;
        }
    }

    #endregion

    #region 道具系统

    public static Vector3 propOriginPos;

    #endregion
}