示例#1
0
        public ForgeEditorDisplayObject(string info, DisplayType type, GUIStyle bold, GUIStyle regular)
        {
            DisplayInfoType = type;
            boldWhite       = bold;
            regularWhite    = regular;

            switch (DisplayInfoType)
            {
            case DisplayType.Header:
                DisplayInfo = info.Replace("<h1>", string.Empty).Replace("</h1>", string.Empty);
                break;

            case DisplayType.Paragraph:
                DisplayInfo = info.Replace("<p>", string.Empty).Replace("</p>", string.Empty);
                break;

            case DisplayType.Video:
                string videoTitle = info.Remove(0, "<video title=\"".Length);
                videoTitle = videoTitle.Remove(videoTitle.IndexOf("\">"), videoTitle.Length - videoTitle.IndexOf("\">"));
                string videoID = info.Remove(0, info.IndexOf("\">") + "\">".Length);
                videoID     = videoID.Remove(videoID.IndexOf("</video>"), videoID.Length - videoID.IndexOf("</video>"));
                DisplayInfo = videoTitle;
                imageID     = videoID;
                imageUrl    = YOUTUBE_URL.Replace("<id>", videoID);
                HTTP imageRequest = new HTTP(YOUTUBE_THUMBNAIL_ENDPOINT.Replace("<id>", imageID));
                imageRequest.GetImage(RetreiveImageResponse);
                break;

            case DisplayType.AssetImage:
                string assetImage = info.Remove(0, "<asset image=\"".Length);
                assetImage = assetImage.Remove(assetImage.IndexOf("\">"), assetImage.Length - assetImage.IndexOf("\">"));
                string assetURL = info.Remove(0, info.IndexOf("\">") + "\">".Length);
                assetURL = assetURL.Remove(assetURL.IndexOf("</asset>"), assetURL.Length - assetURL.IndexOf("</asset>"));
                imageUrl = assetURL;
                //Debug.Log("Attempting to load: " + assetImage);
                HTTP assetRequest = new HTTP(assetImage);
                assetRequest.GetImage(RetreiveImageAssetResponse);
                break;
            }
        }