public override void Show(ChatLog chatLog)
        {
            base.Show(chatLog);

            // Set GroupItem  //
            GroupItem groupItem = GlobalGroup.GetInstance().GetGroup(chatLog.chatID);
            if (groupItem != null)
            {
                if (_labelUserName)
                {
                    _labelUserName.text = groupItem.groupName;
                }
            }

            if (_imageHead != null)
            {
                int headCount = groupItem.memberUserId.Count > 9 ? 9 : groupItem.memberUserId.Count;
                UIManager.GetInstance().RefreshChildren(_imageHead.gameObject, EUIType.GroupMemberHeadIcon, headCount);

                for (int i = 0; i < headCount; i++)
                {
                    string userID = groupItem.memberUserId[i];
                    UserItem userItem = GlobalGroup.GetInstance().GetGroupMember(userID);
                    if (userItem == null)
                    {
                        userItem = new UserItem();
                    }

                    GameObject go = _imageHead.transform.GetChild(i).gameObject;
                    go.GetComponent<GroupMemberFrame>().Show(userItem);
                }
            }
        }
 public void Show(UserItem userItem)
 {
     _userItem = userItem ;
     if (_userItem != null)
     {
         UIManager.GetInstance().SetImage(_imageHead, EAtlasName.Head, "00" + _userItem.headIndex);
         _labelName.text = _userItem.userName;
     }
 }
        public override void OnEnter(object param)
        {
            base.OnEnter(param);

            _userItem = param as UserItem;

            _laeblName.text = _userItem.userName;
            _labelId.text = _userItem.userId;
            UIManager.GetInstance().SetImage(_imageHead, EAtlasName.Head, "00" + _userItem.headIndex);
            UIManager.GetInstance().AddChild(gameObject, EUIType.BackButton);

            InitButtons();
        }
Esempio n. 4
0
        public override void OnEnter(object param)
        {

            Init(param);

            _guestUserItem = GlobalContacts.GetInstance().GetUserItemById(_chatLog.chatID);
            if (_guestUserItem != null)
            {
                if (_labelGuestUserName)
                {
                    _labelGuestUserName.text = _guestUserItem.userName;                    
                }
            }


        }
        public void Show(UserItem userItem)
        {
            _userItem = userItem;

            if (_userItem != null)
            {
                if (_imageHead)
                {
                    UIManager.GetInstance().SetImage(_imageHead, EAtlasName.Head, "00" + _userItem.headIndex);                                    
                }

                if (_labelUserName)
                {
                    _labelUserName.text = _userItem.userName;                    
                }
            }

            if (_toggleAddUser)
            {
                _toggleAddUser.onValueChanged.AddListener(OnClickToggleMemeber);                
            }
        }
        private void RefreshMemberHeadFrames()
        {
            int memberRow = Mathf.CeilToInt((float)_groupItem.memberUserId.Count / (float)MEMBER_ONE_ROW);

            _gridGroupDetail.sizeDelta = new Vector2(
                GlobalVars.DEFAULT_SCREEN_WIDTH, GRID_GROUP_DETAIL_BASE + memberRow * GROUP_INFO_BAR_INC);
            _groupInfoBar.preferredHeight = GROUP_INFO_BAR_BASE + memberRow * GROUP_INFO_BAR_INC;

            UIManager.GetInstance().RefreshChildren(_gridMemberHead.gameObject, EUIType.GroupMemberHeadFrame, _groupItem.memberUserId.Count);

            for (int i = 0; i < _groupItem.memberUserId.Count; i++)
            {
                string userID = _groupItem.memberUserId[i];
                UserItem userItem = GlobalGroup.GetInstance().GetGroupMember(userID);
                if (userItem == null)
                {
                    userItem = new UserItem();
                }

                GameObject go = _gridMemberHead.transform.GetChild(i).gameObject;
                go.GetComponent<GroupMemberFrame>().Show(userItem);
            }
        }
        public void SetUserItemData()
        {
            switch (_chatDataItem.targetType)
            {
                case ChatDataItem.TargetType.SYSTEM:
                    UIManager.GetInstance().SetImage(_imageHead, EAtlasName.Chat, "010");
                    break;
                case ChatDataItem.TargetType.INDIVIDUAL:
                    _userItem = GlobalUser.GetInstance().Self;
                    if (_chatDataItem.sendUserId != GlobalUser.GetInstance().UserId)
                    {
                        _userItem = GlobalContacts.GetInstance().GetUserItemById(_chatDataItem.sendUserId);
                    }

                    UIManager.GetInstance().SetImage(_imageHead, EAtlasName.Head, "00" + _userItem.headIndex);
                    break;
                case ChatDataItem.TargetType.GROUP:
                    _userItem = GlobalGroup.GetInstance().GetGroupMember(_chatDataItem.sendUserId);
                    if (_userItem != null)
                    {
                        UIManager.GetInstance().SetImage(_imageHead, EAtlasName.Head, "00" + _userItem.headIndex);
                    }
                    break;
                default:
                    break;
            }
        }