public void Init(GetProfileEvent profileEvent)
    {
        mProfileEvent = profileEvent;

        Transform infoTop = transform.FindChild("Scroll View").FindChild("InfoTop");

        if ((mProfileEvent.Response.data.imageName != null) &&
            (mProfileEvent.Response.data.imageName.Length > 0))
        {
            Debug.Log("Image is " + mProfileEvent.Response.data.imageName);
        }


        infoTop.FindChild("Frame").FindChild("Label").GetComponent <UILabel>().text
            = mProfileEvent.Response.data.nick;

        infoTop.FindChild("LblAccountBalance").FindChild("Label").GetComponent <UILabel>().text
            = UtilMgr.AddsThousandsSeparator(mProfileEvent.Response.data.gold + "");
        infoTop.FindChild("LblAccountBalance").FindChild("Label").FindChild("Sprite").localPosition
            = new Vector3(-(infoTop.FindChild("LblAccountBalance").FindChild("Label").GetComponent <UILabel>().width + 5), 0);

        infoTop.FindChild("LblTickets").FindChild("Label").GetComponent <UILabel>().text
            = UtilMgr.AddsThousandsSeparator(mProfileEvent.Response.data.ticket + "");
        infoTop.FindChild("LblTickets").FindChild("Label").FindChild("Sprite").localPosition
            = new Vector3(-(infoTop.FindChild("LblTickets").FindChild("Label").GetComponent <UILabel>().width + 5), 0);

        infoTop.FindChild("LblRankingPoint").FindChild("Label").GetComponent <UILabel>().text
            = UtilMgr.AddsThousandsSeparator(mProfileEvent.Response.data.rankPoint + "");
        infoTop.FindChild("LblRankingPoint").FindChild("Label").FindChild("Label").localPosition
            = new Vector3(-(infoTop.FindChild("LblRankingPoint").FindChild("Label").GetComponent <UILabel>().width + 10), 0);

        UtilMgr.LoadUserImage(mProfileEvent.Response.data.photoUrl, infoTop.FindChild("Frame").FindChild("Photo")
                              .FindChild("Texture").GetComponent <UITexture>());
    }
    void InitEntries()
    {
        Transform tf = transform.FindChild("Changeables").FindChild("Entries");

        tf.gameObject.SetActive(true);
        UtilMgr.ClearList(tf.FindChild("Draggable"));
        tf.FindChild("Draggable").GetComponent <UIDraggablePanel2>().Init(mEntryEvent.Response.data.Count,
                                                                          delegate(UIListItem item, int index) {
            item.Target.transform.FindChild("SprRankbox").FindChild("Label").GetComponent <UILabel>()
            .text = mEntryEvent.Response.data[index].rank + "";
            item.Target.transform.FindChild("LblName").GetComponent <UILabel>().text
                = mEntryEvent.Response.data[index].name;
            item.Target.transform.FindChild("LblPtLeft").GetComponent <UILabel>().text
                = mEntryEvent.Response.data[index].fantasyPoint + "";

            float ratio = mEntryEvent.Response.data[index].gameOverPlayers / 9f;
            int width   = (int)(152 * ratio);
            item.Target.transform.FindChild("Panel").FindChild("SprGaugeFront").GetComponent <UISprite>()
            .width = width;
            item.Target.transform.FindChild("Panel").FindChild("SprGaugeFront").localPosition
                = new Vector3(-((152 - width) / 2), 0);

            item.Target.transform.FindChild("SprPhotoBG")
            .FindChild("Photo").FindChild("Texture").GetComponent <UITexture>().mainTexture =
                UtilMgr.GetTextureDefault();

            UtilMgr.LoadUserImage(mEntryEvent.Response.data[index].photoUrl,
                                  item.Target.transform.FindChild("SprPhotoBG")
                                  .FindChild("Photo").FindChild("Texture").GetComponent <UITexture>());
        });
        tf.FindChild("Draggable").GetComponent <UIDraggablePanel2>().ResetPosition();
    }
    void ReceivedUserRanking()
    {
        transform.FindChild("Body").FindChild("ScrollUser").gameObject.SetActive(true);
        transform.FindChild("Body").FindChild("ScrollPlayer").gameObject.SetActive(false);

        UtilMgr.ClearList(transform.FindChild("Body").FindChild("ScrollUser"));
        transform.FindChild("Body").FindChild("ScrollUser").GetComponent <UIDraggablePanel2>().Init(
            mUserEvent.Response.data.Count, delegate(UIListItem item, int index) {
            item.Target.transform.FindChild("SprRankbox").FindChild("Label").GetComponent <UILabel>()
            .text = mUserEvent.Response.data[index].rank + "";
            item.Target.transform.FindChild("LblName").GetComponent <UILabel>()
            .text = mUserEvent.Response.data[index].name;
            item.Target.transform.FindChild("LblPtLeft").GetComponent <UILabel>()
            .text = mUserEvent.Response.data[index].rankPoint + "";

            item.Target.transform.FindChild("SprPhotoBG").FindChild("Photo").FindChild("Texture")
            .GetComponent <UITexture>().mainTexture = UtilMgr.GetTextureDefault();
            UtilMgr.LoadUserImage(mUserEvent.Response.data[index].photoUrl,
                                  item.Target.transform.FindChild("SprPhotoBG").FindChild("Photo").FindChild("Texture")
                                  .GetComponent <UITexture>());
        });
        transform.FindChild("Body").FindChild("ScrollUser").GetComponent <UIDraggablePanel2>().ResetPosition();

        if (NeedAnimation)
        {
            UtilMgr.AddBackState(UtilMgr.STATE.Ranking);
            UtilMgr.AnimatePageToLeft("Lobby", "Ranking");
        }
    }
Exemple #4
0
    public void Reset()
    {
        transform.FindChild("Body").FindChild("Scroll View").FindChild("User").FindChild("LblName")
        .GetComponent <UILabel>().text = UserMgr.UserInfo.nick;
        int width = transform.FindChild("Body").FindChild("Scroll View").FindChild("User").FindChild("LblName")
                    .GetComponent <UILabel>().width;

        transform.FindChild("Body").FindChild("Scroll View").FindChild("User").FindChild("LblName")
        .FindChild("BtnEdit").localPosition = new Vector3(width + 40, 0);
        transform.FindChild("Body").FindChild("Rename").gameObject.SetActive(false);
        transform.FindChild("Body").FindChild("Rename").FindChild("Box").FindChild("Input")
        .GetComponent <UIInput>().value = UserMgr.UserInfo.nick;
        UtilMgr.LoadUserImage(UserMgr.UserInfo.photoUrl,
                              transform.FindChild("Body").FindChild("Scroll View").FindChild("User").FindChild("Photo")
                              .FindChild("Panel").FindChild("Texture").GetComponent <UITexture>());
    }