Exemple #1
0
    public static DialogSelectAvatar GetInstance()
    {
        GameObject         canvas = GameObject.Find("Canvas");
        GameObject         obj    = canvas.transform.Find(DialogName).gameObject;
        DialogSelectAvatar dlg    = obj.GetComponent <DialogSelectAvatar>();

        return(dlg);
    }
Exemple #2
0
    public static void Show(WorkDone cb)
    {
        GameObject         canvas = GameObject.Find("Canvas");
        GameObject         obj    = canvas.transform.Find(DialogName).gameObject;
        DialogSelectAvatar dlg    = obj.GetComponent <DialogSelectAvatar>();

        dlg.DoShow(obj, cb);
    }
Exemple #3
0
    public static GameObject GetHeadObject(string headImgUrl)
    {
        string     headStr = "Head" + headImgUrl;
        GameObject goSrc   = null;
        Transform  tf      =
            DialogSelectAvatar.GetInstance().transform.Find("main").
            transform.Find("Avatars").
            transform.Find("GridLayeout").
            transform.Find(headStr);

        if (tf != null)
        {
            goSrc = tf.gameObject;
        }

        return(goSrc);
    }
Exemple #4
0
    void UpdateSearchUI()
    {
        if (searchRecordObj)
        {
            searchRecordObj.SetActive(false);
        }

        FriendSummaryList fslist      = Lobby.getInstance().CurrentSummaryList;
        GameObject        goNoResults = GameObject.Find("SearchNoResults");

        if (fslist.Data.Count > 0)
        {
            searchRecordObj.SetActive(true);
            GameObject go = GameObject.Find("SearchResult");
            go.SetActive(true);
            go.transform.Find("txtSearchResultName").GetComponent <Text>().text  = fslist.Data[0].Name;
            go.transform.Find("txtSearchResultLevel").GetComponent <Text>().text = fslist.Data[0].Level.ToString();
            int headIndex = Tools.StringToInt32(fslist.Data[0].HeadImgUrl);
            if (headIndex > 0)
            {
                GameObject goSrc = DialogSelectAvatar.GetHeadObject(fslist.Data[0].HeadImgUrl);
                go.transform.Find("ImgHead").GetComponent <Image>().sprite = goSrc.GetComponent <Image>().sprite;
            }

            if (goNoResults != null)
            {
                goNoResults.GetComponent <Text>().text = "";
            }
        }
        else
        {
            searchRecordObj.SetActive(false);
            if (goNoResults != null)
            {
                goNoResults.GetComponent <Text>().text = "NO RESULTS";
            }
        }
    }
Exemple #5
0
    public void AfterUpdateProfileHeadImgUrl()
    {
        GameObject goSrc = DialogSelectAvatar.GetHeadObject(m_headImgUrl);

        if (goSrc != null)
        {
            Lobby.getInstance().UserInfo.HeadImgUrl = m_headImgUrl;
            GameObject goDest =
                DialogPersonalInfo.GetInstance().transform.Find("main").
                transform.Find("BtnUpAvatar").gameObject;
            goDest.GetComponent <Image>().sprite = goSrc.GetComponent <Image>().sprite;
            GameObject.Find("BtnAvatar").transform.Find("BtnHead").GetComponent <Image>().sprite = goSrc.GetComponent <Image>().sprite;
        }
        else
        {
            GameObject goHeadDefault = GameObject.Find("BtnAvatar").transform.Find("BtnHeadDefault").gameObject;
            GameObject goDest        =
                DialogPersonalInfo.GetInstance().transform.Find("main").
                transform.Find("BtnUpAvatar").gameObject;
            goDest.GetComponent <Image>().sprite = goHeadDefault.GetComponent <Image>().sprite;
            GameObject.Find("BtnAvatar").transform.Find("BtnHead").GetComponent <Image>().sprite = goHeadDefault.GetComponent <Image>().sprite;
        }
    }
Exemple #6
0
    public void UpdateUserInfo()
    {
        if (null == inputNickNameObj)
        {
            return;
        }

        LionUserInfo ui = m_userInfo;

        // 区分自己和他人
        bool isSelf = m_userInfo.UserId == Lobby.getInstance().UId;

        // NickName
        if (isSelf)
        {
            valNickNameObj.SetActive(false);
            inputNickNameObj.SetActive(true);
            InputField field = inputNickNameObj.GetComponent <InputField>();
            field.text = ui.Name;
        }
        else
        {
            inputNickNameObj.SetActive(false);
            valNickNameObj.SetActive(true);
            valNickNameObj.GetComponent <Text>().text = ui.Name;
        }

        // Level
        GameObject.Find("valLevel").GetComponent <Text>().text = ui.Level.ToString();

        // Coins
        GameObject.Find("valCoins").GetComponent <Text>().text = Tools.CoinToString(ui.Gold);

        // Location
        GameObject.Find("valLocation").GetComponent <Text>().text = ui.Location;

        // Like
        GameObject.Find("valLike").GetComponent <Text>().text = ui.Praise.ToString();

        // UUID
        GameObject.Find("valUId").GetComponent <Text>().text = ui.UserId.ToString();

        // 头像
        //if (ui.HeadImgUrl != "")
        {
            GameObject goSrc = DialogSelectAvatar.GetHeadObject(ui.HeadImgUrl);;

            if (goSrc != null)
            {
                GameObject goDest =
                    DialogPersonalInfo.GetInstance().transform.Find("main").
                    transform.Find("BtnUpAvatar").gameObject;
                goDest.GetComponent <Image>().sprite = goSrc.GetComponent <Image>().sprite;
            }
            else
            {
                GameObject goHeadDefault = GameObject.Find("BtnAvatar").transform.Find("BtnHeadDefault").gameObject;
                GameObject goDest        =
                    DialogPersonalInfo.GetInstance().transform.Find("main").
                    transform.Find("BtnUpAvatar").gameObject;
                goDest.GetComponent <Image>().sprite = goHeadDefault.GetComponent <Image>().sprite;
            }
        }

        Reception recp = GameObject.Find("Reception").GetComponent <Reception>();

        recp.GetTigerStatInfo(m_userInfo.UserId, UpdateTigerStatUI);
    }
Exemple #7
0
    void OnClick(GameObject sender)
    {
        Tools.PlayAudio(Constants.Audio.Audio_LobbyClickButton);

        DebugConsole.Log(sender.name);
        int btnIndex = GetBtn(sender.name);

        if (btnIndex < 0)
        {
            DebugConsole.Log("Cant find button:" + sender.name);
            return;
        }
        switch ((DialogBtn)btnIndex)
        {
        case DialogBtn.Close:
        {
            GameObject btnObj = GameObject.Find(DialogName);
            if (null == btnObj)
            {
                DebugConsole.Log("null");
            }
            else
            {
                DebugConsole.Log("DoHide");
                DoHide(btnObj);
            }
        }
        break;

        /*
         * case DialogBtn.ProfileOn:
         * case DialogBtn.RecordsOn:
         * {
         *  m_profileOn = !m_profileOn;
         *  // 若是老虎机统计信息,这里需要手动获取一次
         *  if (!m_profileOn)
         *  {
         *      Reception recp = GameObject.Find("Reception").GetComponent<Reception>();
         *      recp.GetTigerStatInfo(m_userInfo.UserId, UpdateTigerStatUI);
         *  }
         *  else
         *  {
         *      UpdateUI();
         *  }
         * }
         * break;*/
        case DialogBtn.UpAvatar:
        {
            //DebugConsole.Log("Upload...");
            DialogSelectAvatar.Show(UpdateAvatar);
        }
        break;

        case DialogBtn.AddFriend:
        {
            DialogBase.Show("FRIEND REQUEST", "Request to add Friend?", AddFriend);
        }
        break;

        case DialogBtn.RemoveFriend:
        {
            DialogBase.Show("FRIEND REMOVE", "Are you sure to remove?", RemoveFriend);
        }
        break;

        case DialogBtn.RegEmail:
        {
            DialogRegEmail.Show();
        }
        break;

        case DialogBtn.ModifyPassword:
        {
            DialogModifyPass.Show();
        }
        break;

        default:
            break;
        }
    }
Exemple #8
0
    void UpdateAvatar()
    {
        Reception recp = GameObject.Find("Reception").GetComponent <Reception>();

        recp.UpdateProfileHeadImgUrl(DialogSelectAvatar.GetInstance().HeadIndex.ToString());
    }