Compare commits

...

2 Commits

Author SHA1 Message Date
舒荣森
eb2b4211cd add 2024-10-30 22:11:06 +08:00
舒荣森
228192a5c1 add 2024-10-30 22:03:04 +08:00
4 changed files with 196 additions and 22 deletions

View File

@ -122,6 +122,107 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1001 &107147069
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_Pivot.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_Pivot.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166433, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166437, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_Name
value: pop
objectReference: {fileID: 0}
- target: {fileID: 1125018133084166437, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 4d328a61046e1d2498391895fd2c11d7, type: 3}
--- !u!1 &111255128
GameObject:
m_ObjectHideFlags: 0
@ -467,7 +568,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!114 &603807337
MonoBehaviour:
m_ObjectHideFlags: 0
@ -894,6 +995,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
sceneslider: {fileID: 2057344806}
logo_inbtn: {fileID: 603807337}
loadSpeed: 0.5
--- !u!1 &1348751385
GameObject:
m_ObjectHideFlags: 0
@ -1344,7 +1446,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 10, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1980015289
MonoBehaviour:
@ -1366,8 +1468,8 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 80ac668eebc18274da102d1113d48c44, type: 3}
m_Type: 1
m_Sprite: {fileID: 21300000, guid: b7d0b95aa29194545b1bad8da63bea19, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 0

View File

@ -16,6 +16,11 @@ public struct AddGold
public int Gold;
}
public struct Login
{
public string Phone;
}
public class mount : MonoBehaviour
{
@ -42,15 +47,18 @@ public class mount : MonoBehaviour
//Login register = new Login();
//register.phonenumble = "13667637952";
//string jsonString = JsonUtility.ToJson(register);
//string response_1 = await web.SendRequest("http://47.109.133.52/Player/Login", "POST", jsonString);
/*
Register register = new Register();
register.Phone = "13667637952";
string jsonString = JsonUtility.ToJson(register);
//Register register = new Register();
//register.Phone = "13667637952";
//string jsonString = JsonUtility.ToJson(register);
//string response_1 = await web.SendRequest("http://47.109.133.52/Player/Login", "POST", jsonString);
//Debug.Log(response_1);
string response_1 = await web.SendRequest("http://47.109.133.52/Player/Login", "POST", jsonString);
Debug.Log(response_1);
*/
//string response_2 = await web.SendRequest("http://47.109.133.52/MinerElf/GetList", "POST");
//Debug.Log(response_2);

View File

@ -51,10 +51,14 @@ public class web : MonoBehaviour
}
else
{
// ´¦Àí·µ»ØµÄCookie
string setCookieHeader;
string str = request.downloadHandler.text;
Debug.Log(str);
if (request.GetResponseHeaders().TryGetValue("Set-Cookie", out setCookieHeader))
{
string[] cookies = setCookieHeader.Split(';');
foreach (var cookie in cookies)
{

View File

@ -2,32 +2,38 @@ using System.Collections;
using System.Collections.Generic;
using System.Net.NetworkInformation;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public struct Login
{
public string phonenumble;
}
public class Logo_in : mount
{
public Slider sceneslider;
public Button logo_inbtn;
public float loadSpeed = 0.5f; // 填充速度
private float progress = 0f;
private bool isLoading = false;
// Start is called before the first frame update
void Start()
{
//sceneslider.gameObject.SetActive(false);
//logo_inbtn.onClick.AddListener(ShowLogoin);
if (sceneslider != null)
{
sceneslider.value = 0f; // 初始值设为0
}
login_in_screen();
}
void ShowLogoin()
{
login_in_screen();
}
public void login_in_screen()//µÇ¼½çÃæ
@ -54,7 +60,7 @@ public class Logo_in : mount
if (type == 0)//×¢²á
{
Login login = new Login();
login.phonenumble = boxTypes[0].prompt;
login.Phone = boxTypes[0].content;
//register.Code = boxTypes[0].content;
string jsonString = JsonUtility.ToJson(login);
string response = await web.SendRequest("http://47.109.133.52/Player/Register", "POST", jsonString);
@ -63,12 +69,26 @@ public class Logo_in : mount
else if (type == 1)//怬
{
Login login = new Login();
login.phonenumble = boxTypes[0].prompt;
login.Phone = boxTypes[0].content;
//register.Code = boxTypes[0].content;
string jsonString = JsonUtility.ToJson(login);
string response = await web.SendRequest("http://47.109.133.52/Player/Login", "POST", jsonString);
Debug.Log(response);
Rootobject root = JsonUtility.FromJson<Rootobject>(response);
Debug.Log(root.ErrorMessage);
if (root.ErrorMessage =="")
{
gameObject.SetActive(false);
Promptmgr.Instance.PromptBubble("登录成功");
isLoading = true;
}
else
{
Promptmgr.Instance.PromptBubble("登录失败,请先注册");
}
}
});
@ -78,6 +98,46 @@ public class Logo_in : mount
// Update is called once per frame
void Update()
{
// 模拟进度条填充,可以改为你的实际加载逻辑
if (isLoading && progress < 1f)
{
progress += loadSpeed * Time.deltaTime;
sceneslider.value = progress;
}
// 当进度条填满后,进行场景跳转
if (progress >= 1f && isLoading)
{
LoadNextScene();
}
}
private void LoadNextScene()
{
// 这里使用场景管理器进行跳转
SceneManager.LoadScene(JumpScene.main_scene);
GameObject.Destroy(this.gameObject);
}
}
public class Rootobject
{
public int ErrorCode;
public string ErrorMessage;
}
public class JsonParser
{
public static Rootobject ParseJson(string json)
{
return JsonUtility.FromJson<Rootobject>(json);
}
}