diff --git a/TheStrongestSnail/Assets/Scripts/LqUiScripts/EditPanel.cs b/TheStrongestSnail/Assets/Scripts/LqUiScripts/EditPanel.cs index 46e4817..5f07c32 100644 --- a/TheStrongestSnail/Assets/Scripts/LqUiScripts/EditPanel.cs +++ b/TheStrongestSnail/Assets/Scripts/LqUiScripts/EditPanel.cs @@ -1,14 +1,31 @@ +using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; +using TMPro; using UnityEngine; +using UnityEngine.SceneManagement; using UnityEngine.UI; -public class EditPanel : MonoBehaviour +public class EditPanel : Base { + public UserInfomation14 userInfomation14; + public InputField UserInputField; + public Text username; + public PerSonalCenterPanel perSonalCenterPanel; // Start is called before the first frame update - void Start() + async void Start() { - + Dictionary head14 = new Dictionary + { + { "Authorization", Global.global.serverResponse.data.token } + }; + + // 异步查询玩家信息 + string response14 = await web.SendRequest(web.URL + "/snail/user/queryUserInfo", "POST", "{}", head14); + Debug.Log("1.4查询玩家信息" + response14); + userInfomation14 = JsonConvert.DeserializeObject(response14); + + username.text = "" + userInfomation14.data.nickName; } // Update is called once per frame @@ -16,8 +33,48 @@ public class EditPanel : MonoBehaviour { } - public void SetEditPanel() + public async void SetEditPanel() { + Dictionary head13 = new Dictionary + { + { "Authorization", Global.global.serverResponse.data.token } + }; + ChangeDetailbody body= new ChangeDetailbody(); + body.nickName = UserInputField.text; + Debug.Log(UserInputField.text); + body.birthday = userInfomation14.data.birthday; + body.gender= userInfomation14.data.gender; + body.headImg = userInfomation14.data.headImg; + Debug.Log("入参"+ JsonUtility.ToJson(body)); + string loginResponse = await web.SendRequest(web.URL + "/snail/user/update", "POST", JsonUtility.ToJson(body), head13); + ChangeReturn response = JsonUtility.FromJson(loginResponse); + if (response.code==200) + { + Debug.Log("1.3完善用户信息"+ loginResponse); + perSonalCenterPanel.GetPlayerInfo(); + Global.global.scene_Main_Jiekou.getPlayerInfo(); + } + else + { + addEventPopUp(response.message); + } + + Debug.Log(response); transform.gameObject.SetActive(false); } } +public class ChangeDetailbody//登录和注册用 +{ + public string nickName = ""; + public string headImg = ""; + public int gender = 0; + public string birthday = ""; + +} + +public class ChangeReturn +{ + public int code; + public string message; + public bool data; +} diff --git a/TheStrongestSnail/Assets/Scripts/LqUiScripts/PerSonalCenterPanel.cs b/TheStrongestSnail/Assets/Scripts/LqUiScripts/PerSonalCenterPanel.cs index f0c3ccf..2f8e838 100644 --- a/TheStrongestSnail/Assets/Scripts/LqUiScripts/PerSonalCenterPanel.cs +++ b/TheStrongestSnail/Assets/Scripts/LqUiScripts/PerSonalCenterPanel.cs @@ -60,7 +60,8 @@ public class PerSonalCenterPanel : MonoBehaviour public void EditBtn() { - GameObject.Instantiate(editPrefabs, trans); + GameObject ob=Instantiate(editPrefabs, trans); + ob.GetComponent().perSonalCenterPanel = this; } public void MyorderBtn() diff --git a/TheStrongestSnail/Assets/Scripts/Scene_shop/wokePanel.cs b/TheStrongestSnail/Assets/Scripts/Scene_shop/wokePanel.cs index a44eb43..719046a 100644 --- a/TheStrongestSnail/Assets/Scripts/Scene_shop/wokePanel.cs +++ b/TheStrongestSnail/Assets/Scripts/Scene_shop/wokePanel.cs @@ -29,7 +29,7 @@ public class wokePanel : ui_huodong this.NameText.text = NameText; this.priceText.text = "¥" + priceText; this.info.text = info; - + //await Base.GlobalObj.GetComponent().LoadImageAsync(Url); BuyBtn.onClick.AddListener(async()=> { await Scene_main_jiekou.instance.ShopOneItem(id); if (Scene_main_jiekou.instance.IsBuyGet) diff --git a/TheStrongestSnail/Assets/Scripts/lianghaoLL/ShimingPanel.cs b/TheStrongestSnail/Assets/Scripts/lianghaoLL/ShimingPanel.cs index b4b6622..710a3d2 100644 --- a/TheStrongestSnail/Assets/Scripts/lianghaoLL/ShimingPanel.cs +++ b/TheStrongestSnail/Assets/Scripts/lianghaoLL/ShimingPanel.cs @@ -1,3 +1,4 @@ +using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -10,10 +11,21 @@ public class ShimingPanel : Base public Button User_AgreementBtn; public Button Privacy_PolicyBtn; public Button checkBtn; + public UserInfomation14 userInfomation14; // Start is called before the first frame update - void Start() + async void Start() { - + Dictionary head14 = new Dictionary + { + { "Authorization", Global.global.serverResponse.data.token } + }; + + // 异步查询玩家信息 + string response14 = await web.SendRequest(web.URL + "/snail/user/queryUserInfo", "POST", "{}", head14); + Debug.Log("1.4查询玩家信息" + response14); + userInfomation14 = JsonConvert.DeserializeObject(response14); + + phonenumber.text = ""+userInfomation14.data.userName; changePdBtn.onClick.AddListener(ChangeClick); Deregister_accountBtn.onClick.AddListener(Deregisterclick); User_AgreementBtn.onClick.AddListener(User_AgreementClick); diff --git a/TheStrongestSnail/Assets/prefabs/ge_ren_zhong_xing/EditPanel.prefab b/TheStrongestSnail/Assets/prefabs/ge_ren_zhong_xing/EditPanel.prefab index 9bd130f..d961a2c 100644 --- a/TheStrongestSnail/Assets/prefabs/ge_ren_zhong_xing/EditPanel.prefab +++ b/TheStrongestSnail/Assets/prefabs/ge_ren_zhong_xing/EditPanel.prefab @@ -1,5 +1,232 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &895596425846999072 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1187208800342382664} + - component: {fileID: 4669806498530837813} + - component: {fileID: 1448502423992284628} + - component: {fileID: 379801035829787383} + m_Layer: 5 + m_Name: InputField (Legacy) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1187208800342382664 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 895596425846999072} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 3287804148620100917} + - {fileID: 8892910685641201724} + m_Father: {fileID: 8996637369542558033} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 139.36, y: 20.734985} + m_SizeDelta: {x: 545.46, y: 71.47} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4669806498530837813 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 895596425846999072} + m_CullTransparentMesh: 1 +--- !u!114 &1448502423992284628 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 895596425846999072} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &379801035829787383 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 895596425846999072} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1448502423992284628} + m_TextComponent: {fileID: 1770971753020342523} + m_Placeholder: {fileID: 8468291165135306074} + m_ContentType: 0 + m_InputType: 0 + m_AsteriskChar: 42 + m_KeyboardType: 0 + m_LineType: 0 + m_HideMobileInput: 0 + m_CharacterValidation: 0 + m_CharacterLimit: 0 + m_OnSubmit: + m_PersistentCalls: + m_Calls: [] + m_OnDidEndEdit: + m_PersistentCalls: + m_Calls: [] + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_CustomCaretColor: 0 + m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} + m_Text: + m_CaretBlinkRate: 0.85 + m_CaretWidth: 1 + m_ReadOnly: 0 + m_ShouldActivateOnSelect: 1 +--- !u!1 &1031816372520075394 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8892910685641201724} + - component: {fileID: 7441466831794590482} + - component: {fileID: 1770971753020342523} + m_Layer: 5 + m_Name: Text (Legacy) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8892910685641201724 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1031816372520075394} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1187208800342382664} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7441466831794590482 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1031816372520075394} + m_CullTransparentMesh: 1 +--- !u!114 &1770971753020342523 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1031816372520075394} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.30588236, g: 0.24705882, b: 0.15294118, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 45 + m_FontStyle: 1 + m_BestFit: 0 + m_MinSize: 4 + m_MaxSize: 45 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: --- !u!1 &6960989441060764512 GameObject: m_ObjectHideFlags: 0 @@ -92,6 +319,33 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a2940e547e5410940b8b407feafada41, type: 3} m_Name: m_EditorClassIdentifier: + retbutton: {fileID: 0} + ClosureObj: {fileID: 0} + userInfomation14: + code: 0 + message: + data: + userId: 0 + userName: 0 + token: + nickName: + headImg: + gender: 0 + birthday: + voluteCoin: 0 + beansCoin: 0 + ichorCoin: 0 + idCard: + inviteCodeMy: + inviteCodeBind: + bindTime: + station: 0 + cuteNo: + menberTime: + isMember: 0 + UserInputField: {fileID: 379801035829787383} + username: {fileID: 8468291165135306074} + perSonalCenterPanel: {fileID: 0} --- !u!1 &6960989442929760420 GameObject: m_ObjectHideFlags: 0 @@ -168,6 +422,86 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!1 &7296248847881340482 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3287804148620100917} + - component: {fileID: 5763550397852471591} + - component: {fileID: 8468291165135306074} + m_Layer: 5 + m_Name: Placeholder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3287804148620100917 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7296248847881340482} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1187208800342382664} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -0.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5763550397852471591 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7296248847881340482} + m_CullTransparentMesh: 1 +--- !u!114 &8468291165135306074 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7296248847881340482} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.30588236, g: 0.24705882, b: 0.15294118, a: 0.5} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 45 + m_FontStyle: 1 + m_BestFit: 0 + m_MinSize: 4 + m_MaxSize: 57 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Enter text... --- !u!1 &8996637367570348153 GameObject: m_ObjectHideFlags: 0 @@ -185,7 +519,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &8996637367570348154 RectTransform: m_ObjectHideFlags: 0 @@ -864,6 +1198,7 @@ RectTransform: - {fileID: 8996637367570348154} - {fileID: 8996637369039718773} - {fileID: 8996637369503128189} + - {fileID: 1187208800342382664} m_Father: {fileID: 6960989441060764543} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}