Beispiel #1
0
    private void updateRoleListPanelsInfo()
    {
        newRolePanelPosY = 0;
        foreach (UInt64 dbid in rolePanelDic.Keys)
        {
            Transform role_panel             = rolePanelDic[dbid];
            Dictionary <string, object> info = roles[dbid];

            //set Pos
            RectTransform rectTrans = role_panel.GetComponent <RectTransform>();
            rectTrans.anchoredPosition = new Vector2(0, newRolePanelPosY);
            newRolePanelPosY          -= rectTrans.sizeDelta.y;

            //find component
            Image roleImg   = role_panel.FindChild("avatar").gameObject.GetComponent <Image>();
            Text  nameTxt   = role_panel.FindChild("name").gameObject.GetComponent <Text>();
            Text  careerTxt = role_panel.FindChild("career").gameObject.GetComponent <Text>();
            Text  levelTxt  = role_panel.FindChild("level").gameObject.GetComponent <Text>();

            //set role data
            Byte career = (Byte)info["career"];
            role_panel.gameObject.name = ((UInt64)info["dbid"]).ToString();
            nameTxt.text   = "名字: " + (string)info["name"];
            careerTxt.text = "职业: " + RoleList.getCareerName(career);
            levelTxt.text  = "等级: " + ((UInt16)info["level"]).ToString();
            roleImg.sprite = Resources.Load <Sprite>("ui/" + RoleList.getRoleName(career));
        }
    }