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

public class PrivilegePerMissionVipAttrItem : MonoBehaviour {

    public Text _Value;
    public GameObject _RIcon;
    public GameObject _NIcon;

    private const string rIconDesc = "iconR";
    private const string nIconDesc = "iconN";
	public void InitItem(string val, int type)
    {
        if (val.Equals(rIconDesc))
        {
            _RIcon.SetActive(true);
            _NIcon.SetActive(false);
            _Value.gameObject.SetActive(false);
        }
        else if (val.Equals(nIconDesc))
        {
            _NIcon.SetActive(true);
            _RIcon.SetActive(false);
            _Value.gameObject.SetActive(false);
        }else if(val.Equals("-1"))
        {
            _RIcon.SetActive(true);
            _NIcon.SetActive(false);
            _Value.gameObject.SetActive(false);
        }
        else
        {
            _NIcon.SetActive(false);
            _RIcon.SetActive(false);
            _Value.gameObject.SetActive(true);

            var funcTypeNameTab = TableManager.GetPrivilegeTypeDescByID(type, 0);
            if(funcTypeNameTab == null)
            {
                LogModule.ErrorLog("fucTypeDesc is null, id : " + type);
                return;
            }
            if (funcTypeNameTab.StrDicId != -1)
            {
                if(val != "-1")
                {
                    string _StrDicId = "#{" + funcTypeNameTab.StrDicId + "}";
                    _Value.text = StrDictionary.GetClientDictionaryString(_StrDicId, val);
                }
                else
                {
                    _Value.text = StrDictionary.GetClientDictionaryString("#{6737}");
                }
            }
            else
            {
                _Value.text = val;
            }
        }
    }
}