///<初始化一个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; }
///<初始化一个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; }
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; } } } }