Merge remote-tracking branch 'origin/dev' into dev_lishuo

# Conflicts:
#	Assets/NuGet.meta
#	Assets/Resources/Images/Ride.meta
#	Assets/Resources/Sound.meta
#	Assets/Scripts/App.cs
#	Assets/Scripts/UI/Prefab/BigMap/Tips.cs
#	Assets/StreamingAssets.meta
This commit is contained in:
lishuo committed 2021-04-15 17:14:00 +08:00
commit 70626ae741
46 files changed
+11645 -3948

No files matched your search

+2 -1
View File
@@ -72,7 +72,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, rect.height*0.5f, 0));
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, Math.Min(rect.height*0.7f, 50f), 0));
gameObject.GetComponent<Image>().material = material;
outline = this.GetComponent<Outline>();
@@ -80,6 +80,7 @@ namespace Assets.Scripts.UI.Control
{
outline = this.gameObject.AddComponent<Outline>();
outline.effectDistance = new Vector2(2, 2);
outline.enabled = false;
}
UIManager.AddEvent(this.mInnerInputField.gameObject, EventTriggerType.PointerClick, new UnityAction<BaseEventData>(this.OnSelect));
+47 -10
View File
@@ -1,10 +1,14 @@
using Assets.Scripts.Apis.Models;
using Assets.Scripts.UI.Control;
using Assets.Scripts.UI.Prefab.Login;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using System;
using System.Linq;
public class Tips : MonoBehaviour
{
@@ -21,9 +25,15 @@ public class Tips : MonoBehaviour
private Text Distance;
private Text TotalClimb;
private PfUIButton pFUIButton;
private RawImage countryIcon;
private Text averageGrade;
private List<CountryModel> countryList;
private GameObject level;
private GameObject m3DIcon;
private void Awake()
{
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
var materialSource = Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial");
var material = Instantiate(materialSource);
var rect = ((RectTransform)transform).rect;
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, 40f, 0));
@@ -39,6 +49,20 @@ public class Tips : MonoBehaviour
App.RouteIdParam = _model.Id;
SceneManager.LoadScene("Ride");
});
averageGrade = this.transform.Find("AverageGrade").GetComponent<Text>();
countryIcon = this.transform.Find("CountryIco").GetComponent<RawImage>();
var countryJson = Resources.Load<TextAsset>("UI/flags-mini").text;
countryList = JsonConvert.DeserializeObject<List<CountryModel>>(countryJson);
level = this.transform.Find("Level").gameObject;
var material1 = Instantiate(materialSource);
var rect1 = ((RectTransform)level.transform).rect;
material1.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect1.width, rect1.height, rect1.height, 0));
level.GetComponent<Image>().material = material1;
m3DIcon = this.transform.Find("3DIcon").gameObject;
}
// Start is called before the first frame update
@@ -63,17 +87,30 @@ public class Tips : MonoBehaviour
return;
}
}
else
//this.gameObject.SetActive(true);
_model = model;
Name.text = _model.Name;
Count.text = _model.TheHeat.ToString();
Distance.text = _model.Distance.ToString("#.0")+"KM";
TotalClimb.text = _model.TotalClimb.ToString();
averageGrade.text = _model.AverageGrade.ToString() + "%";
//var country = countryList.SingleOrDefault(r => r.abbreviation.Equals(_model.CountryCode, StringComparison.InvariantCultureIgnoreCase));
//if(country )
var country = Resources.Load<Sprite>($"UI/flags-mini/{ _model.CountryCode.ToLower() }");
if(country != null)
{
//this.gameObject.SetActive(true);
_model = model;
Name.text = _model.Name;
Count.text = _model.TheHeat.ToString();
Distance.text = _model.Distance.ToString("#.0")+"KM";
TotalClimb.text = _model.TotalClimb.ToString();
countryIcon.texture = country.texture;
}
level.transform.Find("Text").GetComponent<Text>().text = _model.Hard;
m3DIcon.SetActive(_model.Enable3D);
}
@@ -68,6 +68,10 @@ namespace Assets.Scripts.UI.Prefab.Login
if (c == null) return null;
return Resources.Load<Texture>(c.source);
}
public Texture GetCountryImage(string code)
{
return GetCountryImage(GetCountryIndexByCode(code));
}
public int GetCountryIndexByCode(string code)
{
var c = countryList.FindIndex(x => x.abbreviation.ToLower() == code.ToLower());
@@ -31,6 +31,7 @@ public class MapItem : MonoBehaviour
transform.Find("Name").GetComponent<Text>().text = myMap.Name;
Utils.DisplayImage(StartCoroutine, transform.Find("MapTitleImg").GetComponent<RawImage>(), myMap.CoverImage);
transform.Find("CollectImg").gameObject.SetActive(myMap.IsFavorite);
transform.Find("Hot").gameObject.SetActive(myMap.IsFire);
var props = transform.Find("Props");
props.Find("DistanceText").GetComponent<Text>().text = $"{myMap.Distance.ToString("#0.00")}KM";
props.Find("EleText").GetComponent<Text>().text = $"{(myMap.TotalClimb ?? 0.0).ToString("#0.00")}M";
@@ -40,5 +41,6 @@ public class MapItem : MonoBehaviour
var diff = tabContainer.Find("Diff");
diff.Find("Text").GetComponent<Text>().text = myMap.Hard;
tabContainer.Find("3d").gameObject.SetActive(myMap.Enable3D);
tabContainer.Find("Country").GetComponent<RawImage>().texture = UIManager.Instance.loginRegOptions.GetCountryImage(myMap.CountryCode);
}
}
@@ -41,14 +41,6 @@ public class BigMapController : PFUIPanel
mapManager = this.transform.Find("Map").GetComponent<AbstractMap>();
mapManager.OnInitialized += MapManager_OnInitialized;
mapManager.OnUpdated += MapManager_OnUpdated;
mapManager.OnMapRedrawn += () =>
{
//Debug.Log("map redrawn");
};
mapManager.OnTileFinished += (e) =>
{
//Debug.Log("finished");
};
//// mapManager.OnTileFinished += MapManager_OnTileFinished;
//mapManager.SetZoom(13);
@@ -58,26 +50,22 @@ public class BigMapController : PFUIPanel
canvas = this.transform.Find("Canvas").gameObject;
canvas.GetComponent<Canvas>().worldCamera = Camera.main;
var goList = canvas.transform.Find("GoList");
var goList = canvas.transform.Find("SwitchMode");
SetRounded(goList, 64);
UIManager.AddEvent(goList.gameObject, EventTriggerType.PointerClick, (e) =>
{
//App.MainSceneParam.Add("Name", "MapListPanel");
//SceneManager.LoadScene("MainScene");
mapManager.Destroy();
UIManager.ShowMapListPanel();
//this.gameObject.SetActive(false);
DestroyImmediate(this.gameObject);
});
var panel = canvas.transform.Find("Panel");
SetRounded(panel,30f);
base.SetRounded(panel,30f);
content = panel.Find("Scroll View").Find("Viewport").Find("Content").gameObject;
var input = panel.Find("InputField");
SetRounded(input, 20f);
base.SetRounded(input, 20f);
keyword = input.Find("Text").GetComponent<Text>();
var searchBtn = input.Find("Search").gameObject;
UIManager.AddEvent(searchBtn, EventTriggerType.PointerClick, Search);
@@ -85,20 +73,26 @@ public class BigMapController : PFUIPanel
tips = ((GameObject)Instantiate(Resources.Load("UI/Prefab/BigMap/Tips"), canvas.transform.Find("TipsContainer"))).GetComponent<Tips>();
tips.Hide();
BindHeadImage();
}
/// <summary>
/// 给对象设置圆角
/// 绑定头像
/// </summary>
/// <param name="panel"></param>
/// <param name="radius"></param>
void SetRounded(Transform panel, float radius)
void BindHeadImage()
{
var rounded = Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial");
var material = Instantiate(rounded);
var rect = ((RectTransform)panel).rect;
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, radius, 0));
panel.GetComponent<Image>().material = material;
var headImage = canvas.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));
//headImage.material = material;
SetRounded(headImage.transform, rect.height);
Utils.DisplayImage(StartCoroutine, headImage, App.CurrentUser.WxHeadImg);
UIManager.AddEvent(headImage.gameObject, EventTriggerType.PointerClick, (e) =>
{
UIManager.ShowEditUserPanel();
});
}
// Start is called before the first frame update
@@ -6,6 +6,7 @@ using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
@@ -21,6 +22,9 @@ public class EditUserController : PFUIPanel
private Text mNameText;
private RawImage mHeadImage;
private UserApi userApi;
private Button mCancelButton;
private Button mBackButton;
PfUIButton mChangeAvatar;
protected override void Awake()
{
userApi = new UserApi();
@@ -33,7 +37,43 @@ public class EditUserController : PFUIPanel
mMonthDropdown = panel.Find("MonthDropdown").GetComponent<PFUIDropdown>();
mDayDropdown = panel.Find("DayDropdown").GetComponent<PFUIDropdown>();
mSaveButton = this.transform.Find("SaveButton").GetComponent<Button>();
mCancelButton = this.transform.Find("CancelButton").GetComponent<Button>();
mHeadImage = this.transform.Find("HeadImage").GetComponent<RawImage>();
mBackButton = this.transform.Find("BackButton").GetComponent<Button>();
UIManager.AddEvent(mBackButton.gameObject, EventTriggerType.PointerClick, Cancel);
mChangeAvatar = this.transform.Find("ChangeAvatar").GetComponent<PfUIButton>();
UIManager.AddEvent(mChangeAvatar.gameObject, EventTriggerType.PointerClick, (e) =>
{
OpenFileName ofn = new OpenFileName();
ofn.structSize = Marshal.SizeOf(ofn);
ofn.filter = "All Files\0*.*\0\0";
ofn.file = new string(new char[256]);
ofn.maxFile = ofn.file.Length;
ofn.fileTitle = new string(new char[64]);
ofn.maxFileTitle = ofn.fileTitle.Length;
ofn.initialDir = UnityEngine.Application.dataPath;//默认路径
ofn.title = "Open Project";
ofn.defExt = "JPG";//显示文件的类型
//注意 一下项目不一定要全选 但是0x00000008项不要缺少
ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;//OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR
if (Win32.GetOpenFileName(ofn))
{
Debug.Log(ofn.file);
}
});
mSexDropdown.ClearOptions();
mSexDropdown.AddOptions(new List<string>
@@ -68,7 +108,6 @@ public class EditUserController : PFUIPanel
{
SetDayDropdown();
};
mDayDropdown.ClearOptions();
SetDayDropdown();
@@ -84,20 +123,17 @@ public class EditUserController : PFUIPanel
}
async void LoadDataSync()
void LoadDataSync()
{
Material material = null;
if (material == null)
{
material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
}
var rect = ((RectTransform)mHeadImage.transform).rect;
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
mHeadImage.material = material;
SetRounded(mHeadImage.transform, rect.height);
var currentUser = App.CurrentUser;
//var currentUser = App.CurrentUser;
//mIdText.text = "ID:" + currentUser.Id.ToString();
//mNameText.text = currentUser.Nickname;
mIdText.text = currentUser.Id.ToString();
mNameText.text = currentUser.Nickname;
Utils.DisplayImage(StartCoroutine, mHeadImage, currentUser.WxHeadImg);
//if (!string.IsNullOrWhiteSpace(currentUser.WxHeadImg))
//{
@@ -120,6 +156,7 @@ public class EditUserController : PFUIPanel
//}
UIManager.AddEvent(mSaveButton.gameObject, EventTriggerType.PointerClick, Save);
UIManager.AddEvent(mCancelButton.gameObject, EventTriggerType.PointerClick, Cancel);
}
// Start is called before the first frame update
@@ -169,4 +206,9 @@ public class EditUserController : PFUIPanel
UIManager.ShowAlert("result.errMsg");
}
void Cancel(BaseEventData e)
{
UIManager.ShowHomePanel();
}
}
@@ -59,7 +59,10 @@ public class HomeController : PFUIPanel
{
UIManager.ShowAlert("test");
});
UIManager.AddEvent(transform.Find("MainNav").Find("Setting").gameObject, EventTriggerType.PointerClick, x =>
{
UIManager.ShowSettingModal();
});
GetSummary();
}
@@ -39,13 +39,14 @@ public class MapListController : PFUIPanel
}
}
private bool isEnd = false;
protected override void Start()
protected override void Start()
{
//if (hardSelector != null)
//{
// hardSelector.onValueChanged.AddListener(ChangeHard);
//}
btnMapMode = this.transform.Find("BtnMapMode").gameObject;
btnMapMode = this.transform.Find("SwitchMode").gameObject;
SetRounded(btnMapMode.transform, 64);
UIManager.AddEvent(btnMapMode, EventTriggerType.PointerClick, (e) =>
{
UIManager.ShowBigMapPanel();
@@ -97,7 +98,7 @@ public class MapListController : PFUIPanel
});
}
}
BindHeadImage();
GetList();
if (scroll != null)
{
@@ -185,6 +186,25 @@ public class MapListController : PFUIPanel
}
}
/// <summary>
/// 绑定头像
/// </summary>
void BindHeadImage()
{
var headImage = this.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));
headImage.material = material;
Utils.DisplayImage(StartCoroutine, headImage, App.CurrentUser.WxHeadImg);
UIManager.AddEvent(headImage.gameObject, EventTriggerType.PointerClick, (e) =>
{
UIManager.ShowEditUserPanel();
});
}
private void OnEndDrag(BaseEventData arg0)
{
var scrollrect = scroll.GetComponent<ScrollRect>();
@@ -36,5 +36,30 @@ public class PFUIPanel : UIBehaviour
}
child.transform.SetParent(this.transform);
}
/// <summary>
/// 给对象设置圆角
/// </summary>
/// <param name="panel"></param>
/// <param name="radius"></param>
protected void SetRounded(Transform panel, float radius)
{
var rounded = Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial");
var material = Instantiate(rounded);
var rect = ((RectTransform)panel).rect;
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, radius, 0));
var img = panel.GetComponent<Image>();
if (img != null)
{
img.material = material;
return;
}
var rawImg = panel.GetComponent<RawImage>();
if(rawImg != null)
{
rawImg.material = material;
return;
}
}
}
//}
@@ -19,9 +19,10 @@ public class ResultListController : MonoBehaviour
// Start is called before the first frame update
int pageIndex = 0, pageSize = 20;
string name = "";
Transform[] contents;
void Start()
{
ApiBase.SetCookie("73385F5F719B610D132C1ECF3E9143272BF15214D57ED91CD7A9DFD832407471535112AAEB8E9271F75D54FBBF2D99F18FA313C1EEA5676F5D722D7FBB07C926BEC5905591BF9AFDDC6336552DF273112C2DA1794E6FA2F465B11FECD2E82E52");
//ApiBase.SetCookie("73385F5F719B610D132C1ECF3E9143272BF15214D57ED91CD7A9DFD832407471535112AAEB8E9271F75D54FBBF2D99F18FA313C1EEA5676F5D722D7FBB07C926BEC5905591BF9AFDDC6336552DF273112C2DA1794E6FA2F465B11FECD2E82E52");
InitialColor();
scroll = transform.Find("ListPanel").Find("Scroll").GetComponent<ScrollRect>();
btnMatch = transform.Find("ListPanel").Find("BtnMatch");
@@ -32,6 +33,7 @@ public class ResultListController : MonoBehaviour
routeContent = routeScroll.Find("Viewport").Find("Content");
matchScroll = scrollContent.Find("MatchList");
matchContent = matchScroll.Find("Viewport").Find("Content");
contents = new Transform[] { routeContent, matchContent};
if (btnMatch != null)
{
btnMatch.GetComponent<Button>().onClick.AddListener(() => StartScroll(0));
@@ -45,7 +47,7 @@ public class ResultListController : MonoBehaviour
searchInput.Find("Button").GetComponent<Button>().onClick.AddListener(() =>
{
name = searchInput.GetComponent<InputField>().text;
Refresh();
Refresh(contents[scrollIndex]);
});
}
if (routeScroll != null)
@@ -71,13 +73,13 @@ public class ResultListController : MonoBehaviour
}
if (scrollrect.verticalNormalizedPosition >= 1)
{
Refresh();
Refresh(contents[scrollIndex]);
}
}
private void Refresh()
private void Refresh(Transform content)
{
routeContent.transform.DestroyChildren();
content.transform.DestroyChildren();
pageIndex = 0;
GetList();
}
@@ -94,8 +96,8 @@ public class ResultListController : MonoBehaviour
else
{
isEnd = false;
DisplayRouteResult(r.data,routeContent);
DisplayRouteResult(r.data, matchContent);
DisplayRouteResult(r.data,contents[scrollIndex]);
//DisplayRouteResult(r.data, matchContent);
}
}
else
@@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class SettingContoller : PFUIPanel
{
// Start is called before the first frame update
Transform exit;
protected override void Awake()
{
exit = transform.Find("Main").Find("Exit");
if (exit != null)
{
exit.GetComponent<Button>().onClick.AddListener(()=>
{
Close();
});
}
}
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1304d873aa16cd641a83b889e9a1f3af
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: