细节调整
This commit is contained in:
1 parent
038720e7bd
commit
e04ae0b085
24 files changed
+2012
-262
No files matched your search
@@ -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));
|
||||
|
||||
@@ -10,7 +10,7 @@ using UnityEngine.EventSystems;
|
||||
namespace Assets.Scripts.UI.Control
|
||||
{
|
||||
[RequireComponent(typeof(Button))]
|
||||
public class PFUIButton : PFUIComponentBase
|
||||
public class PfUIButton : PFUIComponentBase
|
||||
{
|
||||
public enum Type
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -20,10 +24,16 @@ public class Tips : MonoBehaviour
|
||||
private Text Count;
|
||||
private Text Distance;
|
||||
private Text TotalClimb;
|
||||
private PFUIButton pFUIButton;
|
||||
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));
|
||||
@@ -34,11 +44,25 @@ public class Tips : MonoBehaviour
|
||||
Distance = this.transform.Find("Distance").GetComponent<Text>();
|
||||
TotalClimb = this.transform.Find("TotalClimb").GetComponent<Text>();
|
||||
|
||||
pFUIButton = this.transform.Find("Ride").GetComponent<PFUIButton>();
|
||||
pFUIButton = this.transform.Find("Ride").GetComponent<PfUIButton>();
|
||||
UIManager.AddEvent(pFUIButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (e) => {
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ConnectDeviceModal : PFUIPanel
|
||||
private Image Logo;
|
||||
private UnityEngine.Object deviceItem;
|
||||
private VerticalLayoutGroup content;
|
||||
private PFUIButton connectBtn;
|
||||
private PfUIButton connectBtn;
|
||||
private Dictionary<ushort, DeviceItem> deviceList;
|
||||
|
||||
protected override void Awake()
|
||||
@@ -60,7 +60,7 @@ public class ConnectDeviceModal : PFUIPanel
|
||||
|
||||
deviceItem = Resources.Load("UI/Prefab/Device/DeviceItem");
|
||||
|
||||
connectBtn = container.Find("ConnectBtn").GetComponent<PFUIButton>();
|
||||
connectBtn = container.Find("ConnectBtn").GetComponent<PfUIButton>();
|
||||
|
||||
UIManager.AddEvent(connectBtn.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -37,7 +37,8 @@ public class DeviceController : PFUIPanel
|
||||
UIManager.AddEvent(mReturnBtn.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
|
||||
{
|
||||
//UIManager.ShowHomePanel();
|
||||
UIManager.CloseModal();
|
||||
//UIManager.CloseModal();
|
||||
this.Close();
|
||||
}));
|
||||
|
||||
var bg = this.transform.Find("Status").Find("Bg");
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,8 @@ public class MapListController : PFUIPanel
|
||||
//{
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
Reference in new issue
Block a user