2024-10-11 14:04:52 +08:00
|
|
|
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;
|
2024-10-11 14:22:58 +08:00
|
|
|
public TMP_Text Text_PlayerName;
|
2024-10-11 14:04:52 +08:00
|
|
|
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;
|
2024-10-11 14:22:58 +08:00
|
|
|
public TMP_Text Text_Birthday;
|
2024-10-11 14:04:52 +08:00
|
|
|
public Button Button_EditBirthday;
|
|
|
|
|
public TMP_Text Text_Sign;
|
|
|
|
|
public Button Button_EditIntroduction;
|
2024-10-11 18:17:51 +08:00
|
|
|
public TMP_Text Text_Desc;
|
2024-10-11 14:04:52 +08:00
|
|
|
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;
|
2024-10-11 14:22:58 +08:00
|
|
|
|
2024-10-11 14:04:52 +08:00
|
|
|
///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);
|
2024-10-11 16:04:28 +08:00
|
|
|
BindButton(Button_EditIntroduction,SetIntroduction);
|
2024-10-11 19:15:56 +08:00
|
|
|
BindButton(Button_EditBirthday, SetBirthday);
|
2024-10-12 17:28:48 +08:00
|
|
|
BindButton(Text_Desc.GetComponent<Button>(), SetIntroduction);
|
2024-10-11 14:04:52 +08:00
|
|
|
|
2024-10-11 14:22:58 +08:00
|
|
|
#region 待开发
|
2024-10-11 14:04:52 +08:00
|
|
|
BindButton(Button_HeadChangeGame, 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");
|
2024-10-11 19:15:56 +08:00
|
|
|
OnChangeInfo();
|
|
|
|
|
|
|
|
|
|
Text_Uid.text = Actor.Instance.Base.GetProp(ActorProp.ActorId).ToString();
|
2024-10-11 14:04:52 +08:00
|
|
|
|
2024-10-17 16:52:59 +08:00
|
|
|
|
|
|
|
|
float curExp = Actor.Instance.Base.GetProp(ActorProp.Exp);
|
|
|
|
|
Image_ExpCircle.fillAmount = curExp / ActorLevelTableHelper.Instance.GetLevelUpExp(levelInfo.Level);
|
|
|
|
|
|
2024-10-11 14:04:52 +08:00
|
|
|
|
2024-10-11 18:17:51 +08:00
|
|
|
EventManager.Instance.Register(EventManager.EventName.PlayerInfoUpdate, OnChangeInfo);
|
2024-10-11 14:04:52 +08:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//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();
|
|
|
|
|
|
2024-10-11 18:17:51 +08:00
|
|
|
EventManager.Instance.Unregister(EventManager.EventName.PlayerInfoUpdate, OnChangeInfo);
|
2024-10-11 14:04:52 +08:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#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()
|
|
|
|
|
{
|
2024-10-11 16:04:28 +08:00
|
|
|
CommonUtils.ShowMessageTips("功能尚未开放,敬请期待");
|
2024-10-11 14:04:52 +08:00
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public void SetName()
|
|
|
|
|
{
|
|
|
|
|
//InputField_Name.interactable = true;
|
|
|
|
|
UI_WriteNameController.Open().Forget();
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-11 16:04:28 +08:00
|
|
|
public void SetIntroduction()
|
|
|
|
|
{
|
|
|
|
|
UI_EditIntroductionController.Open().Forget();
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-11 19:15:56 +08:00
|
|
|
public void SetBirthday()
|
|
|
|
|
{
|
|
|
|
|
UI_EditBirthdayController.Open().Forget();
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-11 18:17:51 +08:00
|
|
|
void OnChangeInfo()
|
2024-10-11 14:04:52 +08:00
|
|
|
{
|
2024-10-11 14:22:58 +08:00
|
|
|
Text_PlayerName.text = Actor.Instance.Base.Nickname;
|
2024-10-12 17:44:22 +08:00
|
|
|
if(Actor.Instance.Base.Description == string.Empty)
|
|
|
|
|
{
|
|
|
|
|
Text_Desc.text = CommonUtils.GetLocalizeText("Introduction_default");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Text_Desc.text = Actor.Instance.Base.Description;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-12 16:16:58 +08:00
|
|
|
if (Actor.Instance.Base.Birthday == string.Empty)
|
|
|
|
|
{
|
|
|
|
|
Text_Birthday.text = CommonUtils.GetLocalizeText("Birthday_default");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Text_Birthday.text = Actor.Instance.Base.Birthday;
|
|
|
|
|
}
|
2024-10-11 19:15:56 +08:00
|
|
|
}
|
2024-10-11 14:04:52 +08:00
|
|
|
}
|