Ejemplo n.º 1
0
    ///<初始化一个ITEM如果不够长往上加
    void _MakedGridItem(int idx, COM_ChatInfo p)
    {
        //Transform tf = _Grid.GetChild(idx);
        Transform tf = cGrid.GetChild(idx);

        if (p.teamId_ != 0)
        {
            if (!IsTeamLevelChannel(p) && isShowTeamLevel)
            {
                if (tf == null)
                {
                    return;
                }
                _Free(tf.gameObject);
                return;
            }
        }

        if (null == tf)
        {
            tf = _Alloc().transform;
            cGrid.AddChild(tf);
            //_Grid.AddChild(tf);
            tf.localPosition = Vector3.zero;
            tf.localScale    = Vector3.one;
        }
        tf.gameObject.SetActive(true);
        ChatMinCell cmi = tf.GetComponentInChildren <ChatMinCell>();

        cmi.Info = p;
    }
Ejemplo n.º 2
0
    public static void PushRecord(COM_ChatInfo info)
    {
        //if (info.audioId_ != 0)
        //{
        //    _AudioPiece.AddRange(info.audio_);

        //    if (info.audioId_ == -1)
        //    {
        //        info.audio_ = _AudioPiece.ToArray();
        //        _AudioPiece.Clear();
        //    }
        //    else
        //    {
        //        return;
        //    }

        //}

        ++_RecordLength;
        _Records.AddLast(info);
        if (_RecordLength > _RecordSize)
        {
            _Records.RemoveFirst();
        }
        if (_MakeDirtyFunc != null)
        {
            _MakeDirtyFunc();
        }
    }
Ejemplo n.º 3
0
 public bool IsTeamLevelChannel(COM_ChatInfo chatinfo)
 {
     if (GamePlayer.Instance.GetIprop(PropertyType.PT_Level) > chatinfo.teamMinLevel_ && GamePlayer.Instance.GetIprop(PropertyType.PT_Level) <= chatinfo.teamMaxLevel_)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 4
0
    //system say
    public static void PushRecord(ChatKind ck, string content)
    {
        COM_ChatInfo c = new COM_ChatInfo();

        c.ck_      = ck;
        c.content_ = content;
        PushRecord(c);
    }
Ejemplo n.º 5
0
    //player say
    public static void PushRecord(COM_Chat info)
    {
        COM_ChatInfo c = new COM_ChatInfo();

        c.ck_      = info.ck_;
        c.content_ = info.content_;
        //c.audioId_ = info.audioId_;
        c.audio_      = info.audio_;
        c.assetId_    = (ushort)GamePlayer.Instance.GetIprop(PropertyType.PT_AssetId);
        c.playerName_ = GamePlayer.Instance.InstName; //only player
        PushRecord(c);
    }
Ejemplo n.º 6
0
    ///<初始化一个ITEM如果不够长往上加
    ///


    void _MakedGridItem(int idx, COM_ChatInfo p)
    {
        Transform tf = cGrid.GetChild(idx);

        if (null == tf)
        {
            tf = _Alloc().transform;
            if (null == tf)
            {
            }
            cGrid.AddChild(tf);
            tf.localPosition = Vector3.zero;
            tf.localScale    = Vector3.one;
        }
        tf.gameObject.SetActive(true);
        ChatMaxCell cmi = tf.gameObject.GetComponent <ChatMaxCell>();

        cmi.Info = p;
    }
Ejemplo n.º 7
0
    void __DevelopCase()
    {
        for (int i = 0; i < 200; ++i)
        {
            int r = Random.RandomRange(0, 4);
            if (r == 0)
            {
                ChatSystem.PushSystemMessage("" + i + "这个是测试系统平道哦!!!!");
            }
            else if (r == 1)
            {
                COM_ChatInfo cci = new COM_ChatInfo();
                cci.ck_      = ChatKind.CK_World;
                cci.assetId_ = 2;
                cci.content_ = "" + i + "这个是测试World平道哦!!!!";
                ChatSystem.PushRecord(cci);
                ChatSystem.PushPlayerSay(cci);
            }
            else if (r == 2)
            {
                COM_ChatInfo cci = new COM_ChatInfo();
                cci.ck_      = ChatKind.CK_Team;
                cci.assetId_ = 2;
                cci.content_ = "" + i + "这个是测试Team平道哦!!!!";

                ChatSystem.PushPlayerSay(cci);
                ChatSystem.PushRecord(cci);
            }
            else if (r == 3)
            {
                COM_ChatInfo cci = new COM_ChatInfo();
                cci.ck_      = ChatKind.CK_Guild;
                cci.assetId_ = 2;
                cci.content_ = "" + i + "这个是测试Guild平道哦!!!!";

                ChatSystem.PushPlayerSay(cci);
                ChatSystem.PushRecord(cci);
            }
        }
    }
Ejemplo n.º 8
0
    void OnLineEvent(bool line)
    {
        if (string.IsNullOrEmpty(friendChatLab.text.Trim()))
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("bunengweikong"));
            return;
        }
        if (!line)
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("frinedonline"));
            return;
        }

        else if (chat_com != null)
        {
            chat_com.ck_ = ChatKind.CK_Friend;
            Filt(ref chat_com.content_, 0, 1);
            NetConnection.Instance.sendChat(chat_com, _selectFriend.name_);
            if (chat_com.content_.Length > 30)
            {
                //PopText.Instance.Show(LanguageManager.instance.GetValue("chatLineMax"));
                //return;
            }

            //COM_Chat comC = new COM_Chat();
            chat_com.ck_      = ChatKind.CK_Friend;
            chat_com.content_ = friendChatLab.text;
            chat_com.isMe     = true;
            //	NetConnection.Instance.sendChat (comC,_selectFriend.name_);

            GameObject tf = null;
            tf = GameObject.Instantiate(_GridItem) as GameObject;
            cGrid.AddChild(tf.transform);
            tf.transform.localScale = Vector3.one;
            tf.gameObject.SetActive(true);
            ChatMaxCell  cmi  = tf.gameObject.GetComponent <ChatMaxCell>();
            COM_ChatInfo info = new COM_ChatInfo();            // (COM_ChatInfo)comC ;
            info.playerName_ = GamePlayer.Instance.InstName;

            info.content_ = friendChatLab.text;
            Filt(ref info.content_, 0, 1);
            info.ck_      = ChatKind.CK_Friend;
            info.assetId_ = (ushort)GamePlayer.Instance.GetIprop(PropertyType.PT_AssetId);
            cmi.Info      = info;
            cmi._LChatKindBackground.gameObject.SetActive(false);
            cmi._RChatKindBackground.gameObject.SetActive(false);
            chat_com = null;
            FriendSystem.Instance().addMyChat(_selectFriend.name_, chat_com);
            chatCellList.Add(tf);

            friendChatLab.text = "";
            chatInput.value    = "";
        }
        else
        {
            if (string.IsNullOrEmpty(friendChatLab.text.Trim()))
            {
                PopText.Instance.Show(LanguageManager.instance.GetValue("bunengweikong"));
                return;
            }
            if (friendChatLab.text.Length > 30)
            {
                //PopText.Instance.Show(LanguageManager.instance.GetValue("chatLineMax"));
                //return;
            }
            COM_Chat comC = new COM_Chat();
            comC.ck_      = ChatKind.CK_Friend;
            comC.content_ = friendChatLab.text;
            Filt(ref comC.content_, 0, 1);
            NetConnection.Instance.sendChat(comC, _selectFriend.name_);

            GameObject tf = null;
            tf = GameObject.Instantiate(_GridItem) as GameObject;
            cGrid.AddChild(tf.transform);
            tf.transform.localScale = Vector3.one;
            tf.gameObject.SetActive(true);
            ChatMaxCell  cmi  = tf.gameObject.GetComponent <ChatMaxCell>();
            COM_ChatInfo info = new COM_ChatInfo();
            info.playerName_ = GamePlayer.Instance.InstName;
            info.content_    = friendChatLab.text;
            Filt(ref info.content_, 0, 1);
            info.ck_      = ChatKind.CK_Friend;
            info.assetId_ = (ushort)GamePlayer.Instance.GetIprop(PropertyType.PT_AssetId);
            cmi.Info      = info;
            cmi._LChatKindBackground.gameObject.SetActive(false);
            cmi._RChatKindBackground.gameObject.SetActive(false);
            comC.isMe          = true;
            friendChatLab.text = "";
            chatInput.value    = "";
            FriendSystem.Instance().addMyChat(_selectFriend.name_, comC);
            chatCellList.Add(tf);
        }
        cGrid.Reposition();
        scrollBar.value = 1;
    }
Ejemplo n.º 9
0
    void OnFriendChat(COM_ContactInfo contact, COM_Chat msg)
    {
        if (_selectFriend != null && contact.instId_ == _selectFriend.instId_)
        {
            /*GameObject obj = Object.Instantiate(chatCell.gameObject) as GameObject;
             * obj.SetActive(true);
             * FriendItem cellUI = obj.GetComponent<FriendItem>();
             * cellUI._chatInfo = msg;
             * if(msg.audio_ != null && msg.audio_.Length > 0)
             * {
             * //	obj.transform.Find ("info").GetComponent<UILabel> ().gameObject.SetActive(false);
             *      obj.transform.Find ("vButton").GetComponent<UIButton> ().gameObject.SetActive(true);
             * }
             * else
             * {
             *      obj.transform.Find ("vButton").GetComponent<UIButton> ().gameObject.SetActive(false);
             * }
             * //obj.transform.Find ("info").GetComponent<UILabel> ().text = msg.content_;
             *
             * //cellUI.SetInfoBack(msg.content_);
             * cellUI.ParseSymbol(msg.content_);
             *
             * HeadIconLoader.Instance.LoadIcon(EntityAssetsData.GetData((int)contact.assetId_).assetsIocn_, obj.transform.Find ("icon").Find ("Sprite").GetComponent<UITexture>());
             * if(!_icons.Contains(EntityAssetsData.GetData((int)contact.assetId_).assetsIocn_))
             * {
             *      _icons.Add(EntityAssetsData.GetData((int)contact.assetId_).assetsIocn_);
             * }
             *
             * cellUI.name_.text = contact.name_;
             * //cellUI.level_.text = contact.level_.ToString ();
             * chatGrid.AddChild(obj.transform);
             * obj.transform.localScale = Vector3.one;
             */



            GameObject tf = null;
            tf = GameObject.Instantiate(_GridItem) as GameObject;
            cGrid.AddChild(tf.transform);
            tf.transform.localScale = Vector3.one;
            tf.gameObject.SetActive(true);
            ChatMaxCell  cmi  = tf.gameObject.GetComponent <ChatMaxCell>();
            COM_ChatInfo info = new COM_ChatInfo();
            Filt(ref msg.content_, 0, 1);
            info.content_    = msg.content_;
            info.ck_         = ChatKind.CK_Friend;
            info.playerName_ = contact.name_;
            info.assetId_    = (ushort)contact.assetId_;
            cmi.Info         = info;
            cmi._LChatKindBackground.gameObject.SetActive(false);
            cmi._RChatKindBackground.gameObject.SetActive(false);
            chatCellList.Add(tf);
        }
        else
        {
            foreach (var x in friendCellList)
            {
                if (x.GetComponent <FriendItem>().ContactInfo.instId_ == contact.instId_)
                {
                    //x.GetComponent<FriendItem>().red.gameObject.SetActive(true);
                    x.GetComponent <UISprite>().MarkOn();                   //UISprite.MarkAnthor.MA_RightTop,0,0);
                    break;
                }
            }
            foreach (COM_ContactInfo f in FriendSystem.Instance().offens_)
            {
                if (f.instId_ == contact.instId_)
                {
                    offTabBtn.GetComponentInChildren <UISprite>().MarkOn(UISprite.MarkAnthor.MA_RightTop, -10, -10);
                    break;
                }
            }
        }
    }
Ejemplo n.º 10
0
    private void UpdateChatList(COM_ContactInfo contact)
    {
        List <COM_Chat> strArr = FriendSystem.Instance().ChatCache(contact);

        for (int i = 0; i < chatCellList.Count; i++)
        {
            //chatGrid.RemoveChild(chatCellList[i].transform);
            cGrid.RemoveChild(chatCellList[i].transform);
            chatCellList[i].transform.parent = null;
            chatCellList[i].gameObject.SetActive(false);
            GameObject.Destroy(chatCellList[i]);
        }
        chatCellList.Clear();
        //	return;
        //}
        if (strArr != null && strArr.Count > 0)
        {
            for (int i = 0; i < strArr.Count; i++)
            {
                if (!strArr[i].isMe)
                {
                    GameObject tf = null;
                    tf = GameObject.Instantiate(_GridItem) as GameObject;
                    cGrid.AddChild(tf.transform);
                    tf.transform.localScale = Vector3.one;
                    tf.gameObject.SetActive(true);
                    ChatMaxCell  cmi  = tf.gameObject.GetComponent <ChatMaxCell>();
                    COM_ChatInfo info = new COM_ChatInfo();
                    Filt(ref strArr[i].content_, 0, 1);
                    info.content_    = strArr[i].content_;
                    info.ck_         = ChatKind.CK_Friend;
                    info.playerName_ = contact.name_;
                    info.assetId_    = (ushort)contact.assetId_;
                    cmi.Info         = info;
                    cmi._LChatKindBackground.gameObject.SetActive(false);
                    cmi._RChatKindBackground.gameObject.SetActive(false);
                    chatCellList.Add(tf);
                }
                else
                {
                    GameObject tf = null;
                    tf = GameObject.Instantiate(_GridItem) as GameObject;
                    cGrid.AddChild(tf.transform);
                    tf.transform.localScale = Vector3.one;
                    tf.gameObject.SetActive(true);
                    ChatMaxCell  cmi  = tf.gameObject.GetComponent <ChatMaxCell>();
                    COM_ChatInfo info = new COM_ChatInfo();
                    Filt(ref strArr[i].content_, 0, 1);
                    info.content_    = strArr[i].content_;
                    info.ck_         = ChatKind.CK_Friend;
                    info.playerName_ = GamePlayer.Instance.InstName;
                    info.assetId_    = (ushort)GamePlayer.Instance.GetIprop(PropertyType.PT_AssetId);
                    cmi.Info         = info;
                    cmi._LChatKindBackground.gameObject.SetActive(false);
                    cmi._RChatKindBackground.gameObject.SetActive(false);
                    chatCellList.Add(tf);
                }
            }
        }
        cGrid.Reposition();
        scrollBar.value = 1;
        //FriendSystem.Instance ().ChatDict.Remove(contact.name_);
    }