153 lines
3.8 KiB
C#
153 lines
3.8 KiB
C#
using cfg.ActorCfg;
|
||
using Cysharp.Threading.Tasks;
|
||
using Framework;
|
||
using Gameplay;
|
||
using Gameplay.Net;
|
||
using NLDPB;
|
||
using TMPro;
|
||
using Button = UnityEngine.UI.Button;
|
||
using Image = UnityEngine.UI.Image;
|
||
public class UI_PlayerInfoController : UIWindow
|
||
{
|
||
//UI GameObj
|
||
///Auto Gen Start///
|
||
public Image Image_Bg;
|
||
public Image Image_DarkTop;
|
||
public Image Image_DarkBottom;
|
||
public Image Image_DarkLeft;
|
||
public Image Image_DarkRight;
|
||
public Image Image_BgItem;
|
||
//public Button Button_Back;
|
||
public Button Button_back;
|
||
public TMP_Text Text_Back;
|
||
public Button Button_Home;
|
||
public Image Image_InfoBg;
|
||
public Image Image_HeadPic;
|
||
public Image Image_Head;
|
||
public TMP_Text Text_Level;
|
||
public Image Image_ExpCircle;
|
||
public TMP_Text Text_PlayerName;
|
||
public Button Button_EditName;
|
||
public Image Image_UidBg;
|
||
public Image Image_UidBg1;
|
||
public TMP_Text Text_Uid;
|
||
public TMP_Text Text_UserIdText;
|
||
public Button Button_HeadChangeGame;
|
||
public TMP_Text Text_BirthdayCh;
|
||
public TMP_Text Text_Birthday;
|
||
public Button Button_EditBirthday;
|
||
public TMP_Text Text_Sign;
|
||
public Button Button_EditIntroduction;
|
||
public Image Image_Medal0_up;
|
||
public Image Image_Medal1_up;
|
||
public Image Image_Medal2_up;
|
||
public Image Image_Medal3_up;
|
||
public Image Image_Medal4_up;
|
||
public Image Image_Medal0_down;
|
||
public Image Image_Medal1_down;
|
||
public Image Image_Medal2_down;
|
||
public Image Image_Medal3_down;
|
||
public Image Image_Medal4_down;
|
||
public Button Button_EditMedal;
|
||
public Image Image_TopBlackBar;
|
||
public Image Image_BottomBlackBar;
|
||
|
||
///Auto Gen End///
|
||
|
||
// deal with input data
|
||
public override void PreLoad(object data = null)
|
||
{
|
||
|
||
}
|
||
|
||
public static UniTask<UIWindow> Open()
|
||
{
|
||
return UIManager.Instance.CreateAndOpenWindow(UINameConst.UI_PlayerInfo);
|
||
}
|
||
|
||
// Use this for initialization
|
||
public override void OnInit()
|
||
{
|
||
//bind UI GameObj
|
||
UI_PlayerInfoBinder.GetComponents(this);
|
||
|
||
BindButton(Button_back, OnCloseClick);
|
||
BindButton(Button_Home, OnHomeClick);
|
||
BindButton(Button_EditName, SetName);
|
||
|
||
#region 待开发
|
||
BindButton(Button_EditBirthday, LockFunction);
|
||
BindButton(Button_HeadChangeGame, LockFunction);
|
||
BindButton(Button_EditBirthday,LockFunction);
|
||
BindButton(Button_EditIntroduction,LockFunction);
|
||
BindButton(Button_EditMedal,LockFunction);
|
||
#endregion
|
||
|
||
DataActorLevel levelInfo = ActorLevelTableHelper.Instance.Get((int)Actor.Instance.Base.GetProp(ActorProp.Level));
|
||
var level = levelInfo.Level;
|
||
Text_Level.text = level.ToString("D3");
|
||
Text_PlayerName.text = Actor.Instance.Base.Nickname;
|
||
Text_Uid.text = Actor.Instance.Base.GetProp(ActorProp.ActorId).ToString();
|
||
|
||
//InputField_Name.onEndEdit.AddListener(OnNameEditEnd);
|
||
|
||
EventManager.Instance.Register(EventManager.EventName.PlayerInfoUpdate, OnChangeName);
|
||
|
||
}
|
||
|
||
//invoke when open window
|
||
protected override void OnShowWindow(object data = null)
|
||
{
|
||
|
||
}
|
||
|
||
//invoke when reload window
|
||
protected override void OnReloadWindow(object data = null)
|
||
{
|
||
|
||
}
|
||
|
||
//invoke when close window
|
||
protected override void OnHideWindow()
|
||
{
|
||
|
||
}
|
||
|
||
//invoke when destroy
|
||
public override void OnRelease()
|
||
{
|
||
base.OnRelease();
|
||
|
||
EventManager.Instance.Unregister(EventManager.EventName.PlayerInfoUpdate, OnChangeName);
|
||
|
||
}
|
||
|
||
#region button_click
|
||
protected override void OnCloseClick()
|
||
{
|
||
base.OnCloseClick();
|
||
CloseWindow();
|
||
}
|
||
void OnHomeClick()
|
||
{
|
||
CommonUtils.ChangeUIScene(Constants.MAIN_SCENE_PATH);
|
||
UIManager.Instance.CloseAllNormalExcept(UINameConst.UI_MainPanel);
|
||
}
|
||
|
||
void LockFunction()
|
||
{
|
||
CommonUtils.ShowMessageTips("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>");
|
||
}
|
||
#endregion
|
||
|
||
public void SetName()
|
||
{
|
||
//InputField_Name.interactable = true;
|
||
UI_WriteNameController.Open().Forget();
|
||
}
|
||
|
||
void OnChangeName()
|
||
{
|
||
Text_PlayerName.text = Actor.Instance.Base.Nickname;
|
||
}
|
||
} |