小地图进度微调,人物脚本调整
This commit is contained in:
parent
8ca32cd1ae
commit
2b4b2c4f70
BIN
Assets/Resources/Images/Ride/180-4.png
Normal file
BIN
Assets/Resources/Images/Ride/180-4.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.6 KiB |
104
Assets/Resources/Images/Ride/180-4.png.meta
Normal file
104
Assets/Resources/Images/Ride/180-4.png.meta
Normal file
@ -0,0 +1,104 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e07adf02a73867743949dd36e7f9e063
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Images/Ride/180-5.png
Normal file
BIN
Assets/Resources/Images/Ride/180-5.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
104
Assets/Resources/Images/Ride/180-5.png.meta
Normal file
104
Assets/Resources/Images/Ride/180-5.png.meta
Normal file
@ -0,0 +1,104 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0debc94c2a8d76d44ac15330e14f5d71
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f05d75ce4fddbb4785a5a8fa4f14a8e
|
||||
guid: 8208f8b53f7e57448be43b690ca06014
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
[SerializeField]
|
||||
Animator characterAnimator;
|
||||
|
||||
AbstractMap map;
|
||||
protected AbstractMap map;
|
||||
//AbstractMap map;
|
||||
|
||||
#region 动画控制参数
|
||||
@ -105,7 +105,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
timer -= Time.deltaTime;
|
||||
if (timer <= 0)//定时器 一秒执行一次
|
||||
{
|
||||
SendTcp();
|
||||
BeforeRun();
|
||||
Run();
|
||||
timer = 1.0f;
|
||||
}
|
||||
@ -126,12 +126,12 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
|
||||
//开始骑行
|
||||
if (mainController.isStart)
|
||||
if (GetStart())
|
||||
{
|
||||
//计算累计爬升
|
||||
if (index > 0)
|
||||
{
|
||||
totalClimb = 0;
|
||||
//计算累计爬升
|
||||
for (int i = 1; i <= index; i++)
|
||||
{
|
||||
var diff = mapData.List[i].Elevation - mapData.List[i - 1].Elevation;
|
||||
@ -155,17 +155,23 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//数据处理
|
||||
|
||||
nextPos = map.GeoToWorldPosition(currentlatlong);//下一个点
|
||||
nextPos.y += 1.15f;//提高y轴让人物站在地图上面
|
||||
nextPos.y += 1.35f;//提高y轴让人物站在地图上面
|
||||
prePos = transform.localPosition;//当前点
|
||||
thisRotation = transform.localRotation;
|
||||
//移动动画控制
|
||||
if (distance > 0)
|
||||
//if (distance > 0)
|
||||
{
|
||||
Debug.Log("164"+totalDistance.ToString());
|
||||
StartCoroutine(MoveTo());//移动
|
||||
}
|
||||
}
|
||||
}
|
||||
protected virtual void SendTcp()
|
||||
//游戏开始开关
|
||||
protected virtual bool GetStart()
|
||||
{
|
||||
return mainController.isStart;
|
||||
}
|
||||
protected virtual void BeforeRun()
|
||||
{
|
||||
|
||||
}
|
||||
@ -225,8 +231,6 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
nextSlopeDistance = sumDistance - totalDistance * 1000;
|
||||
NextSlopeTotalDistance = pointList[nextIndex].Distance;
|
||||
currentSlopeDistance = CurrentDistance-( totalDistance * 1000 - (sumDistance - pointList[index].Distance));
|
||||
//人物初始化角度控制
|
||||
|
||||
}
|
||||
public double PreElevation;
|
||||
public double PreSlope;
|
||||
|
||||
@ -17,6 +17,8 @@ using Assets.Scripts;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.Events;
|
||||
using Assets.Scenes.Ride.Scripts.Model.RiderModels;
|
||||
using System.IO;
|
||||
|
||||
public class CyclingController : DeviceServiceMonoBase
|
||||
{
|
||||
@ -50,7 +52,7 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
LoadingController loadingController;
|
||||
private async Task Login()
|
||||
{
|
||||
var result = await new UserApi().Login("13115011550", "laozhong", "");
|
||||
var result = await new UserApi().Login("15261826280", "123456", "");
|
||||
App.CurrentUser = result.data;
|
||||
}
|
||||
GameObject miniMap;
|
||||
@ -77,6 +79,8 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
{
|
||||
UIManager.Instance.MainPanel = this.transform.Find("SingleUI/Panel").GetComponent<PFUIPanel>();
|
||||
UIManager.Instance.ModalsPanel = this.transform.Find("SingleUI/ModalPanel").GetComponent<PFUIPanel>();
|
||||
onlineUserPrefab = Resources.Load<GameObject>("UI/Prefab/Ride/OnlinePlayer");
|
||||
miniMapPlayerPrefab = Resources.Load<GameObject>("UI/Prefab/Ride/MiniMapPlayer");
|
||||
target = transform.Find("Target");
|
||||
//进入倒计时
|
||||
singleUIManager = UIObject.GetComponent<SingleUIManager>();
|
||||
@ -240,7 +244,74 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
singleUIManager.ContinueRide();
|
||||
}
|
||||
|
||||
#region
|
||||
#region TCP相关
|
||||
|
||||
public void TcpHandler()
|
||||
{
|
||||
if (cyclingController != null)
|
||||
{
|
||||
//tcp数据传输
|
||||
cyclingController.Run(null);
|
||||
//在线人物或比赛人物渲染
|
||||
ShowOnlineUsers();
|
||||
}
|
||||
}
|
||||
|
||||
List<OnlinePlayerController> otherList = new List<OnlinePlayerController>();
|
||||
GameObject onlineUserPrefab;
|
||||
GameObject miniMapPlayerPrefab;
|
||||
|
||||
private void ShowOnlineUsers()
|
||||
{
|
||||
var onlineRiders = cyclingController.riders;
|
||||
List<OnlinePlayerController> currentOnlineUserList = new List<OnlinePlayerController>();
|
||||
currentOnlineUserList.AddRange(FindObjectsOfType<OnlinePlayerController>());
|
||||
//新增或者更新
|
||||
foreach (var item in onlineRiders)
|
||||
{
|
||||
var onlineRider = item as OnlineRiderModel;
|
||||
var currentUser = currentOnlineUserList.Where(c => c.UserId == item.UserId).FirstOrDefault();
|
||||
var onlineDistance = onlineRider.EndDistance - onlineRider.PreDistance;
|
||||
var onlineTotalDistance = onlineRider.EndDistance;
|
||||
if (currentUser == null)
|
||||
{
|
||||
//for (int i = 0; i < 100; i++)
|
||||
{
|
||||
//大地图人物
|
||||
GameObject otherPlayerObj = (GameObject)Instantiate(onlineUserPrefab, transform);
|
||||
var onlinePlayerController = otherPlayerObj.GetComponent<OnlinePlayerController>();
|
||||
otherList.Add(onlinePlayerController);
|
||||
onlinePlayerController.UserId = onlineRider.UserId;
|
||||
//onlinePlayerController.SetDistance(onlineDistance);
|
||||
onlinePlayerController.SetTotalDistance(onlineTotalDistance, onlineDistance);
|
||||
onlinePlayerController.SetHead(onlineRider.WxHeadImg);
|
||||
//小地图人物
|
||||
GameObject miniPlayer = (GameObject)Instantiate(miniMapPlayerPrefab, transform);
|
||||
var miniController = miniPlayer.GetComponent<MiniMapPlayerController>();
|
||||
miniController.SetController(onlinePlayerController);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//currentUser.SetDistance(onlineDistance);
|
||||
currentUser.SetTotalDistance(onlineTotalDistance, onlineDistance);
|
||||
}
|
||||
}
|
||||
////移除
|
||||
//foreach (var item in currentOnlineUserList)
|
||||
//{
|
||||
// var currentItem = onlineRiders.Where(c => c.UserId == item.UserId).FirstOrDefault();
|
||||
// if (currentItem == null)
|
||||
// {
|
||||
// item.RemoveSelf();
|
||||
// }
|
||||
//}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 视角切换
|
||||
|
||||
public AbstractMap map3d;
|
||||
public bool Is3dView;
|
||||
public void ChangeMapImageStyle(GameObject arrowGameObj)
|
||||
{
|
||||
@ -255,6 +326,8 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
map.Terrain.SetElevationType(ElevationLayerType.TerrainWithElevation);
|
||||
map.ImageLayer.SetLayerSource(ImagerySourceType.Custom);
|
||||
map.SetCenterLatitudeLongitude(playerController.Currentlatlong);
|
||||
//map3d.gameObject.SetActive(true);
|
||||
//map.gameObject.SetActive(false);
|
||||
//人物属性变更
|
||||
var pos = map.GeoToWorldPosition(playerController.Currentlatlong);
|
||||
playerController.currentPos = pos;
|
||||
@ -272,6 +345,8 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
map.Terrain.ExaggerationFactor = 0f;
|
||||
map.Terrain.SetElevationType(ElevationLayerType.FlatTerrain);
|
||||
map.SetCenterLatitudeLongitude(playerController.Currentlatlong);
|
||||
//map.gameObject.SetActive(true);
|
||||
//map3d.gameObject.SetActive(false);
|
||||
//人物属性变更
|
||||
var pos = map.GeoToWorldPosition(playerController.Currentlatlong);
|
||||
player.transform.position = pos;
|
||||
@ -377,7 +452,10 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
isStart = false;
|
||||
|
||||
string recordId = Guid.NewGuid().ToString();
|
||||
var path = Helper.GetDataDir("MapWorkoutRecords/"+ recordId);
|
||||
//var path = Helper.GetDataDir("MapWorkoutRecords/"+ recordId);
|
||||
var path = PFConstants.MapWorkoutRecordFolder + "/" + recordId;
|
||||
Helper.CreateDirectoryIfNotExsit(path);
|
||||
|
||||
string imageFileName = path +"/"+ Guid.NewGuid().ToString() + ".png";
|
||||
CaptureCamera(Camera.main, new Rect(Screen.width * 0f, Screen.height * 0f, Screen.width * 0.5f, Screen.height * 0.5f), imageFileName);
|
||||
|
||||
@ -392,7 +470,7 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
var rs = resultPanel.GetComponent<ResultPanelScript>();
|
||||
rs.InjectController(this);
|
||||
rs.SetDataSource(cyclingController.recorderData);
|
||||
cyclingController.recorderData.SaveLocal(cyclingModel, selectParamModel, imageFileName, recordId);
|
||||
cyclingController.recorderData.SaveWithLocalRecordAysnc(cyclingModel, selectParamModel, imageFileName, recordId, path);
|
||||
}
|
||||
|
||||
protected void CaptureCamera(Camera camera, Rect rect,string fileName)
|
||||
|
||||
@ -16,14 +16,13 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
public class Helper
|
||||
{
|
||||
public static string GetDataDir(string pathName)
|
||||
public static string CreateDirectoryIfNotExsit(string path)
|
||||
{
|
||||
var dirName = Application.dataPath + "/" + pathName;
|
||||
if (!Directory.Exists(dirName))
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(dirName);
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
return dirName;
|
||||
return path;
|
||||
}
|
||||
|
||||
public static void DelectDir(string srcPath)
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Assets.Scripts.Apis;
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
@ -106,7 +107,7 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
|
||||
public int GlobalCyclingId { get; set; }
|
||||
|
||||
public void SaveLocal(CyclingModel cyclingModel, RouteResultParam selectParam, string imageName,string recordId)
|
||||
public void SaveWithLocalRecordAysnc(CyclingModel cyclingModel, RouteResultParam selectParam, string imageName,string recordId,string path)
|
||||
{
|
||||
Dictionary<MapInterruptRecord, List<string>> recordData = new Dictionary<MapInterruptRecord, List<string>>();
|
||||
if (RiderDatas.Count <= 0)
|
||||
@ -181,7 +182,9 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
interruptRecord.MaxHeartRate = RiderDatas.Max(a => a._HeartRate.GetValueOrDefault(0));
|
||||
//service.CreateRecordCyclingData(interruptRecord);
|
||||
//保存骑行记录txt
|
||||
var path = Helper.GetDataDir("MapWorkoutRecords" + "/" + interruptRecord.Id);
|
||||
|
||||
//var path = Helper.GetDataDir("MapWorkoutRecords" + "/" + interruptRecord.Id);
|
||||
//var path = PFConstants.MapWorkoutRecordFolder + "/" + interruptRecord.Id;
|
||||
var fname = path + "/" + newFileName + ".txt";
|
||||
var files = new List<string>();
|
||||
using (var fs = new FileInfo(fname).OpenWrite())
|
||||
@ -208,18 +211,18 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
|
||||
recordData.Add(interruptRecord, files);
|
||||
|
||||
SaveDataAysnc(recordData);
|
||||
SaveDataAysnc(recordData, path);
|
||||
}
|
||||
/// <summary>
|
||||
/// 保存数据
|
||||
/// </summary>
|
||||
/// <param name="base64Image"></param>
|
||||
/// <returns></returns>
|
||||
public void SaveDataAysnc(Dictionary<MapInterruptRecord, List<string>> data)
|
||||
public void SaveDataAysnc(Dictionary<MapInterruptRecord, List<string>> data,string path)
|
||||
{
|
||||
if (data != null && data.Count > 0)
|
||||
{
|
||||
var path = Helper.GetDataDir("MapWorkoutRecords");
|
||||
//var path = Helper.GetDataDir("MapWorkoutRecords");
|
||||
Task.Run(() => {
|
||||
var record = data.FirstOrDefault();
|
||||
MapInterruptRecordApi service = new MapInterruptRecordApi();
|
||||
@ -228,7 +231,6 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
||||
//删除文件
|
||||
try
|
||||
{
|
||||
path = path + "/" + record.Key.Id;
|
||||
if (result.result && Directory.Exists(path))
|
||||
{
|
||||
Helper.DelectDir(path);
|
||||
|
||||
@ -16,22 +16,31 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
protected override void Init()
|
||||
{
|
||||
base.Init();
|
||||
currentlatlong = mainController.GetCenterCoordinate();
|
||||
_playerController = FindObjectOfType<PlayerController>();
|
||||
var cuurentLocalPos = map.GeoToWorldPosition(currentlatlong);
|
||||
cuurentLocalPos.y += transform.localScale.y;
|
||||
transform.localPosition = cuurentLocalPos;
|
||||
}
|
||||
protected override bool GetStart()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void Compute()
|
||||
{
|
||||
Debug.Log("31" + totalDistance.ToString());
|
||||
currentlatlong = mainController.Along(totalDistance);//下一个坐标
|
||||
}
|
||||
|
||||
public void SetDistance(double _distance)
|
||||
{
|
||||
distance = _distance;
|
||||
}
|
||||
|
||||
public void SetTotalDistance(double _totalDistance)
|
||||
public void SetTotalDistance(double _totalDistance, double _distance)
|
||||
{
|
||||
Debug.Log("41" + _totalDistance.ToString());
|
||||
totalDistance = _totalDistance;
|
||||
distance = _distance;
|
||||
}
|
||||
private string headUrl;
|
||||
public void SetHead(string url )
|
||||
@ -56,5 +65,11 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
headPanel.transform.DOMove(new Vector3(nextPosition.x, nextPosition.y, 0), 1);
|
||||
}
|
||||
|
||||
public void RemoveSelf()
|
||||
{
|
||||
transform.gameObject.Destroy();
|
||||
headPanel.Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -11,14 +11,11 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
#region 骑行逻辑
|
||||
TrailRenderer trail;
|
||||
GameObject onlineUserPrefab;
|
||||
GameObject miniMapPlayerPrefab;
|
||||
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
base.Init();
|
||||
onlineUserPrefab = Resources.Load<GameObject>("UI/Prefab/Ride/OnlinePlayer");
|
||||
miniMapPlayerPrefab = Resources.Load<GameObject>("UI/Prefab/Ride/MiniMapPlayer");
|
||||
|
||||
totalDistance = mainController.selectParamModel.EndDistance;
|
||||
currentlatlong = mainController.GetCenterCoordinate();
|
||||
@ -30,6 +27,13 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//var color7 = Resources.Load<Material>("UI/Material/color7");
|
||||
//var Graph2 = Resources.Load<Material>("UI/Material/3dGraph2");
|
||||
//trail.materials = new Material[] { color7};
|
||||
|
||||
trail.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
|
||||
trail.allowOcclusionWhenDynamic = false;
|
||||
trail.textureMode = LineTextureMode.Tile;
|
||||
trail.motionVectorGenerationMode = MotionVectorGenerationMode.ForceNoMotion;
|
||||
trail.receiveShadows = false;
|
||||
trail.rayTracingMode = UnityEngine.Experimental.Rendering.RayTracingMode.Off;
|
||||
}
|
||||
TargetData targetData;
|
||||
/// <summary>
|
||||
@ -45,7 +49,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
weight = App.CurrentUser.Weight;
|
||||
bicycleWeight = App.CurrentUser.BicycleWeight;
|
||||
#if UNITY_EDITOR
|
||||
power = 2380;//测试功率
|
||||
power = 300;//测试功率
|
||||
#endif
|
||||
mainController.TrackResistance(currentSlope * App.rideSetting.sensitivity / 100);
|
||||
speed = Helper.CalculateSpeed(elevation, currentSlope, power, weight, bicycleWeight);
|
||||
@ -75,60 +79,18 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
|
||||
}
|
||||
protected override void SendTcp()
|
||||
protected override void BeforeRun()
|
||||
{
|
||||
if (mainController.cyclingController != null)
|
||||
if (mainController != null)
|
||||
{
|
||||
mainController.cyclingController.Run(null);
|
||||
ShowOnlineUsers();
|
||||
mainController.TcpHandler();
|
||||
}
|
||||
}
|
||||
List<OnlinePlayerController> otherList = new List<OnlinePlayerController>();
|
||||
|
||||
|
||||
private void ShowOnlineUsers()
|
||||
{
|
||||
var onlineRiders = mainController.cyclingController.riders;
|
||||
List<OnlinePlayerController> currentOnlineUserList = new List<OnlinePlayerController>();
|
||||
currentOnlineUserList.AddRange(FindObjectsOfType<OnlinePlayerController>());
|
||||
|
||||
if (onlineRiders.Count > 0)
|
||||
{
|
||||
foreach (var item in onlineRiders)
|
||||
{
|
||||
var onlineRider = item as OnlineRiderModel;
|
||||
var currentUser = currentOnlineUserList.Where(c => c.UserId == item.UserId).FirstOrDefault();
|
||||
var onlineDistance = onlineRider.EndDistance - onlineRider.PreDistance;
|
||||
var onlineTotalDistance = onlineRider.EndDistance;
|
||||
if (currentUser == null)
|
||||
{
|
||||
//大地图人物
|
||||
GameObject otherPlayerObj = (GameObject)Instantiate(onlineUserPrefab, transform.parent);
|
||||
var onlinePlayerController = otherPlayerObj.GetComponent<OnlinePlayerController>();
|
||||
otherList.Add(onlinePlayerController);
|
||||
onlinePlayerController.UserId = onlineRider.UserId;
|
||||
onlinePlayerController.SetDistance(onlineDistance);
|
||||
onlinePlayerController.SetTotalDistance(onlineTotalDistance);
|
||||
onlinePlayerController.SetHead(onlineRider.WxHeadImg);
|
||||
//小地图人物
|
||||
GameObject miniPlayer = (GameObject)Instantiate(miniMapPlayerPrefab, transform.parent);
|
||||
var miniController = miniPlayer.GetComponent<MiniMapPlayerController>();
|
||||
miniController.SetController(onlinePlayerController);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentUser.SetDistance(onlineDistance);
|
||||
currentUser.SetTotalDistance(onlineTotalDistance);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//上传数据
|
||||
public override void Upload()
|
||||
{
|
||||
mainController.Save(TotalDistance);
|
||||
//SceneManager.LoadScene("MainScene");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@ -5,9 +5,6 @@ using Assets.Scripts.Apis.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEditor.Events;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@ -338,7 +338,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
else
|
||||
{
|
||||
target.transform.eulerAngles.Set(cameraX, cameraY, cameraZ);// = new Vector3(cameraX, cameraY, cameraZ);
|
||||
target.transform.eulerAngles = new Vector3(cameraX, cameraY, cameraZ);
|
||||
}
|
||||
//控制照片移动
|
||||
((RectTransform)arrow.transform).position = Camera.main.WorldToScreenPoint(target.transform.position);
|
||||
@ -655,10 +655,10 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
foreach (var item in onlineUsers)
|
||||
{
|
||||
var itemIndex = chartDataSourceScript.GetViewIndex(item.CurrentIndex) + 1;
|
||||
if (!mainController.isStart && !mainController.isPause && !mainController.isQuit || (mainController.isStart && item.TotalDistance == 0))//未开始未暂停未结束
|
||||
{
|
||||
itemIndex = 0;
|
||||
}
|
||||
//if (!mainController.isStart && !mainController.isPause && !mainController.isQuit || (mainController.isStart && item.TotalDistance == 0))//未开始未暂停未结束
|
||||
//{
|
||||
// itemIndex = 0;
|
||||
//}
|
||||
var m = graph.DataSource.GetPoint("Player 2", itemIndex);
|
||||
graph.PointToWorldSpace(out Vector3 itemPosition, m.x, m.y, "Player 2");
|
||||
itemPosition.x -= 12f;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user