Пример #1
0
    void AddRole(RoleInstance role)
    {
        bool isMust = (_mustRolesFunc != null && _mustRolesFunc(role));

        var roleItemUI = Jyx2RoleHeadUI.Create(role, isMust, () => { info.text = role.Name; });

        roleItemUI.transform.SetParent(m_Container);
    }
Пример #2
0
    void OnConfirm()
    {
        List <RoleInstance> rst = new List <RoleInstance>();

        for (int i = 0; i < m_Container.childCount; ++i)
        {
            var            child      = m_Container.GetChild(i);
            Jyx2RoleHeadUI roleHeadUI = child.GetComponent <Jyx2RoleHeadUI>();
            if (roleHeadUI == null)
            {
                continue;
            }
            if (roleHeadUI.IsChecked)
            {
                var role = roleHeadUI.GetRole();
                rst.Add(role);
                Debug.Log(role.Key);
            }
        }
        _callback(rst);

        Destroy(this.gameObject);
    }