Example #1
0
    public static bool setPlayerPhoto(string imageUrl, UISprite spEmptyFace, PhotoDownLoader face, PhotoDownLoadType type, int photoSize = -1)
    {
        if (imageUrl == null || imageUrl.ToLower().Contains("http") == false)
        {
            face.gameObject.SetActive(false);
            if (imageUrl == null)
            {
                imageUrl = "";
            }
            switch (imageUrl.ToUpper())
            {
            case Character.LEO:
                spEmptyFace.spriteName = Character.LEO_IMG;
                break;

            case Character.CHLOE:
                spEmptyFace.spriteName = Character.CHLOE_IMG;
                break;

            case Character.KILEY:
                spEmptyFace.spriteName = Character.KILEY_IMG;
                break;

            default:
                spEmptyFace.spriteName = Character.EMPTY_IMG;
                break;
            }
        }
        else
        {
            face.gameObject.SetActive(true);

            if (type != PhotoDownLoadType.DownLoad)
            {
                face.init(imageUrl);
            }

            if (type != PhotoDownLoadType.Init)
            {
                if (photoSize > 0)
                {
                    face.down(imageUrl, photoSize);
                }
                else
                {
                    face.down(imageUrl);
                }
            }

            return(true);
        }

        return(false);
    }
    private void addDownLoadStack(PhotoDownLoader pd)
    {
        if (downloadStack == null)
        {
            downloadStack = new List <PhotoDownLoader>();
        }
        if (downloadStack.Contains(pd))
        {
            downloadStack.Remove(pd);
        }
        downloadStack.Add(pd);

        nextDown();
    }
    public void nextDown()
    {
        if (isStackDownload)
        {
            return;
        }
        if (downloadStack.Count <= 0)
        {
            return;
        }

        PhotoDownLoader pd = downloadStack[0];

        downloadStack.Remove(pd);
        if (pd == null || pd.url == "" || getName(pd.url) == "404")
        {
            nextDown();
            return;
        }
        else
        {
            pd.doDownLoad();
        }
    }
Example #4
0
    public static void setPlayerPhoto(int showPhoto, string imageUrl, UISprite spEmptyFace, PhotoDownLoader face, bool downloadNow = false, int photoSize = -1)
    {
        if (showPhoto == WSDefine.TRUE)
        {
            if (imageUrl == null || imageUrl.ToLower().Contains("http") == false)
            {
                face.gameObject.SetActive(false);
                if (imageUrl == null)
                {
                    imageUrl = "";
                }
                switch (imageUrl.ToUpper())
                {
                case Character.LEO:
                    spEmptyFace.spriteName = Character.LEO_IMG;
                    break;

                case Character.CHLOE:
                    spEmptyFace.spriteName = Character.CHLOE_IMG;
                    break;

                case Character.KILEY:
                    spEmptyFace.spriteName = Character.KILEY_IMG;
                    break;

                default:
                    spEmptyFace.spriteName = Character.EMPTY_IMG;
                    break;
                }
            }
            else
            {
                face.gameObject.SetActive(true);
                face.init(imageUrl);
                if (downloadNow)
                {
                    if (photoSize > 0)
                    {
                        face.down(imageUrl, photoSize);
                    }
                    else
                    {
                        face.down(imageUrl);
                    }
                }
            }
        }
        else
        {
            face.gameObject.SetActive(false);
            if (imageUrl == null)
            {
                imageUrl = "";
            }
            switch (imageUrl.ToUpper())
            {
            case Character.LEO:
                spEmptyFace.spriteName = Character.LEO_IMG;
                break;

            case Character.CHLOE:
                spEmptyFace.spriteName = Character.CHLOE_IMG;
                break;

            case Character.KILEY:
                spEmptyFace.spriteName = Character.KILEY_IMG;
                break;

            default:
                spEmptyFace.spriteName = Character.EMPTY_IMG;
                break;
            }
        }
    }
 void Awake()
 {
     _instance = this;
     checkOldPhoto();
 }