示例#1
0
    public bool StartLoading(string url, IImageLoadedHandler imageLoaderHandler, ImageLoaderCache imageLoaderCache = null, object optionalParameter = null)
    {
        if (loadStatus != LoadStatus.Loading)
        {
            _url = url;
            _imageLoadedHandler = imageLoaderHandler;
            _imageLoaderCache   = imageLoaderCache;
            _optionalParameter  = optionalParameter;

            imageTexture = _imageLoaderCache.TryLoadImageFromCache(_url);
            if (imageTexture != null)
            {
                _imageLoadedHandler.ImageLoaded(imageTexture, _optionalParameter);
            }
            else
            {
                _coroutine = StartCoroutine(LoadingEnumerator());
            }

            return(true);
        }
        else
        {
            return(false);
        }
    }
示例#2
0
 protected override void OnElementChanged(ElementChangedEventArgs <Image> e)
 {
     base.OnElementChanged(e);
     if (e.NewElement != null)
     {
         var fastImage = e.NewElement as FastImage;
         _imageLoader = ImageLoaderCache.GetImageLoader(this);
         SetImageUrl(fastImage.ImageUrl);
     }
 }
示例#3
0
    public void Start()
    {
        if (!resourcesUrl.EndsWith("/"))
        {
            resourcesUrl += "/";
        }

        if (Application.platform == RuntimePlatform.WebGLPlayer)
        {
            Debug.Log("The full URL is: " + Application.absoluteURL);

            // Set scenario and map based on URL parameters

            Uri uri = new Uri(Application.absoluteURL);

            string scenarioArg = HttpUtility.ParseQueryString(uri.Query).Get("scenario");
            string mapArg      = HttpUtility.ParseQueryString(uri.Query).Get("map");

            if (scenarioArg == null || !int.TryParse(scenarioArg, out scenarioId))
            {
                scenarioId = 0;
            }
            if (mapArg == null || !int.TryParse(mapArg, out mapId))
            {
                mapId = 0;
            }
        }

        footageThumbnailsCache = new ImageLoaderCache(100);
        footagePhotosCache     = new ImageLoaderCache(25);
        cluesPhotosCache       = new ImageLoaderCache(25);

        mapObj = mapObjList[mapId];
        foreach (GameObject mo in mapObjList)
        {
            mo.SetActive(false);
        }
        mapObj.SetActive(true);

        map                 = mapObj.GetComponent <Map>();
        sceneCamera         = sceneCameraObj.GetComponent <Camera>();
        sceneCameraControls = sceneCameraObj.GetComponent <CameraControls>();
        timelineCamera      = timelineCameraObj.GetComponent <Camera>();

        startScreenText.text = scenarioNameList[scenarioId] + "\n" + startScreenText.text;
    }