134 lines
3.1 KiB
C#
134 lines
3.1 KiB
C#
|
using System;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Runtime.InteropServices;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.EventSystems;
|
|||
|
using UnityEngine.SceneManagement;
|
|||
|
using UnityEngine.UI;
|
|||
|
|
|||
|
public class UserPanel : BasePanel, ISelectHandler
|
|||
|
{
|
|||
|
//<2F>û<EFBFBD>ͷ<EFBFBD><CDB7>
|
|||
|
public Image imgUserHead;
|
|||
|
|
|||
|
//<2F><>Ч
|
|||
|
public Toggle togSound;
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
public Toggle togClose;
|
|||
|
//<2F><><EFBFBD>Ի<EFBFBD><D4BB>Ƽ<EFBFBD>
|
|||
|
public Toggle togPersonal;
|
|||
|
|
|||
|
//<2F>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
public Button btnQuit;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
public Button btnCopyYQM;
|
|||
|
//<2F><><EFBFBD><EFBFBD>qqȺ<71><C8BA>
|
|||
|
public Button btnCopyQQ;
|
|||
|
//<2F>û<EFBFBD>Э<EFBFBD><D0AD>
|
|||
|
public Button btnXY;
|
|||
|
//<2F><>˽<EFBFBD><CBBD><EFBFBD><EFBFBD>
|
|||
|
public Button btnZC;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
public Button btnGY;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
public Button btnGX;
|
|||
|
//ע<><D7A2><EFBFBD>˺<EFBFBD>
|
|||
|
public Button btnZX;
|
|||
|
//<2F>˳<EFBFBD><CBB3><EFBFBD>¼
|
|||
|
public Button btnTC;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύ
|
|||
|
public Button btnSubmit;
|
|||
|
|
|||
|
//<2F>û<EFBFBD><C3BB><EFBFBD>
|
|||
|
public Text txtUserName;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
public Text txtYQM;
|
|||
|
//qqȺ<71><C8BA>
|
|||
|
public Text txtQQ;
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
public InputField inputYQM;
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ⲿJS<4A><53><EFBFBD><EFBFBD>
|
|||
|
[DllImport("__Internal")]
|
|||
|
private static extern void CopyToClipboardJS(string text);
|
|||
|
|
|||
|
public override void Init()
|
|||
|
{
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
UpdatePanel();
|
|||
|
|
|||
|
btnQuit.onClick.AddListener(() =>
|
|||
|
{
|
|||
|
UIManager.Instance.HidePanel<UserPanel>();
|
|||
|
});
|
|||
|
btnTC.onClick.AddListener(() =>
|
|||
|
{
|
|||
|
SceneManager.LoadScene("LoginScene");
|
|||
|
UIManager.Instance.HidePanel<GamePanel>(false);
|
|||
|
UIManager.Instance.HidePanel<UserPanel>(false);
|
|||
|
GameMgr.Instance.petList.Clear();
|
|||
|
PoolMgr.Instance.ClearPool();
|
|||
|
GC.Collect();
|
|||
|
});
|
|||
|
|
|||
|
btnSubmit.onClick.AddListener(() =>
|
|||
|
{
|
|||
|
if (inputYQM.text != null)
|
|||
|
{
|
|||
|
InviteMsg msg = new InviteMsg();
|
|||
|
msg.openId = GameDataMgr.Instance.player.openId;
|
|||
|
msg.invitePerson = inputYQM.text;
|
|||
|
StartCoroutine(NetMgr.Instance.InvitePost(msg));
|
|||
|
}
|
|||
|
inputYQM.text = null;
|
|||
|
});
|
|||
|
|
|||
|
btnCopyYQM.onClick.AddListener(CopyYQMToClipboard);
|
|||
|
btnCopyQQ.onClick.AddListener(CopyQQToClipboard);
|
|||
|
togSound.onValueChanged.AddListener((v) =>
|
|||
|
{
|
|||
|
//<2F>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD>п<EFBFBD><D0BF><EFBFBD>
|
|||
|
BKMusic.Instance.SetIsOpen(v);
|
|||
|
//<2F><>¼<EFBFBD><C2BC>Ч<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
GameDataMgr.Instance.musicData.isOpen = v;
|
|||
|
});
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void CopyYQMToClipboard()
|
|||
|
{
|
|||
|
// <20><>ȡUI<55>ı<EFBFBD>
|
|||
|
string textToCopy = txtYQM.text;
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD>WebGLƽ̨<C6BD><CCA8><EFBFBD><EFBFBD>
|
|||
|
#if UNITY_WEBGL && !UNITY_EDITOR
|
|||
|
CopyToClipboardJS(textToCopy);
|
|||
|
#endif
|
|||
|
}
|
|||
|
|
|||
|
void CopyQQToClipboard()
|
|||
|
{
|
|||
|
// <20><>ȡUI<55>ı<EFBFBD>
|
|||
|
string textToCopy = txtQQ.text;
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD>WebGLƽ̨<C6BD><CCA8><EFBFBD><EFBFBD>
|
|||
|
#if UNITY_WEBGL && !UNITY_EDITOR
|
|||
|
CopyToClipboardJS(textToCopy);
|
|||
|
#endif
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
private void UpdatePanel()
|
|||
|
{
|
|||
|
txtUserName.text = GameDataMgr.Instance.player.username;
|
|||
|
txtYQM.text = "<22><><EFBFBD><EFBFBD><EFBFBD>룺"+GameDataMgr.Instance.player.openId;
|
|||
|
}
|
|||
|
public void OnSelect(BaseEventData eventData)
|
|||
|
{
|
|||
|
inputYQM.text = "";
|
|||
|
}
|
|||
|
}
|