2022-02-16 18:22:27 +08:00

46 lines
1.5 KiB
C#

using Assets.Scripts;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AddressController : PFUIPanel
{
// Start is called before the first frame update
Dictionary<string, InputField> inputDict;
protected override void Awake()
{
inputDict = new Dictionary<string, InputField>()
{
{"Name",transform.Find("Main/Name/input").GetComponent<InputField>() },
{"Phone",transform.Find("Main/PN/input").GetComponent<InputField>() },
{"Address",transform.Find("Main/Addr/input").GetComponent<InputField>() },
};
inputDict["Name"].text = App.CurrentUser.Contact;
inputDict["Phone"].text = App.CurrentUser.ContactPhone;
inputDict["Address"].text = App.CurrentUser.ContactAddress;
UIManager.AddEvent(transform.Find("Main/BtnJoin").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, async b =>
{
App.CurrentUser.Contact = inputDict["Name"].text;
App.CurrentUser.ContactPhone = inputDict["Phone"].text;
App.CurrentUser.ContactAddress = inputDict["Address"].text;
var res = await ConfigHelper.userApi.UpdateUserInfo(App.CurrentUser);
if (res.result)
{
Close();
UIManager.ShowActivityPanel(App.ActivityUrl);
}
});
}
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}