193 lines
7.1 KiB
C#
193 lines
7.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Net.NetworkInformation;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
|
|
public class Logo_in : mount
|
|
{
|
|
|
|
public Slider sceneslider;
|
|
public Button logo_inbtn;
|
|
public float loadSpeed = 0.5f; // 填充速度
|
|
public float loadDuration = 5f; // 总加载时间,用于计时器控制
|
|
public float smoothingSpeed = 0.1f;
|
|
public override void Awake()
|
|
{
|
|
|
|
}
|
|
// 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
|
|
}
|
|
|
|
PlayerPrefs.SetInt("SceneStatus", -1);
|
|
Privacy_Policy_screen();
|
|
}
|
|
|
|
|
|
public void Privacy_Policy_screen()
|
|
{
|
|
List<BoxType> boxTypes = new List<BoxType>();
|
|
boxTypes.Add(new BoxType { Name = "", prompt = "", Type = 9, widthnum = 700, WidthHeight = 650, content = "在您使用我们(萌妖)服务前,请您务必审慎阅读、充分理解腾讯游戏用户协议隐私保护指引和儿童隐私保护指引的各条款,了解我们对您个人信息的处理规则。同时,您应特别注意前述协议中免除或者限制我们责任的条款、对您权利进行限制的条款、约定争议解决方式和司法管辖的条款。如您已详细阅读并同意 萌妖出击游戏用户协议、隐私保护指引和儿童隐私保护指引,请点击“同意”开始使用我们的服务。" });
|
|
boxTypes.Add(new BoxType {Name = "submit", textName = " 取消确定 ", Type = 12 });
|
|
GameObject gameObject = add_pop_up(true);//生成弹窗母体
|
|
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)
|
|
{
|
|
|
|
}
|
|
else if (type == 1)
|
|
{
|
|
Real_name_screen();
|
|
gameObject.GetComponent<input_box_pop_up_window>().destroy();
|
|
}
|
|
});
|
|
}
|
|
|
|
public void Real_name_screen()
|
|
{
|
|
List<BoxType> boxTypes = new List<BoxType>();
|
|
boxTypes.Add(new BoxType { Name = "", prompt = "", Type = 13, content = "根据有关部门的规定,网络游戏用户需要使用有效身份信息进行实名注册,为享受健康游戏生活,请玩家尽快实名注册。我们承诺将严格保护您的个人信息,不会对外泄露。" });
|
|
boxTypes.Add(new BoxType { Name = "verification_code", textName = " 姓名", prompt = "请输入真实姓名", Type = 0, is_required = true });
|
|
boxTypes.Add(new BoxType { Name = "verification_code", textName = " 身份证", prompt = "请输入身份证号", Type = 0, is_required = true });
|
|
boxTypes.Add(new BoxType { Name = "submit", textName = " 取消确定 ", Type = 2 });
|
|
GameObject gameObject = add_pop_up(true);//生成弹窗母体
|
|
List<GameObject> gameObjects = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, "实名认证");//测试输入框回调处理
|
|
gameObjects[3].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
|
|
{
|
|
if (type == 0)//取消
|
|
{
|
|
Application.Quit();
|
|
}
|
|
else if (type == 1)//提交
|
|
{
|
|
login_in_screen();
|
|
gameObject.GetComponent<input_box_pop_up_window>().destroy();
|
|
}
|
|
});
|
|
|
|
}
|
|
public void login_in_screen()//登录界面
|
|
{
|
|
|
|
List<BoxType> boxTypes = new List<BoxType>();
|
|
boxTypes.Add(new BoxType { Name = "account_number", textName = " 手机号", prompt = "请输入手机号", Type = 1, is_required = true });
|
|
boxTypes.Add(new BoxType { Name = "verification_code", textName = " 验证码", prompt = "请输入验证码", Type = 0, is_required = true });
|
|
boxTypes.Add(new BoxType { Name = "submit", textName = " 取消确定 ", Type = 5 });
|
|
GameObject gameObject = add_pop_up(true);//生成弹窗母体
|
|
List<GameObject> gameObjects = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, "登录");//测试输入框回调处理
|
|
|
|
//gameObjects[0].GetComponent<input_box_pop_up_window_item>().register_click((BoxType boxType, int type) =>//手机号获取验证码点击
|
|
//{
|
|
// if (boxType.is_required && string.IsNullOrWhiteSpace(boxType.content))
|
|
// {
|
|
// Promptmgr.Instance.PromptBubble("请不要" + boxType.textName + "为空");
|
|
// return;
|
|
// }
|
|
// Debug.Log("获取验证码");
|
|
//});
|
|
gameObjects[2].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
|
|
{
|
|
if (type == 0)//注册
|
|
{
|
|
//Login login = new Login();
|
|
//login.Phone = boxTypes[0].content;
|
|
////register.Code = boxTypes[0].content;
|
|
//string jsonString = JsonUtility.ToJson(login);
|
|
//string response = await web.SendRequest(web.URL+"/Player/Register", "POST", jsonString);
|
|
//Debug.Log(response);
|
|
}
|
|
else if (type == 1)//登录
|
|
{
|
|
//Login login = new Login();
|
|
//login.Phone = boxTypes[0].content;
|
|
//Debug.Log(boxTypes[0].content);
|
|
////register.Code = boxTypes[0].content;
|
|
//string jsonString = JsonUtility.ToJson(login);
|
|
//string response = await web.SendRequest(web.URL+"/Player/Login", "POST", jsonString);
|
|
//Debug.Log(response);
|
|
|
|
|
|
//Rootobject root = JsonUtility.FromJson<Rootobject>(response);
|
|
|
|
|
|
|
|
//if (root.ErrorMessage=="" && boxTypes[0].content!= "")
|
|
//{
|
|
// gameObject.SetActive(false);
|
|
// Promptmgr.Instance.PromptBubble("登录成功");
|
|
// isLoading = true;
|
|
//}
|
|
//else
|
|
//{
|
|
// Promptmgr.Instance.PromptBubble("登录失败,请先注册");
|
|
//}
|
|
|
|
gameObject.SetActive(false);
|
|
Promptmgr.Instance.PromptBubble("登录成功");
|
|
|
|
StartCoroutine(LoadSceneWithProgress());
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
IEnumerator LoadSceneWithProgress()
|
|
{
|
|
// 开始异步加载场景
|
|
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(JumpScene.scene_Main);
|
|
asyncLoad.allowSceneActivation = false;
|
|
|
|
AsyncOperation asyncLoadjinshadao = SceneManager.LoadSceneAsync(JumpScene.scene_jiashadao);
|
|
asyncLoadjinshadao.allowSceneActivation = false;
|
|
|
|
AsyncOperation asyncLoadbaoshidao = SceneManager.LoadSceneAsync(JumpScene.scene_baoshidao);
|
|
asyncLoadbaoshidao.allowSceneActivation = false;
|
|
|
|
if (!asyncLoad.isDone)
|
|
{
|
|
asyncLoad.allowSceneActivation = true;
|
|
}
|
|
|
|
yield return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public class Rootobject
|
|
{
|
|
public int ErrorCode;
|
|
public string ErrorMessage;
|
|
|
|
}
|
|
|
|
|
|
public class JsonParser
|
|
{
|
|
public static Rootobject ParseJson(string json)
|
|
{
|
|
return JsonUtility.FromJson<Rootobject>(json);
|
|
}
|
|
}
|
|
|
|
|
|
|