Compare commits

...

2 Commits

7 changed files with 673 additions and 377 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3,33 +3,39 @@ using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using UnityEngine.UI;
using Unity.VisualScripting;
public class FramePanel : MonoBehaviour
{
public Button button;
public Vector2 OrPos;
public bool IsClick;
public Text chart_title;
public Text stats1award;
public Text stats1Name;
public Text stats2award;
public Text stats2Name;
public Text stats3award;
public Text stats3Name;
public Text stats4award;
public Text stats4Name;
public Text stats5award;
public Text stats5Name;
// Start is called before the first frame update
void Start()
async void Start()
{
button.onClick.AddListener(OnClickBtn);
OrPos=transform.position;
TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS();
chart_title.text = info.Data.ChartTitle;
stats1award.text = info.Data.Charts[0].Reward;
stats1Name.text = info.Data.Charts[0].Name;
stats2award.text = info.Data.Charts[1].Reward;
stats2Name.text = info.Data.Charts[1].Name;
stats3award.text = info.Data.Charts[2].Reward;
stats3Name.text = info.Data.Charts[2].Name;
stats4award.text = info.Data.Charts[3].Reward;
stats4Name.text = info.Data.Charts[3].Name;
stats5award.text = info.Data.Charts[4].Reward;
stats5Name.text = info.Data.Charts[4].Name;
}
void OnClickBtn()
{
if (!IsClick)
{
float moveDistance = Screen.height / 4;
transform.DOMoveY(OrPos.y + moveDistance, 0.5f);
IsClick = true;
}
else
{
transform.DOMoveY(OrPos.y, 0.5f);
IsClick=false;
}
}
}

View File

@ -23,6 +23,8 @@ public class AssetsPanel : MonoBehaviour
public Text UserName;
public Text UserID;
public Image UserHead;
public Text PersonaText;
public Text PersonID;
// Start is called before the first frame update
void Start()
{
@ -68,7 +70,9 @@ public class AssetsPanel : MonoBehaviour
Ore.text = Scene_main_jiekou.instance.infoData.water.ToString();
Forging.text = Scene_main_jiekou.instance.infoData.forge.ToString();
UserName.text = Scene_main_jiekou.instance.infoData.nickname.ToString();
PersonaText.text = Scene_main_jiekou.instance.infoData.nickname.ToString();
UserID.text = Scene_main_jiekou.instance.infoData.uid.ToString();
PersonID.text = Scene_main_jiekou.instance.infoData.uid.ToString();
}

View File

@ -0,0 +1,61 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ReviseName : mount
{
public Button ReviseBtn;
public Text RevisrText;
public Text MainnameText;
// Start is called before the first frame update
void Start()
{
ReviseBtn.onClick.AddListener(ReviseClick);
}
public void ReviseClick()
{
List<BoxType> boxTypes = new List<BoxType>();
boxTypes.Add(new BoxType { Name = "verification_code", textName = " 修改昵称:", prompt = "请输入修改的昵称", Type = 0, is_required = true });
boxTypes.Add(new BoxType { Name = "submit", textName = " 取消确定 ", prompt = "取消", Type = 2 });
GameObject gameObject = add_pop_up(true);//生成弹窗母体
RectTransform rect = gameObject.GetComponent<RectTransform>();
rect.transform.position = new Vector3(Screen.width/2,Screen.height/2,0);
List<GameObject> gameObjects = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, "修改昵称");//测试输入框回调处理
gameObjects[1].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 0)//取消
{
gameObject.GetComponent<input_box_pop_up_window>().destroy();
}
else if (type == 1)//提交
{
Debug.Log(boxTypes[0].content);
UpdatePlayerInfoResponse issuccefful = await Scene_main_jiekou.instance.UpdatePlayerInfos("nickname", boxTypes[0].content);
if (issuccefful.code ==200)
{
Promptmgr.Instance.PromptBubble("修改昵称成功");
RevisrText.text = issuccefful.data.nickname;
MainnameText.text = issuccefful.data.nickname;
gameObject.GetComponent<input_box_pop_up_window>().destroy();
}
else
{
Promptmgr.Instance.PromptBubble(issuccefful.message);
}
}
});
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2911dd3981376da459f4cb5b4a0031c8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -12,7 +12,7 @@ public class Scene_main_jiekou :MonoBehaviour
treeFansList treeFansList = new treeFansList();
treeGetWater getWater = new treeGetWater();
wateringTree watering = new wateringTree();
updatePlayerInfo updatePlayer=new updatePlayerInfo();
public static Scene_main_jiekou instance;
public PlayerInfoData infoData;
public void Awake()
@ -64,4 +64,9 @@ public class Scene_main_jiekou :MonoBehaviour
{
return await watering.WateringTree();
}
public async Task<UpdatePlayerInfoResponse> UpdatePlayerInfos(string field, string value)//呢称需要包含中文可以跟字母组合,但必须大于两个//只能更新名字头像
{
return await updatePlayer.UpdatePlayerInfo(field, value);
}
}

View File

@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using UnityEngine;
//用户信息更新
public class updatePlayerInfo : MonoBehaviour
@ -20,16 +21,27 @@ public class updatePlayerInfo : MonoBehaviour
};
}
//=========用户信息更新=============================================================================
public async Task<bool> UpdatePlayerInfo(string field, string value)//呢称需要包含中文可以跟字母组合,必须大于两个//只能更新名字头像
public async Task<UpdatePlayerInfoResponse> UpdatePlayerInfo(string field, string value)//呢称需要包含中文可以跟字母组合,必须大于两个//只能更新名字头像
{
string body = $"{{\"{field}\":\"{value}\"}}";
//Debug.Log("=====" + body);
string response = await myWeb.SendRequest(myWeb.URL + "/api/user/update_info", "POST", body, CreateHeaders());
Debug.Log("用户信息更新" + response);
//myResponse ModifyTradePasswordResponse = JsonConvert.DeserializeObject<myResponse>(response);
bool isSucceed = true;
//if (ModifyTradePasswordResponse.code == 200) { isSucceed = true; } else { isSucceed = false; }
return isSucceed;
UpdatePlayerInfoResponse updatePlayerInfoResponse = JsonConvert.DeserializeObject<UpdatePlayerInfoResponse>(response);
return updatePlayerInfoResponse;
}
}
//=================================================================================
//=================================================================================
public class UpdatePlayerInfoResponse
{
public int code;
public string message;
public UpdatePlayerInfoData data;
}
public class UpdatePlayerInfoData
{
public string nickname;
public string avatar;
}