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

public class ChildSkillTips : MonoBehaviour {

    public Transform _BGTransform;
    public Text _SkillName;
    public Text _CurlevelDesc;
    public Text _NextLevelDesc;
    public GameObject _NextlevelDescObj;

    public static ChildSkillTips Instance;
    private void Awake()
    {
        Instance = this;
    }

    private void OnDestroy()
    {
        Instance = null;
    }

    public void InitSkillInfoTips(int curStudyId, int nextStudyId, Vector3 pos)
    {
        _BGTransform.transform.position = pos;
        var curLevelStudyTab = TableManager.GetChildrenStudyLevelUpByID(curStudyId, 0);
        if(curLevelStudyTab == null)
        {
            gameObject.SetActive(false);
            Debug.LogError("ChildrenStudyParamTab is null : " + curStudyId);
            return;
        }
        _SkillName.text = curLevelStudyTab.SkillName;
        _CurlevelDesc.text = StrDictionary.GetClientDictionaryString("#{" + curLevelStudyTab.DescStrId + "}");

        if (nextStudyId == -1)
        {
            _NextLevelDesc.gameObject.SetActive(false);
            _NextlevelDescObj.SetActive(false);
        }
        else
        {
            _NextLevelDesc.gameObject.SetActive(true);
            _NextlevelDescObj.SetActive(true);

            var nextLevelStudyTab = TableManager.GetChildrenStudyLevelUpByID(nextStudyId, 0);
            if(nextLevelStudyTab == null)
            {
                _NextLevelDesc.gameObject.SetActive(false);
                _NextlevelDescObj.SetActive(false);

                return;
            }else
            {
                _NextLevelDesc.text = StrDictionary.GetClientDictionaryString("#{" + nextLevelStudyTab.DescStrId + "}");
            }
        }
    }

    public void OnMask()
    {
        ClosePanel();
    }

    public void ClosePanel()
    {
        UIManager.CloseUI(UIInfo.ChildSkillTips);
    }
}