Exemplo n.º 1
0
    /// <summary> 서버에서주는 채팅 응답 </summary>
    public void OnReciveChat(NetData.ChatData chatData, ChatType type)
    {
        string miniMsg = null;

        if (!chatData.Msg.Contains("[url=Item/"))
        {
            miniMsg = string.Format("{0} : {1}", chatData.UserName, chatData.Msg);
        }
        else
        {
            miniMsg = chatData.Msg;
        }

        if (type == ChatType.System)
        {
            char[] AlertArr = SceneManager.instance.optionData.OffAlram.ToCharArray(); //알림
            if (AlertArr[3] == '2')
            {
                return;
            }

            chatData.Msg = string.Format(_LowDataMgr.instance.GetStringCommon(913), chatData.Msg);
            miniMsg      = string.Format(_LowDataMgr.instance.GetStringCommon(913), miniMsg);
        }
        else if (type == ChatType.Guild)
        {
            chatData.Msg = string.Format(_LowDataMgr.instance.GetStringCommon(910), chatData.Msg);
            miniMsg      = string.Format(_LowDataMgr.instance.GetStringCommon(910), miniMsg);
        }
        else if (type == ChatType.Whisper)
        {
            char[] WhisperArr = SceneManager.instance.optionData.BlockWhisper.ToCharArray(); //귓말
            if (!chatData.UserName.Equals(NetData.instance.Nickname) && WhisperArr[0] == '2')
            {
                return;
            }

            chatData.Msg = string.Format(_LowDataMgr.instance.GetStringCommon(911), chatData.Msg);
            miniMsg      = string.Format(_LowDataMgr.instance.GetStringCommon(911), miniMsg);
        }
        else if (type == ChatType.World)
        {
            chatData.Msg = string.Format(_LowDataMgr.instance.GetStringCommon(912), chatData.Msg);
            miniMsg      = string.Format(_LowDataMgr.instance.GetStringCommon(912), miniMsg);
        }
        else if (type == ChatType.Map)
        {
            chatData.Msg = string.Format(_LowDataMgr.instance.GetStringCommon(961), chatData.Msg);
            miniMsg      = string.Format(_LowDataMgr.instance.GetStringCommon(961), miniMsg);
        }

        if (IsMyChat)//나의 채팅
        {
            InputMsg.value = "";
            IsMyChat       = false;
        }

        MiniTextList.Add(miniMsg);
        AddChatData(chatData, type);
    }
Exemplo n.º 2
0
    /// <summary> 귓말 시작. </summary>
    public void StartWhisper(NetData.ChatData whisper)
    {
        if (!BigChatPopup.activeSelf)
        {
            OnClickBigChatPopup();
        }

        WhisperData = whisper;
        TabGroup.CoercionTab((int)ChatType.Whisper);
    }
Exemplo n.º 3
0
    public void AddLogChat(string chat)
    {
        char[] AlertArr = SceneManager.instance.optionData.OffAlram.ToCharArray(); //시스템알림
        if (AlertArr[3] == '2')
        {
            return;
        }

        chat = string.Format(_LowDataMgr.instance.GetStringCommon(913), chat);
        NetData.ChatData data = new NetData.ChatData(chat);

        AddChatData(data, ChatType.System);
        MiniTextList.Add(chat);
    }
Exemplo n.º 4
0
    /// <summary> 서버에서주는 채팅 응답 </summary>
    public void OnReciveChat(string msg, ChatType type)
    {
        char[] WhisperArr = SceneManager.instance.optionData.BlockWhisper.ToCharArray(); //귓말
        char[] AlertArr   = SceneManager.instance.optionData.OffAlram.ToCharArray();     //알림

        if (type == ChatType.System)
        {
            if (AlertArr[3] == '2')
            {
                return;
            }

            msg = string.Format(_LowDataMgr.instance.GetStringCommon(913), msg);
        }
        else if (type == ChatType.Guild)
        {
            msg = string.Format(_LowDataMgr.instance.GetStringCommon(910), msg);
        }
        else if (type == ChatType.Whisper)
        {
            if (WhisperArr[0] == '2')
            {
                return;
            }
            msg = string.Format(_LowDataMgr.instance.GetStringCommon(911), msg);
        }
        else if (type == ChatType.World)
        {
            msg = string.Format(_LowDataMgr.instance.GetStringCommon(912), msg);
        }
        else if (type == ChatType.Map)
        {
            msg = string.Format(_LowDataMgr.instance.GetStringCommon(961), msg);
        }

        MiniTextList.Add(msg);

        NetData.ChatData chatData = new NetData.ChatData(msg);
        AddChatData(chatData, ChatType.System);
    }
Exemplo n.º 5
0
    /// <summary> 채팅 슬롯 타입에 맞게 슬롯 셋팅 </summary>
    SlotData SetChatSlot(SlotData slotData, NetData.ChatData chatData, byte type, int num)
    {
        Transform tf = null;

        if (slotData == null)//빈 슬롯이 없다. 생성
        {
            Transform createTf = null;
            switch (type)
            {
            case 0:    //나
                createTf = MySlot;
                break;

            case 1:    //다른 유저
                //case 4://1:1 귓말
                createTf = UserSlot;
                break;

            case 2:    //텍스트
                createTf = TxtSlot;
                break;

            case 3:    //귓속말 대상 리스트
                createTf = WhisperTargetSlot;
                break;
            }

            tf       = Instantiate(createTf) as Transform;
            slotData = new SlotData(tf, type);
        }
        else
        {
            tf = slotData.Tf;
            ChatSlotList.Remove(slotData);
        }

        if (type == 2)// 텍스트
        {
            tf.FindChild("txt").GetComponent <UILabel>().text = chatData.Msg;

            EventDelegate.Set(tf.GetComponent <UIEventTrigger>().onClick, delegate() {
                OnClickBroadCast(tf.FindChild("txt").GetComponent <UILabel>());
            });
        }
        else//유저 대화 슬롯.
        {
            tf.FindChild("msg").GetComponent <UILabel>().text = chatData.Msg;
            tf.FindChild("port/icon").GetComponent <UISprite>().spriteName = UIHelper.GetClassPortIcon((uint)chatData.ClassId, 2);
            tf.FindChild("name").GetComponent <UILabel>().text             = chatData.UserName;

            if (0 < chatData.VipLv)
            {
                tf.FindChild("vip").gameObject.SetActive(true);
                tf.FindChild("vip/txt").GetComponent <UILabel>().text = string.Format("{0}.{1}", _LowDataMgr.instance.GetStringCommon(460), chatData.VipLv);
            }
            else
            {
                tf.FindChild("vip").gameObject.SetActive(false);
            }

            if (type != 0)//내가 아니라면
            {
                EventDelegate.Set(tf.GetComponent <UIEventTrigger>().onClick, () => {
                    UIMgr.OpenUserInfoPopup(chatData.UserUID, chatData.UserName, chatData.ClassId, chatData.VipLv, chatData.Lv);
                });
            }

            if (type == 3)
            {
                EventDelegate.Set(tf.FindChild("BtnTalk").GetComponent <UIEventTrigger>().onClick, () => {
                    StartWhisper(chatData);
                });
            }
        }

        tf.parent     = DefaultGridTf;//0 < WhisperTargetId ? TargetGridTf :
        tf.localScale = Vector3.one;

        ChatSlotList.Insert(num, slotData);

        return(slotData);
    }
Exemplo n.º 6
0
    /*
     * public void AddNotice(string msg, uint commonId)
     * {
     *  if(0 < commonId)
     *      msg = _LowDataMgr.instance.GetStringCommon(commonId);
     *
     *  for (int i = NoticeLbl.Length - 1; 0 < i; i--)
     *  {
     *      int arr = i - 1;
     *      NoticeLbl[i].color = NoticeLbl[arr].color;
     *      NoticeLbl[i].text = NoticeLbl[arr].text;
     *      NoticeDelay[i] = NoticeDelay[arr];
     *  }
     *
     *  IsNoticeClear = false;
     *  NoticeDelay[0] = 1;
     *  NoticeLbl[0].color = Color.white;
     *  NoticeLbl[0].text = msg;
     * }
     */
    /// <summary> 서버 or 클라에서 채팅 내용 추가하는 함수. </summary>
    void AddChatData(NetData.ChatData chatData, ChatType type)
    {
        List <NetData.ChatData> addChatList = null;

        if (ChatDic.TryGetValue(type, out addChatList)) //채팅 리스트 등록
        {
            if (type == ChatType.Whisper)               //귓말 대상 슬롯 추가 or 마지막 대사 갱신
            {
                bool isAddTarget = true;
                for (int i = 0; i < addChatList.Count; i++)
                {
                    if (!addChatList[i].WhisperUID.Equals(chatData.WhisperUID))
                    {
                        continue;
                    }

                    NetData.ChatData data = addChatList[i];
                    data.Msg = chatData.Msg;
                    addChatList.RemoveAt(i);
                    addChatList.Insert(0, data);

                    isAddTarget = false;
                    break;
                }

                if (isAddTarget)
                {
                    if (MaxWhisperTarget <= addChatList.Count)//최대값을 벗어나면 삭제.
                    {
                        addChatList.RemoveAt(addChatList.Count - 1);
                    }

                    addChatList.Insert(0, chatData);
                }
            }
            else
            {
                if (MaxChatLine <= addChatList.Count)//최대값을 벗어나면 삭제.
                {
                    addChatList.RemoveAt(addChatList.Count - 1);
                }

                addChatList.Insert(0, chatData);
            }
        }
        else
        {
            addChatList = new List <NetData.ChatData>();
            addChatList.Add(chatData);
            ChatDic.Add(type, addChatList);
        }

        if (type == ChatType.Whisper)//귓말 대상과의 대화 추가.
        {
            if (WhisperChatDic.TryGetValue(chatData.WhisperUID, out addChatList))
            {
                if (MaxChatLine <= addChatList.Count)//최대값을 벗어나면 삭제.
                {
                    addChatList.RemoveAt(addChatList.Count - 1);
                }

                addChatList.Insert(0, chatData);
            }
            else//신규
            {
                addChatList = new List <NetData.ChatData>();
                addChatList.Add(chatData);

                WhisperChatDic.Add(chatData.WhisperUID, addChatList);//대상 대화 리스트
            }
        }

        if (type == ChatType.System)//시스템일 경우 모든 대화모드에 추가함.
        {
            for (int i = 0; i < (int)ChatType.Map + 1; i++)
            {
                if ((ChatType)i == ChatType.System)  //여기에는 로그 남기지 않는다.
                {
                    continue;
                }

                List <NetData.ChatData> list = null;
                if (((ChatType)i == ChatType.Whisper))//귓말 대상 슬롯에는 로그 안보이게한다.
                {
                    var enumerator = WhisperChatDic.GetEnumerator();
                    while (enumerator.MoveNext())                          //대화 목록에 추가.
                    {
                        if (MaxChatLine <= enumerator.Current.Value.Count) //최대값을 벗어나면 삭제.
                        {
                            enumerator.Current.Value.RemoveAt(enumerator.Current.Value.Count - 1);
                        }

                        enumerator.Current.Value.Insert(0, chatData);
                    }
                }
                else if (ChatDic.TryGetValue((ChatType)i, out list))
                {
                    if (MaxChatLine <= list.Count)//최대값을 벗어나면 삭제.
                    {
                        list.RemoveAt(list.Count - 1);
                    }

                    list.Insert(0, chatData);
                }
                else
                {
                    list = new List <NetData.ChatData>();
                    list.Add(chatData);
                    ChatDic.Add((ChatType)i, list);
                }
            }
        }
        else//전역값에는 모든 채팅 내용을 담아놓는다.
        {
            List <NetData.ChatData> worldData = null;
            if (ChatDic.TryGetValue(ChatType.Everything, out worldData))
            {
                if (MaxChatLine <= worldData.Count)//최대값을 벗어나면 삭제.
                {
                    worldData.RemoveAt(worldData.Count - 1);
                }

                worldData.Insert(0, chatData);
            }
            else
            {
                worldData = new List <NetData.ChatData>();
                worldData.Add(chatData);
                ChatDic.Add(ChatType.Everything, worldData);
            }
        }

        if (!BigChatPopup.activeSelf || (CurChatType != ChatType.Everything && type != ChatType.System && CurChatType != type))  //갱신하지 않는 조건.
        {
            return;
        }

        ///현재 보고있는 탭 대화목록 가져오기
        List <NetData.ChatData> chatList = null;

        if (CurChatType == ChatType.Whisper && 0 < WhisperData.WhisperUID)//귓속말 대상과의 대화 중이라면.
        {
            if (!WhisperChatDic.TryGetValue(WhisperData.WhisperUID, out chatList))
            {
                chatList = new List <NetData.ChatData>();
            }
        }
        else//그 외.
        {
            if (!ChatDic.TryGetValue(CurChatType, out chatList))
            {
                chatList = new List <NetData.ChatData>();
            }
        }

        RefreshSlotData(chatList);
    }