Esempio n. 1
0
 /// <summary>
 /// 尝试显示ItemProto,通过按键触发
 /// </summary>
 internal static void TryShowItemProto()
 {
     if (ShowProto.Value)
     {
         if (lastTip != null && lastTip.showingItemId != 0)
         {
             var proto = LDB.items.Select(lastTip.showingItemId);
             if (proto != null)
             {
                 RUEHelper.ShowProto(proto);
             }
             else
             {
                 var recipe = LDB.recipes.Select(-lastTip.showingItemId);
                 if (recipe != null)
                 {
                     foreach (var id in recipe.Results)
                     {
                         var item = LDB.items.Select(id);
                         RUEHelper.ShowProto(item);
                     }
                 }
             }
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 尝试显示RecipeProto,通过按键触发
 /// </summary>
 internal static void TryShowRecipeProto()
 {
     if (ShowProto.Value)
     {
         if (lastTip != null && lastTip.showingItemId != 0)
         {
             var itemProto = LDB.items.Select(lastTip.showingItemId);
             if (itemProto != null)
             {
                 foreach (var proto in itemProto.recipes)
                 {
                     RUEHelper.ShowProto(proto);
                 }
             }
             else
             {
                 var proto = LDB.recipes.Select(-lastTip.showingItemId);
                 RUEHelper.ShowProto(proto);
             }
         }
     }
 }
 public static void ShowSet <T>(this ProtoSet <T> protoSet) where T : Proto
 {
     if (protoSet.dataArray.Length > 100)
     {
         GUILayout.BeginHorizontal(GUI.skin.box);
         GUILayout.Label($"Page {selectPages[protoSet.GetType()] + 1} / {protoSet.dataArray.Length / 100 + 1}", GUILayout.Width(80));
         if (GUILayout.Button("-", GUILayout.Width(20)))
         {
             selectPages[protoSet.GetType()]--;
         }
         if (GUILayout.Button("+", GUILayout.Width(20)))
         {
             selectPages[protoSet.GetType()]++;
         }
         if (selectPages[protoSet.GetType()] < 0)
         {
             selectPages[protoSet.GetType()] = protoSet.dataArray.Length / 100;
         }
         else if (selectPages[protoSet.GetType()] > protoSet.dataArray.Length / 100)
         {
             selectPages[protoSet.GetType()] = 0;
         }
         GUILayout.EndHorizontal();
     }
     GUILayout.BeginHorizontal(GUI.skin.box);
     GUILayout.Label($"index", GUILayout.Width(40));
     GUILayout.Label($"ID", GUILayout.Width(40));
     GUILayout.Label($"Name");
     GUILayout.Label($"TranslateName");
     if (SupportsHelper.SupportsRuntimeUnityEditor)
     {
         GUILayout.Label($"Show Data", GUILayout.Width(100));
     }
     GUILayout.EndHorizontal();
     sv = GUILayout.BeginScrollView(sv, GUI.skin.box);
     for (int i = selectPages[protoSet.GetType()] * 100; i < Mathf.Min(selectPages[protoSet.GetType()] * 100 + 100, protoSet.dataArray.Length); i++)
     {
         GUILayout.BeginHorizontal();
         GUILayout.Label($"{i}", GUILayout.Width(40));
         if (protoSet.dataArray[i] != null)
         {
             GUILayout.Label($"{protoSet.dataArray[i].ID}", GUILayout.Width(40));
             GUILayout.Label($"{protoSet.dataArray[i].Name}");
             GUILayout.Label($"{protoSet.dataArray[i].name.Translate()}");
             if (SupportsHelper.SupportsRuntimeUnityEditor)
             {
                 if (GUILayout.Button($"Show Data", GUILayout.Width(100)))
                 {
                     ShowItem item = new ShowItem(protoSet.dataArray[i], $"{protoSet.dataArray[i].GetType().Name} {protoSet.dataArray[i].name.Translate()}");
                     RUEHelper.ShowData(item);
                 }
             }
         }
         else
         {
             GUILayout.Label("null");
         }
         GUILayout.EndHorizontal();
     }
     GUILayout.EndScrollView();
 }
        public static void ShowSet <T>(this ProtoSet <T> protoSet) where T : Proto
        {
            if (ProtoDataUI.Skin != null)
            {
                GUI.skin = ProtoDataUI.Skin.GetSkin();
            }
            GUILayout.BeginHorizontal(GUI.skin.box);
            Search = GUILayout.TextField(Search, GUILayout.Width(200));
            if (needSearch)
            {
                SearchLDB(protoSet);
            }
            GUILayout.Label($"Page {selectPages[protoSet.GetType()] + 1} / {searchResultList.Count / 100 + 1}", GUILayout.Width(80));
            if (GUILayout.Button("-", GUILayout.Width(20)))
            {
                selectPages[protoSet.GetType()]--;
            }
            if (GUILayout.Button("+", GUILayout.Width(20)))
            {
                selectPages[protoSet.GetType()]++;
            }
            if (selectPages[protoSet.GetType()] < 0)
            {
                selectPages[protoSet.GetType()] = searchResultList.Count / 100;
            }
            else if (selectPages[protoSet.GetType()] > searchResultList.Count / 100)
            {
                selectPages[protoSet.GetType()] = 0;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginVertical(GUI.skin.box);
            GUILayout.BeginHorizontal();
            GUILayout.Label($"index", GUILayout.Width(40));
            GUILayout.Label($"ID", GUILayout.Width(40));
            GUILayout.Label($"Name");
            GUILayout.Label($"TranslateName");
            if (SupportsHelper.SupportsRuntimeUnityEditor)
            {
                GUILayout.Label($"Show Data", GUILayout.Width(100));
            }
            GUILayout.EndHorizontal();
            sv = GUILayout.BeginScrollView(sv);
            for (int i = selectPages[protoSet.GetType()] * 100; i < Mathf.Min(selectPages[protoSet.GetType()] * 100 + 100, searchResultList.Count); i++)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label($"{i}", GUILayout.Width(40));
                if (searchResultList[i] != null)
                {
                    GUILayout.Label($"{searchResultList[i].ID}", GUILayout.Width(40));
                    GUILayout.Label($"{searchResultList[i].Name}");
                    GUILayout.Label($"{searchResultList[i].name.Translate()}");
                    if (SupportsHelper.SupportsRuntimeUnityEditor)
                    {
                        if (GUILayout.Button($"Show Data", GUILayout.Width(100)))
                        {
                            ShowItem item = new ShowItem(searchResultList[i], $"{searchResultList[i].GetType().Name} {searchResultList[i].Name.Translate()}");
                            RUEHelper.ShowData(item);
                        }
                    }
                }
                else
                {
                    GUILayout.Label("null");
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndScrollView();
            GUILayout.EndVertical();
        }