This commit is contained in:
Caiyanpeng committed 2021-08-26 15:49:06 +08:00
1 parent 723c881790
commit f21b83697b
18 files changed
+1912 -1386

No files matched your search

+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", "");
+23 -9
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
}
@@ -77,12 +78,25 @@ public class WeChatController
}
/// <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);
#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);
+6 -1
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;
@@ -24,7 +25,7 @@ public class MainController : BaseScene
#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("ModalPanel").GetComponent<RectTransform>().sizeDelta = new Vector2(844, 390);
//transform.Find("ModalPanel").GetComponent<RectTransform>().sizeDelta = new Vector2(844, 390);
#endif
App.MainDeviceAdapter.StartScan();
}
@@ -35,6 +36,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)
//{
+5 -1
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
@@ -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;
@@ -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
}
//进入比赛
@@ -29,6 +29,9 @@ public class ResultListController : PFUIPanel
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 : PFUIPanel
}
scroll.transform.Find("Error").gameObject.SetActive(contents[scrollIndex].childCount == 0);
}
#region 主页面滑动逻辑
#region 主页面滑动逻辑
int scrollIndex = 0;
bool startScroll = false;
ScrollRect scroll;
@@ -296,7 +299,6 @@ public class ResultListController : PFUIPanel
var value = index * scrollValue;
if (scroll != null && startScroll)
{
#if (UNITY_ANDROID || UNITY_IOS)
if (scroll.horizontalNormalizedPosition >= value)
{
scroll.horizontalNormalizedPosition -= (scrollValue / 20);
@@ -317,30 +319,6 @@ public class ResultListController : PFUIPanel
startScroll = false;
}
}
#else
//if (scroll.verticalNormalizedPosition <= 1)
//{
// scroll.verticalNormalizedPosition =0;
// Debug.Log($"{scroll.verticalNormalizedPosition},{scrollValue/20}");
// if (scroll.verticalNormalizedPosition <= 0)
// {
// Debug.Log(index);
// scroll.verticalNormalizedPosition = 0;
// startScroll = false;
// }
//}
//else
//{
// scroll.verticalNormalizedPosition += (scrollValue / 20);
// Debug.Log($"反向:{scroll.verticalNormalizedPosition},{scrollValue / 20}");
// if (scroll.verticalNormalizedPosition >= 1)
// {
// Debug.Log(index);
// scroll.verticalNormalizedPosition = 1;
// startScroll = false;
// }
//}
#endif
}
}
#endregion
@@ -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()
{