using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using GCGame.Table;

public class WorldBossDug : MonoBehaviour {

    public Text Tip;
    public Button CrossBossOKBtn;
    public Button WorldBossOKBtn;

    private int m_DugBossID = -1;
    public void Init(int bossID)
    {
        Tab_WorldBossConfig TabBoss = TableManager.GetWorldBossConfigByID(bossID, 0);
        if (TabBoss == null)
        {
            Close();
            return;
        }
        Tab_RoleBaseAttr roleBase = TableManager.GetRoleBaseAttrByID(TabBoss.Id, 0);
        if (roleBase == null)
        {
            Close();
            return;
        }
        m_DugBossID = bossID;
        if (TabBoss.ISOtherServer == 0)
        {
            Tip.text = StrDictionary.GetClientDictionaryString("#{49005}", roleBase.Name);
            CrossBossOKBtn.gameObject.SetActive(false);
            WorldBossOKBtn.gameObject.SetActive(true);
        }
        else
        {
            Tip.text = StrDictionary.GetClientDictionaryString("#{49056}", roleBase.Name);
            CrossBossOKBtn.gameObject.SetActive(true);
            WorldBossOKBtn.gameObject.SetActive(false);
        }
    }

    public void JoinDug()
    {
        UIManager.CloseUI(UIInfo.WorldBossDug);
        m_DugBossID = -1;
        return;
        UIManager.ShowUI(UIInfo.WorldBoss, delegate (bool bSuccess, object param)
        {
            if (bSuccess)
            {
                GameObject Wnd = UIManager.GetUIGameObject(UIInfo.WorldBoss);
                if (Wnd != null)
                {
                    WorldBoss worldBoss = Wnd.GetComponent<WorldBoss>();
                    if (worldBoss != null)
                    {
                        worldBoss.SetFirstSelectBossId((int)param);
                    }
                }
            }
        },
         m_DugBossID);

        UIManager.CloseUI(UIInfo.WorldBossDug);
    }

    public void NotTip(bool isOn)
    {
        if (isOn)
        {
            string sign = Singleton<ObjManager>.Instance.MainPlayer.GUID.ToString() + (System.DateTime.Now.Year * 1000).ToString() + System.DateTime.Now.DayOfYear.ToString();
            PlayerPrefs.SetString("WorldBossDug", sign);
        }
        else
        {
            PlayerPrefs.DeleteKey("WorldBossDug");
        }
    }

    public void Close()
    {
        UIManager.CloseUI(UIInfo.WorldBossDug);
        m_DugBossID = -1;
    }
}