Beispiel #1
0
    private IEnumerator HTTPGetSlice(int sliceNumber)
    {
        string url = "http://" + _slicesHttp + "/" + sliceNumber + ".jpg";

        using (WWW www = new WWW(url))
        {
            yield return(www);

            if (string.IsNullOrEmpty(www.error))
            {
                if (sliceNumber == _currentSlice) // to ignore multiple requests
                {
                    if (!_slicer.IsSlicing())     // to ignore load if user started slicing again
                    {
                        www.LoadImageIntoTexture(_texture);

                        if (_refreshAspect)
                        {
                            slice.transform.localScale = new Vector3(_texture.width * _pixelSize, _texture.height * _pixelSize, 1.0f);
                            updateSlicePosition();
                            _main.resizeOrtographicCamera();
                            ResizeTabletopSurface();
                            ResizeSliceIndicator();

                            GetComponent <Storage>().Load();

                            _refreshAspect = false;
                        }
                    }
                }
            }
            else
            {
                Debug.Log("Slice donwload error: " + www.error);
            }
        }
    }