修改样式

This commit is contained in:
Caiyanpeng committed 2021-09-06 17:50:01 +08:00
1 parent 467a6f3810
commit b11c5de681
28 files changed
+3447 -2823

No files matched your search

+5 -1
View File
@@ -80,8 +80,12 @@ public static class App
public static Vector2 MobileResolution = new Vector2(844f, 390f);//移动端分辨率
public static Vector2 PcResolution = new Vector2(1600f, 900f);//PC端分辨率
public static int autoClearTimes = 30;
static App()
public readonly static double width = Screen.width;
public readonly static double height = Screen.height;
public readonly static bool isFullScreen = width/height>1.8;
static App()
{
Debug.Log(isFullScreen);
#if !UNITY_EDITOR
//Host = "http://pf.juze.pro/";
//UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21000);
-1
View File
@@ -17,7 +17,6 @@ public class MainController : BaseScene
protected override void Awake()
{
base.Awake();
Version = this.transform.Find("GameObject").Find("Version").GetComponent<Text>();
Version.text = "V"+App.AppVersion;
DeviceCache.Init(PFConstants.DeviceCacheFolder);
@@ -22,7 +22,8 @@ public class QuickLoginScroll : MonoBehaviour
UIManager.AddEvent(scroll.gameObject, UnityEngine.EventSystems.EventTriggerType.BeginDrag, b =>
{
startPos = scroll.horizontalNormalizedPosition;
Debug.Log("开始滑动"+startPos);
doAni();
Debug.Log("开始滑动" + startPos);
});
UIManager.AddEvent(scroll.gameObject, UnityEngine.EventSystems.EventTriggerType.EndDrag, b =>
{
@@ -38,7 +39,6 @@ public class QuickLoginScroll : MonoBehaviour
{
UIManager.AddEvent(L.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick,(b)=>
{
startPos = scroll.horizontalNormalizedPosition;
goLeft();
});
//L.onClick.AddListener(goLeft);
@@ -47,20 +47,29 @@ public class QuickLoginScroll : MonoBehaviour
{
UIManager.AddEvent(R.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (b) =>
{
startPos = scroll.horizontalNormalizedPosition;
goRight();
});
//R.onClick.AddListener(goRight);
}
}
private void doAni()
private void doAni(bool flag = false)
{
lightbg.GetComponent<Image>().color = Utils.HexToColorHtml("#ffffff00");
lightbg.GetComponent<Image>().gameObject.SetActive(false);
int index = GetIndex();
content.GetChild(index).GetComponent<QuickLoginUser>().setNoActive();
//lightbg.GetComponent<Image>().DOFade(0, 0.15f);
if (flag)
{
lightbg.GetComponent<Image>().gameObject.SetActive(true);
lightbg.GetComponent<Image>().DOFade(1, 0.2f);
content.GetChild(index).GetComponent<QuickLoginUser>().setActive();
}
else
{
lightbg.GetComponent<Image>().color = Utils.HexToColorHtml("#ffffff00");
lightbg.GetComponent<Image>().gameObject.SetActive(false);
content.GetChild(index).GetComponent<QuickLoginUser>().setNoActive();
//lightbg.GetComponent<Image>().DOFade(0, 0.15f);
}
}
public void Initial()
@@ -105,6 +114,7 @@ public class QuickLoginScroll : MonoBehaviour
if (i == 0)
{
scroll.horizontalNormalizedPosition = startPos;
doAni(true);
return;
}
goMove(i);
@@ -112,6 +122,7 @@ public class QuickLoginScroll : MonoBehaviour
#if UNITY_ANDROID || UNITY_IOS
void goLeft()
{
startPos = scroll.horizontalNormalizedPosition;
if (scroll.horizontalNormalizedPosition <= 0 + 0.0001)
{
return;
@@ -120,6 +131,7 @@ public class QuickLoginScroll : MonoBehaviour
}
void goRight()
{
startPos = scroll.horizontalNormalizedPosition;
if (scroll.horizontalNormalizedPosition + 0.0001 >= 1)
{
return;
@@ -186,14 +198,20 @@ public class QuickLoginScroll : MonoBehaviour
string c;
if (i == index)
{
lightbg.GetComponent<Image>().gameObject.SetActive(true);
lightbg.GetComponent<Image>().DOFade(1, 0.2f);
content.GetChild(i).GetComponent<QuickLoginUser>().setActive();
doAni(true);
//
}
else
{
content.GetChild(i).GetComponent<QuickLoginUser>().setNoActive();
if (i < index)
{
content.GetChild(i).GetComponent<QuickLoginUser>().setNoActiveFunc(goLeft);
}
else
{
content.GetChild(i).GetComponent<QuickLoginUser>().setNoActiveFunc(goRight);
}
}
}
}
@@ -8,6 +8,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
@@ -100,18 +101,35 @@ public class QuickLoginUser : MonoBehaviour
//ColorUtility.TryParseHtmlString("#ffffffff", out Color color);
//transform.Find("Avatar").GetComponent<RawImage>().color = color;
transform.Find("Avatar").GetComponent<RawImage>().DOFade(1f, 0.3f);
#if UNITY_ANDROID || UNITY_IOS
transform.GetComponent<Button>().onClick.RemoveAllListeners();
transform.GetComponent<Button>().onClick.AddListener(goMain);
#else
transform.GetComponent<Button>().enabled = true;
#endif
transform.Find("NickNameText").GetComponent<Text>().DOFade(1f, 0.3f);
//transform.Find("NickNameText").GetComponent<Text>().enabled = true;
transform.Find("BtnDelete").GetComponent<Button>().gameObject.SetActive(true);
}
public void setNoActive()
{
//ColorUtility.TryParseHtmlString("#ffffff80", out Color color);
//transform.Find("Avatar").GetComponent<RawImage>().color = color;
transform.Find("Avatar").GetComponent<RawImage>().DOFade(0.5f, 0.3f);
#if !(UNITY_ANDROID || UNITY_IOS)
transform.GetComponent<Button>().enabled = false;
#endif
transform.Find("NickNameText").GetComponent<Text>().DOFade(0, 0.3f);//.enabled = false;
transform.Find("BtnDelete").GetComponent<Button>().gameObject.SetActive(false);
}
internal void setNoActiveFunc(UnityAction goScroll)
{
#if UNITY_ANDROID || UNITY_IOS
transform.GetComponent<Button>().onClick.RemoveAllListeners();
transform.GetComponent<Button>().onClick.AddListener(goScroll);
#endif
}
}
@@ -35,7 +35,6 @@ public class HomeController : PFUIPanel
protected override void Start()
{
base.Start();
mainNav = this.transform.Find("MainNav").GetComponent<MainNav>();
mainNav.ShowExit();
var BtnContainer = transform.Find("MainFuncContainer");
@@ -131,11 +130,19 @@ public class HomeController : PFUIPanel
#else
if (App.weChatController.isApplicationAvilible("com.zhixingpai.powerfun", "powerfun"))
{
Application.OpenURL("powerfun://app");
UIManager.ShowConfirm("Switch to PowerFun Workouts?", "We will close the Powerfun and start PowerFun Workouts.", () =>
{
UIManager.CloseConfirm();
Application.OpenURL("powerfun://app");
});
}
else
{
Application.OpenURL("http://www.powerfun.com/Download");
UIManager.ShowConfirm("未检测到应用", "是否前往官网下载?", () =>
{
UIManager.CloseConfirm();
Application.OpenURL("http://www.powerfun.com/Download");
});
}
#endif
}
@@ -60,14 +60,14 @@ public class MapListController : PFUIPanel
}
var mc = transform.Find("MC");
UIManager.AddEvent(transform.Find("Panel/BtnFilter").gameObject, EventTriggerType.PointerClick, b =>
UIManager.AddEvent(transform.Find("SwitchMode/BtnFilter").gameObject, EventTriggerType.PointerClick, b =>
{
topContainer.DOLocalMoveX(App.topRectStartX.Value - topRect.rect.width, 0.3f);
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 =>
UIManager.AddEvent(mc.gameObject, EventTriggerType.PointerClick, b =>
{
topContainer.DOLocalMoveX(App.topRectStartX.Value, 0.3f);
mc.GetComponent<CanvasGroup>().DOFade(0, 0.3f).onComplete = () =>
@@ -0,0 +1,47 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class BigLeftController : MonoBehaviour
{
public void OnPointerClick()
{
Debug.Log(11);
RouteItem route = transform.parent.GetComponent<RouteItem>();
if (route.enter)
{
route.OnPointerExit(null);
}
else
{
route.OnPointerEnter(null);
}
}
//public void OnPointerEnter(PointerEventData eventData)
//{
// transform.parent.GetComponent<RouteItem>().OnPointerEnter(eventData);
//}
//public void OnPointerExit(PointerEventData eventData)
//{
// transform.parent.GetComponent<RouteItem>().OnPointerExit(eventData);
//}
// Start is called before the first frame update
void Start()
{
transform.GetComponent<Button>().onClick.AddListener(() =>
{
OnPointerClick();
});
}
// Update is called once per frame
void Update()
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5b3ab3b02366c6242875fcd497f9958e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -8,16 +8,18 @@ using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler
public class RouteItem : MonoBehaviour
#if !(UNITY_ANDROID || UNITY_IOS)
,IPointerEnterHandler,IPointerExitHandler
#endif
{
RouteResult routeResult;
// Start is called before the first frame update
Transform left,row1,row2,right;
Transform left,row1,row2,right,rightDot;
Transform btnReRide, btnContinue, btnDelete;
Transform btnDetail;
void Start()
{
}
// Update is called once per frame
@@ -33,11 +35,11 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
{
routeResult = result;
this.index = index;
left = transform.Find("Left");
left = transform.Find("BigLeft/Left");
row1 = left.Find("Main").Find("Row1");
row2 = left.Find("Main").Find("Row2");
Utils.DisplayImage(transform.Find("CoverImage").GetComponent<RawImage>(), result.RouteImage, true);
Utils.DisplayImage(transform.Find("BigLeft/CoverImage").GetComponent<RawImage>(), result.RouteImage, true);
left.Find("Main").Find("Name").GetComponent<Text>().text = result.RouteName;
left.Find("Main").Find("Time").GetComponent<Text>().text = result.CreateTime.ToString("HH:mm:ss dd-MM-yyyy");
@@ -82,7 +84,7 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
{
//btnDelete.gameObject.SetActive(false);
//btnDelete.GetComponent<Button>().onClick.AddListener(Delete);
UIManager.AddEvent(btnDelete.gameObject, EventTriggerType.PointerClick, (b) => Delete());
UIManager.AddEvent(btnDelete.gameObject, EventTriggerType.PointerClick, (b) => Detail());
}
SetButtonColor(false);
transform.Find("RightMatch").gameObject.SetActive(false);
@@ -99,12 +101,21 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
SetButtonColor(false);
transform.Find("Right").gameObject.SetActive(false);
}
rightDot = transform.Find("RightDot");
if (rightDot != null)
{
UIManager.AddEvent(rightDot.Find("BtnDot").gameObject, EventTriggerType.PointerClick, (b) => OnPointerEnter(null));
UIManager.AddEvent(rightDot.Find("BtnDelete").gameObject, EventTriggerType.PointerClick, (b) => Delete());
}
//right.gameObject.SetActive(true);
#if !(UNITY_ANDROID || UNITY_IOS)
gameObject.GetComponent<Button>().onClick.AddListener(() =>
{
Detail();
});
#else
gameObject.GetComponent<Button>().enabled = false;
#endif
}
void Detail()
@@ -179,7 +190,7 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
}
});
}
#if !(UNITY_ANDROID||UNITY_IOS)
#if !(UNITY_ANDROID || UNITY_IOS)
void SetButtonColor(bool f)
{
if (routeResult!=null)
@@ -249,6 +260,7 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
}
}
#endif
public bool enter { get; private set; }
public void OnPointerExit(PointerEventData eventData)
{
transform.GetComponent<Image>().color = Utils.HexToColorHtml("#23232d");
@@ -274,6 +286,7 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
titleColor = "#414251";
SetButtonColor(false);
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
enter = false;
}
public void OnPointerEnter(PointerEventData eventData)
@@ -301,5 +314,6 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
titleColor = "#5c5c6e";
SetButtonColor(true);
Cursor.SetCursor(Resources.Load<Texture2D>("Images/PointerButtonHover"), Vector2.zero, CursorMode.Auto);
enter = true;
}
}
+1
View File
@@ -429,6 +429,7 @@ public class UIManager : MonoBehaviour
//panel.gameObject.AddComponent<GameObject>(panelToShow.gameObject);
//panelToShow.transform.SetParent(parent.transform);
parent.AddChild(panelToShow);
//panelToShow.gameObject.SetActive(true);
panelToShow.Show();