切换移动端暂存

This commit is contained in:
CaiYanPeng 2021-08-09 10:01:17 +08:00
parent f14a071179
commit ca91f45ef3
15 changed files with 201 additions and 46 deletions

View File

@ -12,10 +12,11 @@ public class MyBuildPostprocessor
{ {
//Debug.Log(pathToBuiltProject); //Debug.Log(pathToBuiltProject);
//System.IO.File.AppendAllText("D:\\test.txt",pathToBuiltProject); //System.IO.File.AppendAllText("D:\\test.txt",pathToBuiltProject);
#if !(UNITY_IOS || UNITY_ANDROID)
var dir = Path.GetDirectoryName(pathToBuiltProject); var dir = Path.GetDirectoryName(pathToBuiltProject);
File.Copy(dir + "\\PowerFun_Data\\Plugins\\x86_64\\ANT_WrappedLib.dll", dir + "\\PowerFun_Data\\Managed\\ANT_WrappedLib.dll"); File.Copy(dir + "\\PowerFun_Data\\Plugins\\x86_64\\ANT_WrappedLib.dll", dir + "\\PowerFun_Data\\Managed\\ANT_WrappedLib.dll");
File.Copy(dir + "\\PowerFun_Data\\Plugins\\x86_64\\DSI_CP210xManufacturing_3_1.dll", dir + "\\PowerFun_Data\\Managed\\DSI_CP210xManufacturing_3_1.dll"); File.Copy(dir + "\\PowerFun_Data\\Plugins\\x86_64\\DSI_CP210xManufacturing_3_1.dll", dir + "\\PowerFun_Data\\Managed\\DSI_CP210xManufacturing_3_1.dll");
File.Copy(dir + "\\PowerFun_Data\\Plugins\\x86_64\\DSI_SiUSBXp_3_1.dll", dir + "\\PowerFun_Data\\Managed\\DSI_SiUSBXp_3_1.dll"); File.Copy(dir + "\\PowerFun_Data\\Plugins\\x86_64\\DSI_SiUSBXp_3_1.dll", dir + "\\PowerFun_Data\\Managed\\DSI_SiUSBXp_3_1.dll");
#endif
} }
} }

View File

@ -1,4 +1,4 @@
#import <MapboxMobileEvents/MapboxMobileEvents.h> #import "MapboxMobileEvents/include/MapboxMobileEvents/MapboxMobileEvents.h"
void initialize(const char* accessToken, const char* userAgentBase, const char* hostSDKVersion) { void initialize(const char* accessToken, const char* userAgentBase, const char* hostSDKVersion) {
[[MMEEventsManager sharedManager] initializeWithAccessToken:[NSString stringWithUTF8String:accessToken] [[MMEEventsManager sharedManager] initializeWithAccessToken:[NSString stringWithUTF8String:accessToken]

View File

@ -8,7 +8,7 @@ FOUNDATION_EXPORT const unsigned char MapboxMobileEventsVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <MapboxMobileEvents/PublicHeader.h> // In this header, you should import all the public headers of your framework using statements like #import <MapboxMobileEvents/PublicHeader.h>
#import <MapboxMobileEvents/MMEConstants.h> #import <MMEConstants.h>
#import <MapboxMobileEvents/MMEEvent.h> #import <MMEEvent.h>
#import <MapboxMobileEvents/MMETypes.h> #import <MMETypes.h>
#import <MapboxMobileEvents/MMEEventsManager.h> #import <MMEEventsManager.h>

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6c0b73ecbec479c43a99fc8513bbf95b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<application>
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:theme="@style/UnityThemeSelector" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="powerfunx" android:host="app" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 506e447c8b55f0449ae2b5b5ed37dd99
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -5,7 +5,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Assets.Scripts.Apis namespace Assets.Scripts.Apis
{ {
internal class MapCompetitionApi : ApiBase internal class MapCompetitionApi : ApiBase

View File

@ -11,7 +11,7 @@ using Assets.Scripts.Devices;
public static class App public static class App
{ {
public static string Host = "http://192.168.0.101:5084/"; public static string Host = "http://192.168.0.101:5083/";
public static string AppVersion = Application.version; public static string AppVersion = Application.version;
@ -72,12 +72,12 @@ public static class App
static App() static App()
{ {
#if !UNITY_EDITOR #if !UNITY_EDITOR
// Host = "http://pf.juze.pro/"; Host = "http://pf.juze.pro/";
// UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21000); UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21000);
// TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21001); TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21001);
Host = "https://wx.powerfun.com.cn/"; //Host = "https://wx.powerfun.com.cn/";
UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 11000); //UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 11000);
TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 11001); //TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 11001);
#endif #endif
} }
} }

View File

@ -14,8 +14,10 @@ namespace Assets.Scripts.Devices
private List<DeviceAdapter> adapters = new List<DeviceAdapter>(); private List<DeviceAdapter> adapters = new List<DeviceAdapter>();
public MainDeviceAdapter() public MainDeviceAdapter()
{ {
#if !(UNITY_IOS || UNITY_ANDROID)
this.CreateAntAdapter(); this.CreateAntAdapter();
this.CreateBleAdapter(); this.CreateBleAdapter();
#endif
} }
private void CreateAntAdapter() private void CreateAntAdapter()

View File

@ -21,7 +21,9 @@ using UnityEngine.Events;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
using UnityEngine.UI; using UnityEngine.UI;
#if !(UNITY_IOS || UNITY_ANDROID)
using ZenFulcrum.EmbeddedBrowser; using ZenFulcrum.EmbeddedBrowser;
#endif
//记录小f 是-457和-681 //记录小f 是-457和-681
public class QUserInfo public class QUserInfo
@ -86,7 +88,9 @@ public class LoginController : MonoBehaviour
//注册主页面 //注册主页面
private UserResultModel userResult; private UserResultModel userResult;
/*微信相关*/ /*微信相关*/
#if !(UNITY_IOS || UNITY_ANDROID)
private Browser wxBrowser; private Browser wxBrowser;
#endif
private string wxState; private string wxState;
private Transform wxLogin1; private Transform wxLogin1;
private Transform wxLogin2; private Transform wxLogin2;
@ -252,6 +256,7 @@ public class LoginController : MonoBehaviour
var wechatLogin = loginContainer.Find("otherContainer").Find("Wechat").GetComponent<Button>(); var wechatLogin = loginContainer.Find("otherContainer").Find("Wechat").GetComponent<Button>();
UIManager.AddEvent(wechatLogin.gameObject, EventTriggerType.PointerClick, (b) => UIManager.AddEvent(wechatLogin.gameObject, EventTriggerType.PointerClick, (b) =>
{ {
#if !(UNITY_IOS || UNITY_ANDROID)
if (wxLock) return; if (wxLock) return;
wxLock = true; wxLock = true;
//wxState = (DateTime.Now.ToUniversalTime().Ticks / 10000 * new System.Random().Next(1, 5)).ToString(); //wxState = (DateTime.Now.ToUniversalTime().Ticks / 10000 * new System.Random().Next(1, 5)).ToString();
@ -269,7 +274,7 @@ public class LoginController : MonoBehaviour
//Debug.Log(178 + "已经开启" + wx1.gameObject.activeSelf); //Debug.Log(178 + "已经开启" + wx1.gameObject.activeSelf);
//wx1.GetComponent<CanvasGroup>().DOFade(1, 0.8f).onComplete = () => { wxLock = false; }; //wx1.GetComponent<CanvasGroup>().DOFade(1, 0.8f).onComplete = () => { wxLock = false; };
wxLogin1.DOLocalMoveY(0, 0.3f).onComplete = () => { wxLock = false; }; wxLogin1.DOLocalMoveY(0, 0.3f).onComplete = () => { wxLock = false; };
#endif
}); });
var login = loginContainer.Find("login").GetComponent<Button>(); var login = loginContainer.Find("login").GetComponent<Button>();
@ -311,6 +316,7 @@ public class LoginController : MonoBehaviour
{ {
wxReturnLogin(); wxReturnLogin();
}); });
#if !(UNITY_IOS || UNITY_ANDROID)
wxBrowser = wxLogin1.Find("Browser (GUI)").GetComponent<Browser>(); wxBrowser = wxLogin1.Find("Browser (GUI)").GetComponent<Browser>();
if (wxBrowser != null) if (wxBrowser != null)
{ {
@ -333,6 +339,7 @@ public class LoginController : MonoBehaviour
//browser.Zoom = 0.5f; //browser.Zoom = 0.5f;
//browser. //browser.
} }
#endif
} }
wxLogin2 = mainContent.Find("FormContainer-wx2"); wxLogin2 = mainContent.Find("FormContainer-wx2");
if (wxLogin2 != null) if (wxLogin2 != null)
@ -519,6 +526,7 @@ public class LoginController : MonoBehaviour
/// </summary> /// </summary>
private void AdjustWxQrCode() private void AdjustWxQrCode()
{ {
#if !(UNITY_IOS || UNITY_ANDROID)
wxBrowser.EvalJSCSP(@" wxBrowser.EvalJSCSP(@"
document.getElementsByClassName('qrcode')[0].style.marginTop = 0; document.getElementsByClassName('qrcode')[0].style.marginTop = 0;
document.getElementsByClassName('title')[0].style.display = 'none'; document.getElementsByClassName('title')[0].style.display = 'none';
@ -528,8 +536,11 @@ public class LoginController : MonoBehaviour
document.body.style.transformOrigin = 'top left'; document.body.style.transformOrigin = 'top left';
document.body.style.transform = 'scale(0.85106382978)'; document.body.style.transform = 'scale(0.85106382978)';
document.body.style.padding = '0';").Done(); document.body.style.padding = '0';").Done();
#endif
} }
//浏览器加载回调 //浏览器加载回调
#if !(UNITY_IOS || UNITY_ANDROID)
private async void OnUserScan() private async void OnUserScan()
{ {
if (wxBrowser.Url.Contains("qrconnect")) if (wxBrowser.Url.Contains("qrconnect"))
@ -590,7 +601,9 @@ public class LoginController : MonoBehaviour
} }
} }
} }
}
}
#endif
private void goThirdNext() private void goThirdNext()
{ {
this.StartScrollPanel(4); this.StartScrollPanel(4);
@ -605,7 +618,7 @@ public class LoginController : MonoBehaviour
{ {
} }
#region #region
int time = 0; int time = 0;
float timer = 0f; float timer = 0f;
bool startCaptcha = false; bool startCaptcha = false;
@ -644,7 +657,7 @@ public class LoginController : MonoBehaviour
Utils.SetValidate(signFormDict, r.errFieldMsg); Utils.SetValidate(signFormDict, r.errFieldMsg);
} }
} }
#endregion #endregion
void CaptchaTimerTick() void CaptchaTimerTick()
{ {
@ -882,7 +895,9 @@ public class LoginController : MonoBehaviour
void wxReturnLogin() void wxReturnLogin()
{ {
wxLock = true; wxLock = true;
#if !(UNITY_IOS || UNITY_ANDROID)
wxBrowser.LoadHTML("<div/>"); wxBrowser.LoadHTML("<div/>");
#endif
//wxBrowser.Url = "chrome://version/"; //wxBrowser.Url = "chrome://version/";
wxLogin1.DOLocalMoveY(-573, 0.3f).onComplete = () => wxLogin1.DOLocalMoveY(-573, 0.3f).onComplete = () =>
{ {
@ -1178,7 +1193,7 @@ public class LoginController : MonoBehaviour
} }
//float adjTime = 0; //float adjTime = 0;
//bool startJs = false; //bool startJs = false;
#region #region
private int tmpImdex = 0; private int tmpImdex = 0;
private int scrollPanelIndex = 2; private int scrollPanelIndex = 2;
//private float scrollValue = 0.5f; //private float scrollValue = 0.5f;
@ -1217,9 +1232,9 @@ public class LoginController : MonoBehaviour
} }
} }
} }
#endregion #endregion
#region #region
private bool startScrollSign = false; private bool startScrollSign = false;
private int scrollSignIndex = 0; private int scrollSignIndex = 0;
@ -1285,5 +1300,5 @@ public class LoginController : MonoBehaviour
} }
} }
} }
#endregion #endregion
} }

View File

@ -175,9 +175,9 @@ namespace Assets.Scenes.Ride.Scripts
protected virtual void StartRide(BaseEventData baseEvent) protected virtual void StartRide(BaseEventData baseEvent)
{ {
var checkAnt = cyclingController.CheckAnt(); var checkAnt = cyclingController.CheckAnt();
#if UNITY_EDITOR //#if UNITY_EDITOR
checkAnt = true; checkAnt = true;
#endif //#endif
if (!checkAnt && !cyclingController.isWatch) if (!checkAnt && !cyclingController.isWatch)
{ {
var alert = (GameObject)Instantiate(Resources.Load("UI/Prefab/Ride/Alert"), panel.transform); var alert = (GameObject)Instantiate(Resources.Load("UI/Prefab/Ride/Alert"), panel.transform);

View File

@ -55,9 +55,9 @@ namespace Assets.Scenes.Ride.Scripts
cadance = mainController.UpdateCadence(); cadance = mainController.UpdateCadence();
weight = App.CurrentUser.Weight; weight = App.CurrentUser.Weight;
bicycleWeight = App.CurrentUser.BicycleWeight; bicycleWeight = App.CurrentUser.BicycleWeight;
#if UNITY_EDITOR //#if UNITY_EDITOR
power = 500; power = 500;
#endif //#endif
mainController.TrackResistance(currentSlope * App.RideSetting.Sensitivity / 100); mainController.TrackResistance(currentSlope * App.RideSetting.Sensitivity / 100);
} }
catch (Exception ex) catch (Exception ex)

View File

@ -53,20 +53,8 @@ public class HomeController : PFUIPanel
BtnTraining = BtnContainer.Find("BtnTraining"); BtnTraining = BtnContainer.Find("BtnTraining");
UIManager.AddEvent(BtnTraining.gameObject, EventTriggerType.PointerClick, (e) => UIManager.AddEvent(BtnTraining.gameObject, EventTriggerType.PointerClick, (e) =>
{ {
var path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\PowerFun\Rhino.PowerFun.exe"; Debug.Log(Application.platform);
//Debug.Log(System.IO.File.Exists(path + )); goTraining(e);
if (!System.IO.File.Exists(path))
{
//TODO: auto update
UIManager.ShowDownloadWorkoutsPanel();
//Application.OpenURL("https://powerfun.oss-cn-shanghai.aliyuncs.com/Releases/PowerFunWorkouts.exe");
return;
}
UIManager.ShowConfirm("Switch to PowerFun Workouts?", "We will close the Powerfun and start PowerFun Workouts.", () =>
{
Utils.ExecFile(path);
Application.Quit();
});
}); });
UIManager.AddEvent(BtnTraining.gameObject, EventTriggerType.PointerEnter, OnHover); UIManager.AddEvent(BtnTraining.gameObject, EventTriggerType.PointerEnter, OnHover);
UIManager.AddEvent(BtnTraining.gameObject, EventTriggerType.PointerExit, OnExit); UIManager.AddEvent(BtnTraining.gameObject, EventTriggerType.PointerExit, OnExit);
@ -117,6 +105,27 @@ public class HomeController : PFUIPanel
} }
OnExit(e); OnExit(e);
} }
void goTraining(BaseEventData e)
{
#if !(UNITY_IOS || UNITY_ANDROID)
var path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\PowerFun\Rhino.PowerFun.exe";
//Debug.Log(System.IO.File.Exists(path + ));
if (!System.IO.File.Exists(path))
{
//TODO: auto update
UIManager.ShowDownloadWorkoutsPanel();
//Application.OpenURL("https://powerfun.oss-cn-shanghai.aliyuncs.com/Releases/PowerFunWorkouts.exe");
return;
}
UIManager.ShowConfirm("Switch to PowerFun Workouts?", "We will close the Powerfun and start PowerFun Workouts.", () =>
{
Utils.ExecFile(path);
Application.Quit();
});
#else
Application.OpenURL("powerfun://app");
#endif
}
//进入比赛 //进入比赛
private void GoMatch(BaseEventData e) private void GoMatch(BaseEventData e)
{ {

View File

@ -38,6 +38,7 @@ GraphicsSettings:
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16003, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: [] m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0} type: 0}

View File

@ -8,7 +8,7 @@ PlayerSettings:
AndroidProfiler: 0 AndroidProfiler: 0
AndroidFilterTouchesWhenObscured: 0 AndroidFilterTouchesWhenObscured: 0
AndroidEnableSustainedPerformanceMode: 0 AndroidEnableSustainedPerformanceMode: 0
defaultScreenOrientation: 4 defaultScreenOrientation: 3
targetDevice: 2 targetDevice: 2
useOnDemandResources: 0 useOnDemandResources: 0
accelerometerFrequency: 60 accelerometerFrequency: 60
@ -78,7 +78,7 @@ PlayerSettings:
macRetinaSupport: 1 macRetinaSupport: 1
runInBackground: 1 runInBackground: 1
captureSingleScreen: 0 captureSingleScreen: 0
muteOtherAudioSources: 0 muteOtherAudioSources: 1
Prepare IOS For Recording: 0 Prepare IOS For Recording: 0
Force IOS Speakers When Recording: 0 Force IOS Speakers When Recording: 0
deferSystemGesturesMode: 0 deferSystemGesturesMode: 0
@ -179,7 +179,7 @@ PlayerSettings:
applicationIdentifier: {} applicationIdentifier: {}
buildNumber: {} buildNumber: {}
AndroidBundleVersionCode: 1 AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 19 AndroidMinSdkVersion: 24
AndroidTargetSdkVersion: 0 AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1 AndroidPreferredInstallLocation: 1
aotOptions: aotOptions:
@ -234,7 +234,8 @@ PlayerSettings:
iOSUseLaunchScreenStoryboard: 0 iOSUseLaunchScreenStoryboard: 0
iOSLaunchScreenCustomStoryboardPath: iOSLaunchScreenCustomStoryboardPath:
iOSDeviceRequirements: [] iOSDeviceRequirements: []
iOSURLSchemes: [] iOSURLSchemes:
- powerfunx
iOSBackgroundModes: 0 iOSBackgroundModes: 0
iOSMetalForceHardShadows: 0 iOSMetalForceHardShadows: 0
metalEditorSupport: 1 metalEditorSupport: 1
@ -322,7 +323,99 @@ PlayerSettings:
m_Width: 128 m_Width: 128
m_Height: 128 m_Height: 128
m_Kind: 0 m_Kind: 0
m_BuildTargetPlatformIcons: [] m_BuildTargetPlatformIcons:
- m_BuildTarget: Android
m_Icons:
- m_Textures: []
m_Width: 432
m_Height: 432
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 324
m_Height: 324
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 216
m_Height: 216
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 162
m_Height: 162
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 108
m_Height: 108
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 81
m_Height: 81
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 192
m_Height: 192
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 144
m_Height: 144
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 96
m_Height: 96
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 72
m_Height: 72
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 48
m_Height: 48
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 36
m_Height: 36
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 192
m_Height: 192
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 144
m_Height: 144
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 96
m_Height: 96
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 72
m_Height: 72
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 48
m_Height: 48
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 36
m_Height: 36
m_Kind: 1
m_SubKind:
m_BuildTargetBatching: m_BuildTargetBatching:
- m_BuildTarget: Standalone - m_BuildTarget: Standalone
m_StaticBatching: 1 m_StaticBatching: 1
@ -637,7 +730,8 @@ PlayerSettings:
webGLThreadsSupport: 0 webGLThreadsSupport: 0
webGLWasmStreaming: 0 webGLWasmStreaming: 0
scriptingDefineSymbols: {} scriptingDefineSymbols: {}
platformArchitecture: {} platformArchitecture:
iPhone: 1
scriptingBackend: scriptingBackend:
Standalone: 0 Standalone: 0
il2cppCompilerConfiguration: il2cppCompilerConfiguration:
@ -651,7 +745,9 @@ PlayerSettings:
assemblyVersionValidation: 1 assemblyVersionValidation: 1
gcWBarrierValidation: 0 gcWBarrierValidation: 0
apiCompatibilityLevelPerPlatform: apiCompatibilityLevelPerPlatform:
Android: 3
Standalone: 3 Standalone: 3
iPhone: 3
m_RenderingPath: 1 m_RenderingPath: 1
m_MobileRenderingPath: 1 m_MobileRenderingPath: 1
metroPackageName: Template_3D metroPackageName: Template_3D