AR初版demo

This commit is contained in:
lishuo committed 2022-03-04 16:12:15 +08:00
1 parent c1c93c2a60
commit e85d5f8613
82 files changed
+4010 -62

No files matched your search

@@ -67,6 +67,16 @@ namespace Assets.Scripts.Apis.Models
this.CalcGrade();
this.CalcBbox();
this.CalcCenter();
this.CalcBearing();
}
}
private void CalcBearing()
{
for (int i = 0; i < _List.Count - 1; i++)
{
var pt1 = Turf.Point(new double[] { _List[i].Point[1], _List[i].Point[0] });
var pt2 = Turf.Point(new double[] { _List[i + 1].Point[1], _List[i + 1].Point[0] });
_List[i].Bearing = Turf.Bearing(pt1, pt2);
}
}
@@ -157,6 +167,7 @@ namespace Assets.Scripts.Apis.Models
public double Elevation { get; set; }
public double Grade { get; set; }
public double Bearing { get; set; }
}
public override string ToString()
+23 -20
View File
@@ -201,28 +201,31 @@ public static class App
static App()
{
InitLanguage();
#if !UNITY_EDITOR
//测试服务器
Host = "http://pf.juze.pro/";
UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21000);
TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21001);
//线上
//Host = "https://wx.powerfun.com.cn/";
//UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 11000);
//TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 11001);
//本地
//Host = "http://192.168.0.101:5085/";
//UdpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.97"), 11000);
//TcpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.102"), 21001);
Debug.unityLogger.logEnabled = false;
#else
//Host = "http://pf.juze.pro/";
//Host = "http://192.168.0.101:5087/";
Host = "https://wx.powerfun.com.cn/";
UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 11000);
TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 11001);
//UdpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.102"), 21001);
//TcpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.102"), 21001);
#endif
//#if !UNITY_EDITOR
// //测试服务器
// Host = "http://pf.juze.pro/";
// UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21000);
// TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21001);
// //线上
// //Host = "https://wx.powerfun.com.cn/";
// //UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 11000);
// //TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 11001);
// //本地
// //Host = "http://192.168.0.101:5085/";
// //UdpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.97"), 11000);
// //TcpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.102"), 21001);
// Debug.unityLogger.logEnabled = false;
//#else
// //Host = "http://pf.juze.pro/";
// //Host = "http://192.168.0.101:5087/";
// UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 11000);
// TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 11001);
// //UdpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.102"), 21001);
// //TcpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.102"), 21001);
//#endif
if (!FB.IsInitialized)
{
FB.Init();
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b10ceda9bec25b14ea5e190eb9bb0341
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -61,6 +61,14 @@ public static class PFConstants
}
}
public static string VideoFolder
{
get
{
return Application.persistentDataPath+@"/video";
}
}
public static string LogFolder
{
get
+47
View File
@@ -13,6 +13,7 @@ using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;
using UnityEngine.Video;
namespace Assets.Scripts
{
@@ -461,6 +462,52 @@ namespace Assets.Scripts
}
}
}
//下载video
public static IEnumerator DownloadVideo(string fileName,string url, UnityAction<float, UnityWebRequest> onProcessing = null, UnityAction<string> onCompleted = null)
{
string local = "";
var path = PFConstants.VideoFolder;
//根据id读取本地文件
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
var filepath= path+$"/{fileName}.mp4";
if (File.Exists(filepath))
{
local = filepath;
}
//本地文件读取不到读取网络文件
else
{
UnityWebRequest request = UnityWebRequest.Get(url);
request.SendWebRequest();
while (!request.isDone)
{
if (onProcessing != null)
{
onProcessing.Invoke(request.downloadProgress, request);
}
yield return new WaitForSeconds(1);
}
if (request.isNetworkError || request.isHttpError)
{
Debug.Log(request.error);
}
else
{
var fs = File.Create(filepath);
fs.Write(request.downloadHandler.data, 0, request.downloadHandler.data.Length);
fs.Close();
local = filepath;
}
}
if (onCompleted != null)
{
onCompleted.Invoke(local);
}
}
static IEnumerator DownloadImage(MaskableGraphic img,string MediaUrl, Action<Texture> action = null,UnityAction<byte[]> callback = null)
{
UnityWebRequest request = UnityWebRequest.Get(MediaUrl);