142 lines
4.0 KiB
C#
142 lines
4.0 KiB
C#
using Assets.MyGame.Scripts.Net;
|
|||
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using TMPro;
|
||
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.UI;
|
||
|
|
|
||
|
|
public class UserInfoPanel : SubUIBase
|
||
|
|
{
|
||
|
|
[Header("信息")]
|
||
|
|
public TextMeshProUGUI tMPText_Name;
|
||
|
|
public TextMeshProUGUI tMPText_ID;
|
||
|
|
public TextMeshProUGUI tMPText_UserNumber;
|
||
|
|
public Button btn_ForgetPassWord;
|
||
|
|
public TextMeshProUGUI tMPText_LabelQM;
|
||
|
|
public TextMeshProUGUI tMPText_IP;
|
||
|
|
public TextMeshProUGUI tMPText_VIPLeave;
|
||
|
|
public TextMeshProUGUI tMPText_PhoneNumber;
|
||
|
|
public Button btn_ChangePhone;
|
||
|
|
public Button btn_ChangUser;
|
||
|
|
[Header("设置")]
|
||
|
|
public Toggle toggle_MusicEffect;
|
||
|
|
public Toggle toggle_Music;
|
||
|
|
public Toggle toggle_BroadCast;
|
||
|
|
public Toggle toggle_PlayTrumpet;
|
||
|
|
public Toggle toggle_SystemHint;
|
||
|
|
public TextMeshProUGUI tMPText_CurrVision;
|
||
|
|
public TextMeshProUGUI tMPText_NewVision;
|
||
|
|
GameManager gameManager => GameManager.Instance;
|
||
|
|
public override void Awake()
|
||
|
|
{
|
||
|
|
base.Awake();
|
||
|
|
btn_ForgetPassWord.onClick.AddListener(() =>
|
||
|
|
{
|
||
|
|
|
||
|
|
});
|
||
|
|
toggle_MusicEffect.onValueChanged.AddListener((a) =>
|
||
|
|
{
|
||
|
|
PlayerPrefs.SetInt("YX",a?1:0);
|
||
|
|
});
|
||
|
|
toggle_Music.onValueChanged.AddListener((a) =>
|
||
|
|
{
|
||
|
|
PlayerPrefs.SetInt("YY", a ? 1 : 0);
|
||
|
|
});
|
||
|
|
toggle_BroadCast.onValueChanged.AddListener((a) =>
|
||
|
|
{
|
||
|
|
PlayerPrefs.SetInt("XTGB", a ? 1 : 0);
|
||
|
|
});
|
||
|
|
toggle_PlayTrumpet.onValueChanged.AddListener((a) =>
|
||
|
|
{
|
||
|
|
PlayerPrefs.SetInt("WJLB", a ? 1 : 0);
|
||
|
|
});
|
||
|
|
toggle_SystemHint.onValueChanged.AddListener((a) =>
|
||
|
|
{
|
||
|
|
PlayerPrefs.SetInt("XTTS", a ? 1 : 0);
|
||
|
|
});
|
||
|
|
}
|
||
|
|
protected override void OnShow(object args = null)
|
||
|
|
{
|
||
|
|
base.OnShow(args);
|
||
|
|
InitInformation();
|
||
|
|
InitSetting();
|
||
|
|
}
|
||
|
|
|
||
|
|
private void InitInformation()
|
||
|
|
{
|
||
|
|
if (gameManager.user.BaseInfo.isRedName)
|
||
|
|
{
|
||
|
|
tMPText_Name.color = Color.red;
|
||
|
|
}
|
||
|
|
tMPText_Name.text = gameManager.user.BaseInfo.userName;
|
||
|
|
tMPText_ID.text = gameManager.user.BaseInfo.number;
|
||
|
|
tMPText_UserNumber.text = gameManager.user.BaseInfo.mobile;
|
||
|
|
string str = PlayerPrefs.GetString("QM", "我比较懒,什么都没写");
|
||
|
|
tMPText_LabelQM.text = str;
|
||
|
|
tMPText_IP.text = gameManager.user.@static.lastLoginIp;
|
||
|
|
tMPText_VIPLeave.text = gameManager.user.assets.vipLevel.ToString();
|
||
|
|
tMPText_PhoneNumber.text = MaskPhone(gameManager.user.BaseInfo.mobile);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void InitSetting()
|
||
|
|
{
|
||
|
|
int temp = PlayerPrefs.GetInt("YX",1);
|
||
|
|
if (temp == 0)
|
||
|
|
{
|
||
|
|
toggle_MusicEffect.isOn = false;
|
||
|
|
}
|
||
|
|
else if (temp == 1)
|
||
|
|
{
|
||
|
|
toggle_MusicEffect.isOn = true;
|
||
|
|
}
|
||
|
|
temp = PlayerPrefs.GetInt("YY",1);
|
||
|
|
if (temp == 0)
|
||
|
|
{
|
||
|
|
toggle_Music.isOn = false;
|
||
|
|
}
|
||
|
|
else if (temp == 1)
|
||
|
|
{
|
||
|
|
toggle_Music.isOn = true;
|
||
|
|
}
|
||
|
|
temp = PlayerPrefs.GetInt("XTGB",1);
|
||
|
|
if (temp == 0)
|
||
|
|
{
|
||
|
|
toggle_BroadCast.isOn = false;
|
||
|
|
}
|
||
|
|
else if (temp == 1)
|
||
|
|
{
|
||
|
|
toggle_BroadCast.isOn = true;
|
||
|
|
}
|
||
|
|
temp = PlayerPrefs.GetInt("WJLB",1);
|
||
|
|
if (temp == 0)
|
||
|
|
{
|
||
|
|
toggle_PlayTrumpet.isOn = false;
|
||
|
|
}
|
||
|
|
else if (temp == 1)
|
||
|
|
{
|
||
|
|
toggle_PlayTrumpet.isOn = true;
|
||
|
|
}
|
||
|
|
temp = PlayerPrefs.GetInt("XTTS",1);
|
||
|
|
if (temp == 0)
|
||
|
|
{
|
||
|
|
toggle_SystemHint.isOn = false;
|
||
|
|
}
|
||
|
|
else if (temp == 1)
|
||
|
|
{
|
||
|
|
toggle_SystemHint.isOn = true;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
public static string MaskPhone(string phone)
|
||
|
|
{
|
||
|
|
if (string.IsNullOrEmpty(phone) || phone.Length <= 6)
|
||
|
|
return phone;
|
||
|
|
int prefix = 3;
|
||
|
|
int suffix = 3;
|
||
|
|
int maskCount = phone.Length - prefix - suffix;
|
||
|
|
|
||
|
|
return phone.Substring(0, prefix) + new string('*', maskCount) + phone.Substring(phone.Length - suffix);
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|