Merge remote-tracking branch 'origin/dev' into dev_lishuo
# Conflicts: # Assets/Mapbox/User/Modifiers.meta # Assets/Resources/UI/Control/PFUISlider.prefab.meta # Assets/StreamingAssets.meta
This commit is contained in:
commit
40d118cea3
39 files changed
+7928
-2275
No files matched your search
@@ -438,27 +438,30 @@ namespace Assets.Scripts.Apis
|
||||
url1 = ConfigHelper.Host + url1;
|
||||
}
|
||||
//AddLanguage();
|
||||
var request = (HttpWebRequest)WebRequest.Create(url1);
|
||||
request.Method = "GET";
|
||||
//foreach (var item in httpClient.DefaultRequestHeaders)
|
||||
//var request = (HttpWebRequest)WebRequest.Create(url1);
|
||||
//request.Method = "GET";
|
||||
////foreach (var item in httpClient.DefaultRequestHeaders)
|
||||
////{
|
||||
//// request.Headers.Add(item.Key, item.Value.First());
|
||||
////}
|
||||
//request.UserAgent = httpClient.DefaultRequestHeaders.UserAgent.ToString();
|
||||
//request.Accept = "application/json";
|
||||
//request.Headers.Add("Language", "en");
|
||||
//request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
|
||||
//request.CookieContainer = new CookieContainer();
|
||||
//foreach (Cookie item in cookies)
|
||||
//{
|
||||
// request.Headers.Add(item.Key, item.Value.First());
|
||||
// request.CookieContainer.Add(item);
|
||||
//}
|
||||
request.UserAgent = httpClient.DefaultRequestHeaders.UserAgent.ToString();
|
||||
request.Accept = "application/json";
|
||||
request.Headers.Add("Language", "en");
|
||||
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
|
||||
request.CookieContainer = new CookieContainer();
|
||||
foreach (Cookie item in cookies)
|
||||
{
|
||||
request.CookieContainer.Add(item);
|
||||
}
|
||||
|
||||
var res = request.GetResponse();
|
||||
using (var stream = new StreamReader(res.GetResponseStream()))
|
||||
{
|
||||
return stream.ReadToEnd();
|
||||
}
|
||||
//var res = request.GetResponse();
|
||||
//using (var stream = new StreamReader(res.GetResponseStream()))
|
||||
//{
|
||||
// return stream.ReadToEnd();
|
||||
//}
|
||||
var res = GetAsync(url).GetAwaiter().GetResult();
|
||||
|
||||
return System.Text.Encoding.UTF8.GetString(res);
|
||||
}
|
||||
|
||||
public T Get<T>(string url)
|
||||
|
||||
@@ -9,13 +9,20 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.Scripts
|
||||
{
|
||||
public class ConfigHelper
|
||||
public static class ConfigHelper
|
||||
{
|
||||
public static string Host = App.Host;
|
||||
|
||||
public static string AppVersion = App.AppVersion;
|
||||
|
||||
public static UserApi userApi = new UserApi();
|
||||
public static UserApi _userApi;
|
||||
public static UserApi userApi
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_userApi == null) _userApi = new UserApi();
|
||||
return _userApi;
|
||||
}
|
||||
}
|
||||
public static MapApi mapApi = new MapApi();
|
||||
public static MapInterruptRecordApi mapInterruptRecordApi = new MapInterruptRecordApi();
|
||||
public static ThirdPartApi thirdPartApi = new ThirdPartApi();
|
||||
|
||||
@@ -9,6 +9,7 @@ using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -231,22 +232,25 @@ public class LoginController : MonoBehaviour
|
||||
if (loginContainer != null)
|
||||
{
|
||||
var returnQuick = loginContainer.Find("returnQuick").GetComponent<Button>();
|
||||
returnQuick.onClick.AddListener(ReturnQuick);
|
||||
UIManager.AddEvent(returnQuick.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
ReturnQuick();
|
||||
});
|
||||
var sign = loginContainer.Find("reg").GetComponent<Button>();
|
||||
sign.onClick.AddListener(() => goSign());
|
||||
remember = loginContainer.Find("rememberButton").GetComponent<Button>();
|
||||
remember.onClick.AddListener(() =>
|
||||
{
|
||||
var gou = remember.transform.Find("Gou");
|
||||
if (gou.gameObject.activeSelf)
|
||||
{
|
||||
gou.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
gou.gameObject.SetActive(true);
|
||||
}
|
||||
});
|
||||
UIManager.AddEvent(remember.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
var gou = remember.transform.Find("Gou");
|
||||
if (gou.gameObject.activeSelf)
|
||||
{
|
||||
gou.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
gou.gameObject.SetActive(true);
|
||||
}
|
||||
});
|
||||
var wechatLogin = loginContainer.Find("otherContainer").Find("Wechat").GetComponent<Button>();
|
||||
wechatLogin.onClick.AddListener(() =>
|
||||
{
|
||||
@@ -277,26 +281,32 @@ public class LoginController : MonoBehaviour
|
||||
if (signContainer != null)
|
||||
{
|
||||
var loginr2 = signContainer.Find("loginr2").GetComponent<Button>();
|
||||
loginr2.onClick.AddListener(goLoginReturn2);
|
||||
UIManager.AddEvent(loginr2.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
goLoginReturn2();
|
||||
});
|
||||
}
|
||||
if (exit != null)
|
||||
{
|
||||
exit.onClick.AddListener(() => Application.Quit());
|
||||
UIManager.AddEvent(exit.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
Application.Quit();
|
||||
});
|
||||
}
|
||||
|
||||
wxLogin1 = mainContent.Find("FormContainer-Login").Find("Mask").Find("FormContainer-wx1");
|
||||
if (wxLogin1 != null)
|
||||
{
|
||||
wxLogin1.Find("Image").GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
wxLock = true;
|
||||
wxBrowser.Url = "chrome://version/";
|
||||
wxLogin1.DOLocalMoveY(-573, 0.3f).onComplete = () =>
|
||||
{
|
||||
wxLock = false;
|
||||
wxLogin1.gameObject.SetActive(false);
|
||||
};
|
||||
});
|
||||
UIManager.AddEvent(wxLogin1.Find("Image").gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
wxLock = true;
|
||||
wxBrowser.Url = "chrome://version/";
|
||||
wxLogin1.DOLocalMoveY(-573, 0.3f).onComplete = () =>
|
||||
{
|
||||
wxLock = false;
|
||||
wxLogin1.gameObject.SetActive(false);
|
||||
};
|
||||
});
|
||||
wxBrowser = wxLogin1.Find("Browser (GUI)").GetComponent<Browser>();
|
||||
if (wxBrowser != null)
|
||||
{
|
||||
@@ -323,14 +333,14 @@ public class LoginController : MonoBehaviour
|
||||
wxLogin2 = mainContent.Find("FormContainer-wx2");
|
||||
if (wxLogin2!=null)
|
||||
{
|
||||
wxLogin2.Find("return").GetComponent<Button>().onClick.AddListener(() => {
|
||||
wxLogin2.gameObject.SetActive(false);
|
||||
//wxLogin3.gameObject.SetActive(false);
|
||||
pageNums = 4;
|
||||
Canvas.ForceUpdateCanvases();
|
||||
StartScrollPanel(1);
|
||||
});
|
||||
|
||||
UIManager.AddEvent(wxLogin2.Find("return").gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
wxLogin2.gameObject.SetActive(false);
|
||||
//wxLogin3.gameObject.SetActive(false);
|
||||
pageNums = 4;
|
||||
Canvas.ForceUpdateCanvases();
|
||||
StartScrollPanel(1);
|
||||
});
|
||||
wxLogin2.Find("Next").GetComponent<Button>().onClick.AddListener(()=>
|
||||
{
|
||||
this.goSign(false);
|
||||
@@ -339,24 +349,29 @@ public class LoginController : MonoBehaviour
|
||||
wxLogin3 = mainContent.Find("FormContainer-wx3");
|
||||
if (wxLogin3 != null)
|
||||
{
|
||||
wxLogin3.Find("return").GetComponent<Button>().onClick.AddListener(() => {
|
||||
if (signContainer.gameObject.activeSelf)
|
||||
{
|
||||
StartScrollPanel(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
signContainer.gameObject.SetActive(true);
|
||||
pageNums = 4;
|
||||
//wxLogin3.gameObject.SetActive(false);
|
||||
StartScrollPanel(1);
|
||||
}
|
||||
});
|
||||
wxLogin3.Find("rememberButton").GetComponent<Button>().onClick.AddListener(()=>
|
||||
{
|
||||
var gou = wxLogin3.Find("rememberButton").Find("Gou").gameObject;
|
||||
gou.SetActive(!gou.activeSelf);
|
||||
});
|
||||
UIManager.AddEvent(wxLogin3.Find("return").gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
if (signContainer.gameObject.activeSelf)
|
||||
{
|
||||
StartScrollPanel(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
signContainer.gameObject.SetActive(true);
|
||||
pageNums = 4;
|
||||
//wxLogin3.gameObject.SetActive(false);
|
||||
StartScrollPanel(1);
|
||||
}
|
||||
});
|
||||
UIManager.AddEvent(wxLogin3.Find("rememberButton").gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
var gou = wxLogin3.Find("rememberButton").Find("Gou").gameObject;
|
||||
gou.SetActive(!gou.activeSelf);
|
||||
});
|
||||
//wxLogin3.Find("rememberButton").GetComponent<Button>().onClick.AddListener(()=>
|
||||
//{
|
||||
|
||||
//});
|
||||
wxLogin3.Find("Next").GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
goMain(wxLogin3.Find("rememberButton").Find("Gou"));
|
||||
@@ -368,14 +383,22 @@ public class LoginController : MonoBehaviour
|
||||
toolContainer = transform.Find("Panel").Find("ToolContainer");
|
||||
if (toolContainer != null)
|
||||
{
|
||||
toolContainer.Find("Setting").GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
UIManager.ShowSettingModal();
|
||||
});
|
||||
toolContainer.Find("Msg").GetComponent<Button>().onClick.AddListener(() =>
|
||||
UIManager.AddEvent(toolContainer.Find("Setting").gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
UIManager.ShowSettingModal();
|
||||
});
|
||||
//toolContainer.Find("Setting").GetComponent<Button>().onClick.AddListener(() =>
|
||||
//{
|
||||
// UIManager.ShowSettingModal();
|
||||
//});
|
||||
UIManager.AddEvent(toolContainer.Find("Msg").gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
UIManager.ShowNewsModal();
|
||||
});
|
||||
//toolContainer.Find("Msg").GetComponent<Button>().onClick.AddListener(() =>
|
||||
//{
|
||||
// UIManager.ShowNewsModal();
|
||||
//});
|
||||
}
|
||||
}
|
||||
private void AdjustWxQrCode()
|
||||
@@ -769,6 +792,7 @@ public class LoginController : MonoBehaviour
|
||||
userInfos.Remove(u);
|
||||
}
|
||||
UIManager.Instance.userInfos = userInfos;
|
||||
UIManager.Instance.userInfoIndex = 0;
|
||||
}
|
||||
App.CurrentUser = data;
|
||||
//App.CurrentUser = new UserModel
|
||||
@@ -786,8 +810,8 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
public void SaveInfo(UserResultModel data)
|
||||
{
|
||||
var u = userInfos.Find(x => x.Id == data.Id);
|
||||
if (u == null)
|
||||
var index = userInfos.FindIndex(x => x.Id == data.Id);
|
||||
if (index == -1)
|
||||
{
|
||||
userInfos.Add(new QUserInfo
|
||||
{
|
||||
@@ -796,19 +820,27 @@ public class LoginController : MonoBehaviour
|
||||
Avatar = data.WxHeadImg,
|
||||
Cookie = data.cookie
|
||||
});
|
||||
index = userInfos.Count - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
userInfos.Insert(0, new QUserInfo
|
||||
{
|
||||
Id = data.Id,
|
||||
NickName = data.Nickname,
|
||||
Avatar = data.WxHeadImg,
|
||||
Cookie = data.cookie
|
||||
});
|
||||
userInfos.Remove(u);
|
||||
var u = userInfos[index];
|
||||
u.Id = data.Id;
|
||||
u.NickName = data.Nickname;
|
||||
u.Avatar = data.WxHeadImg;
|
||||
u.Cookie = data.cookie;
|
||||
//userInfos.Insert(0, new QUserInfo
|
||||
//{
|
||||
// Id = data.Id,
|
||||
// NickName = data.Nickname,
|
||||
// Avatar = data.WxHeadImg,
|
||||
// Cookie = data.cookie
|
||||
//});
|
||||
//userInfos.Remove(u);
|
||||
}
|
||||
UIManager.Instance.userInfos = userInfos;
|
||||
UIManager.Instance.userInfoIndex = index;
|
||||
//PlayerPrefs.SetInt("UserInfoIndex", index);
|
||||
}
|
||||
async void Submit()
|
||||
{
|
||||
@@ -844,6 +876,13 @@ public class LoginController : MonoBehaviour
|
||||
{
|
||||
loginForm.password.ActivateInputField();
|
||||
}
|
||||
if (Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Return))
|
||||
{
|
||||
if (loginForm != null && !string.IsNullOrEmpty(loginForm.email.text) && !string.IsNullOrEmpty(loginForm.password.text))
|
||||
{
|
||||
Submit();
|
||||
}
|
||||
}
|
||||
if (startCaptcha)
|
||||
{
|
||||
CaptchaTimerTick();
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PFUISlider : MonoBehaviour
|
||||
{
|
||||
private Text text;
|
||||
private Slider slider;
|
||||
private void Awake()
|
||||
{
|
||||
text = transform.Find("Text").GetComponent<Text>();
|
||||
slider = transform.GetComponent<Slider>();
|
||||
text.text = $"{(slider.value * 100).ToString("#0")}%";
|
||||
slider.onValueChanged.AddListener((f) =>
|
||||
{
|
||||
text.text = $"{(f * 100).ToString("#0")}%";
|
||||
});
|
||||
}
|
||||
// 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: e288f268809db2a4bbc2b31a9fe797e4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -11,9 +11,22 @@ namespace Assets.Scripts.UI.Control
|
||||
[RequireComponent(typeof(Text))]
|
||||
public class PFUIText : PFUIComponentBase
|
||||
{
|
||||
private Text text;
|
||||
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return text.text;
|
||||
}
|
||||
set
|
||||
{
|
||||
text.text = value;
|
||||
}
|
||||
}
|
||||
protected void Awake()
|
||||
{
|
||||
|
||||
text = this.transform.GetComponent<Text>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,8 @@ using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.Events;
|
||||
using DG.Tweening;
|
||||
|
||||
namespace Assets.Scripts.UI.Control
|
||||
{
|
||||
@@ -16,14 +18,18 @@ namespace Assets.Scripts.UI.Control
|
||||
{
|
||||
Normal,
|
||||
Border,
|
||||
Primary
|
||||
Primary,
|
||||
Image
|
||||
}
|
||||
|
||||
[SerializeField] Type mType;
|
||||
[SerializeField] string Tooltips;
|
||||
private GameObject tooltips;
|
||||
private Image image;
|
||||
public Text text;
|
||||
private Texture2D cursor;
|
||||
private Text text;
|
||||
//private Texture2D cursor;
|
||||
private Outline outline;
|
||||
private Button mButton;
|
||||
|
||||
protected void Awake()
|
||||
{
|
||||
@@ -35,19 +41,35 @@ namespace Assets.Scripts.UI.Control
|
||||
}
|
||||
|
||||
//设置光标
|
||||
cursor = Resources.Load<Texture2D>("Images/PointerButtonHover");
|
||||
//cursor = Resources.Load<Texture2D>("Images/PointerButtonHover");
|
||||
|
||||
image = gameObject.GetComponent<Image>();
|
||||
text = this.transform.Find("Text").GetComponent<Text>();
|
||||
|
||||
Material material = null;
|
||||
if (material == null)
|
||||
if(mType == Type.Image)
|
||||
{
|
||||
material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
text.gameObject.SetActive(false);
|
||||
}
|
||||
var rect = ((RectTransform)transform).rect;
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height*0.5f, 0));
|
||||
image.material = material;
|
||||
else
|
||||
{
|
||||
Material material = null;
|
||||
if (material == null)
|
||||
{
|
||||
material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
}
|
||||
var rect = ((RectTransform)transform).rect;
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height * 0.5f, 0));
|
||||
image.material = material;
|
||||
}
|
||||
|
||||
tooltips = this.transform.Find("Tooltips").gameObject;
|
||||
if (!string.IsNullOrWhiteSpace(Tooltips))
|
||||
{
|
||||
//
|
||||
tooltips.transform.Find("Text").GetComponent<Text>().text = Tooltips;
|
||||
}
|
||||
tooltips.SetActive(false);
|
||||
|
||||
mButton = this.GetComponent<Button>();
|
||||
|
||||
InitColor();
|
||||
BindEvent();
|
||||
@@ -87,8 +109,13 @@ namespace Assets.Scripts.UI.Control
|
||||
UIManager.AddEvent(this.gameObject, EventTriggerType.PointerEnter, new UnityEngine.Events.UnityAction<UnityEngine.EventSystems.BaseEventData>(e =>
|
||||
{
|
||||
if (!this.isActiveAndEnabled) return;
|
||||
Cursor.SetCursor(cursor, Vector2.zero, CursorMode.Auto);
|
||||
|
||||
//Cursor.SetCursor(cursor, Vector2.zero, CursorMode.Auto);
|
||||
if (!string.IsNullOrWhiteSpace(Tooltips))
|
||||
{
|
||||
tooltips.GetComponent<CanvasGroup>().alpha = 0f;
|
||||
tooltips.SetActive(true);
|
||||
tooltips.GetComponent<CanvasGroup>().DOFade(1f, 0.2f);
|
||||
}
|
||||
switch (mType)
|
||||
{
|
||||
case Type.Normal:
|
||||
@@ -112,10 +139,14 @@ namespace Assets.Scripts.UI.Control
|
||||
}));
|
||||
|
||||
//鼠标离开
|
||||
UIManager.AddEvent(this.gameObject, EventTriggerType.PointerExit, new UnityEngine.Events.UnityAction<UnityEngine.EventSystems.BaseEventData>(e =>
|
||||
UIManager.AddEvent(this.gameObject, EventTriggerType.PointerExit, new UnityAction<BaseEventData>(e =>
|
||||
{
|
||||
if (!this.isActiveAndEnabled) return;
|
||||
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
|
||||
if (!string.IsNullOrWhiteSpace(Tooltips))
|
||||
{
|
||||
tooltips.SetActive(false);
|
||||
}
|
||||
//Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
|
||||
switch (mType)
|
||||
{
|
||||
case Type.Normal:
|
||||
@@ -170,7 +201,7 @@ namespace Assets.Scripts.UI.Control
|
||||
UIManager.AddEvent(this.gameObject, EventTriggerType.PointerUp, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
|
||||
{
|
||||
if (!this.isActiveAndEnabled) return;
|
||||
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
|
||||
//Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
|
||||
|
||||
switch (mType)
|
||||
{
|
||||
@@ -200,6 +231,7 @@ namespace Assets.Scripts.UI.Control
|
||||
public void SetEnabled(bool value)
|
||||
{
|
||||
base.enabled = value;
|
||||
mButton.enabled = value;
|
||||
if (base.enabled)
|
||||
{
|
||||
InitColor();
|
||||
|
||||
@@ -42,7 +42,7 @@ public class Tips : MonoBehaviour
|
||||
this.GetComponent<Image>().material = material;
|
||||
|
||||
Name = this.transform.Find("Name").GetComponent<Text>();
|
||||
Count = this.transform.Find("Count").GetComponent<Text>();
|
||||
Count = this.transform.Find("CountWrap").Find("Count").GetComponent<Text>();
|
||||
Distance = this.transform.Find("Distance").GetComponent<Text>();
|
||||
TotalClimb = this.transform.Find("TotalClimb").GetComponent<Text>();
|
||||
|
||||
@@ -115,7 +115,6 @@ public class Tips : MonoBehaviour
|
||||
|
||||
m3DIcon.SetActive(_model.Enable3D);
|
||||
|
||||
|
||||
//altitudeGraph
|
||||
|
||||
Utils.DisplayImage(StartCoroutine, altitudeGraph, _model.AltitudeGraph);
|
||||
@@ -129,31 +128,52 @@ public class Tips : MonoBehaviour
|
||||
//{
|
||||
// position.y = position.z;
|
||||
//}
|
||||
this.transform.position = position;
|
||||
|
||||
var localPosition = this.transform.localPosition;
|
||||
if (localPosition.y + 150 > localPosition.z)
|
||||
{
|
||||
localPosition.y = localPosition.z -150;
|
||||
}
|
||||
if(localPosition.x * -1f > localPosition.z)
|
||||
{
|
||||
localPosition.x = localPosition.z * -1f;
|
||||
}
|
||||
else if(localPosition.x > localPosition.z *2)
|
||||
{
|
||||
localPosition.x = localPosition.z * 2;
|
||||
}
|
||||
this.transform.localPosition = localPosition;
|
||||
this.transform.localScale = new Vector2(2, 2);
|
||||
this.Move(position);
|
||||
|
||||
//tips.Show();
|
||||
this.gameObject.SetActive(true);
|
||||
|
||||
this.SetModel(model);
|
||||
}
|
||||
|
||||
public void Move(Vector3 position)
|
||||
{
|
||||
this.transform.position = position;
|
||||
|
||||
var localPosition = this.transform.localPosition;
|
||||
Debug.Log(localPosition.y);
|
||||
if(localPosition.y > 128)
|
||||
{
|
||||
localPosition.y = 128;
|
||||
}
|
||||
if(localPosition.x < -465)
|
||||
{
|
||||
localPosition.x = -465f;
|
||||
}
|
||||
if(localPosition.x > 1080)
|
||||
{
|
||||
localPosition.x = 1080;
|
||||
}
|
||||
//if (localPosition.y + 150 > localPosition.z)
|
||||
//{
|
||||
// localPosition.y = localPosition.z -150;
|
||||
//}
|
||||
//if(localPosition.x * -1f > localPosition.z)
|
||||
//{
|
||||
// localPosition.x = localPosition.z * -1f;
|
||||
//}
|
||||
//else if(localPosition.x > localPosition.z *2)
|
||||
//{
|
||||
// localPosition.x = localPosition.z * 2;
|
||||
//}
|
||||
this.transform.localPosition = localPosition;
|
||||
this.transform.localScale = new Vector2(2, 2);
|
||||
|
||||
Debug.Log($"{ this.transform.localPosition.y }, { this.transform.localPosition.y }");
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
this.gameObject.SetActive(false);
|
||||
//this.gameObject.SetActive(false);
|
||||
DestroyImmediate(this.gameObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using DG.Tweening;
|
||||
using Assets.Scripts.UI.Control;
|
||||
using System;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class Confirm : PFUIPanel
|
||||
{
|
||||
private PFUIText _title;
|
||||
private PFUIText _content;
|
||||
private PfUIButton _ok;
|
||||
private UnityAction _callback;
|
||||
private PfUIButton _cancel;
|
||||
protected override void Awake()
|
||||
{
|
||||
//var rect = this.gameObject.AddComponent<RectTransform>();
|
||||
//var layout = this.gameObject.AddComponent<VerticalLayoutGroup>();
|
||||
//layout.spacing = 20f;
|
||||
//layout.childAlignment = TextAnchor.MiddleCenter;
|
||||
|
||||
var wrap = this.transform.Find("GameObject");
|
||||
_title = wrap.Find("Title").GetComponent<PFUIText>();
|
||||
_content = wrap.Find("Content").GetComponent<PFUIText>();
|
||||
//text.transform.SetParent(layout.transform);
|
||||
//text.text = "阿斯达克法拉盛地方";
|
||||
///text = layout.transform.GetChild(0).gameObject.AddComponent<Text>();
|
||||
|
||||
//text = GetComponentInChildren<Transform>().gameObject.AddComponent<Text>();
|
||||
|
||||
_ok = wrap.Find("Ok").GetComponent<PfUIButton>();
|
||||
_cancel = wrap.Find("Cancel").GetComponent<PfUIButton>();
|
||||
//button.onClick.AddListener(() =>
|
||||
//{
|
||||
// this.Close();
|
||||
// //this.Destroy(true);
|
||||
// //DestroyImmediate(this);
|
||||
//});
|
||||
UIManager.AddEvent(_ok.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
if(_callback != null)
|
||||
{
|
||||
_callback();
|
||||
}
|
||||
});
|
||||
UIManager.AddEvent(_cancel.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
this.Close();
|
||||
});
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
protected override void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Set(string title, string content, UnityAction callback)
|
||||
{
|
||||
//if(text == null)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//text.text = txt;
|
||||
_title.Text = title;
|
||||
_content.Text = content;
|
||||
_callback = callback;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
var panel = this.transform.Find("Panel");
|
||||
var bg = panel.GetComponent<Image>();
|
||||
//bg.alphaHitTestMinimumThreshold
|
||||
|
||||
var color = bg.color;
|
||||
color.a = 0.6f;
|
||||
bg.color = color;
|
||||
base.Show();
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
var panel = this.transform.Find("Panel");
|
||||
var bg = panel.GetComponent<Image>();
|
||||
|
||||
bg.DOFade(0, 0.2f).OnComplete(() =>
|
||||
{
|
||||
this.gameObject.SetActive(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6618e32f03c775a4b9bf59d1da2a8d24
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -47,7 +47,9 @@ public class QuickLoginScroll : MonoBehaviour
|
||||
}
|
||||
//scroll.horizontalNormalizedPosition = 0;
|
||||
Canvas.ForceUpdateCanvases();
|
||||
scroll.horizontalNormalizedPosition = contentSize/2;
|
||||
var i = PlayerPrefs.GetInt("UserInfoIndex");
|
||||
Debug.Log($"51 {i}");
|
||||
scroll.horizontalNormalizedPosition = contentSize/2+i*contentSize;
|
||||
SetColor();
|
||||
}
|
||||
void goLeft()
|
||||
|
||||
@@ -84,6 +84,7 @@ public class QuickLoginUser : MonoBehaviour
|
||||
var userInfos = UIManager.Instance.userInfos;
|
||||
userInfos.RemoveAt(index);
|
||||
UIManager.Instance.userInfos = userInfos;
|
||||
UIManager.Instance.userInfoIndex = 0;
|
||||
}
|
||||
|
||||
public void setActive()
|
||||
|
||||
@@ -35,7 +35,9 @@ public class MainNav : MonoBehaviour
|
||||
|
||||
UIManager.AddEvent(exit, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
Application.Quit();
|
||||
UIManager.ShowConfirm("Quit", "Do you want to quit PowerFun?", ()=> {
|
||||
Application.Quit();
|
||||
});
|
||||
});
|
||||
|
||||
UIManager.AddEvent(transform.Find("Setting").gameObject, EventTriggerType.PointerClick, x =>
|
||||
|
||||
@@ -59,9 +59,8 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
|
||||
// //transform.localPosition.Set(transform.localPosition.x, localY.Value, transform.localPosition.z);
|
||||
// //transform.DOLocalMoveY(localY.Value, 0.5f);
|
||||
//});
|
||||
transform.GetComponent<Button>().onClick.AddListener(() =>
|
||||
transform.GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
Debug.Log(123);
|
||||
UIManager.ShowMapDetailPanel(myMap.Id);
|
||||
});
|
||||
transform.Find("Name").GetComponent<Text>().text = myMap.Name;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class NewsController : PFUIPanel
|
||||
@@ -13,7 +14,7 @@ public class NewsController : PFUIPanel
|
||||
exit = transform.Find("Main").Find("Exit");
|
||||
if (exit != null)
|
||||
{
|
||||
exit.GetComponent<Button>().onClick.AddListener(() =>
|
||||
UIManager.AddEvent(exit.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
Close();
|
||||
});
|
||||
|
||||
@@ -30,7 +30,23 @@ public class BigMapController : PFUIPanel
|
||||
UnityEngine.Object begin;
|
||||
Sprite end;
|
||||
private Dictionary<int, LineItem> linesCache = new Dictionary<int, LineItem>();
|
||||
Tips tips;
|
||||
UnityEngine.Object tipsObject;
|
||||
private Tips _tips;
|
||||
private Tips tips
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_tips == null)
|
||||
{
|
||||
_tips = ((GameObject)Instantiate(tipsObject, canvas.transform.Find("TipsContainer"))).GetComponent<Tips>();
|
||||
}
|
||||
return _tips;
|
||||
}
|
||||
set
|
||||
{
|
||||
_tips = value;
|
||||
}
|
||||
}
|
||||
int timer = 0;
|
||||
protected override void Awake()
|
||||
{
|
||||
@@ -76,8 +92,9 @@ public class BigMapController : PFUIPanel
|
||||
var searchBtn = input.Find("Search").gameObject;
|
||||
UIManager.AddEvent(searchBtn, EventTriggerType.PointerClick, Search);
|
||||
|
||||
tips = ((GameObject)Instantiate(Resources.Load("UI/Prefab/BigMap/Tips"), canvas.transform.Find("TipsContainer"))).GetComponent<Tips>();
|
||||
tips.Hide();
|
||||
tipsObject = Resources.Load("UI/Prefab/BigMap/Tips");
|
||||
//tips = ((GameObject)Instantiate(tipsObject, canvas.transform.Find("TipsContainer"))).GetComponent<Tips>();
|
||||
//tips.Hide();
|
||||
|
||||
BindHeadImage();
|
||||
}
|
||||
@@ -228,6 +245,7 @@ public class BigMapController : PFUIPanel
|
||||
if(item.Value.Selected)
|
||||
{
|
||||
tips.Hide();
|
||||
tips = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,11 +307,16 @@ public class BigMapController : PFUIPanel
|
||||
line.Item = iii;
|
||||
iii.onClick = () =>
|
||||
{
|
||||
if(tips != null)
|
||||
{
|
||||
tips.Hide();
|
||||
tips = null;
|
||||
}
|
||||
if (line.Selected)
|
||||
{
|
||||
line.Selected = false;
|
||||
tips.Hide();
|
||||
//iii.Selected(false);
|
||||
//tips.Hide();
|
||||
//tips = null;
|
||||
return;
|
||||
}
|
||||
line.Selected = true;
|
||||
@@ -360,7 +383,8 @@ public class BigMapController : PFUIPanel
|
||||
line.Selected = true;
|
||||
var position = line.BeginMarker.transform.position;
|
||||
//position.z += 25;
|
||||
tips.Show(position, line.Model);
|
||||
//tips.Show(position, line.Model);
|
||||
tips.Move(position);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
@@ -200,21 +200,20 @@ public class EditUserController : PFUIPanel
|
||||
mPhone.Text = currentUser.ContactPhone;
|
||||
mAddr.Text = currentUser.ContactAddress;
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
mConutryDropdown.ClearOptions();
|
||||
mConutryDropdown.AddOptions(UIManager.Instance.loginRegOptions.countrys);
|
||||
mConutryDropdown.SelectIndex(UIManager.Instance.loginRegOptions.countryDefaultValue);
|
||||
mConutryDropdown.transform.Find("RawImage").GetComponent<RawImage>().texture =
|
||||
UIManager.Instance.loginRegOptions.GetCountryImage(UIManager.Instance.loginRegOptions.countryDefaultValue);
|
||||
mConutryDropdown.OnValueChange = (int index) =>
|
||||
{
|
||||
mConutryDropdown.transform.Find("RawImage").GetComponent<RawImage>().texture =
|
||||
UIManager.Instance.loginRegOptions.GetCountryImage(index);
|
||||
};
|
||||
mConutryDropdown.SelectValue(App.CurrentUser.Country);
|
||||
//mConutryDropdown.transform.Find("RawImage").GetComponent<RawImage>().texture =
|
||||
// UIManager.Instance.loginRegOptions.GetCountryImage(UIManager.Instance.loginRegOptions.countryDefaultValue);
|
||||
var rect = ((RectTransform)mHeadImage.transform).rect;
|
||||
SetRounded(mHeadImage.transform, rect.height);
|
||||
UIManager.AddEvent(mSaveButton.gameObject, EventTriggerType.PointerClick, Save);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Assets.Scripts.UI.Control;
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using System.Collections;
|
||||
@@ -57,10 +58,11 @@ public class HomeController : PFUIPanel
|
||||
{
|
||||
UIManager.ShowUserInfoPanel();
|
||||
});
|
||||
|
||||
userInfo.Find("BtnMore").GetComponent<PfUIButton>().SetEnabled(false);
|
||||
UIManager.AddEvent(userInfo.Find("BtnMore").gameObject, EventTriggerType.PointerClick, x =>
|
||||
{
|
||||
UIManager.ShowAlert("test");
|
||||
//UIManager.ShowConfirm("Quit", "Do you want to quit PowerFun?", null);
|
||||
});
|
||||
GetSummary();
|
||||
}
|
||||
@@ -156,7 +158,6 @@ public class HomeController : PFUIPanel
|
||||
cg.alpha = 0;
|
||||
base.Show();
|
||||
|
||||
cg.DOFade(1f, 0.3f);
|
||||
|
||||
cg.DOFade(1f, 0.3f);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
@@ -46,7 +47,7 @@ public class MapListController : PFUIPanel
|
||||
//{
|
||||
// hardSelector.onValueChanged.AddListener(ChangeHard);
|
||||
//}
|
||||
ApiBase.SetCookie("15A37DF28842CBA8E4E550BFA24186C8222D392F3EE18D9E95A49CC32796D2E3F6E40385C6A114942546EE1DD793DF34880DE48090B91AD2460EB887B59664BB3965F3371DDA1F1401EC7F27C5A1084566E47069F12CB6BBC0BC7A84ADC5582B");
|
||||
//ApiBase.SetCookie("15A37DF28842CBA8E4E550BFA24186C8222D392F3EE18D9E95A49CC32796D2E3F6E40385C6A114942546EE1DD793DF34880DE48090B91AD2460EB887B59664BB3965F3371DDA1F1401EC7F27C5A1084566E47069F12CB6BBC0BC7A84ADC5582B");
|
||||
btnMapMode = this.transform.Find("SwitchMode").gameObject;
|
||||
SetRounded(btnMapMode.transform, 64);
|
||||
UIManager.AddEvent(btnMapMode, EventTriggerType.PointerClick, (e) =>
|
||||
@@ -104,6 +105,10 @@ public class MapListController : PFUIPanel
|
||||
GetList();
|
||||
if (scroll != null)
|
||||
{
|
||||
//scroll.GetComponent<ScrollRect>().onValueChanged.AddListener((v) =>
|
||||
//{
|
||||
// OnEndDrag(null);
|
||||
//});
|
||||
UIManager.AddEvent(scroll, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag);
|
||||
}
|
||||
//UIManager.AddEvent(transform.Find("Panel").Find("Panel"))
|
||||
@@ -146,10 +151,14 @@ public class MapListController : PFUIPanel
|
||||
searchInput = transform.Find("Panel").Find("Panel").Find("SearchInput");
|
||||
if (searchInput != null)
|
||||
{
|
||||
searchInput.GetComponent<InputField>().onEndEdit.AddListener((s) =>
|
||||
{
|
||||
Debug.Log(Input.GetKeyUp(KeyCode.A));
|
||||
//onEndEdit(s);
|
||||
});
|
||||
searchInput.Find("Button").GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
ftname = searchInput.GetComponent<InputField>().text;
|
||||
Refresh();
|
||||
onEndEdit();
|
||||
});
|
||||
}
|
||||
sorts = transform.Find("Panel").Find("Panel").Find("FilterOptions");
|
||||
@@ -187,7 +196,15 @@ public class MapListController : PFUIPanel
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void onEndEdit()
|
||||
{
|
||||
var t = searchInput.GetComponent<InputField>().text;
|
||||
if (!string.IsNullOrEmpty(t))
|
||||
{
|
||||
ftname = t;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 绑定头像
|
||||
/// </summary>
|
||||
@@ -213,13 +230,13 @@ public class MapListController : PFUIPanel
|
||||
private void OnEndDrag(BaseEventData arg0)
|
||||
{
|
||||
var scrollrect = scroll.GetComponent<ScrollRect>();
|
||||
Debug.Log(scrollrect.verticalNormalizedPosition);
|
||||
if (scrollrect.verticalNormalizedPosition <= 0)
|
||||
{
|
||||
Debug.Log(scrollrect.verticalNormalizedPosition);
|
||||
pageIndex++;
|
||||
GetList();
|
||||
}
|
||||
if (scrollrect.verticalNormalizedPosition >= 1)
|
||||
if (scrollrect.verticalNormalizedPosition >= (pageIndex == 0 ? 1.2:1))
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
@@ -281,6 +298,7 @@ public class MapListController : PFUIPanel
|
||||
{
|
||||
content.transform.DestroyChildren();
|
||||
pageIndex = 0;
|
||||
isEnd = false;
|
||||
GetList();
|
||||
}
|
||||
void ResetList()
|
||||
@@ -291,9 +309,29 @@ public class MapListController : PFUIPanel
|
||||
Refresh();
|
||||
}
|
||||
// Update is called once per frame
|
||||
bool startMouse = false;
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (Input.GetAxis("Mouse ScrollWheel") != 0)
|
||||
{
|
||||
if (scroll.GetComponent<ScrollRect>().verticalNormalizedPosition <= 0 ||
|
||||
scroll.GetComponent<ScrollRect>().verticalNormalizedPosition >= (pageIndex == 0 ? 1.2 : 1))
|
||||
{
|
||||
startMouse = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (startMouse)
|
||||
{
|
||||
startMouse = false;
|
||||
OnEndDrag(null);
|
||||
}
|
||||
}
|
||||
if (Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Return))
|
||||
{
|
||||
onEndEdit();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
|
||||
@@ -11,9 +11,8 @@ public class UserInfoController : PFUIPanel
|
||||
// Start is called before the first frame update
|
||||
UserApi userApi;
|
||||
Transform infoPanel,summaryPanel;
|
||||
protected override void Start()
|
||||
protected override void Awake()
|
||||
{
|
||||
userApi = ConfigHelper.userApi;
|
||||
this.transform.localPosition = new Vector3(0, 0, 0);
|
||||
|
||||
Button exitBtn = this.transform.Find("InfoPanel").Find("Button").GetComponent<Button>();
|
||||
@@ -42,16 +41,20 @@ public class UserInfoController : PFUIPanel
|
||||
// UIManager.ShowEditUserPanel();
|
||||
//});
|
||||
summaryPanel = transform.Find("SummaryPanel");
|
||||
}
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
Load();
|
||||
}
|
||||
async void Load()
|
||||
void Load()
|
||||
{
|
||||
//if (!App.FromLogin)
|
||||
//{
|
||||
// var result = await userApi.Login("15651831367", "123456", "");
|
||||
// App.CurrentUser = result.data;
|
||||
//}
|
||||
var r = userApi.GetSummary();
|
||||
var r = ConfigHelper.userApi.GetSummary();
|
||||
if (r.result)
|
||||
{
|
||||
var summary = r.data;
|
||||
|
||||
@@ -4,11 +4,26 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
using Assets.Scripts;
|
||||
using System;
|
||||
|
||||
public class Settings
|
||||
{
|
||||
public int AutoPause { set; get; }
|
||||
public float Sensitivity { set; get; }
|
||||
public int IMode { set; get; }
|
||||
public int Unit { set; get; }
|
||||
public float Volume { set; get; }
|
||||
public int WMode { set; get; }
|
||||
public int Language { set; get; }
|
||||
}
|
||||
public class SettingContoller : PFUIPanel
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
Transform exit;
|
||||
Button[] AutoPause, IMode, Unit, WMode, Language;
|
||||
Slider Sensitivity, Volume;
|
||||
Settings settings;
|
||||
protected override void Awake()
|
||||
{
|
||||
exit = transform.Find("Main").Find("Exit");
|
||||
@@ -20,27 +35,111 @@ public class SettingContoller : PFUIPanel
|
||||
//});
|
||||
UIManager.AddEvent(exit.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
UIManager.Instance.settings = settings;
|
||||
Close();
|
||||
});
|
||||
}
|
||||
var inner = transform.Find("Main").Find("Inner");
|
||||
AutoPause = new Button[]
|
||||
{
|
||||
inner.Find("AutoPause").Find("BtnOpen").GetComponent<Button>(),
|
||||
inner.Find("AutoPause").Find("BtnClose").GetComponent<Button>()
|
||||
};
|
||||
IMode = new Button[]
|
||||
{
|
||||
inner.Find("IMode").Find("BtnSimple").GetComponent<Button>(),
|
||||
inner.Find("IMode").Find("BtnFull").GetComponent<Button>()
|
||||
};
|
||||
Unit = new Button[]
|
||||
{
|
||||
inner.Find("Unit").Find("BtnMetric").GetComponent<Button>(),
|
||||
inner.Find("Unit").Find("BtnImperial").GetComponent<Button>()
|
||||
};
|
||||
WMode = new Button[]
|
||||
{
|
||||
inner.Find("WMode").Find("BtnWindow").GetComponent<Button>(),
|
||||
inner.Find("WMode").Find("BtnFull").GetComponent<Button>()
|
||||
};
|
||||
Language = new Button[]
|
||||
{
|
||||
inner.Find("Language").Find("BtnChinese").GetComponent<Button>(),
|
||||
inner.Find("Language").Find("BtnEnglish").GetComponent<Button>()
|
||||
};
|
||||
Sensitivity = inner.Find("Sensitivity").Find("Slider").GetComponent<Slider>();
|
||||
Volume = inner.Find("Volume").Find("Slider").GetComponent<Slider>();
|
||||
AddClick();
|
||||
LoadSettings();
|
||||
}
|
||||
|
||||
private void AddClick()
|
||||
{
|
||||
AddClick(WMode);
|
||||
AddClick(Unit);
|
||||
AddClick(IMode);
|
||||
AddClick(AutoPause);
|
||||
AddClick(Language);
|
||||
Sensitivity.onValueChanged.AddListener((f) => { settings.Sensitivity = f; });
|
||||
Volume.onValueChanged.AddListener((f) => { settings.Volume = f; });
|
||||
}
|
||||
|
||||
private void LoadSettings()
|
||||
{
|
||||
settings = UIManager.Instance.settings;
|
||||
SetValue(WMode, settings.WMode,"WMode");
|
||||
SetValue(Unit, settings.Unit, "Unit");
|
||||
SetValue(IMode, settings.IMode, "IMode");
|
||||
SetValue(AutoPause, settings.AutoPause, "AutoPause");
|
||||
SetValue(Language, settings.Language, "Language");
|
||||
Sensitivity.value = settings.Sensitivity;
|
||||
Volume.value = settings.Volume;
|
||||
}
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
void AddClick(Button[] buttons)
|
||||
{
|
||||
for (int i = 0; i < buttons.Length; i++)
|
||||
{
|
||||
int index = i;
|
||||
UIManager.AddEvent(buttons[i].gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
SetValue(buttons, index,buttons[index].transform.parent.name);
|
||||
});
|
||||
}
|
||||
}
|
||||
void SetValue(Button[] buttons, int value,string valueName)
|
||||
{
|
||||
for (int i = 0; i < buttons.Length; i++)
|
||||
{
|
||||
var b = buttons[i];
|
||||
if (i == value)
|
||||
{
|
||||
b.GetComponent<Image>().color = Utils.HexToColorHtml("#F93086");
|
||||
b.transform.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#FFFFFF");
|
||||
settings.GetType().GetProperty(valueName).SetValue(UIManager.Instance.settings,i);
|
||||
}
|
||||
else
|
||||
{
|
||||
b.GetComponent<Image>().color = Utils.HexToColorHtml("#414251");
|
||||
b.transform.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#9e9ead");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
var cg = this.GetComponent<CanvasGroup>();
|
||||
cg.alpha = 0;
|
||||
base.Show();
|
||||
|
||||
cg.DOFade(1f, 0.3f);
|
||||
}
|
||||
}
|
||||
+75
-10
@@ -6,6 +6,8 @@ using UnityEngine.EventSystems;
|
||||
using DG.Tweening;
|
||||
using Assets.Scripts.UI.Prefab.Login;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine.UI;
|
||||
using Assets.Scripts.UI.Control;
|
||||
|
||||
public class UIManager : MonoBehaviour
|
||||
{
|
||||
@@ -126,6 +128,12 @@ public class UIManager : MonoBehaviour
|
||||
var userInfosJson = PlayerPrefs.GetString("UserInfos");
|
||||
userInfos = JsonConvert.DeserializeObject<List<QUserInfo>>(userInfosJson);
|
||||
if (userInfos == null) userInfos = new List<QUserInfo>();
|
||||
|
||||
var settingsJson = PlayerPrefs.GetString("Settings");
|
||||
settings = JsonConvert.DeserializeObject<Settings>(settingsJson);
|
||||
if (settings == null) settings = new Settings();
|
||||
|
||||
userInfoIndex = PlayerPrefs.GetInt("UserInfoIndex");
|
||||
collectDict = new Dictionary<bool, Sprite> {
|
||||
{ false,Resources.Load<Sprite>("Images/p-4灰")},
|
||||
{ true,Resources.Load<Sprite>("Images/p-4")},
|
||||
@@ -353,27 +361,38 @@ public class UIManager : MonoBehaviour
|
||||
}
|
||||
EventTrigger.Entry pointerEvent = new EventTrigger.Entry();
|
||||
pointerEvent.eventID = eventTriggerType;
|
||||
pointerEvent.callback.AddListener(call);
|
||||
pointerEvent.callback.AddListener((e)=> {
|
||||
if (gameObject.activeInHierarchy == false) return;
|
||||
var btn = gameObject.GetComponent<Button>();
|
||||
if(btn != null && btn.enabled == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
call(e);
|
||||
});
|
||||
et.triggers.Add(pointerEvent);
|
||||
|
||||
if(eventTriggerType == EventTriggerType.PointerClick)
|
||||
|
||||
if (eventTriggerType == EventTriggerType.PointerClick)
|
||||
{
|
||||
//设置光标
|
||||
if (cursor == null)
|
||||
{
|
||||
cursor = Resources.Load<Texture2D>("Images/PointerButtonHover");
|
||||
}
|
||||
UIManager.AddEvent(gameObject, EventTriggerType.PointerEnter, (e)=>{
|
||||
if (!gameObject.activeInHierarchy) return;
|
||||
UIManager.AddEvent(gameObject, EventTriggerType.PointerEnter, (e) =>
|
||||
{
|
||||
//if (!gameObject.activeInHierarchy) return;
|
||||
Cursor.SetCursor(cursor, Vector2.zero, CursorMode.Auto);
|
||||
});
|
||||
UIManager.AddEvent(gameObject, EventTriggerType.PointerUp, (e) => {
|
||||
if (!gameObject.activeInHierarchy) return;
|
||||
UIManager.AddEvent(gameObject, EventTriggerType.PointerUp, (e) =>
|
||||
{
|
||||
//if (!gameObject.activeInHierarchy) return;
|
||||
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
|
||||
});
|
||||
UIManager.AddEvent(gameObject, EventTriggerType.PointerExit, (e) => {
|
||||
if (!gameObject.activeInHierarchy) return;
|
||||
|
||||
UIManager.AddEvent(gameObject, EventTriggerType.PointerExit, (e) =>
|
||||
{
|
||||
//if (!gameObject.activeInHierarchy) return;
|
||||
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
|
||||
});
|
||||
}
|
||||
@@ -422,6 +441,26 @@ public class UIManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
Confirm confirm = null;
|
||||
public static void ShowConfirm(string title, string content, UnityAction action)
|
||||
{
|
||||
if (UIManager.Instance == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(UIManager.Instance.confirm == null)
|
||||
{
|
||||
UIManager.Instance.confirm = UIManager.Instance.GetInstance<Confirm>("Confirm", ref UIManager.Instance.confirm);
|
||||
UIManager.Show(UIManager.Instance.confirm, null, true);
|
||||
UIManager.Instance.confirm.Set(title, content, action);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.Instance.confirm.Show();
|
||||
UIManager.Instance.confirm.Set(title, content, action);
|
||||
}
|
||||
}
|
||||
|
||||
public LoginRegOptions loginRegOptions { get; private set; }
|
||||
private List<QUserInfo> _userInfos;
|
||||
public List<QUserInfo> userInfos
|
||||
@@ -437,6 +476,32 @@ public class UIManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
public Dictionary<bool, Sprite> collectDict { get; private set; }
|
||||
private int _userInfoIndex;
|
||||
public int userInfoIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _userInfoIndex;
|
||||
}
|
||||
set
|
||||
{
|
||||
_userInfoIndex = value;
|
||||
PlayerPrefs.SetInt("UserInfoIndex", value);
|
||||
}
|
||||
}
|
||||
private Settings _settings;
|
||||
public Settings settings
|
||||
{
|
||||
get
|
||||
{
|
||||
return _settings;
|
||||
}
|
||||
set
|
||||
{
|
||||
_settings = value;
|
||||
PlayerPrefs.SetString("Settings", JsonConvert.SerializeObject(value));
|
||||
}
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
UIManager.Instance = null;
|
||||
|
||||
@@ -168,5 +168,6 @@ namespace Assets.Scripts
|
||||
str = String.Concat(str, random.Next(10).ToString());
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user