// Update is called once per frame
    void Update()
    {
        //btn_Toggle.isChecked

        if (loading)
        {
            picture.fid = fid;
            if (!FaceBook.getfriendImages().ContainsKey(fid))
            {
                FacebookPictureDownloader.EnQueue(fid);

                /*
                 * FB.API(Util.GetPictureURL(fid, 128, 128), Facebook.HttpMethod.GET, pictureResult =>
                 * {
                 *  if (pictureResult.Error != null)
                 *  {
                 *      Debug.LogError(pictureResult.Error);
                 *  }
                 *  else
                 *  {
                 *      FaceBook.getfriendImages().Add(fid.ToString(), pictureResult.Texture);
                 *  }
                 * });
                 */
            }

            loading = false;
        }
    }
    public void SetInit(int rank, string fid, string name, string score, string sendable, bool me)
    {
        this.fid = fid;

        if (this.label_rank != null)
        {
            this.label_rank.text = rank.ToString();
        }
        if (this.label_name != null)
        {
            this.label_name.text = name;
        }
        if (this.label_score != null)
        {
            this.label_score.text = score;
        }

        if (sendable.Equals("1"))
        {
            this.sendable = true;
        }
        else
        {
            this.sendable = false;
        }

        this.me = me;

        if (me)
        {
            label_rank.color = new Color(13.0f / 255.0f, 150.0f / 255.0f, 150.0f / 255.0f);
            this.sendable    = false;
            sendBtn.SetActive(false);
        }
        else if (this.sendable)
        {
            sendBtn.SetActive(true);
            sendunable.SetActive(false);
        }
        else
        {
            sendBtn.SetActive(true);
            sendunable.SetActive(true);
        }

        if (!me && rank > 3)
        {
            label_rank.color = new Color(8.0f / 255.0f, 8.0f / 255.0f, 8.0f / 255.0f);
        }

        picture.fid = fid;

        if (!FaceBook.getfriendImages().ContainsKey(fid))
        {
            FacebookPictureDownloader.EnQueue(fid);
        }

        this.init = true;
    }
    public void SetFriendTogetherContext(string friendname, string fid)
    {
        setenable = true;
        //this.friendname = friendname;
        this.fid    = fid;
        picture.fid = fid;

        if (!FaceBook.getfriendImages().ContainsKey(fid))
        {
            FacebookPictureDownloader.EnQueue(fid);
        }

        if (label_name != null)
        {
            label_name.text = friendname;
        }
    }
Exemple #4
0
    // Update is called once per frame
    void Update()
    {
        currentT += Time.deltaTime;

        if (fid != null)
        {
            if (texture == null)
            {
                Debug.LogError(this.name + "," + this.gameObject.name + "," + "TextureUpdate, Texture NULL");
                return;
            }

            if (texture.mainTexture == null)
            {
                Debug.LogError("TextureUpdate, Texture.MainTexture NULL");
                return;
            }

            if (texture.mainTexture.name.Equals("MS_ranking_bg_face"))
            {
                if (FaceBook.getfriendImages().ContainsKey(fid))
                {
                    currentT = 0.0f;

                    Texture picture = null;
                    FaceBook.getfriendImages().TryGetValue(fid, out picture);

                    if (picture != null)
                    {
                        texture.mainTexture = picture;
                    }
                }
            }
            else
            {
                Debug.Log("TextureUpdate, Texture Correct!");
                Destroy(this);
            }
        }
    }
    public void Update()
    {
        if (wait != null)
        {
            if (wait.Count > 0)
            {
                string fid = wait.Dequeue();

                if (!FaceBook.getfriendImages().ContainsKey(fid) && !complete.Contains(fid) && !ing.ContainsKey(fid))
                {
                    ing.Add(fid, false);

                    FB.API(Util.GetPictureURL(fid, 128, 128), Facebook.HttpMethod.GET, pictureResult =>
                    {
                        ing.Remove(fid);

                        if (pictureResult.Error != null)
                        {
                            //Debug.LogError(pictureResult.Error);
                            wait.Enqueue(fid);
                        }
                        else
                        {
                            try
                            {
                                FaceBook.getfriendImages().Add(fid, pictureResult.Texture);
                                complete.Enqueue(fid);
                            }
                            catch (System.Exception e)
                            {
                                Debug.Log(e.Message + " : Exceiption.");
                            }
                        }
                    });
                }
            }
        }
    }
Exemple #6
0
    //private string sendderName = null;

    public void SetMessageContext(int type, string sendderName, string fid)
    {
        setenable = true;
        this.type = type;
        //this.sendderName = sendderName;
        this.fid    = fid;
        picture.fid = fid;
        if (!FaceBook.getfriendImages().ContainsKey(fid))
        {
            FacebookPictureDownloader.EnQueue(fid);
        }

        switch (type)
        {
        case 1:
            if (title != null)
            {
                //title.text = StringData.getType1_Title(sendderName);
                title.text = StringData.getString(StringData.Type1_Title_key).Replace("%s", sendderName);
            }
            if (subtitle != null)
            {
                //subtitle.text = StringData.getType1_Message(sendderName);
                subtitle.text = StringData.getString(StringData.Type1_Message_key).Replace("%s", sendderName);
            }
            if (label_acceptbutton != null)
            {
                //label_acceptbutton.text = StringData.Type1_AcceptButton;
                label_acceptbutton.text = StringData.getString(StringData.Type1_AcceptButton_key);
            }
            break;

        case 2:
            if (title != null)
            {
                //title.text = StringData.getType2_Title(sendderName);
                title.text = StringData.getString(StringData.Type2_Title_key).Replace("%s", sendderName);
            }
            if (subtitle != null)
            {
                //subtitle.text = StringData.getType2_Message(sendderName);
                subtitle.text = StringData.getString(StringData.Type2_Message_key).Replace("%s", sendderName);
            }
            if (label_acceptbutton != null)
            {
                //label_acceptbutton.text = StringData.Type2_AcceptButton;
                label_acceptbutton.text = StringData.getString(StringData.Type2_AcceptButton_key);
            }
            break;

        case 3:
            if (title != null)
            {
                //title.text = StringData.getType3_Title(sendderName);
                title.text = StringData.getString(StringData.Type3_Title_key).Replace("%s", sendderName);
            }
            if (subtitle != null)
            {
                //subtitle.text = StringData.getType3_Message(sendderName);
                subtitle.text = StringData.getString(StringData.Type3_Message_key).Replace("%s", sendderName);
            }
            if (label_acceptbutton != null)
            {
                //label_acceptbutton.text = StringData.Type3_AcceptButton;
                label_acceptbutton.text = StringData.getString(StringData.Type3_AcceptButton_key);
            }
            break;

        default:
            if (title != null)
            {
                title.text = StringData.getString(StringData.Type_Unknown_key);
                //title.text = "알수 없는 메시지";
            }
            if (subtitle != null)
            {
                subtitle.text = sendderName;
            }
            break;
        }
    }
Exemple #7
0
    // Use this for initialization
    void Start()
    {
        topUser = CMainData.TopUser;
        if (topUser != null)
        {
            for (int i = 0; i < topUser.Count; i++)
            {
                TextureUpdate t = face[i].GetComponent <TextureUpdate>();
                if (t != null)
                {
                    if (FaceBook.getfriendImages().ContainsKey(topUser[i]["fid"].ToString()))
                    {
                        Texture picture = null;
                        FaceBook.getfriendImages().TryGetValue(topUser[i]["fid"].ToString(), out picture);

                        if (picture != null)
                        {
                            if (face[i] != null)
                            {
                                face[i].mainTexture = picture;
                            }
                            Destroy(t);
                        }
                        else
                        {
                            t.fid = topUser[i]["fid"].ToString();
                        }
                    }
                    else
                    {
                        t.fid = topUser[i]["fid"].ToString();
                        FacebookPictureDownloader.EnQueue(topUser[i]["fid"].ToString());
                    }
                }

                /*
                 * string strURL = topUser[i]["fid"].ToString() + "?fields=id,name";
                 * Debug.Log("FRIEND NAME URL = [ " + strURL + " ]");
                 * FB.API(strURL, Facebook.HttpMethod.GET, result =>
                 * {
                 *  if (result.Error == null)
                 *  {
                 *      Debug.Log("FRIEND NAME RESULT = [ " + result.Text + " ]");
                 *      Dictionary<string, string> friendInfo = Util.DeserializeJSONFriendInfo(result.Text);
                 *      friendInfoList.Add(friendInfo["id"],friendInfo["name"]);
                 *  }
                 * });
                 */

                FacebookName facebookName = friend_name[i].GetComponent <FacebookName>();
                facebookName.fid = topUser[i]["fid"].ToString();

                //if (friend_name[i] != null)
                //    friend_name[i].text = topUser[i]["name"].ToString();

                if (score[i] != null)
                {
                    score[i].text = topUser[i]["score"].ToString();
                }
            }

            for (int i = topUser.Count; i < 10; i++)
            {
                face[i].gameObject.SetActive(false);
                back[i].SetActive(false);
                friend_name[i].gameObject.SetActive(false);
                rank[i].gameObject.SetActive(false);
                score[i].gameObject.SetActive(false);
            }
        }
        else
        {
            for (int i = 0; i < 10; i++)
            {
                face[i].gameObject.SetActive(false);
                back[i].SetActive(false);
                friend_name[i].gameObject.SetActive(false);
                rank[i].gameObject.SetActive(false);
                score[i].gameObject.SetActive(false);
            }
        }

        TextureUpdate t_my = face[10].GetComponent <TextureUpdate>();

        if (CMainData.UserTexture != null)
        {
            face[10].mainTexture = CMainData.UserTexture;
            Destroy(t_my);
        }
        else if (FaceBook.getfriendImages().ContainsKey(FB.UserId))
        {
            Texture picture = null;
            FaceBook.getfriendImages().TryGetValue(FB.UserId, out picture);

            if (picture != null)
            {
                if (face[10] != null)
                {
                    face[10].mainTexture = picture;
                }
                Destroy(t_my);
            }
            else
            {
                t_my.fid = FB.UserId;
            }
        }
        else
        {
            FacebookPictureDownloader.EnQueue(FB.UserId);
        }

        if (CMainData.Username != null)
        {
            friend_name[10].text = CMainData.Username;
        }

        if (score[10] != null)
        {
            score[10].text = CMainData.UserScore.ToString();
        }
        if (rank[10] != null)
        {
            rank[10].text = CMainData.UserRanking.ToString();
        }
    }