예제 #1
0
        private void SearchHandler(string search)
        {
            StringBuilder result = new StringBuilder();

            foreach (var value in dicTexts)
            {
                if (value.Value.ToLower().Contains(search.ToLower()))
                {
                    selectedTabID = ArrayUtility.IndexOf(tabNames, value.Key);
                    FillMDList(selectedTabID);
                    result.AppendLine("===========");
                    foreach (var item in _dicInfos[value.Key])
                    {
                        if (item.Contains(search))
                        {
                            result.AppendLine(item.ToString());
                        }
                    }
                }
            }

            string resultStr = result.ToString();

            EditorTipWindow.Push("搜索结果:", resultStr);
            Debug.Log(resultStr);
        }
예제 #2
0
        private static async void DrawTex(FMDItem info)
        {
            if (info.IsNotLoadUrl)
            {
                info.IsNotLoadUrl = false;
                if (!info.Url.Contains("http"))
                {
                    string    path = $"tex/{Path.GetFileName(info.Url)}";
                    Texture2D tex  = ResLoadUnlit.GetAssetInPackageByRelative <Texture2D>(path);
                    info.Texture = tex;
                }
                else
                {
                    UnityWebRequest req = UnityWebRequestTexture.GetTexture(info.Url);
                    req.SendWebRequest();
                    while (!req.isDone)
                    {
                        await Task.Delay(1000);
                    }

                    var tex = req.downloadHandler as DownloadHandlerTexture;
                    if (tex != null)
                    {
                        info.Texture = tex.texture;
                    }

                    //  await Task.Delay(2000);
                    req.Dispose();
                }
            }
            else if (info.Texture != null)
            {
                var width = 300 * (float)info.Texture.width / info.Texture.height;

                if (GUILayout.Button(info.Texture, _imgStyle, GUILayout.Width(width),
                                     GUILayout.Height(300)))
                {
                    EditorTipWindow.Push(info.Texture);
                }
            }
        }