Ejemplo n.º 1
0
 public void closeAudio()
 {
     foreach (Transform tr in cGrid.transform)
     {
         ChatMaxCell catc = tr.GetComponent <ChatMaxCell>();
         catc.closeVecUI();
     }
 }
Ejemplo n.º 2
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.º 3
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.º 4
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.º 5
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_);
    }