前两个页面迁移完成

This commit is contained in:
Caiyanpeng committed 2021-03-26 09:50:04 +08:00
1 parent ba324aa68d
commit e7044b3cde
67 files changed
+6373 -3171

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@ using UnityEngine;
public static class App
{
public static string Host = "http://192.168.0.97:5082/";
public static string Host = "http://192.168.0.101:5087/";
public static string AppVersion = "1.0.0";
@@ -5,7 +5,7 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class UserInfo : MonoBehaviour
public class HomeController : MonoBehaviour
{
[SerializeField] Text Ftp;
[SerializeField] RawImage Avatar;
@@ -22,7 +22,7 @@ public class UserInfo : MonoBehaviour
var parent = Utils.FindUpParent(gameObject.transform);
if (parent.Find("ToastContainer") == null)
{
var toast = Instantiate(Resources.Load<GameObject>("ToastContainer"));
var toast = Instantiate(Resources.Load<GameObject>("UI/Prefab/ToastContainer"));
toast.name = "ToastContainer";
toast.GetComponent<RectTransform>().position = new Vector3(Screen.width / 2, Screen.height / 2, 0);
toast.transform.parent = parent;
+78
View File
@@ -0,0 +1,78 @@
using Assets.Cyp;
using Assets.Scripts;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class LoginController : MonoBehaviour
{
[SerializeField] InputField phone;
[SerializeField] InputField pwd;
[SerializeField] Button login;
[SerializeField] RawImage loading;
// Start is called before the first frame update
void Start()
{
if (login != null)
{
login.onClick.AddListener(Submit);
}
if (loading != null)
{
loading.texture.wrapMode = TextureWrapMode.Repeat;
}
}
async void Submit()
{
if (phone == null || pwd == null)
{
Utils.showToast(gameObject, "未绑定", 1);
return;
}
//if (string.IsNullOrEmpty(phone.text) || string.IsNullOrEmpty(pwd.text))
//{
// Utils.showToast(gameObject, "请输入信息", 1);
// return;
//}
//var res = await Global.userApi.Login(phone.text, pwd.text, "");
//测试用
var res = await ConfigHelper.userApi.Login("15651831367", "123456", "");
//var res = await NoAuthApi.Login(phone.text, pwd.text);
if (res.result)
{
ConfigHelper.CurrentUser = res.data;
SceneManager.LoadScene("2-Main");
}
else
{
}
}
// Update is called once per frame
void Update()
{
if (phone.isFocused && pwd != null && Input.GetKeyDown(KeyCode.Tab))
{
pwd.ActivateInputField();
}
//if (Input.GetKeyDown(KeyCode.Return) && )
//{
//}
//if (Input.GetKeyDown(KeyCode.Return)) {
// Debug.Log("回车键");
// if (pwd.isFocused)
// {
// this.Submit();
// }
//}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 56b7510faf14fb04ab59d33b95cbc4a1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+31
View File
@@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class ButtonHoverScript : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
{
public void OnPointerEnter(PointerEventData eventData)
{
Debug.Log("鼠标悬浮");
gameObject.transform.localScale = new Vector3(1.03f, 1.03f, 1f);
}
public void OnPointerExit(PointerEventData eventData)
{
Debug.Log("鼠标松开");
gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 727df423a048be44c9bf96931b788ac7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+19
View File
@@ -29,6 +29,25 @@ namespace Assets.Scripts
}
/*显示简略提示,需要拖Toast的预制件,且保证其他组件名字不是Toast,ToastContainer*/
/*删除父亲节点下的所有孩子*/
static public void DestroyChildren(this Transform t)
{
bool isPlaying = Application.isPlaying;
while (t.childCount != 0)
{
Transform child = t.GetChild(0);
if (isPlaying)
{
child.parent = null;
UnityEngine.Object.Destroy(child.gameObject);
}
else UnityEngine.Object.DestroyImmediate(child.gameObject);
}
}
/*删除父亲节点下的所有孩子*/
/*显示网络图片*/
public delegate Coroutine StartCoroutine(IEnumerator routine);
public static void DisplayImage(StartCoroutine startCoroutine,RawImage img, string url)