//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Monday, November 05, 2018
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace vnxbqy.UI
|
{
|
|
public class ChatBubblePreviewWin : Window
|
{
|
[SerializeField] Text m_ChatLeftName;
|
[SerializeField] Text m_ChatRightName;
|
[SerializeField] ChatBubbleBehaviour m_ChatLeftBubble;
|
[SerializeField] ChatBubbleBehaviour m_ChatRightBubble;
|
[SerializeField] Text m_BubbleName;
|
[SerializeField] Button m_Goto;
|
[SerializeField] Button m_Close;
|
|
public static int previewBubbleId = 0;
|
|
ChatBubbleModel model
|
{
|
get { return ModelCenter.Instance.GetModel<ChatBubbleModel>(); }
|
}
|
|
#region Built-in
|
protected override void BindController()
|
{
|
}
|
|
protected override void AddListeners()
|
{
|
m_Close.onClick.AddListener(CloseClick);
|
m_Goto.onClick.AddListener(Goto);
|
}
|
|
protected override void OnPreOpen()
|
{
|
ChatBubbleModel.ChatBubble bubble;
|
if (model.TryGetBubble(previewBubbleId, out bubble))
|
{
|
m_ChatLeftName.text = Language.Get("ChatBubbleLeftName");
|
m_ChatRightName.text = Language.Get("ChatBubbleRightName");
|
m_ChatLeftBubble.DisplayBubble(previewBubbleId);
|
m_ChatRightBubble.DisplayBubble(previewBubbleId);
|
m_ChatLeftBubble.DisplayContent(Language.Get("ChatBubbleLeftWord"), true);
|
m_ChatRightBubble.DisplayContent(Language.Get("ChatBubbleRightWord"), false);
|
var config = ChatBubbleBoxConfig.Get(previewBubbleId);
|
m_BubbleName.text = config.Name;
|
}
|
}
|
|
protected override void OnAfterOpen()
|
{
|
}
|
|
protected override void OnPreClose()
|
{
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
#endregion
|
|
private void Goto()
|
{
|
var config = ChatBubbleBoxConfig.Get(previewBubbleId);
|
if (config != null)
|
{
|
CloseImmediately();
|
if (WindowCenter.Instance.IsOpen<ChatExtentWin>())
|
{
|
WindowCenter.Instance.Close<ChatExtentWin>();
|
}
|
WindowJumpMgr.Instance.WindowJumpTo((JumpUIType)config.Jump);
|
}
|
}
|
}
|
}
|
|
|
|
|