示例#1
0
    public void SetUser(GameObject newObject, UserItem userItem)
    {
        //已经准备好
        if (userItem.runState == 0)
        {
            newObject.GetComponentInChildren <ChangeStateButton>().Change();
        }
        GameObject life = newObject.transform.Find("life").gameObject;

        //管理员
        if (LoginInfo.Userinfo.type == 1)
        {
            newObject.GetComponentInChildren <ChangeStateButton>().GetComponent <Button>().interactable = false;
            int selectIndex = ListData.GetIndexGameSelect(GetComponentInParent <ListView>().selectGameId);
            if (life != null && selectIndex == 0)
            {
                life.gameObject.SetActive(true);
            }
            else
            {
                life.gameObject.SetActive(false);
            }
        }
        //玩家
        else
        {
            if (life != null)
            {
                life.gameObject.SetActive(false);
            }
            if (userItem.runState == 0)
            {
                //运行起来后
                newObject.GetComponentInChildren <ChangeStateButton>().GetComponent <Button>().interactable = false;
            }
            else
            {
                if (LoginInfo.Userinfo.id != userItem.id)
                {
                    newObject.GetComponentInChildren <ChangeStateButton>().GetComponent <Button>().interactable = false;
                }
            }
        }
    }