Skip to content

+EA 23.300 Nightly - Plugin.UI โ€‹

May 1, 2026

2 files modified.

Important Changes โ€‹

None.

BookList โ€‹

using System;

cs
using System; 
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEngine; 

public class BookList
{

public class Item

cs

		public string cat;

		public string path; 
		public int chance = 100;

		public int skin;
	}

	public static List<Func<string[]>> booklistLoaders = new List<Func<string[]>>(); 
	public static Dictionary<string, Dictionary<string, Item>> dict;

	public static void Init()
	{
		if (dict == null) 
		if (dict != null) 
		{ 
			return; 
		} 
		dict = new Dictionary<string, Dictionary<string, Item>>(); 
		List<string> list = new List<string>(); 
		list.AddRange(LoadDefaultBookList()); 
		foreach (Func<string[]> booklistLoader in booklistLoaders) 
		{
			dict = new Dictionary<string, Dictionary<string, Item>>(); 
			AddDir("Book", CorePath.CorePackage.Book); 
			AddDir("Scroll", CorePath.CorePackage.Scroll); 
			try
			{ 
				list.AddRange(booklistLoader()); 
			} 
			catch (Exception arg) 
			{ 
				Debug.LogWarning($"#book external booklist loader failed\n{arg}"); 
			} 
		}
		static void AddDir(string id, string path) 
		foreach (string item in list) 
		{
			DirectoryInfo directoryInfo = new DirectoryInfo(path); 
			Dictionary<string, Item> dictionary = new Dictionary<string, Item>(); 
			dict.Add(id, dictionary); 
			FileInfo[] files = directoryInfo.GetFiles(); 
			DirectoryInfo directoryInfo = new DirectoryInfo(item); 
			if (!directoryInfo.Exists) 
			{ 
				Debug.LogWarning("#book invalid booklist path/" + item); 
				continue; 
			} 
			string name = directoryInfo.Name; 
			dict.TryAdd(name, new Dictionary<string, Item>()); 
			FileInfo[] files = directoryInfo.GetFiles("*.txt", SearchOption.TopDirectoryOnly); 
			foreach (FileInfo fileInfo in files)
			{
				if (!(fileInfo.Extension != ".txt")) 
				using StreamReader streamReader = new StreamReader(fileInfo.FullName); 
				string text = Path.ChangeExtension(fileInfo.Name, null); 
				string text2 = streamReader.ReadLine(); 
				int? num = text2?.Length; 
				if (!num.HasValue || num.GetValueOrDefault() <= 0) 
				{
					StreamReader streamReader = new StreamReader(fileInfo.FullName); 
					string[] array = streamReader.ReadLine().Split(','); 
					Item item = new Item
					{ 
						cat = id, 
						title = array[0], 
						author = ((array.Length >= 2 && !array[1].IsEmpty()) ? "nameAuthor".lang(array[1]) : "unknownAuthor".lang()), 
						chance = ((array.Length >= 3) ? array[2].ToInt() : 100), 
						skin = ((array.Length >= 4) ? array[3].ToInt() : 0), 
						id = fileInfo.Name.Replace(fileInfo.Extension, "") 
					}; 
					dictionary.Add(item.id, item); 
					streamReader.Close(); 
					Debug.LogWarning("#book invalid first line/" + item); 
					continue; 
				}
				string[] array = text2.Split(','); 
				dict[name][text] = new Item
				{ 
					cat = name, 
					title = array[0], 
					author = ((array.Length > 1) ? "nameAuthor".lang(array[1]) : "unknownAuthor".lang()), 
					chance = ((array.Length > 2) ? array[2].ToInt() : 100), 
					skin = ((array.Length > 3) ? array[3].ToInt() : 0), 
					id = text, 
					path = fileInfo.FullName 
				}; 
			}
		}
	}

public static Item GetItem(string id, string idCat = "Book")

cs
		Init();
		return dict[idCat].TryGetValue(id) ?? dict["Book"]["_default"];
	}
	public static string[] LoadDefaultBookList() 
	{ 
		return new string[2] 
		{ 
			CorePath.CorePackage.Book, 
			CorePath.CorePackage.Scroll 
		}; 
	} 
}

UIBook โ€‹

string STR(string s)

cs

	public static SearchContext searchContext;

	public static List<Func<string[]>> topicLoaders = new List<Func<string[]>>(); 
	private void Awake()
	{
		if (searchContext == null || Application.isEditor)

public void Show()

cs
public void BuildPages()
{
	pages.Clear();
	string[] array = bookItem?.lines ?? IO.LoadTextArray(CorePath.CorePackage.Help + idFile); 
	if (idFile == "version" && Lang.langCode == "CN") 
	{ 
		array = IO.LoadTextArray(CorePath.CorePackage.TextEN + idFile); 
	} 
	if (array.IsEmpty()) 
	{ 
		array = IO.LoadTextArray(CorePath.CorePackage.Text + idFile); 
	} 
	if (array.IsEmpty()) 
	string[] array = bookItem?.lines; 
	if (bookItem?.path != null && array == null) 
	{
		array = IO.LoadTextArray(CorePath.CorePackage.TextCommon + idFile); 
		array = IO.LoadTextArray(bookItem.path); 
	}
	if (array.IsEmpty())
	{
		array = IO.LoadTextArray(CorePath.CorePackage.HelpEN + idFile); 
		List<string> list = new List<string> 
		{ 
			CorePath.CorePackage.Help, 
			CorePath.CorePackage.Text, 
			CorePath.CorePackage.TextCommon, 
			CorePath.CorePackage.HelpEN, 
			CorePath.CorePackage.TextEN 
		}; 
		if (idFile == "version" && Lang.langCode == "CN") 
		{ 
			list.Insert(1, CorePath.CorePackage.TextEN); 
		} 
		foreach (string item in list) 
		{ 
			array = IO.LoadTextArray(item + idFile); 
			if (!array.IsEmpty()) 
			{ 
				break; 
			} 
		} 
	}
	if (array.IsEmpty()) 
	if (array == null) 
	{
		array = IO.LoadTextArray(CorePath.CorePackage.TextEN + idFile); 
		array = Array.Empty<string>(); 
	}
	Page page = new Page();
	int num = 0;

public void AddPage(Page page)

cs

	public void RefreshTopics()
	{
		string[] array = IO.LoadTextArray(CorePath.CorePackage.Help + "_topics.txt"); 
		List<UIList> lists = new List<UIList>();
		lists.Add(list); 
		list.Clear(); 
		list.callbacks = new UIList.Callback<Item, ButtonCategory> 
		lists.Add(this.list); 
		this.list.Clear(); 
		this.list.callbacks = new UIList.Callback<Item, ButtonCategory> 
		{
			onClick = delegate(Item a, ButtonCategory b)
			{

public void RefreshTopics()

cs
	Item item = null;
	Item item2 = null;
	helpTitles.Clear();
	string[] array2 = array; 
	for (int i = 0; i < array2.Length; i++) 
	List<string> list = new List<string>(); 
	list.AddRange(LoadBuiltInTopics()); 
	foreach (Func<string[]> topicLoader in topicLoaders) 
	{
		string[] array3 = array2[i].Replace(oldValue, "").Split(','); 
		string[] array4 = array3[0].Split('-'); 
		try
		{ 
			list.AddRange(topicLoader()); 
		} 
		catch (Exception arg) 
		{ 
			Debug.LogWarning($"#book external topic loader failed\n{arg}"); 
		} 
	} 
	foreach (string item6 in list) 
	{ 
		string[] array = item6.Replace(oldValue, "").Split(','); 
		string[] array2 = array[0].Split('-'); 
		Item item3 = new Item
		{
			idFile = array4[0], 
			id = array4[1], 
			title = array3[1] 
			idFile = array2[0], 
			id = array2[1], 
			title = array[1] 
		};
		helpTitles[array3[0]] = item3.title.Replace("$", ""); 
		helpTitles[array[0]] = item3.title.Replace("$", ""); 
		if (item3.title.StartsWith("$"))
		{
			item = item3;
			item3.title = item3.title.TrimStart('$');
			list.Add(item3); 
			this.list.Add(item3); 
		}
		else if (item != null)
		{

public void RefreshTopics()

cs
		}
		else
		{
			list.Add(item3); 
			this.list.Add(item3); 
		}
		if (item3.idFile == idFirstFile && item3.id == idFirstTopic)
		{

public void RefreshTopics()

cs
				idFirstFile = null;
			}
		}
		list.Refresh(); 
		this.list.Refresh(); 
		if (item2 != null)
		{
			foreach (UIList item6 in lists) 
			foreach (UIList item7 in lists) 
			{
				item6.Select(item2, invoke: true); 
				item7.Select(item2, invoke: true); 
			}
		}
		else if (list.children.Count > 0) 
		else if (this.list.children.Count > 0) 
		{
			list.children.FirstItem().Select(0, invoke: true); 
			this.list.children.FirstItem().Select(0, invoke: true); 
		}
		else
		{
			list.Select(0, invoke: true); 
			this.list.Select(0, invoke: true); 
		}
		SkinManager.tempSkin = null;
	}

	public string[] LoadBuiltInTopics() 
	{ 
		return IO.LoadTextArray(CorePath.CorePackage.Help + "_topics.txt"); 
	} 
	public void ShowPage(int idx = 0)
	{
		if ((bool)note2)