using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
///
/// 聊天频道按钮
///
public class ChatChannelButton : MonoBehaviour
{
//聊天面板
public ChatPanel Panel;
private Toggle toggle;
private Text text;
private int channelID;
private void Awake()
{
toggle = GetComponent();
text = GetComponentInChildren();
channelID = int.Parse(gameObject.name.ToString());
}
private void OnEnable()
{
toggle.onValueChanged.AddListener(OnValueChanged);
}
private void OnDisable()
{
toggle.onValueChanged.RemoveListener(OnValueChanged);
}
///
///
///
///
private void OnValueChanged(bool arg0)
{
if (arg0)
{
// 停止当前频道在播放的音频
AudioManager.Instance.Stop(ChatType.PublicChat.ToString());
text.color = Color.white;
//申请离开当前频道
ChatManager.Instance.SendLeavePublicChatChannel();
ChatManager.Instance.joinChannelID = channelID;
}
else
{
text.color = new Color32(140, 166, 255, 255);
}
}
}