Esempio n. 1
0
        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;
            }
        }
        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);
                }
            }
        }
        private void InitGroupFrames()
        {
            foreach (GroupItem groupItem in GlobalGroup.GetInstance())
            {
                GameObject go = UIManager.GetInstance().AddChild(_gridSelectGroup.gameObject, EUIType.GroupFrame);
                go.GetComponent <GroupFrame>().Show(groupItem);
            }

            _gridSelectGroup.sizeDelta = new Vector2(GlobalVars.DEFAULT_SCREEN_WIDTH,
                                                     GlobalGroup.GetInstance().Count *GROUP_FRAME_HEIGHT);
        }
        public override void OnShow(object param = null)
        {
            base.OnShow(param);

            _groupItem = GlobalGroup.GetInstance().GetGroup(_chatLog.chatID);
            if (_groupItem != null)
            {
                if (_labelGuestUserName)
                {
                    _labelGuestUserName.text = _groupItem.groupName;
                }
            }
        }
Esempio n. 5
0
        public void OnClearAll(string[] args)
        {
            PlayerPrefs.DeleteKey(GlobalVars.PREF_USER_ID);
            PlayerPrefs.DeleteKey(GlobalVars.PREF_USER_PASSWORD);

            GlobalChat.GetInstance().ClearLogDict();
            GlobalContacts.GetInstance().ClearFriendDict();
            GlobalGroup.GetInstance().ClearGroupDict();

            DirectoryInfo dirInfo = new DirectoryInfo(Application.persistentDataPath);

            foreach (var item in dirInfo.GetDirectories())
            {
                item.Delete(true);
            }
        }
Esempio n. 6
0
        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);
            }
        }