public static void OnGUI() { GUILayout.BeginHorizontal("物品详情", GUI.skin.window, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true)); if (ItemSearchUI.SelectItem != null) { GUILayout.BeginVertical(GUI.skin.box, GUILayout.Width(120)); Texture2D icon = ModTool.GetIcon(ItemSearchUI.SelectItem); if (icon != null) { GUILayout.Label(icon); } else { GUILayout.Label("此物品无图标"); } if (InGameWiki.ShowJSON.Value) { if (GUILayout.Button("显示JSON数据")) { JsonUI.Json = ItemSearchUI.SelectItem; } } GUILayout.EndVertical(); } svPos = GUILayout.BeginScrollView(svPos, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true)); if (ItemSearchUI.SelectItem == null) { GUILayout.Label("当前未选中物品"); } else { GUI.contentColor = ItemSearchUI.SelectItem.GetQualityColor(); GUILayout.Label($"物品名称: {ItemSearchUI.SelectItem["name"].str.UnCode64()}"); GUI.contentColor = Color.white; GUILayout.Label($"ID: {ItemSearchUI.SelectItem["id"].I}"); GUILayout.Label($"品质: {ItemSearchUI.SelectItem["quality"].I}品"); GUILayout.Label($"类别: {Tools.getStr("ItemType" + (int)ItemSearchUI.SelectItem["type"].n)}"); GUILayout.Label($"简介: {ItemSearchUI.SelectItem["desc"].str.UnCode64()}"); GUILayout.Label($"描述: {ItemSearchUI.SelectItem["desc2"].str.UnCode64()}"); GUILayout.Label($"最大堆叠: { ItemSearchUI.SelectItem["maxNum"].I }"); GUILayout.Label($"价格: { ItemSearchUI.SelectItem["price"].I }"); switch ((int)ItemSearchUI.SelectItem["type"].n) { case 6: //药材 GUILayout.Label("【药性】"); GUILayout.Label($"用于主药: {Tools.getLiDanLeiXinStr((int)ItemSearchUI.SelectItem["yaoZhi2"].n)}"); GUILayout.Label($"用于辅药: {Tools.getLiDanLeiXinStr((int)ItemSearchUI.SelectItem["yaoZhi3"].n)}"); GUILayout.Label($"用于药引: {Tools.getLiDanLeiXinStr((int)ItemSearchUI.SelectItem["yaoZhi1"].n)}"); break; } } GUILayout.EndScrollView(); //联动数据1 if (ItemSearchUI.SelectItem != null) { switch ((int)ItemSearchUI.SelectItem["type"].n) { case 5: //丹药 DanYaoUI(ItemSearchUI.SelectItem); break; case 6: //药材 YaoCaiUI(ItemSearchUI.SelectItem); break; } } //联动数据 - 采集地数据 if (ItemSearchUI.SelectItem != null) { //6药材 8材料 if ((int)ItemSearchUI.SelectItem["type"].n == 6 || (int)ItemSearchUI.SelectItem["type"].n == 8) { CaiJiDiUI(ItemSearchUI.SelectItem); } } GUILayout.EndHorizontal(); }
public static void OnGUI() { GUILayout.BeginVertical("物品搜索", GUI.skin.window, GUILayout.Height(300), GUILayout.ExpandWidth(true)); #region 过滤及翻页 GUILayout.BeginHorizontal(GUI.skin.box); //种类 GUILayout.Label("种类", GUILayout.Width(30)); selectType = GUILayout.SelectionGrid(selectType, typeStrs, 18); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(GUI.skin.box); //品级 GUILayout.Label("品级", GUILayout.Width(30)); selectQuality = GUILayout.SelectionGrid(selectQuality, qualityStrs, 7, GUILayout.Width(350)); GUILayout.Space(20); //关键词 GUILayout.Label("关键词", GUILayout.Width(45)); searchStr = GUILayout.TextField(searchStr, GUILayout.Width(100)); GUILayout.Space(20); //页数 SearchItems(); maxPage = ItemList.Count / 30; if (ItemList.Count % 30 != 0) { maxPage++; } GUILayout.Label($" 第{nowPage + 1}页 共{maxPage}页", GUILayout.Width(100)); if (GUILayout.Button("上一页", GUILayout.Width(50))) { nowPage--; } if (GUILayout.Button("下一页", GUILayout.Width(50))) { nowPage++; } if (nowPage < 0) { nowPage = maxPage - 1; } if (nowPage >= maxPage) { nowPage = 0; } tmpPage = 0; tmpShow = 0; GUILayout.EndHorizontal(); #endregion //列表 svPos = GUILayout.BeginScrollView(svPos); foreach (var kv in ItemList) { if (tmpPage < nowPage * 30) { tmpPage++; continue; } tmpShow++; GUILayout.BeginHorizontal(GUI.skin.box); GUILayout.Label($"{nowPage * 30 + tmpShow}", GUILayout.Width(40)); GUI.contentColor = ModTool.GetItemQualityColor(kv.Value); if (GUILayout.Button(Tools.instance.Code64ToString(kv.Value["name"].str), GUILayout.Width(100))) { SelectItem = kv.Value; } GUI.contentColor = Color.white; GUILayout.Label($"{Tools.instance.Code64ToString(kv.Value["desc"].str)}"); GUILayout.EndHorizontal(); if (tmpShow >= 30) { break; } } GUILayout.EndScrollView(); GUILayout.EndVertical(); }