void OnEnable()
        {
            ReferenceUtil.Init();
            dicTexts = new Dictionary <string, string>();

            Skin = ResLoadUnlit.GetAssetInPackageByRelative <GUISkin>(SkinPath);

            dicTexts = ResLoadUnlit.LoadTextAsset(MdFloder, ".md");
            tabNames = new string[dicTexts.Count];
            dicTexts.Keys.CopyTo(tabNames, 0);

            selectedTabID = EditorPrefs.GetInt("ShaderRef_SeletedIndex_md", 0);
            FillMd(selectedTabID);
        }
Пример #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);
                }
            }
        }