private void Align() { if (LoginManager.Instance.LocalUser.Id.Value == mItemData.Message.uid) { mAlignType = ALIGN_TYPE.RIGHT; curChatItemStruct = rightChatItemStruct; } else { mAlignType = ALIGN_TYPE.LEFT; curChatItemStruct = leftChatItemStruct; } }
public override void Clean() { if (curChatItemStruct == null) { curChatItemStruct = leftChatItemStruct; } leftChatItemStruct.TitleLabel.text = null; rightChatItemStruct.TitleLabel.text = null; leftChatItemStruct.TextLabel.text = null; rightChatItemStruct.TextLabel.text = null; leftChatItemStruct.AudioLabel.text = null; rightChatItemStruct.AudioLabel.text = null; leftChatItemStruct.AudioDurationLabel.text = null; rightChatItemStruct.AudioDurationLabel.text = null; if (heroIcon != null) { heroIcon.spriteName = ""; frameIcon.spriteName = ""; } mAlignType = ALIGN_TYPE.LEFT; mItemData = null; }
public override void Awake() { base.Awake(); var t = mDMono.transform; leftChatItemStruct = new ChatItemStruct(); leftChatItemStruct.Container = t.Find("LeftContainer").gameObject; if (t.Find("LeftContainer/HeroPortraitTemplate/Icon") != null) { leftChatItemStruct.HeroIcon = t.GetComponent <UISprite>("LeftContainer/HeroPortraitTemplate/Icon"); leftChatItemStruct.FrameIcon = t.GetComponent <UISprite>("LeftContainer/HeroPortraitTemplate/Icon/Frame"); } leftChatItemStruct.Audio = t.Find("LeftContainer/Audio").gameObject; leftChatItemStruct.AudioLabel = t.GetComponent <UISymbolLabel>("LeftContainer/Audio/AudioLabel"); leftChatItemStruct.Audio.transform.GetComponent <UIButton>("AudioBackground").onClick.Add(new EventDelegate(OnAudioClick)); leftChatItemStruct.AudioDurationLabel = t.GetComponent <UILabel>("LeftContainer/Audio/AudioBackground/DurationLabel"); leftChatItemStruct.AudioUnreadSprite = t.GetComponent <UISprite>("LeftContainer/Audio/AudioBackground/DurationLabel/UnReadSprite"); leftChatItemStruct.TitleLabel = t.GetComponent <UISymbolLabel>("LeftContainer/TitleLabel"); leftChatItemStruct.Text = t.Find("LeftContainer/Text").gameObject; leftChatItemStruct.TextLabel = t.GetComponent <UISymbolLabel>("LeftContainer/Text/TextLabel"); leftChatItemStruct.TextBGSprite = t.GetComponent <UISprite>("LeftContainer/Text/TextBackground"); if (t.Find("LeftContainer/HeroPortraitTemplate/Level/Label") != null) { t.GetComponent <UIButton>("LeftContainer/HeroPortraitTemplate").onClick.Add(new EventDelegate(ShowOtherPlayerInfo)); leftChatItemStruct.LevelLabel = t.GetComponent <UILabel>("LeftContainer/HeroPortraitTemplate/Level/Label"); leftChatItemStruct.ChannelSprite = t.GetComponent <UISprite>("LeftContainer/ChannelSprite"); leftChatItemStruct.VipTagTf = t.Find("LeftContainer/VipObj"); leftChatItemStruct.AudioSpObjs = new GameObject[3]; leftChatItemStruct.AudioSpObjs[0] = t.Find("LeftContainer/Audio/AudioBackground/AudioSpObj/AudioSprite").gameObject; leftChatItemStruct.AudioSpObjs[1] = t.Find("LeftContainer/Audio/AudioBackground/AudioSpObj/AudioSprite (1)").gameObject; leftChatItemStruct.AudioSpObjs[2] = t.Find("LeftContainer/Audio/AudioBackground/AudioSpObj/AudioSprite (2)").gameObject; } rightChatItemStruct = new ChatItemStruct(); rightChatItemStruct.Container = t.Find("RightContainer").gameObject; if (t.Find("RightContainer/HeroPortraitTemplate/Icon") != null) { rightChatItemStruct.HeroIcon = t.GetComponent <UISprite>("RightContainer/HeroPortraitTemplate/Icon"); rightChatItemStruct.FrameIcon = t.GetComponent <UISprite>("RightContainer/HeroPortraitTemplate/Icon/Frame"); } rightChatItemStruct.Audio = t.Find("RightContainer/Audio").gameObject; rightChatItemStruct.AudioLabel = t.GetComponent <UISymbolLabel>("RightContainer/Audio/AudioLabel"); rightChatItemStruct.Audio.transform.GetComponent <UIButton>("AudioBackground").onClick.Add(new EventDelegate(OnAudioClick)); rightChatItemStruct.AudioDurationLabel = t.GetComponent <UILabel>("RightContainer/Audio/AudioBackground/DurationLabel"); rightChatItemStruct.AudioUnreadSprite = t.GetComponent <UISprite>("RightContainer/Audio/AudioBackground/DurationLabel/UnReadSprite"); rightChatItemStruct.TitleLabel = t.GetComponent <UISymbolLabel>("RightContainer/TitleLabel"); rightChatItemStruct.Text = t.Find("RightContainer/Text").gameObject; rightChatItemStruct.TextLabel = t.GetComponent <UISymbolLabel>("RightContainer/Text/TextLabel"); rightChatItemStruct.TextBGSprite = t.GetComponent <UISprite>("RightContainer/Text/TextBackground"); if (t.Find("RightContainer/HeroPortraitTemplate/Level/Label") != null) { rightChatItemStruct.LevelLabel = t.Find("RightContainer/HeroPortraitTemplate/Level/Label") .GetComponent <UILabel>(); rightChatItemStruct.ChannelSprite = t.Find("RightContainer/ChannelSprite") .GetComponent <UISprite>(); rightChatItemStruct.VipTagTf = t.Find("RightContainer/VipObj"); rightChatItemStruct.AudioSpObjs = new GameObject[3]; rightChatItemStruct.AudioSpObjs[0] = t.Find("RightContainer/Audio/AudioBackground/AudioSpObj/AudioSprite").gameObject; rightChatItemStruct.AudioSpObjs[1] = t.Find("RightContainer/Audio/AudioBackground/AudioSpObj/AudioSprite (1)").gameObject; rightChatItemStruct.AudioSpObjs[2] = t.Find("RightContainer/Audio/AudioBackground/AudioSpObj/AudioSprite (2)").gameObject; } if (t.parent.parent.parent.parent.GetComponent <DynamicMonoILR>() != null) { FriendChatHud = t.parent.parent.parent.parent.GetMonoILRComponent <FriendChatController>(); } }