Merge remote-tracking branch 'origin/dev_mobile' into dev_mobile_ble

# Conflicts:
#	Assets/Scripts/App.cs
#	Assets/Scripts/Mobile/WeChatController.cs
This commit is contained in:
lishuo committed 2021-09-02 10:10:06 +08:00
commit c280408192
92 files changed
+27853 -6958

No files matched your search

+14 -2
View File
@@ -44,7 +44,7 @@ namespace Assets.Scripts.Apis
httpClient = new System.Net.Http.HttpClient(httpClientHandler);
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
HandleHeaders(httpClient.DefaultRequestHeaders);
}
protected async Task<bool> GetAsFileSync(string url, string fileName)
@@ -97,12 +97,24 @@ namespace Assets.Scripts.Apis
var client = new HttpClient(httpClientHandler);
client.DefaultRequestHeaders.Add("Language", "en");
client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
HandleHeaders(client.DefaultRequestHeaders);
var result = await client.GetByteArrayAsync(_url).ConfigureAwait(false);
return result;
}
private static void HandleHeaders(HttpRequestHeaders defaultRequestHeaders)
{
#if UNITY_ANDROID
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
#elif UNITY_IOS
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("UnityiOS", ConfigHelper.AppVersion));
#else
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
#endif
}
protected async Task<byte[]> GetUrlAsync(string url)
{
var httpResponseMessage = await httpClient.GetAsync(url, HttpCompletionOption.ResponseContentRead).ConfigureAwait(false);
+3 -1
View File
@@ -22,7 +22,7 @@ public static class App
public static string WxAppId => "wx9e8ca734e024f084";
#else
//移动版微信id
public static string WxAppId => "wx9146e6697a6aef2d";
public static string WxAppId => "wxe3573a84e7e29902";
#endif
public static string MapBoxAccessToken => "pk.eyJ1IjoiYW5keXNqdCIsImEiOiJja2ZhajE5OGwwamRiMnltcW96bHk0ZWFuIn0.GvKanc6UveWSvIjS9HfBPA";
@@ -73,6 +73,8 @@ public static class App
}
public static string CurrentScene { get; set; }//当前场景
public static float? topRectStartX { get; internal set; }
public static WeChatController weChatController = new WeChatController();
public static Vector2 MobileResolution = new Vector2(844f, 390f);//移动端分辨率
@@ -7,6 +7,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using UnityEngine;
+15 -3
View File
@@ -11,6 +11,9 @@ public class LoginControllerMobile : MonoBehaviour
// Start is called before the first frame update
ScrollRect loginScrollView;
Transform thirdLoginPage;
public WeChatController weChat { get; private set; }
void Awake()
{
loginScrollView = transform.Find("Panel/LoginContainer/LoginScrollView").GetComponent<ScrollRect>();
@@ -26,8 +29,19 @@ public class LoginControllerMobile : MonoBehaviour
(b) => goWxLogin());
}
private void Start()
{
transform.Find("MobileInfo/BatteryText").GetComponent<Text>().text =
$"{Math.Round(SystemInfo.batteryLevel * 100, 0)}%";
transform.Find("MobileInfo/TimeText").GetComponent<Text>().text =
DateTime.Now.ToString("HH:mm");
weChat = App.weChatController;
weChat.Init(App.WxAppId);
//App.weChatController.Init(App.WxAppId);
//var s = App.weChatController.isApplicationAvilible("com.gugoumainapp","powerfun").ToString();
//Utils.showToast(null, SystemInfo.batteryLevel.ToString());
}
// Update is called once per frame
void Update()
{
@@ -44,8 +58,6 @@ public class LoginControllerMobile : MonoBehaviour
private void goWxLogin()
{
#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS)
var weChat = App.weChatController;
weChat.Init(App.WxAppId);
if (weChat.IsWeChatAppInstalled())
{
weChat.WxLogin("snsapi_userinfo", "");
+27 -11
View File
@@ -22,6 +22,8 @@ public class WeChatController
[DllImport("__Internal")]
private static extern void WechatLogin(string scope,string state);
[DllImport("__Internal")]
private static extern bool checkAPPIsExist(string URLScheme);
#endif
#endregion
/// <summary>
@@ -52,13 +54,12 @@ public class WeChatController
public void Init(string APPID)
{
_APP_ID = APPID;
#if !UNITY_EDITOR && UNITY_ANDROID
#if UNITY_ANDROID
mainActivityClass = new AndroidJavaClass(_className);
// 第一个参数: MainActivity中的方法名
// 第二、三个参数: 分别是SendMessageToUnity需要接收的第一和第二个参数,对比上面Java的代码
mainActivityClass.CallStatic("InitWeChat", Application.identifier, _APP_ID);
#endif
#if !UNITY_EDITOR && UNITY_IOS
#elif UNITY_IOS
RegisterApp(_APP_ID);
#endif
}
@@ -74,17 +75,32 @@ public class WeChatController
#elif UNITY_IOS
return IsWechatInstalled_iOS();
#else
return false;
return false;
#endif
}
/// <summary>
/// 分享链接至微信,缩略图用的是APP Icon
/// </summary>
/// <param name="scene">分享至什么场景, 0-对话、1-朋友圈、2-收藏</param>
/// <param name="url">网页链接</param>
/// <param name="title">标题</param>
/// <param name="description">描述</param>
/// 判断应用是否存在
/// </summary>
/// <param name="pkgName"></param>
/// <returns></returns>
public bool isApplicationAvilible(string pkgName,string URLScheme)
{
#if UNITY_ANDROID
return mainActivityClass.CallStatic<bool>("isApplicationAvilible",pkgName);
#elif UNITY_IOS
return checkAPPIsExist(URLScheme);
#else
return false;
#endif
}
/// <summary>
/// 分享链接至微信,缩略图用的是APP Icon
/// </summary>
/// <param name="scene">分享至什么场景, 0-对话、1-朋友圈、2-收藏</param>
/// <param name="url">网页链接</param>
/// <param name="title">标题</param>
/// <param name="description">描述</param>
public void ShareWebpageToWX(int scene, string url, string title, string description)
{
mainActivityClass.CallStatic("ShareWebpageToWX", scene, url, title, description);
@@ -173,4 +189,4 @@ public class WeChatController
var imageData = texture.EncodeToPNG();
return imageData;
}
}
}
+6 -3
View File
@@ -486,14 +486,16 @@ public class LoginController : MonoBehaviour
}
async void Init()
{
UIManager.Instance.ModalsPanel = this.transform.Find("ModalPanel").GetComponent<PFUIPanel>();
userInfos = UIManager.Instance.userInfos;
App.DefaultRotateTexture = Utils.ReadTextureFromPlayerPrefs("rotateImage");
App.firstEnter = PlayerPrefs.GetInt("firstEnter");
PlayerPrefs.SetInt("firstEnter", 1);
var notifyId = PlayerPrefs.GetInt("notifyId");
//Task.Run(async () =>
//{
//});
var r = await ConfigHelper.userApi.GetNotify();
if (r.result)
{
@@ -508,13 +510,14 @@ public class LoginController : MonoBehaviour
//#endif
App.notifyContent = r.data.Value<string>("Content");
if (r.data.Value<int>("Id") != notifyId)
if (r.data.Value<int>("Id") != notifyId)//r.data.Value<int>("Id") != notifyId
{
UIManager.ShowNewsModal();
PlayerPrefs.SetInt("notifyId", r.data.Value<int>("Id"));
}
}
GetRotateImage();
}
async void GetRotateImage()
+17 -3
View File
@@ -3,6 +3,7 @@ using Assets.Scripts.Devices.Ant;
using Assets.Scripts.Scenes;
using Assets.Scripts.UI.Prefab.Device;
using Mapbox.Examples;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
@@ -23,11 +24,20 @@ public class MainController : BaseScene
Loom.Initialize();
#if UNITY_ANDROID || UNITY_IOS
transform.GetComponent<CanvasScaler>().referenceResolution = new Vector2(844, 390);
transform.Find("Panel").GetComponent<RectTransform>().sizeDelta = new Vector2(844, 390);
//transform.Find("Panel").GetComponent<RectTransform>().sizeDelta = new Vector2(844, 390);
var rectTransform = transform.Find("Panel").GetComponent<RectTransform>();
rectTransform.anchorMin = Vector2.zero;
rectTransform.anchorMax = Vector2.one;
rectTransform.offsetMin = Vector2.zero;
rectTransform.offsetMax = Vector2.zero;
//var rect1 = transform.Find("GameObject").GetComponent<RectTransform>();
//rect1.anchorMin = Vector2.zero;
//rect1.anchorMax = Vector2.one;
//rect1.offsetMin = Vector2.zero;
//rect1.offsetMax = Vector2.zero;
//transform.Find("ModalPanel").GetComponent<RectTransform>().sizeDelta = new Vector2(844, 390);
#else
App.MainDeviceAdapter.StartScan();
#endif
App.MainDeviceAdapter.StartScan();
}
// Start is called before the first frame update
@@ -36,6 +46,10 @@ public class MainController : BaseScene
UIManager.Instance.Root = root;
UIManager.Instance.MainPanel = this.transform.Find("Panel").GetComponent<PFUIPanel>();
UIManager.Instance.ModalsPanel = this.transform.Find("ModalPanel").GetComponent<PFUIPanel>();
transform.Find("MobileInfo/BatteryText").GetComponent<Text>().text =
$"{Math.Round(SystemInfo.batteryLevel * 100, 0)}%";
transform.Find("MobileInfo/TimeText").GetComponent<Text>().text =
DateTime.Now.ToString("HH:mm");
#if UNITY_EDITOR
if (App.CurrentUser == null) //App.CurrentUser == null
{
@@ -7,6 +7,7 @@ using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using DG.Tweening;
namespace Assets.Scripts.UI.Control
{
@@ -96,6 +97,10 @@ namespace Assets.Scripts.UI.Control
public void SetValidate()
{
outline.enabled = true;
outline.DOFade(1, 1f).onComplete = () =>
{
outline.DOFade(0, 1f);
};
}
//public void SetValidate(string s)
//{
+6 -2
View File
@@ -7,7 +7,7 @@ using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using DG.Tweening;
namespace Assets.Scripts.UI.Control
{
public class PFUIInputField: PFUIComponentBase
@@ -81,7 +81,7 @@ namespace Assets.Scripts.UI.Control
material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
}
var rect = ((RectTransform)transform).rect;
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, Math.Min(rect.height*0.7f, 50f), 0));
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, Math.Min(rect.height*0.35f, 50f), 0));
gameObject.GetComponent<Image>().material = material;
outline = this.GetComponent<Outline>();
@@ -123,6 +123,10 @@ namespace Assets.Scripts.UI.Control
if (value)
{
outline.enabled = true;
outline.DOFade(1, 1f).onComplete = () =>
{
outline.DOFade(0, 1f);
};
outline.effectColor = Utils.HexToColorHtml("#F93086");
ColorUtility.TryParseHtmlString("#F93086", out Color color);
//this.mInnerInputField.transform.Find("Text").GetComponent<Text>().color = color;
+2
View File
@@ -110,12 +110,14 @@ namespace Assets.Scripts.UI.Control
{
if (!this.isActiveAndEnabled) return;
//Cursor.SetCursor(cursor, Vector2.zero, CursorMode.Auto);
#if !(UNITY_ANDROID || UNITY_IOS)
if (!string.IsNullOrWhiteSpace(Tooltips))
{
tooltips.GetComponent<CanvasGroup>().alpha = 0f;
tooltips.SetActive(true);
tooltips.GetComponent<CanvasGroup>().DOFade(1f, 0.2f);
}
#endif
switch (mType)
{
case Type.Normal:
@@ -14,9 +14,27 @@ public class QuickLoginScroll : MonoBehaviour
private float contentSize;
private int count;
[SerializeField] Button L, R;
float startPos, endPos;
void Start()
{
scroll = gameObject.GetComponent<ScrollRect>();
UIManager.AddEvent(scroll.gameObject, UnityEngine.EventSystems.EventTriggerType.BeginDrag, b =>
{
startPos = scroll.horizontalNormalizedPosition;
Debug.Log(startPos);
});
UIManager.AddEvent(scroll.gameObject, UnityEngine.EventSystems.EventTriggerType.EndDrag, b =>
{
endPos = scroll.horizontalNormalizedPosition;
if (startPos > endPos)
{
goLeft();
}
else if (startPos < endPos)
{
goRight();
}
});
//scroll.onValueChanged.AddListener((a) =>
//{
// Debug.Log(a);
@@ -28,6 +46,7 @@ public class QuickLoginScroll : MonoBehaviour
{
UIManager.AddEvent(L.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick,(b)=>
{
startPos = scroll.horizontalNormalizedPosition;
goLeft();
});
//L.onClick.AddListener(goLeft);
@@ -36,6 +55,7 @@ public class QuickLoginScroll : MonoBehaviour
{
UIManager.AddEvent(R.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
{
startPos = scroll.horizontalNormalizedPosition;
goRight();
});
//R.onClick.AddListener(goRight);
@@ -67,6 +87,7 @@ public class QuickLoginScroll : MonoBehaviour
if (content.childCount - 3 > 0)
{
contentSize = 1f / (content.childCount - 3);
Debug.Log(contentSize);
}
else
{
@@ -82,32 +103,39 @@ public class QuickLoginScroll : MonoBehaviour
scroll.horizontalNormalizedPosition = contentSize/2+i*contentSize;
#else
scroll.horizontalNormalizedPosition = i * contentSize;
Debug.Log(scroll.horizontalNormalizedPosition);
#endif
SetColor();
}
void goLeft()
{
Debug.Log($"{scroll.horizontalNormalizedPosition},{contentSize}");
if (scroll.horizontalNormalizedPosition+0.0001 <= contentSize) return;
if (scroll.horizontalNormalizedPosition <= 0 + 0.0001) return;
goMove(-1);
}
void goRight()
{
Debug.Log(scroll.horizontalNormalizedPosition);
if (scroll.horizontalNormalizedPosition+0.0001 >= 1) return;
goMove();
}
void goMove(int i = 1)
{
doAni();
//#if !(UNITY_ANDROID || UNITY_IOS)
// if (!start) startPosition = scroll.horizontalNormalizedPosition;
//#else
// int ind = GetIndex(startPos);
// if (!start) startPosition = ind*contentSize;
//#endif
if (!start) startPosition = scroll.horizontalNormalizedPosition;
start = true;
scrollValue = i*contentSize / 10;
#if !(UNITY_ANDROID || UNITY_IOS)
scrollValue = i * contentSize / 10;
#else
scrollValue = ((GetIndex(startPos) + i) * contentSize - startPos) / 10;
#endif
}
private bool start = false;
private float scrollValue = 0, totalScrollValue = 0, startPosition = 0;
int GetIndex()
int GetIndex(float? startPos = null)
{
#if !(UNITY_ANDROID || UNITY_IOS)
return (int)System.Math.Round(
@@ -118,9 +146,8 @@ public class QuickLoginScroll : MonoBehaviour
{
return 1;
}
return (int)System.Math.Round(
(scroll.horizontalNormalizedPosition+ contentSize) / contentSize,
0);
return (int)System.Math.Round
((startPos ?? scroll.horizontalNormalizedPosition + contentSize) / contentSize, 0);
#endif
}
void SetColor()
@@ -156,7 +183,11 @@ public class QuickLoginScroll : MonoBehaviour
{
scrollValue = 0;
start = false;
#if !(UNITY_ANDROID || UNITY_IOS)
scroll.horizontalNormalizedPosition = startPosition + (totalScrollValue<0?-1:1)*contentSize;
#else
scroll.horizontalNormalizedPosition = (GetIndex(startPos) + (totalScrollValue < 0 ? -1 : 1)) * contentSize;
#endif
//Debug.Log();
SetColor();
totalScrollValue = 0;
@@ -23,10 +23,14 @@ public class QuickLoginUser : MonoBehaviour
{
if (user == null) return;
this.top = top;
#if !(UNITY_ANDROID || UNITY_IOS)
UIManager.AddEvent(gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
{
goMain();
});
#else
gameObject.GetComponent<Button>().onClick.AddListener(() => { goMain(); });
#endif
//transform.GetComponent<Button>().onClick.AddListener();
this.user = user;
Utils.DisplayHead(transform.Find("Avatar").GetComponent<RawImage>(), user.Avatar);
+20 -13
View File
@@ -110,9 +110,11 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
tabContainer.Find("3d").gameObject.SetActive(myMap.Enable3D);
tabContainer.Find("Country").GetComponent<RawImage>().texture = UIManager.Instance.loginRegOptions.GetCountryImage(myMap.CountryCode);
transform.Find("CollectImg").GetComponent<Button>().onClick.AddListener(Collect);
transform.Find("CollectImg").gameObject.SetActive(false);
transform.Find("CollectImg").Find("Image").GetComponent<Image>().sprite =
UIManager.Instance.collectDict[myMap.IsFavorite];
#if !(UNITY_ANDROID || UNITY_IOS)
transform.Find("CollectImg").gameObject.SetActive(false);
#endif
transform.Find("BtnInfo").GetComponent<Button>().onClick.AddListener(Info);
transform.Find("BtnRide").GetComponent<Button>().onClick.AddListener(Ride);
@@ -141,8 +143,23 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
UIManager.ShowMapDetailPanel(map.Id);
}
public void OnPointerExit(PointerEventData eventData)
{
#if !(UNITY_ANDROID || UNITY_IOS)
if (localY != null)
{
transform.DOLocalMoveY(localY.Value, 0.3f);
}
transform.Find("CollectImg").gameObject.SetActive(false);
transform.Find("Shadow").gameObject.SetActive(false);
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
//SetActive4Button(false);
SetColor(false);
#endif
}
public void OnPointerEnter(PointerEventData eventData)
{
#if !(UNITY_ANDROID || UNITY_IOS)
if (localY == null)
{
localY = transform.localPosition.y;
@@ -153,6 +170,7 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
Cursor.SetCursor(Resources.Load<Texture2D>("Images/PointerButtonHover"), Vector2.zero, CursorMode.Auto);
//SetActive4Button(true);
SetColor(true);
#endif
}
void SetActive4Button(bool b)
{
@@ -160,18 +178,7 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
transform.Find("BtnInfo").gameObject.SetActive(b);
transform.Find("BtnRide").gameObject.SetActive(b);
}
public void OnPointerExit(PointerEventData eventData)
{
if (localY != null)
{
transform.DOLocalMoveY(localY.Value, 0.3f);
}
transform.Find("CollectImg").gameObject.SetActive(false);
transform.Find("Shadow").gameObject.SetActive(false);
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
//SetActive4Button(false);
SetColor(false);
}
private void SetColor(bool isFav)
{
PropNames.icons.ForEach((v) =>
@@ -25,7 +25,7 @@ public class BigMapController : PFUIPanel
AbstractMap mapManager;
//GameObject cube;
//GameObject cube1;
GameObject canvas;
GameObject canvas,mainContainer;
GameObject content;
Text keyword;
UnityEngine.Object begin;
@@ -81,12 +81,21 @@ public class BigMapController : PFUIPanel
//mapManager.SetCenterLatitudeLongitude(new Mapbox.Utils.Vector2d(32.051203, 118.771572));
this.transform.Find("Map").GetComponent<QuadTreeCameraMovement>()._referenceCamera = Camera.main;
canvas = this.transform.Find("Canvas").gameObject;
#if UNITY_ANDROID || UNITY_IOS
mainContainer = canvas.transform.Find("MainContainer").gameObject;
#else
mainContainer = canvas;
#endif
canvas.GetComponent<Canvas>().worldCamera = Camera.main;
var goList = canvas.transform.Find("SwitchMode");
var goList = mainContainer.transform.Find("SwitchMode");
#if UNITY_ANDROID || UNITY_IOS
SetRounded(goList, 52);
#else
SetRounded(goList, 64);
#endif
UIManager.AddEvent(goList.Find("GoList").gameObject, EventTriggerType.PointerClick, (e) =>
{
mapManager.Destroy();
@@ -96,9 +105,12 @@ public class BigMapController : PFUIPanel
//DestroyImmediate(this.gameObject);
});
var panel = canvas.transform.Find("Panel");
var panel = mainContainer.transform.Find("Panel");
#if UNITY_ANDROID || UNITY_IOS
base.SetRounded(panel, 20f);
#else
base.SetRounded(panel, 30f);
#endif
var qtcm = this.transform.Find("Map").GetComponent<QuadTreeCameraMovement>();
UIManager.AddEvent(panel.gameObject, EventTriggerType.PointerEnter, (e) =>
@@ -125,8 +137,11 @@ public class BigMapController : PFUIPanel
var searchBtn = input.Find("Search").gameObject;
UIManager.AddEvent(searchBtn, EventTriggerType.PointerClick, Search);
#if UNITY_ANDROID || UNITY_IOS
tipsObject = Resources.Load("UI/Prefab/MapList/MapItem-Mobile");
#else
tipsObject = Resources.Load("UI/Prefab/MapList/MapItem");
#endif
//tips = ((GameObject)Instantiate(tipsObject, canvas.transform.Find("TipsContainer"))).GetComponent<Tips>();
//tips.Hide();
@@ -142,7 +157,7 @@ public class BigMapController : PFUIPanel
/// </summary>
void BindHeadImage()
{
var headImage = canvas.transform.Find("HeadImage").GetComponent<RawImage>();
var headImage = mainContainer.transform.Find("HeadImage").GetComponent<RawImage>();
//var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
var rect = ((RectTransform)headImage.transform).rect;
//material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
@@ -315,7 +330,7 @@ public class BigMapController : PFUIPanel
//GameObject direct;
void CreateLine(int id, LineItem line)
{
#region 画线
#region 画线
List<Vector2d> pp1 = line.Points;
var dat = new List<Vector3>();
foreach (var item in pp1)
@@ -354,13 +369,16 @@ public class BigMapController : PFUIPanel
//lineRender.SetVertexCount(dat.Count);
lineRender.SetPositions(feat.Points[0].ToArray());
#endregion
#endregion
#region 添加左边的列表项
#region 添加左边的列表项
if (linesCache[id].Item == null)
{
#if UNITY_ANDROID || UNITY_IOS
var itemObject = Resources.Load("UI/Prefab/BigMap/Mobile/Item");
#else
var itemObject = Resources.Load("UI/Prefab/BigMap/Item");
#endif
var itemObject1 = (GameObject)Instantiate(itemObject, content.transform, false);
var iii = itemObject1.GetComponent<Item>();
iii.SetModel(line.Model);
@@ -396,9 +414,9 @@ public class BigMapController : PFUIPanel
}
};
}
#endregion
#endregion
#region 添加marker
#region 添加marker
if (line.BeginMarker == null)
{
@@ -437,7 +455,7 @@ public class BigMapController : PFUIPanel
line.BeginMarker.transform.position = ConverToPosition(line.Points.First());
#endregion
#endregion
if (line.Selected)
{
@@ -62,12 +62,20 @@ public class EarthController : PFUIPanel
//itemObject = Resources.Load("UI/Prefab/BigMap/Item");
panel = rootPanel.Find("Panel").gameObject;
#if UNITY_ANDROID || UNITY_IOS
SetRounded(panel.transform, 20);
#else
SetRounded(panel.transform, 60);
#endif
panel.gameObject.SetActive(false);
var goList = rootPanel.transform.Find("SwitchMode");
#if UNITY_ANDROID || UNITY_IOS
SetRounded(goList, 52);
#else
SetRounded(goList, 64);
#endif
UIManager.AddEvent(goList.Find("GoList").gameObject, EventTriggerType.PointerClick, (e) =>
{
//UIManager.PopStack();
@@ -2,6 +2,8 @@
using Assets.Scripts.Apis;
using Assets.Scripts.Apis.Models;
using Assets.Scripts.UI.Control;
using Assets.Scripts.UI.UIEffect;
using DG.Tweening;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
@@ -48,8 +50,33 @@ public class EditUserController : PFUIPanel
{
Debug.Log(Utils.GetIP(Utils.ADDRESSFAM.IPv4));
userApi = new UserApi();
#if !(UNITY_ANDROID || UNITY_IOS)
var panel = this.transform.Find("Panel");
#else
var panel = this.transform.Find("Panel/MainPanel");
float? panelTop = null;
UIGradient g1 = transform.Find("Panel/Btn1").GetComponent<UIGradient>()
, g2 = transform.Find("Panel/Btn2").GetComponent<UIGradient>();
UIManager.AddEvent(transform.Find("Panel/Btn1").gameObject, EventTriggerType.PointerClick, b =>
{
if (!panelTop.HasValue) panelTop = transform.localPosition.y+185;
panel.DOLocalMoveY(panelTop.Value, 0.3f);
g1.color1 = Utils.HexToColorHtml("#F93086");
g1.color2 = Utils.HexToColorHtml("#ff7485");
g2.color1 = Utils.HexToColorHtml("#353543");
g2.color2 = Utils.HexToColorHtml("#474759");
//.color1 = Utils.HexToColorHtml()
});
UIManager.AddEvent(transform.Find("Panel/Btn2").gameObject, EventTriggerType.PointerClick, b =>
{
if (!panelTop.HasValue) panelTop = transform.localPosition.y+185;
panel.DOLocalMoveY(panelTop.Value + 370, 0.3f);
g2.color1 = Utils.HexToColorHtml("#F93086");
g2.color2 = Utils.HexToColorHtml("#ff7485");
g1.color1 = Utils.HexToColorHtml("#353543");
g1.color2 = Utils.HexToColorHtml("#474759");
});
#endif
mID = panel.Find("IDNumber").Find("input").Find("Text").GetComponent<Text>();
mSexDropdown = panel.Find("SexDropdown").GetComponent<PFUIDropdown>();
mSexDropdown = panel.Find("SexDropdown").GetComponent<PFUIDropdown>();
@@ -248,15 +275,7 @@ public class EditUserController : PFUIPanel
}
private void Switch(BaseEventData arg0)
{
UIManager.ShowConfirm("Logout", "Do you want to log out and change accounts?", () =>
{
#if !(UNITY_ANDROID || UNITY_IOS)
SceneManager.LoadScene("Login");
#else
SceneManager.LoadScene("Login-Mobile");
#endif
UIManager.CloseConfirm();
},2);
UIManager.SwitchAccount();
}
// Update is called once per frame
@@ -129,7 +129,14 @@ public class HomeController : PFUIPanel
Application.Quit();
});
#else
Application.OpenURL("powerfun://app");
if (App.weChatController.isApplicationAvilible("com.zhixingpai.powerfun", "powerfun"))
{
Application.OpenURL("powerfun://app");
}
else
{
Application.OpenURL("http://www.powerfun.com/Download");
}
#endif
}
//进入比赛
@@ -41,8 +41,44 @@ public class MapListController : PFUIPanel
}
}
private bool isEnd = false;
private Transform topContainer;
protected override void Start()
{
#if (UNITY_ANDROID || UNITY_IOS)
topContainer = transform.Find("Top");
var rectTransform = transform.GetComponent<RectTransform>();
var offsetMax = rectTransform.offsetMax;
rectTransform.offsetMax = new Vector2(0, offsetMax.y);
var offsetMin = rectTransform.offsetMin;
rectTransform.offsetMin = new Vector2(0, offsetMin.y);
//筛选按钮
var topRect = topContainer.GetComponent<RectTransform>();
if (!App.topRectStartX.HasValue)
{
App.topRectStartX = topRect.localPosition.x;
}
var mc = transform.Find("MC");
UIManager.AddEvent(transform.Find("Panel/BtnFilter").gameObject, EventTriggerType.PointerClick, b =>
{
topContainer.DOLocalMoveX(App.topRectStartX.Value - topRect.rect.width, 0.3f);
mc.gameObject.SetActive(true);
mc.GetComponent<CanvasGroup>().alpha = 0;
mc.GetComponent<CanvasGroup>().DOFade(1, 0.3f);
});
UIManager.AddEvent(topContainer.Find("BtnCancel").gameObject, EventTriggerType.PointerClick, b =>
{
topContainer.DOLocalMoveX(App.topRectStartX.Value, 0.3f);
mc.GetComponent<CanvasGroup>().DOFade(0, 0.3f).onComplete = () =>
{
mc.gameObject.SetActive(false);
};
});
map = Resources.Load<GameObject>("UI/Prefab/MapList/MapItem-Mobile");
#else
topContainer = transform.Find("Panel").Find("Top");
#endif
sort = "Near";
sortDire = "asc";
//if (hardSelector != null)
@@ -69,14 +105,14 @@ public class MapListController : PFUIPanel
// layout.cellSize = new Vector2((width - 120) / 5, (width - 120) / 5);
//}
}
distanceOptions = transform.Find("Panel").Find("Top").Find("distanceOptions");
distanceOptions = topContainer.Find("distanceOptions");
if (distanceOptions != null)
{
var dDropdown = distanceOptions.GetComponent<Dropdown>();
dDropdown.options = MapFilterOptions.distances;
dDropdown.onValueChanged.AddListener(ChangeDistance);
}
diffOptions = transform.Find("Panel").Find("Top").Find("DifficultyContainer");
diffOptions = topContainer.Find("DifficultyContainer");
if (diffOptions != null)
{
foreach (Transform t in diffOptions)
@@ -130,8 +166,8 @@ public class MapListController : PFUIPanel
UIManager.ShowHomePanel();
});
}
tdContainer = transform.Find("Panel").Find("Top").Find("3dContainer");
favContainer = transform.Find("Panel").Find("Top").Find("FavContainer");
tdContainer = topContainer.Find("3dContainer");
favContainer = topContainer.Find("FavContainer");
if (tdContainer != null)
{
UIManager.AddEvent(tdContainer.gameObject, EventTriggerType.PointerClick, (b) =>
@@ -154,7 +190,7 @@ public class MapListController : PFUIPanel
Refresh();
});
}
searchInput = transform.Find("Panel").Find("Top").Find("SearchInput");
searchInput = topContainer.Find("SearchInput");
if (searchInput != null)
{
//searchInput.GetComponent<InputField>().onEndEdit.AddListener((s) =>
@@ -167,7 +203,7 @@ public class MapListController : PFUIPanel
onEndEdit();
});
}
sorts = transform.Find("Panel").Find("Top").Find("FilterOptions");
sorts = topContainer.Find("FilterOptions");
if (sorts != null)
{
var drop = sorts.GetComponent<Dropdown>();
@@ -195,7 +231,7 @@ public class MapListController : PFUIPanel
Refresh();
});
}
sortDir = transform.Find("Panel").Find("Top").Find("Dir");
sortDir = topContainer.Find("Dir");
if (sortDir)
{
var image = sortDir.Find("Image").GetComponent<Image>();
@@ -29,15 +29,7 @@ public class UserInfoController : PFUIPanel
UIManager.AddEvent(transform.Find("InfoPanel").Find("SwitchAccountButton").gameObject,
EventTriggerType.PointerClick, (b) =>
{
UIManager.ShowConfirm("Logout", "Do you want to log out and change accounts?", () =>
{
#if !(UNITY_ANDROID || UNITY_IOS)
SceneManager.LoadScene("Login");
#else
SceneManager.LoadScene("Login-Mobile");
#endif
UIManager.CloseConfirm();
},2);
UIManager.SwitchAccount();
});
infoPanel = transform.Find("InfoPanel").Find("P");
@@ -57,9 +49,10 @@ public class UserInfoController : PFUIPanel
#if UNITY_ANDROID || UNITY_IOS
editBtn.gameObject.SetActive(true);
var recordBtn = infoPanel.Find("RecordButton");
UIManager.AddEvent(recordBtn.gameObject, EventTriggerType.PointerEnter, (b) =>
UIManager.AddEvent(recordBtn.gameObject, EventTriggerType.PointerClick, (b) =>
{
Debug.Log("去看記錄");
Debug.Log(62);
UIManager.ShowResultListPanel();
});
#else
UIManager.AddEvent(transform.Find("InfoPanel").gameObject, EventTriggerType.PointerEnter, (b) =>
@@ -71,7 +71,11 @@ public class RaceHomeScript : RaceScript
StartTime();
rightContainer = transform.Find("RightContainer");
leftContainer = transform.Find("LeftContainer");
#if !(UNITY_ANDROID || UNITY_IOS)
btnGoList = rightContainer.Find("Container-2/BtnGoList");
#else
btnGoList = rightContainer.Find("BtnGoList");
#endif
if (btnGoList != null)
{
UIManager.AddEvent(btnGoList.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
@@ -92,7 +96,11 @@ public class RaceHomeScript : RaceScript
async void GetData()
{
#if !(UNITY_ANDROID || UNITY_IOS)
var r = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 7, order: 0);
#else
var r = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 4, order: 0);
#endif
var activityList = await ConfigHelper.mapCompetitionApi.GetCompetitionListV2("", 0, 3, activity: 1, order: 2);
DisplayMaps(r.data, activityList.data);
Initial();
@@ -112,6 +120,10 @@ public class RaceHomeScript : RaceScript
smallGame = Resources.Load<GameObject>("UI/Prefab/Race/ItemSmall"),
bannerItem = Resources.Load<GameObject>("UI/Prefab/Race/Banner/BannerItem"),
dotItem = Resources.Load<GameObject>("UI/Prefab/Race/Banner/DotItem");
#if UNITY_ANDROID || UNITY_ANDROID
bannerItem = Resources.Load<GameObject>("UI/Prefab/Race/Banner/BannerItem-Mobile");
smallGame = Resources.Load<GameObject>("UI/Prefab/Race/Mobile/ItemSmall-Mobile");
#endif
//for (i = 0; i < 2; i++)
//{
// var game = Instantiate<GameObject>(bigGame);
@@ -166,9 +178,11 @@ public class RaceHomeScript : RaceScript
dot.transform.localScale = Vector3.one;
//scroll.content
}
#if !(UNITY_ANDROID || UNITY_IOS)
rightContainer.Find("Container-2/BtnGoList").SetAsLastSibling();
rightContainer.Find("Container-2/BtnGoList").GetComponent<RaceMaskScript>().localY =
list.Count < 4 ? -167.5f :-492.5f;
#endif
}
void OnBannerClick(MapCompetition map)
{
@@ -192,7 +206,14 @@ public class RaceHomeScript : RaceScript
//{
// contentSize = 0;
//}
contentSize = 1f / (content.childCount - 1);
if (content.childCount > 1)
{
contentSize = 1f / (content.childCount - 1);
}
else
{
contentSize = 0;
}
scroll.horizontalNormalizedPosition = 0;
}
void goLeft()
@@ -211,7 +232,7 @@ public class RaceHomeScript : RaceScript
void goMove(int i = 1)
{
//doAni();
if (startMoveEnd) return;
if (startMoveEnd || contentSize == 0) return;
if (!start) startPosition = scroll.horizontalNormalizedPosition;
start = true;
scrollValue = i * contentSize / 20;
@@ -9,7 +9,10 @@ using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class RaceItemScript : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler, IPointerUpHandler
public class RaceItemScript : MonoBehaviour
#if !(UNITY_ANDROID||UNITY_IOS)
, IPointerExitHandler, IPointerEnterHandler, IPointerUpHandler
#endif
{
// Start is called before the first frame update
public enum ItemType { big, small }
@@ -26,8 +29,9 @@ public class RaceItemScript : MonoBehaviour, IPointerExitHandler, IPointerEnterH
{
}
public void Initial(MapCompetition mapCompetition,Transform parent)
public void Initial(MapCompetition mapCompetition,Transform parent,string from = "list")
{
#if !(UNITY_ANDROID || UNITY_IOS)
transform.GetComponent<Button>().onClick.AddListener(() =>
{
App.RouteIdParam = mapCompetition.RouteId;
@@ -35,6 +39,16 @@ public class RaceItemScript : MonoBehaviour, IPointerExitHandler, IPointerEnterH
SceneManager.LoadScene("Ride");
});
Utils.DisplayImage(transform.GetComponent<RawImage>(), mapCompetition.RouteCover, true);
#else
if (from == "list")
{
Utils.DisplayImage(transform.GetComponent<RawImage>(), mapCompetition.RouteCover, true);
transform.GetComponent<Button>().onClick.AddListener(() =>
{
UIManager.ShowRaceDetailModal(mapCompetition);
});
}
#endif
Utils.DisplayImage(transform.Find("AltitudeCurve").GetComponent<RawImage>(), mapCompetition.AltitudeGraph, true);
transform.Find("InfoContainer/Text").GetComponent<Text>().SetTextWithEllipsis(mapCompetition.Title);
transform.Find("GetReadyContainer").gameObject.SetActive(mapCompetition.Status != 4);
@@ -52,7 +66,14 @@ public class RaceItemScript : MonoBehaviour, IPointerExitHandler, IPointerEnterH
transform.Find("InfoContainer/StartTime/Text").GetComponent<Text>().text = mapCompetition.StartTime.ToLocalTime().ToString();
transform.Find("CountContainer/Text").GetComponent<Text>().text = mapCompetition.ApplyCount.ToString();
SetStatus(mapCompetition);
#if !(UNITY_ANDROID || UNITY_IOS)
SetButtonGroup(mapCompetition);
#else
if (from != "list")
{
SetButtonGroup(mapCompetition);
}
#endif
if (parent != null)
{
this.parent = parent;
@@ -193,7 +193,16 @@ public class RaceListScript : RaceScript
}
//Refresh();
}
protected override void Start()
{
#if (UNITY_ANDROID || UNITY_IOS)
var rectTransform = transform.GetComponent<RectTransform>();
var offsetMax = rectTransform.offsetMax;
rectTransform.offsetMax = new Vector2(0, offsetMax.y);
var offsetMin = rectTransform.offsetMin;
rectTransform.offsetMin = new Vector2(0, offsetMin.y);
#endif
}
private async Task Login()
{
var result = await ConfigHelper.userApi.Login("13115011550", "laozhong", "");
@@ -279,7 +288,12 @@ public class RaceListScript : RaceScript
private void DisplayMaps(List<MapCompetition> list)
{
#if UNITY_ANDROID || UNITY_IOS
GameObject smallGame = Resources.Load<GameObject>("UI/Prefab/Race/Mobile/ItemSmall-Mobile");
#else
GameObject smallGame = Resources.Load<GameObject>("UI/Prefab/Race/ItemSmall");
#endif
foreach (var map in list)
{
var game = Instantiate<GameObject>(smallGame);
@@ -9,10 +9,12 @@ public class RaceMaskScript : MonoBehaviour, IPointerEnterHandler,IPointerExitHa
public void OnPointerEnter(PointerEventData eventData)
{
transform.Find("Panel").GetComponent<CanvasGroup>().DOFade(1, 0.5f);
if (localY.HasValue)
if (!localY.HasValue)
{
transform.DOLocalMoveY(localY.Value + 5, 0.3f);
localY = transform.localPosition.y;
}
transform.DOLocalMoveY(localY.Value + 5, 0.3f);
}
public void OnPointerExit(PointerEventData eventData)
@@ -0,0 +1,36 @@
using Assets.Scripts;
using Assets.Scripts.Apis.Models;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class RaceModalScript : RaceScript
{
// Start is called before the first frame update
void Start()
{
UIManager.AddEvent(transform.Find("Container/Exit").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
//停止计时器
UIManager.CloseModal();
transform.GetComponent<RaceScript>().SetCurrentItem(null);
});
}
// Update is called once per frame
void Update()
{
}
public void Initial(MapCompetition mapCompetition)
{
var item = transform.Find("Container/Main/ItemSmall-Mobile");
item.GetComponent<RaceItemScript>().Initial(mapCompetition, transform,"modal");
//开始计时器
transform.GetComponent<RaceScript>().SetCurrentItem(item);
Utils.DisplayImage(transform.Find("Container/Main/Left").GetComponent<RawImage>(),
mapCompetition.RouteCover, true);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 95df82ebb7d60894c80ae5ba7afdf48b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+2 -2
View File
@@ -31,10 +31,10 @@ public class RaceScript : PFUIPanel
/// <param name="t"></param>
public void SetCurrentItem(Transform t)
{
currentItem = t;
HandleTime();
if (t != null)
{
currentItem = t;
HandleTime();
StartTime();
}
else
@@ -9,7 +9,7 @@ using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class ResultListController : MonoBehaviour
public class ResultListController : PFUIPanel
{
[SerializeField]Transform routeResult;
Transform localRouteItem;
@@ -29,6 +29,9 @@ public class ResultListController : MonoBehaviour
void Awake()
{
//ApiBase.SetCookie("73385F5F719B610D132C1ECF3E9143272BF15214D57ED91CD7A9DFD832407471535112AAEB8E9271F75D54FBBF2D99F18FA313C1EEA5676F5D722D7FBB07C926BEC5905591BF9AFDDC6336552DF273112C2DA1794E6FA2F465B11FECD2E82E52");
#if UNITY_ANDROID || UNITY_IOS
routeResult = Resources.Load<Transform>("UI/Prefab/ResultList/RouteItem-Mobile");
#endif
InitialColor();
scroll = transform.Find("ListPanel").Find("Scroll").GetComponent<ScrollRect>();
btnMatch = transform.Find("ListPanel").Find("BtnMatch");
@@ -283,7 +286,7 @@ public class ResultListController : MonoBehaviour
}
scroll.transform.Find("Error").gameObject.SetActive(contents[scrollIndex].childCount == 0);
}
#region 主页面滑动逻辑
#region 主页面滑动逻辑
int scrollIndex = 0;
bool startScroll = false;
ScrollRect scroll;
@@ -318,7 +321,7 @@ public class ResultListController : MonoBehaviour
}
}
}
#endregion
#endregion
//float scrollIndex = 0;
//bool startScroll = false;
//ScrollRect scroll;
@@ -0,0 +1,30 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ResultListPanelController : PFUIPanel
{
// Start is called before the first frame update
void Start()
{
UIManager.AddEvent(transform.Find("LTPanel/Button").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
UIManager.ShowPrePanel();
});
UIManager.AddEvent(transform.Find("LTPanel/SwitchAccountButton").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
{
UIManager.SwitchAccount();
});
}
public override void Show()
{
base.Show();
transform.Find("RideResultList").GetComponent<ResultListController>().Load();
}
// Update is called once per frame
void Update()
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 693a8dfbfae474849b06c5d0080136f1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -100,12 +100,12 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
transform.Find("Right").gameObject.SetActive(false);
}
//right.gameObject.SetActive(true);
#if !(UNITY_ANDROID || UNITY_IOS)
gameObject.GetComponent<Button>().onClick.AddListener(() =>
{
Detail();
});
});
#endif
}
void Detail()
{
@@ -179,6 +179,7 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
}
});
}
#if !(UNITY_ANDROID||UNITY_IOS)
void SetButtonColor(bool f)
{
if (routeResult!=null)
@@ -215,7 +216,6 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
}
else
{
Debug.Log(216);
btnDetail.GetComponent<Image>().color = Utils.HexToColorHtml("#414251");
btnDetail.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#353543");
}
@@ -223,6 +223,32 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
}
}
#else
void SetButtonColor(bool f)
{
if (!f)
{
transform.Find("Right").gameObject.SetActive(false);
transform.Find("RightMatch").gameObject.SetActive(false);
transform.Find("RightDot").gameObject.SetActive(true);
}
else
{
transform.Find("Right").gameObject.SetActive(index == 0);
if (index == 0)
{
bool disabled = routeResult.ContinueCyclingParam == null;
if (disabled)
{
btnContinue.GetComponent<Image>().color = Utils.HexToColorHtml("#cdcdcd");
}
}
transform.Find("RightMatch").gameObject.SetActive(index == 1);
transform.Find("RightDot").gameObject.SetActive(false);
}
}
#endif
public void OnPointerExit(PointerEventData eventData)
{
transform.GetComponent<Image>().color = Utils.HexToColorHtml("#23232d");
+62 -4
View File
@@ -14,6 +14,7 @@ using System.Linq;
using Newtonsoft.Json.Linq;
using System;
using Assets.Scenes.Ride.Scripts;
using UnityEngine.SceneManagement;
public class UIManager : MonoBehaviour
{
@@ -137,6 +138,21 @@ public class UIManager : MonoBehaviour
return this.GetPanelInstance("EditUserPanel", ref this.mEditUserController);
}
}
#if UNITY_ANDROID || UNITY_IOS
private ResultListPanelController mResultListController;
public ResultListPanelController ResultListPanel
{
get
{
return this.GetPanelInstance("ResultListPanel", ref this.mResultListController);
}
}
public static void ShowResultListPanel()
{
Debug.Log(UIManager.Instance.MainPanel);
UIManager.Show(UIManager.Instance.ResultListPanel, UIManager.Instance.MainPanel);
}
#endif
/*比赛首页*/
private RaceHomeScript mRaceHomeScript;
public RaceHomeScript RaceHomePanel
@@ -152,7 +168,7 @@ public class UIManager : MonoBehaviour
{
UIManager.PopStack();
}
UIManager.Instance.MainPanel.transform.parent.Find("Bg").GetComponent<Image>().sprite =
UIManager.Instance.MainPanel.GetComponent<Image>().sprite =
Resources.Load<Sprite>("Images/Race/RACE-BG");
UIManager.Show(UIManager.Instance.RaceHomePanel, UIManager.Instance.MainPanel);
}
@@ -186,6 +202,22 @@ public class UIManager : MonoBehaviour
//UIManager.Show(UIManager.Instance.RaceListPanel, UIManager.Instance.MainPanel);
}
/*比赛列表*/
#region 比赛点击弹窗
private RaceModalScript mRaceModalScript;
public RaceModalScript RaceDetailModal
{
get
{
return this.GetPanelInstance("RaceDetailModal", ref this.mRaceModalScript);
}
}
public static void ShowRaceDetailModal(MapCompetition mapCompetition)
{
UIManager.Show(UIManager.Instance.RaceDetailModal, null, true);
UIManager.Instance.mRaceModalScript.Initial(mapCompetition);
//UIManager.Show(UIManager.Instance.RaceListPanel, UIManager.Instance.MainPanel);
}
#endregion
private PFUIPanel mModalsPanel;
public PFUIPanel ModalsPanel
{
@@ -329,7 +361,11 @@ public class UIManager : MonoBehaviour
{
if (internalComponent == null)
{
#if !(UNITY_ANDROID || UNITY_IOS)
UnityEngine.Object @object = Resources.Load("UI/Prefab/Common/" + prefabName);
#else
UnityEngine.Object @object = Resources.Load("UI/Prefab/Common/Mobile/" + prefabName);
#endif
if (@object != null)
{
GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(@object, base.transform.parent, false);
@@ -399,12 +435,19 @@ public class UIManager : MonoBehaviour
//panelToShow.transform.position = new Vector3(0, 0, 0);
panelToShow.transform.localPosition = new Vector3(0, 0, 0);
//panelToShow.transform.localRotation = new Quaternion(0, 0, 0, 0);
#if !(UNITY_ANDROID || UNITY_IOS)
//if (modal == false)
{
panelToShow.transform.GetComponent<RectTransform>().offsetMin = new Vector2(0, 0);
panelToShow.transform.GetComponent<RectTransform>().offsetMax = new Vector2(0, 0);
}
#else
if (modal)
{
panelToShow.transform.GetComponent<RectTransform>().offsetMin = new Vector2(0, 0);
panelToShow.transform.GetComponent<RectTransform>().offsetMax = new Vector2(0, 0);
}
#endif
panelToShow.transform.localScale = parent.transform.localScale;
}
@@ -468,7 +511,7 @@ public class UIManager : MonoBehaviour
public static void ShowHomePanel()
{
stack.Clear();
UIManager.Instance.MainPanel.transform.parent.Find("Bg").GetComponent<Image>().sprite =
UIManager.Instance.MainPanel.GetComponent<Image>().sprite =
Resources.Load<Sprite>("Images/main-bg");
UIManager.Show(UIManager.Instance.HomePanel, UIManager.Instance.MainPanel);
}
@@ -598,7 +641,11 @@ public class UIManager : MonoBehaviour
public static void ShowBigMapPanel(double lat = 0, double lon = 0)
{
UIManager.Instance.MainPanel.gameObject.SetActive(false);
#if UNITY_ANDROID || UNITY_IOS
var obj = Resources.Load("UI/Prefab/Panel/Mobile/BigMapPanel");
#else
var obj = Resources.Load("UI/Prefab/Panel/BigMapPanel");
#endif
//var root = UIManager.Instance.MainPanel.transform.parent.parent;
var bigMap = (GameObject)Instantiate(obj, UIManager.Instance.Root.transform);
bigMap.GetComponent<BigMapController>().Show(lat, lon);
@@ -824,5 +871,16 @@ public class UIManager : MonoBehaviour
{
UIManager.Instance = null;
}
public static void SwitchAccount()
{
ShowConfirm("Logout", "Do you want to log out and change accounts?", () =>
{
#if !(UNITY_ANDROID || UNITY_IOS)
SceneManager.LoadScene("Login");
#else
SceneManager.LoadScene("Login-Mobile");
#endif
CloseConfirm();
}, 2);
}
}
+1 -1
View File
@@ -253,7 +253,7 @@ namespace Assets.Scripts
yield return request.SendWebRequest();
if (request.isNetworkError || request.isHttpError)
Debug.Log(request.error);
else
else if(img!=null)
{
img.texture = ((DownloadHandlerTexture)request.downloadHandler).texture;
if (action != null)