using System;
using I2.Loc;
using UnityEngine;
using UnityEngine.Events;
using wf;

public class YotogiSkillNameHoverPlate : MonoBehaviour
{
	private void Awake()
	{
		this.label = base.GetComponent<UILabel>();
		this.bg = base.transform.parent.gameObject.GetComponent<UISprite>();
	}

	public void ClearName()
	{
		if (this.label == null)
		{
			return;
		}
		this.label.text = string.Empty;
		Utility.SetLocalizeTerm(this.label, string.Empty, false);
	}

	public void SetName(string skillName, string skillNameTerm, bool isExpLock)
	{
		if (this.label == null)
		{
			return;
		}
		if (isExpLock)
		{
			this.label.text = skillName + "(EXPロック)";
		}
		else
		{
			this.label.text = skillName;
		}
		if (Product.supportMultiLanguage)
		{
			Localize localize = this.label.GetComponent<Localize>();
			if (localize == null)
			{
				localize = this.label.gameObject.AddComponent<Localize>();
				localize.LocalizeEventExecEnd.AddListener(new UnityAction(this.OnLocalizeEvent));
			}
			localize.TermArgs = new Localize.ArgsPair[2];
			localize.TermArgs[0] = Localize.ArgsPair.Create(skillNameTerm, true);
			localize.TermArgs[1] = ((!isExpLock) ? Localize.ArgsPair.Create(string.Empty, false) : Localize.ArgsPair.Create("SceneYotogi/(EXPロック)", true));
			localize.SetTerm("SceneYotogi/スキル選択スキル名表記");
		}
		this.LabelPixelPerfect();
	}

	public void LabelPixelPerfect()
	{
		if (this.label == null)
		{
			return;
		}
		this.label.width = 0;
		this.label.MakePixelPerfect();
		this.bg.width = this.label.width + 20;
	}

	private void OnLocalizeEvent()
	{
		this.LabelPixelPerfect();
	}

	private UILabel label;

	private UISprite bg;
}
