82 lines
2.1 KiB
C#
82 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
// Token: 0x02000019 RID: 25
|
|
public class TagViewer : MonoBehaviour
|
|
{
|
|
// Token: 0x06000083 RID: 131 RVA: 0x00003A8C File Offset: 0x00002C8C
|
|
public void Prepare(List<TagTip> tips, Action<string> insertTitle, Action<string> insertMessage, IFontOutViewer fontout, IColorViewer color)
|
|
{
|
|
this._tips = tips;
|
|
this._fontout = fontout;
|
|
this._color = color;
|
|
List<TMP_Dropdown.OptionData> list = new List<TMP_Dropdown.OptionData>();
|
|
for (int i = 0; i < tips.Count; i++)
|
|
{
|
|
list.Add(new TMP_Dropdown.OptionData(tips[i].Name));
|
|
}
|
|
this._dropDown.Prepare("タグ一覧", list);
|
|
this._insertTButton.onClick.RemoveAllListeners();
|
|
this._insertMButton.onClick.RemoveAllListeners();
|
|
this._insertTButton.onClick.AddListener(delegate
|
|
{
|
|
insertTitle(this.CreateMessage());
|
|
});
|
|
this._insertMButton.onClick.AddListener(delegate
|
|
{
|
|
insertMessage(this.CreateMessage());
|
|
});
|
|
}
|
|
|
|
// Token: 0x06000084 RID: 132 RVA: 0x00003B64 File Offset: 0x00002D64
|
|
private string CreateMessage()
|
|
{
|
|
TagTip tip = this.GetTip(this._dropDown.GetCurrentOption().text);
|
|
string text;
|
|
if (tip.Category == TagTip.TagCategory.Picto)
|
|
{
|
|
text = tip.OpeningTag.Replace("=", "=" + this._fontout.GetName());
|
|
}
|
|
else if (tip.Category == TagTip.TagCategory.Color)
|
|
{
|
|
text = tip.OpeningTag + this._color.GetColorCode() + tip.ClosingTag;
|
|
}
|
|
else
|
|
{
|
|
text = tip.ActualTag();
|
|
}
|
|
return text;
|
|
}
|
|
|
|
// Token: 0x06000085 RID: 133 RVA: 0x00003BF0 File Offset: 0x00002DF0
|
|
private TagTip GetTip(string name)
|
|
{
|
|
return this._tips.FirstOrDefault<TagTip>((TagTip tip) => tip.Name == name);
|
|
}
|
|
|
|
// Token: 0x0400003B RID: 59
|
|
[SerializeField]
|
|
private CustomDropDown _dropDown;
|
|
|
|
// Token: 0x0400003C RID: 60
|
|
[SerializeField]
|
|
private Button _insertTButton;
|
|
|
|
// Token: 0x0400003D RID: 61
|
|
[SerializeField]
|
|
private Button _insertMButton;
|
|
|
|
// Token: 0x0400003E RID: 62
|
|
private List<TagTip> _tips = new List<TagTip>();
|
|
|
|
// Token: 0x0400003F RID: 63
|
|
private IFontOutViewer _fontout;
|
|
|
|
// Token: 0x04000040 RID: 64
|
|
private IColorViewer _color;
|
|
}
|