Compare commits

...
10 changed files with 1353 additions and 1289 deletions

No files matched your search

+1315 -1272
View File
File diff suppressed because it is too large. Load diff
+1 -2
View File
@@ -54,7 +54,7 @@ public static class App
public static IDictionary<string, Texture> TextureCache = new Dictionary<string, Texture>(); public static IDictionary<string, Texture> TextureCache = new Dictionary<string, Texture>();
public static Texture CurrentUserHeadTexture; public static Texture CurrentUserHeadTexture;
public static RouteResult routeResult;//骑行记录向骑行场景传值 public static RouteResult routeResult;//骑行记录向骑行场景传值
public static Texture DefaultRotateTexture; public static Texture DefaultRotateTexture { get; set; }
//全局用 输入框或者下拉框修改标志位 //全局用 输入框或者下拉框修改标志位
public static bool isChanged { get; set; } public static bool isChanged { get; set; }
public static string notifyContent { get; internal set; } public static string notifyContent { get; internal set; }
@@ -109,7 +109,6 @@ public static class App
//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/";
//Host = "http://192.168.0.101:5084/";
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);
Debug.unityLogger.logEnabled = false; Debug.unityLogger.logEnabled = false;
+1 -1
View File
@@ -611,7 +611,7 @@ public class LoginController : BaseScene
//} //}
Debug.Log(JsonConvert.SerializeObject(locationInfo)); Debug.Log(JsonConvert.SerializeObject(locationInfo));
var i = await ConfigHelper.thirdPartApi.GetMapImage(locationInfo); var i = await ConfigHelper.thirdPartApi.GetMapImage(locationInfo);
var t = new Texture2D(4, 4,TextureFormat.DXT5, false); var t = new Texture2D(2, 2, TextureFormat.DXT5, false);
if (t.LoadImage(Utils.StreamToBytes(i))) if (t.LoadImage(Utils.StreamToBytes(i)))
{ {
Debug.Log("成功"); Debug.Log("成功");
@@ -510,7 +510,7 @@ public class CyclingController : DeviceServiceMonoBase
#if UNITY_EDITOR #if UNITY_EDITOR
check = true; check = true;
#endif #endif
if (check) if (check || isWatch)
{ {
singleUIManager.StartRide(); singleUIManager.StartRide();
transform.Find("UI/Panel(Clone)/ToolBarPanel/StartOrPauseButton").GetComponent<Button>().enabled = true; transform.Find("UI/Panel(Clone)/ToolBarPanel/StartOrPauseButton").GetComponent<Button>().enabled = true;
@@ -521,7 +521,7 @@ public class CyclingController : DeviceServiceMonoBase
transform.Find("UI/Panel(Clone)/ToolBarPanel/StartOrPauseButton").GetComponent<Button>().enabled = false; transform.Find("UI/Panel(Clone)/ToolBarPanel/StartOrPauseButton").GetComponent<Button>().enabled = false;
transform.Find("UI/Panel(Clone)/ToolBarPanel/SettingButton").GetComponent<Button>().enabled = false; transform.Find("UI/Panel(Clone)/ToolBarPanel/SettingButton").GetComponent<Button>().enabled = false;
Utils.showToast(null, "Please connect the device!", duration: int.MaxValue, isLowest: true Utils.showToast(null, "Please connect the device!", duration: int.MaxValue, isLowest: true
, stopFunc: () => !(!CheckAnt() && !isWatch) || transform.Find("UI/Panel(Clone)/SelectPlayer").gameObject.activeInHierarchy , stopFunc: () => isWatch || CheckAnt() || transform.Find("UI/Panel(Clone)/SelectPlayer").gameObject.activeInHierarchy
, endCallback: () => , endCallback: () =>
{ {
if (!transform.Find("UI/Panel(Clone)/SelectPlayer").gameObject.activeInHierarchy) if (!transform.Find("UI/Panel(Clone)/SelectPlayer").gameObject.activeInHierarchy)
@@ -61,7 +61,7 @@ namespace Assets.Scenes.Ride.Scripts
weight = App.CurrentUser.Weight; weight = App.CurrentUser.Weight;
bicycleWeight = App.CurrentUser.BicycleWeight; bicycleWeight = App.CurrentUser.BicycleWeight;
#if UNITY_EDITOR #if UNITY_EDITOR
power = 343; power = 143;
#endif #endif
mainController.TrackResistance(currentSlope * App.RideSetting.Sensitivity / 100); mainController.TrackResistance(currentSlope * App.RideSetting.Sensitivity / 100);
} }
@@ -70,10 +70,12 @@ public class DeviceView : MonoBehaviour
mSearchButton = unconnectionPanel.transform.Find("SearchButton").gameObject; mSearchButton = unconnectionPanel.transform.Find("SearchButton").gameObject;
mPairButton = unconnectionPanel.transform.Find("PairButton").gameObject; mPairButton = unconnectionPanel.transform.Find("PairButton").gameObject;
searchState = unconnectionPanel.transform.Find("SearchState").GetComponent<Text>(); searchState = unconnectionPanel.transform.Find("SearchState").GetComponent<Text>();
unconnectionButton = unconnectionPanel.GetComponent<Button>();
mPairButton.SetActive(false); mPairButton.SetActive(false);
connectionPanel = this.transform.Find("ConnectionPanel").gameObject; connectionPanel = this.transform.Find("ConnectionPanel").gameObject;
#if UNITY_IOS || UNITY_ANDROID
unconnectionButton = unconnectionPanel.GetComponent<Button>();
connectionButton = connectionPanel.GetComponent<Button>(); connectionButton = connectionPanel.GetComponent<Button>();
#endif
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial")); var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
var rect = ((RectTransform)transform).rect; var rect = ((RectTransform)transform).rect;
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height * 0.2f, 0)); material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height * 0.2f, 0));
@@ -125,7 +127,7 @@ public class DeviceView : MonoBehaviour
title.text = GetTitle(); title.text = GetTitle();
connectionPanel.SetActive(false); connectionPanel.SetActive(false);
#if UNITY_IOS || UNITY_ANDROID
UIManager.AddEvent(unconnectionButton.gameObject, EventTriggerType.PointerClick, new UnityAction<UnityEngine.EventSystems.BaseEventData>(e => UIManager.AddEvent(unconnectionButton.gameObject, EventTriggerType.PointerClick, new UnityAction<UnityEngine.EventSystems.BaseEventData>(e =>
{ {
if (!mPairButton.activeSelf) if (!mPairButton.activeSelf)
@@ -134,13 +136,13 @@ public class DeviceView : MonoBehaviour
} }
connectButtonClick(); connectButtonClick();
})); }));
#endif
UIManager.AddEvent(mPairButton, EventTriggerType.PointerClick, new UnityAction<UnityEngine.EventSystems.BaseEventData>(e => UIManager.AddEvent(mPairButton, EventTriggerType.PointerClick, new UnityAction<UnityEngine.EventSystems.BaseEventData>(e =>
{ {
connectButtonClick(); connectButtonClick();
})); }));
#if UNITY_IOS || UNITY_ANDROID
UIManager.AddEvent(connectionButton.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e => { UIManager.AddEvent(connectionButton.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e => {
if (!connectionPanel.activeSelf) if (!connectionPanel.activeSelf)
{ {
@@ -148,6 +150,7 @@ public class DeviceView : MonoBehaviour
} }
mDisconnectButtonClick(); mDisconnectButtonClick();
})); }));
#endif
UIManager.AddEvent(mDisconnectButton, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e => { UIManager.AddEvent(mDisconnectButton, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e => {
@@ -283,6 +286,7 @@ public class DeviceView : MonoBehaviour
else { else {
hasDevice = App.MainDeviceAdapter.GetDevices().Any(d => d.Sensor == SensorType); hasDevice = App.MainDeviceAdapter.GetDevices().Any(d => d.Sensor == SensorType);
} }
Debug.Log(hasDevice);
if (hasDevice) if (hasDevice)
{ {
mSearchButton.SetActive(false); mSearchButton.SetActive(false);
+20 -1
View File
@@ -432,10 +432,29 @@ namespace Assets.Scripts
} }
/*获取最顶层对象*/ /*获取最顶层对象*/
/*Texture相关*/ /*Texture相关*/
public static Texture2D DeCompress(this Texture2D source)
{
RenderTexture renderTex = RenderTexture.GetTemporary(
source.width,
source.height,
0,
RenderTextureFormat.Default,
RenderTextureReadWrite.Linear);
Graphics.Blit(source, renderTex);
RenderTexture previous = RenderTexture.active;
RenderTexture.active = renderTex;
Texture2D readableText = new Texture2D(source.width, source.height);
readableText.ReadPixels(new Rect(0, 0, renderTex.width, renderTex.height), 0, 0);
readableText.Apply();
RenderTexture.active = previous;
RenderTexture.ReleaseTemporary(renderTex);
return readableText;
}
public static void WriteTextureToPlayerPrefs(string tag, Texture2D tex) public static void WriteTextureToPlayerPrefs(string tag, Texture2D tex)
{ {
// if texture is png otherwise you can use tex.EncodeToJPG(). // if texture is png otherwise you can use tex.EncodeToJPG().
byte[] texByte = tex.EncodeToPNG(); byte[] texByte = tex.DeCompress().EncodeToJPG();
// convert byte array to base64 string // convert byte array to base64 string
string base64Tex = System.Convert.ToBase64String(texByte); string base64Tex = System.Convert.ToBase64String(texByte);
+2 -2
View File
@@ -6,8 +6,8 @@ EditorBuildSettings:
serializedVersion: 2 serializedVersion: 2
m_Scenes: m_Scenes:
- enabled: 1 - enabled: 1
path: Assets/Scenes/Login-Mobile.unity path: Assets/Scenes/Login.unity
guid: 4be878da00cf764499988cf403faf94d guid: 6dce3e17997730b4492f91dd8fede429
- enabled: 1 - enabled: 1
path: Assets/Scenes/MainScene.unity path: Assets/Scenes/MainScene.unity
guid: ab586a3c1bacd4a48a55178eb06fe0cc guid: ab586a3c1bacd4a48a55178eb06fe0cc
-1
View File
@@ -38,7 +38,6 @@ 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}
+3 -3
View File
@@ -86,7 +86,7 @@ PlayerSettings:
submitAnalytics: 1 submitAnalytics: 1
usePlayerLog: 1 usePlayerLog: 1
bakeCollisionMeshes: 0 bakeCollisionMeshes: 0
forceSingleInstance: 0 forceSingleInstance: 1
useFlipModelSwapchain: 1 useFlipModelSwapchain: 1
resizableWindow: 0 resizableWindow: 0
useMacAppStoreValidation: 0 useMacAppStoreValidation: 0
@@ -133,7 +133,7 @@ PlayerSettings:
16:10: 1 16:10: 1
16:9: 1 16:9: 1
Others: 1 Others: 1
bundleVersion: 2.0.7 bundleVersion: 2.0.8
preloadedAssets: [] preloadedAssets: []
metroInputSource: 0 metroInputSource: 0
wsaTransparentSwapchain: 0 wsaTransparentSwapchain: 0
@@ -180,7 +180,7 @@ PlayerSettings:
Android: com.ZhiXingPai.PowerFunUnity Android: com.ZhiXingPai.PowerFunUnity
buildNumber: buildNumber:
iPhone: 2.0.7.0 iPhone: 2.0.7.0
AndroidBundleVersionCode: 9 AndroidBundleVersionCode: 10
AndroidMinSdkVersion: 24 AndroidMinSdkVersion: 24
AndroidTargetSdkVersion: 30 AndroidTargetSdkVersion: 30
AndroidPreferredInstallLocation: 1 AndroidPreferredInstallLocation: 1