AR骑行动画&换装基本交互逻辑
This commit is contained in:
1 parent
d938a0c8be
commit
995aef63f8
117 files changed
+60802
-2718
No files matched your search
@@ -0,0 +1,23 @@
|
||||
namespace Assets.Scripts.Apis.Models
|
||||
{
|
||||
public class EquitmentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Remark { get; set; }
|
||||
//封面图片
|
||||
public string Url { get; set; }
|
||||
/// <summary>
|
||||
/// 装备类型 0:自行车 1:头盔 2:衣服 3:皮肤 4:套装
|
||||
/// </summary>
|
||||
public int Type { get; set; }
|
||||
/// <summary>
|
||||
/// 是否开放
|
||||
/// </summary>
|
||||
public bool IsLock { get; set; }
|
||||
|
||||
public bool IsDelete { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 617f86e867bad204992aaa843715f09c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -352,7 +352,11 @@ namespace Assets.Scripts.Apis
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
//获取某是
|
||||
public Task<JsonResult<List<EquitmentModel>>> GetEquitmentList(int? type =null)
|
||||
{
|
||||
var url = $"UserEquipment/GetList?type={ type }";
|
||||
return GetAsync<JsonResult<List<EquitmentModel>>>(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,14 +17,14 @@ using UnityEngine.UI;
|
||||
|
||||
public class MainController : BaseScene
|
||||
{
|
||||
[SerializeField]GameObject root;
|
||||
[SerializeField] GameObject root;
|
||||
private Text Version;
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
Debug.Log("执行25");
|
||||
Version = this.transform.Find("GameObject").Find("Version").GetComponent<Text>();
|
||||
Version.text = "V"+App.AppVersion;
|
||||
Version.text = "V" + App.AppVersion;
|
||||
DeviceCache.Init(PFConstants.DeviceCacheFolder);
|
||||
Loom.Initialize();
|
||||
msg = transform.Find("GameObject/Message").GetComponent<CanvasGroup>();
|
||||
@@ -53,7 +53,7 @@ public class MainController : BaseScene
|
||||
modalRect.sizeDelta = new Vector2(1600, 900);
|
||||
App.MainDeviceAdapter.StartScan();
|
||||
#endif
|
||||
EventQueueSystem.AddListener<LinkedMessageEvent>(LinkedMessageHandler);
|
||||
//EventQueueSystem.AddListener<LinkedMessageEvent>(LinkedMessageHandler);
|
||||
App.isHomeChanged -= OnIsHomeChanged;
|
||||
App.isHomeChanged += OnIsHomeChanged;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ public class MainController : BaseScene
|
||||
|
||||
private void ShowQueueMessage()
|
||||
{
|
||||
int i = 0,count = App.globalMessageQueue.Count;
|
||||
int i = 0, count = App.globalMessageQueue.Count;
|
||||
while (App.globalMessageQueue.Count != 0)
|
||||
{
|
||||
//SetMessage(msgs[i], App.globalMessageQueue.Dequeue());
|
||||
@@ -149,7 +149,8 @@ public class MainController : BaseScene
|
||||
emptyt = 0;
|
||||
if (App.currentPageIsHome)
|
||||
{
|
||||
DoMessage6(e);
|
||||
//DoMessage6(e);
|
||||
DoTopMessage(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,6 +159,11 @@ public class MainController : BaseScene
|
||||
#else
|
||||
float moveOffset = 38;
|
||||
#endif
|
||||
private void DoTopMessage(LinkedMessageEvent e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
private void DoMessage6(LinkedMessageEvent e)
|
||||
{
|
||||
//Resources.UnloadUnusedAssets();
|
||||
@@ -284,7 +290,7 @@ public class MainController : BaseScene
|
||||
$"{Math.Round(SystemInfo.batteryLevel * 100, 0)}%";
|
||||
transform.Find("MobileInfo/TimeText").GetComponent<Text>().text =
|
||||
DateTime.Now.ToString("HH:mm");
|
||||
ShowQueueMessage();
|
||||
//ShowQueueMessage();
|
||||
#if UNITY_EDITOR
|
||||
if (App.CurrentUser == null) //App.CurrentUser == null
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using Assets.Scripts.Apis.Models;
|
||||
using DG.Tweening;
|
||||
using Mapbox.Utils;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -44,9 +45,12 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
protected RaycastHit hit;
|
||||
float timer = 1f;
|
||||
protected bool start = true;
|
||||
|
||||
protected Sequence sequence;
|
||||
protected VideoGameManager manager { get; set; }
|
||||
Camera camera;
|
||||
float currenPlayerHeight;
|
||||
Transform bone_bottle_2 { get; set; }
|
||||
|
||||
protected virtual void Start()
|
||||
{
|
||||
@@ -63,6 +67,8 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
animator.Play("idle");
|
||||
}
|
||||
camera = Camera.main;
|
||||
//bone_bottle_2
|
||||
bone_bottle_2 = transform.Find("bone_cable_20");
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
@@ -70,13 +76,13 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
timer -= Time.deltaTime;
|
||||
ComputeAnimator();//控制动画
|
||||
CreateHeadImage();
|
||||
|
||||
while (timer <= 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
ComputeNextSlope();//计算下一个坡度
|
||||
ComputePlayer();//计算人物属性
|
||||
//animator.Play("touchHead");
|
||||
if (manager.IsStart())
|
||||
{
|
||||
ticks++;
|
||||
@@ -102,50 +108,26 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
//人物碰撞
|
||||
void OnCollisionEnter(Collision collision)
|
||||
{
|
||||
//manager.GetSlotIndex();
|
||||
|
||||
}
|
||||
|
||||
void RayCastHit()
|
||||
{
|
||||
//获取player的position信息
|
||||
Vector3 pos = transform.position;
|
||||
//射线碰撞物信息接收
|
||||
|
||||
//第二种写法
|
||||
//我们可以先创建出一条射线
|
||||
Ray ray = new Ray(pos, new Vector3(0, 0, 1));
|
||||
//然后用这条射线去做射线检测
|
||||
//射线,输出碰撞体信息,射线长度,射线在那一层检测,射线不忽略开启触发器(istrigger)的碰撞体
|
||||
isHit = Physics.Raycast(ray, out hit, 1f, 1 << 0, QueryTriggerInteraction.Collide);
|
||||
if (isHit)
|
||||
{
|
||||
print(hit.collider.name);
|
||||
}
|
||||
}
|
||||
protected void ComputeRandom()
|
||||
{
|
||||
var offset = 30;
|
||||
if (ticks % 6 == 0)
|
||||
transform.DOMoveZ(transform.position.z - 1.1f*offset, 1f);
|
||||
if (ticks % 5 == 0)
|
||||
transform.DOMoveZ(transform.position.z + offset, 2f);
|
||||
|
||||
//人物的rotation y
|
||||
transform.DOLocalRotate(new Vector3(0f, bearing, 0f), 1f);
|
||||
}
|
||||
//动画状态机
|
||||
protected virtual void ComputeAnimator()
|
||||
{
|
||||
if (animator != null)
|
||||
{
|
||||
|
||||
animator.SetFloat("preSpeed", (float)preSpeed);
|
||||
animator.SetFloat("speed", (float)speed);
|
||||
animator.SetFloat("grade", (float)currentSlope);
|
||||
animator.SetFloat("power", (float)power);
|
||||
var headBack = ticks % 10 == 0 && speed > 0 && bearing == 0;
|
||||
var drink = ticks % 15 == 0 && speed > 0 && bearing == 0;
|
||||
animator.SetBool("headBack", headBack);
|
||||
animator.SetBool("drinking", drink);
|
||||
}
|
||||
}
|
||||
protected virtual int GetCurrentFrame()
|
||||
@@ -153,9 +135,9 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
return manager.GetCurrentFrame();
|
||||
}
|
||||
private bool animated = false;
|
||||
//大转弯是60度
|
||||
private int offset = 0;
|
||||
protected virtual void Turn()
|
||||
private float offset = 0;
|
||||
//控制角色进行向左或向右
|
||||
protected virtual void Turn()
|
||||
{
|
||||
var currentFrame = GetCurrentFrame();
|
||||
var result = manager.mockDirection.Where(c => c.Start < currentFrame && c.End > currentFrame).FirstOrDefault();
|
||||
@@ -163,36 +145,55 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
{
|
||||
bearing = result.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
bearing = 0;
|
||||
}
|
||||
animator.SetFloat("bearing", bearing);
|
||||
if (Math.Abs(bearing) > 50)
|
||||
var headBack = ticks % 60 == 0 && speed > 0 && bearing == 0;
|
||||
var drink = ticks % 125 == 0 && speed > 0 && bearing == 0;
|
||||
animator.SetBool("headBack", headBack);
|
||||
animator.SetBool("drinking", drink);
|
||||
|
||||
var waiting = ratio == 0 ? 1 : 1 / ratio;
|
||||
if (Math.Abs(bearing) > 30)
|
||||
{
|
||||
if (!animated)
|
||||
{
|
||||
animated = true;
|
||||
transform.DOMoveX(transform.position.x + 3, 1).onComplete += () =>
|
||||
var tween = transform.DORotate(new Vector3(0, bearing, -bearing/5), waiting);
|
||||
tween.onComplete += () =>
|
||||
{
|
||||
offset = -3;
|
||||
var zoffset = bearing / 10.5f;
|
||||
var doMoveX = transform.DOMoveX(transform.position.x + zoffset, waiting);
|
||||
doMoveX.onComplete += () =>
|
||||
{
|
||||
offset = -zoffset;
|
||||
};
|
||||
};
|
||||
print(176);
|
||||
tween.SetEase(Ease.InOutSine).SetLoops(2, LoopType.Incremental);
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (offset != 0)
|
||||
{
|
||||
transform.DOMoveX(transform.position.x + offset, 1f).onComplete += () =>
|
||||
var cpoffset = offset;
|
||||
transform.DORotate(new Vector3(0, bearing, 0), 1.2f * waiting).onComplete += () =>
|
||||
{
|
||||
animated = false;
|
||||
transform.DOMoveX(transform.position.x + cpoffset, 1.2f * waiting).onComplete += () =>
|
||||
{
|
||||
animated = false;
|
||||
};
|
||||
};
|
||||
offset = 0;
|
||||
}
|
||||
}
|
||||
transform.DORotate(new Vector3(0, bearing, 0), 1f);
|
||||
//var aniInfo = animator.GetCurrentAnimatorStateInfo(0);
|
||||
//if (aniInfo.loop)
|
||||
//{
|
||||
else
|
||||
{
|
||||
transform.DORotate(new Vector3(0, bearing, -bearing), waiting);
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
//计算人物当前属性
|
||||
protected virtual void ComputePlayer()
|
||||
@@ -226,17 +227,35 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
distance = Math.Round(speed / 3600, 5, MidpointRounding.AwayFromZero);
|
||||
totalDistance += distance;
|
||||
currentlatLon = manager.Along(totalDistance % mapData.TotalDistance);
|
||||
////根据人物速度设置人物距离摄像头远近
|
||||
//if (speed > 20 && speed < 30)
|
||||
//{
|
||||
// transform.DOMoveZ(3, 1f);
|
||||
//}
|
||||
//else if (speed > 30 && speed < 40)
|
||||
//{
|
||||
// transform.DOMoveZ(3.5f, 1f);
|
||||
//}
|
||||
//else if (speed > 40)
|
||||
//{
|
||||
// transform.DOMoveZ(4, 1f);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// transform.DOMoveZ(3, 1f);
|
||||
//}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError(e);
|
||||
}
|
||||
}
|
||||
protected float ratio = 1;
|
||||
|
||||
protected virtual void ComputeVideo()
|
||||
{
|
||||
mapData = manager.GetMapData();
|
||||
float ratio = 1;
|
||||
|
||||
if (currentIndex + 1 < mapData.List.Count)
|
||||
{
|
||||
ratio = (float)(speed / mapData.List[currentIndex + 1].Speed);
|
||||
@@ -247,8 +266,22 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
}
|
||||
if (manager.CurrentPlayer != null && manager.CurrentPlayer.UserId != UserId)
|
||||
return;
|
||||
|
||||
if (ratio > 1)
|
||||
{
|
||||
ratio = Math.Min(ratio, 1.2f);
|
||||
}
|
||||
if (ratio < 1)
|
||||
{
|
||||
ratio = Math.Max(ratio, 0.6f);
|
||||
}
|
||||
var info = animator.GetCurrentAnimatorClipInfo(0);
|
||||
var currentClip = info.FirstOrDefault();
|
||||
if (currentClip.clip != null && currentClip.clip.isLooping)
|
||||
{
|
||||
animator.speed = ratio;
|
||||
}
|
||||
manager.Play(ratio);
|
||||
|
||||
}
|
||||
|
||||
protected virtual void ComputeRecord() { }
|
||||
@@ -318,7 +351,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
if (head != null)
|
||||
{
|
||||
//它们的乘积就是高度
|
||||
Vector3 worldPosition = new Vector3(transform.position.x, transform.position.y+1.5f, transform.position.z);
|
||||
Vector3 worldPosition = new Vector3(bone_bottle_2.position.x, bone_bottle_2.position.y+0.8f, bone_bottle_2.position.z);
|
||||
var playerScreenPos = Camera.main.WorldToScreenPoint(worldPosition);
|
||||
head.transform.position = playerScreenPos;
|
||||
ftpImage.fillAmount = (float)(wkg / 6);
|
||||
|
||||
@@ -67,15 +67,26 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
{
|
||||
var players = manager.cyclingController.riders;
|
||||
var headList = FindObjectsOfType<HeadScript>();
|
||||
var videoPlayer = manager.CurrentPlayer;
|
||||
foreach (var item in players)
|
||||
{
|
||||
BarChart barChart = GetComponent<BarChart>();
|
||||
Vector3 vector3 = Vector3.back;
|
||||
var currentIndex = Math.Round(item.EndDistance / manager.mapRoute.Distance * manager.GetMapData().List.Count);
|
||||
var distance = item.EndDistance % manager.mapRoute.Distance;
|
||||
|
||||
var currentIndex = Math.Round(distance / manager.mapRoute.Distance * manager.GetMapData().List.Count);
|
||||
barChart.GetBarTrackPosition($"Player {currentIndex}", "Group 1", out vector3);
|
||||
|
||||
var currentHead = headList.Where(c => c.UserId == item.UserId).FirstOrDefault();
|
||||
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
var diff = distance - videoPlayer.totalDistance % manager.mapRoute.Distance;
|
||||
if (diff < 0)
|
||||
{
|
||||
vector3.y = -800f;
|
||||
}
|
||||
}
|
||||
if (currentHead == null)
|
||||
{
|
||||
var onlineHead = Instantiate(headPanel, transform);
|
||||
@@ -87,6 +98,18 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
currentHead.transform.position = vector3;
|
||||
}
|
||||
}
|
||||
//删除离线的人
|
||||
foreach (var item in headList)
|
||||
{
|
||||
if (item.UserId != 0)
|
||||
{
|
||||
var player = players.Where(c => c.UserId == item.UserId).FirstOrDefault();
|
||||
if (player == null)
|
||||
{
|
||||
item.gameObject.Destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ChartDynamicMaterial getChartMaterial(double grade = 0d)
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
private void Update()
|
||||
{
|
||||
flag += Time.deltaTime;
|
||||
if (flag >= 1f)
|
||||
if (flag >= 0.5f)
|
||||
{
|
||||
alph -= Time.deltaTime;
|
||||
if (alph <= 0)
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
trail.startColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 1f);
|
||||
trail.endColor = new Color(0.9764706f, 0.1882353f, 0.5254902f, 1f);
|
||||
}
|
||||
float timer = 0;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (cyclingCotroller.CurrentPlayer != null)
|
||||
@@ -70,42 +70,8 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
((RectTransform)tr.transform).anchoredPosition = new Vector2((vp2.x * RectRoot.sizeDelta.x) - (RectRoot.sizeDelta.x * 0.5f), (vp2.y * RectRoot.sizeDelta.y) - (RectRoot.sizeDelta.y * 0.5f));
|
||||
trail.enabled = cyclingCotroller.CurrentPlayer.power > 0;
|
||||
}
|
||||
timer += Time.deltaTime;
|
||||
|
||||
while (timer >= 1)
|
||||
{
|
||||
//CreateMiniPath();
|
||||
timer = 0;
|
||||
}
|
||||
}
|
||||
void CreateMiniPath()
|
||||
{
|
||||
if (cyclingCotroller.CurrentPlayer == null)
|
||||
return;
|
||||
var dat = new List<Vector3>();
|
||||
var mapData = cyclingCotroller.GetMapData();
|
||||
if (mapData != null)
|
||||
{
|
||||
var count = mapData.List.Count;
|
||||
var interval = Math.Max(Math.Ceiling(count / 100D), 1f);
|
||||
for (int i = 0; i < mapData.List.Count; i++)
|
||||
{
|
||||
if (i % interval == 0)
|
||||
{
|
||||
var point = mapData.List[i].Point;
|
||||
Vector3 item = _map.GeoToWorldPosition(new Vector2d(point[0], point[1]));
|
||||
item.y += 5f;
|
||||
if (cyclingCotroller.CurrentPlayer.currentIndex >= i)
|
||||
{
|
||||
dat.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
var feat = new VectorFeatureUnity();
|
||||
feat.Points.Add(dat);
|
||||
CreateRedLineRender(feat);//创建小地图路线
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool init = false;
|
||||
private void _map_OnInitialized()
|
||||
|
||||
@@ -28,7 +28,10 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
private void Start()
|
||||
{
|
||||
manager = FindObjectOfType<VideoGameManager>();
|
||||
GetComponent<Button>().onClick.AddListener(ButtonListener);
|
||||
if (manager._aRMode == VideoGameManager.ARMode.INSPECT)
|
||||
{
|
||||
GetComponent<Button>().onClick.AddListener(ButtonListener);
|
||||
}
|
||||
}
|
||||
private float timer = 1f;
|
||||
private void Update()
|
||||
|
||||
@@ -47,18 +47,18 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
{
|
||||
if (_contactList != null) _contactList.Clear();
|
||||
var list = MapUDPService.GetOnlineUsers(App.RouteIdParam);
|
||||
int index = 0;
|
||||
list = list.Where(c => c.Id != App.CurrentUser.Id).ToList();
|
||||
foreach (var item in list)
|
||||
{
|
||||
_isInit = true;
|
||||
ContactInfo obj = new ContactInfo();
|
||||
obj.Name = item.Name;
|
||||
obj.Gender = DateTime.Now.Millisecond.ToString();
|
||||
obj.Gender = "";
|
||||
obj.id = item.Id.ToString();
|
||||
_contactList.Add(obj);
|
||||
}
|
||||
}
|
||||
float timer = 0.5f;
|
||||
float timer = 1f;
|
||||
private void Update()
|
||||
{
|
||||
timer -= Time.deltaTime;
|
||||
@@ -67,27 +67,11 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
if (manager.CurrentPlayer == null)
|
||||
return;
|
||||
var totalDitance = manager.GetMapData().TotalDistance;
|
||||
var currentDistance = manager.CurrentPlayer.totalDistance % totalDitance;
|
||||
var currentDistance = manager.CurrentPlayer.totalDistance;
|
||||
|
||||
var currenList = FindObjectsOfType<ListItem>();//当前列表
|
||||
var list = MapUDPService.GetOnlineUsers(App.RouteIdParam);//最新列表
|
||||
foreach (ListItem o in currenList)
|
||||
{
|
||||
var needUpdate = list.Where(c => c.Id.ToString() == o.Id).FirstOrDefault();
|
||||
if (needUpdate != null)
|
||||
{
|
||||
var left = (needUpdate.EndDistance % totalDitance - currentDistance) * 1000;
|
||||
var right = (needUpdate.EndDistance % totalDitance - totalDitance - currentDistance) * 1000;
|
||||
var diff = Math.Abs(left) > Math.Abs(right) ? right : left;
|
||||
o.gameObject.SetActive(true);
|
||||
o.UpdateItem(needUpdate.Name,diff.ToString("f0")+"M", needUpdate.Id.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
o.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
list = list.Where(c => c.Id != App.CurrentUser.Id).ToList();
|
||||
if (currenList.Count() == 0 && list.Count() > 0)
|
||||
{
|
||||
InitData();
|
||||
@@ -96,7 +80,28 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
_recyclableScrollRect.ReloadData();
|
||||
}
|
||||
}
|
||||
timer += 0.5f;
|
||||
//var currenList = FindObjectsOfType<ListItem>();//当前列表
|
||||
//var list = MapUDPService.GetOnlineUsers(App.RouteIdParam);//最新列表
|
||||
var currentPlayer = FindObjectOfType<VideoPlayer>();
|
||||
foreach (ListItem o in currenList)
|
||||
{
|
||||
if (currentPlayer.UserId.ToString() == o.Id)
|
||||
continue;
|
||||
var needUpdate = list.Where(c => c.Id.ToString() == o.Id).FirstOrDefault();
|
||||
if (needUpdate != null)
|
||||
{
|
||||
var left = Math.Round((needUpdate.EndDistance - manager.CurrentPlayer.totalDistance) * 1000);
|
||||
//var right = (needUpdate.EndDistance % totalDitance - totalDitance - currentDistance) * 1000;
|
||||
//var diff = Math.Abs(left) > Math.Abs(right) ? right : left;
|
||||
o.UpdateItem(needUpdate.Name, left.ToString() + "M", needUpdate.Id.ToString());
|
||||
//o.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
//o.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
timer +=1f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,70 +20,73 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
//计算
|
||||
protected override void ComputePlayer()
|
||||
{
|
||||
base.ComputePlayer();
|
||||
var current = manager.CurrentPlayer;
|
||||
if (current != null && current.UserId != UserId)
|
||||
{
|
||||
var left = totalDistance % mapData.TotalDistance;
|
||||
var right = current.totalDistance % mapData.TotalDistance;
|
||||
diff = (left - right) * 1000;
|
||||
if (Math.Abs(diff) > 200)
|
||||
if (Math.Abs(diff) > 50)
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
var z = current.transform.position.z + diff * 0.1;
|
||||
transform.DOMoveZ((float)z, 1f);
|
||||
//Push();
|
||||
}
|
||||
}
|
||||
//人物向前超车 右边超车
|
||||
private void Push()
|
||||
protected override void Turn()
|
||||
{
|
||||
try
|
||||
{
|
||||
var offsetX = 1f;
|
||||
var currentPlayer = FindObjectOfType<VideoPlayer>();
|
||||
//根据差距动态位移
|
||||
var current = currentPlayer.transform.position;
|
||||
var x = current.x + offsetX;
|
||||
var z = current.z + diff;
|
||||
var y = current.y;
|
||||
var end = new Vector3(x, y, (float)z);
|
||||
//前方有人
|
||||
if (isHit)
|
||||
{
|
||||
var onlinePlayer = hit.collider.transform.GetComponent<AbstractVideoPlayer>();
|
||||
if (distance - onlinePlayer.distance > 20)
|
||||
{
|
||||
var prePos = onlinePlayer.transform.position;
|
||||
var disx = prePos.x + offsetX;
|
||||
var disz = prePos.z + diff;
|
||||
var disy = prePos.y;
|
||||
end = new Vector3(disx, (float)disz, disy);
|
||||
animator.Play("turnRight");
|
||||
transform.DOMove(end, 1f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.DOMoveZ((float)z, 1f);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
print(e.Message);
|
||||
}
|
||||
base.Turn();
|
||||
var current = manager.CurrentPlayer;
|
||||
var z = current.transform.position.z + diff * 0.5f;
|
||||
transform.DOMoveZ((float)z, 1f);
|
||||
//x轴位移
|
||||
|
||||
//z轴位移
|
||||
|
||||
//人物转向
|
||||
|
||||
|
||||
//try
|
||||
//{
|
||||
// var offsetX = 1f;
|
||||
// var current = manager.CurrentPlayer;
|
||||
// var z = current.transform.position.z + diff * 0.5f;
|
||||
// //前方有人
|
||||
// if (isHit)
|
||||
// {
|
||||
// var onlinePlayer = hit.collider.transform.GetComponent<AbstractVideoPlayer>();
|
||||
// if (distance - onlinePlayer.distance > 20)
|
||||
// {
|
||||
// var prePos = onlinePlayer.transform.position;
|
||||
// var disx = prePos.x + offsetX;
|
||||
// var disz = prePos.z + diff;
|
||||
// var disy = prePos.y;
|
||||
// var end = new Vector3(disx, (float)disz, disy);
|
||||
// animator.Play("turnRight");
|
||||
// transform.DOMove(end, 1f);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// transform.DOMoveZ((float)z, 1f);
|
||||
// }
|
||||
//}
|
||||
//catch (Exception e) {
|
||||
// print(e.Message);
|
||||
//}
|
||||
}
|
||||
protected override void ComputeAnimator()
|
||||
{
|
||||
base.ComputeAnimator();
|
||||
if (manager.CurrentPlayer == null || manager.CurrentPlayer.UserId != UserId)
|
||||
{
|
||||
var currentFrame = manager.GetFrameOffSet(diff);
|
||||
//var currentFrame = manager.GetFrameOffSet(diff);
|
||||
var mainFrame = manager.GetCurrentFrame();
|
||||
var min = Math.Min(currentFrame, mainFrame);
|
||||
var max = Math.Max(currentFrame, mainFrame);
|
||||
frames = currentFrame;
|
||||
var result = manager.mockDirection.Where(c => c.Start < min && c.End > max).FirstOrDefault();
|
||||
var currentFrame = mainFrame + diff * 10;
|
||||
//var min = Math.Min(currentFrame, mainFrame);
|
||||
//var max = Math.Max(currentFrame, mainFrame);
|
||||
frames = (int)currentFrame;
|
||||
var result = manager.mockDirection.Where(c => c.Start < frames && c.End > frames).FirstOrDefault();
|
||||
bearing = result?.Value ?? 0;
|
||||
animator.SetFloat("bearing", bearing);
|
||||
}
|
||||
@@ -97,7 +100,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
}
|
||||
protected override int GetCurrentFrame()
|
||||
{
|
||||
return manager.DistanceToFrames(diff) + manager.GetCurrentFrame();
|
||||
return (int)(diff * 10) + manager.GetCurrentFrame();
|
||||
}
|
||||
protected override void ComputeVideo()
|
||||
{
|
||||
@@ -105,15 +108,16 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
}
|
||||
|
||||
//设置当前玩家属性
|
||||
public void SetPlayer(string name,double totalDistance, double cadance,double heartRate, double wkg, int userId)
|
||||
public void SetPlayer(string name, double distance, double totalDistance, double cadance,double heartRate, double wkg, int userId,double power)
|
||||
{
|
||||
this.wkg = 2.3d;
|
||||
this.wkg = wkg;
|
||||
this.UserName = name;
|
||||
this.cadance = cadance;
|
||||
this.totalDistance = totalDistance;
|
||||
this.heartRate = (int?)heartRate;
|
||||
this.UserId = userId;
|
||||
this.power = 200;
|
||||
this.power = power;
|
||||
this.speed = distance * 3600;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -152,9 +152,10 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
var currentPlayer = list.FirstOrDefault();
|
||||
if (currentPlayer != null)
|
||||
{
|
||||
var onlineRider = currentPlayer as OnlineRiderModel;
|
||||
var obj = Instantiate(OnlinePlayer, transform);
|
||||
var online = obj.GetComponent<OnlineVideoPlayer>();
|
||||
online.SetPlayer(currentPlayer.NickName, currentPlayer.EndDistance, currentPlayer.Cadence, currentPlayer.HeartRate, currentPlayer.TotalTicks, currentPlayer.UserId);
|
||||
online.SetPlayer(onlineRider.NickName, onlineRider.EndDistance-onlineRider.PreDistance, onlineRider.EndDistance, onlineRider.Cadence, onlineRider.HeartRate, onlineRider.TotalTicks, onlineRider.UserId, onlineRider.Power);
|
||||
obj.transform.DOMoveX(0, 1);
|
||||
ChangePlayer(currentPlayer.UserId);
|
||||
CurrentPlayer = online;
|
||||
@@ -184,16 +185,17 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
if (exsit != null)
|
||||
{
|
||||
var online = exsit.GetComponent<OnlineVideoPlayer>();
|
||||
online.SetPlayer(onlineRider.NickName,onlineRider.EndDistance, item.Cadence, item.HeartRate, onlineRider.WeightKg, item.UserId);
|
||||
|
||||
online.SetPlayer(onlineRider.NickName, onlineRider.EndDistance - onlineRider.PreDistance, onlineRider.EndDistance, item.Cadence, item.HeartRate, onlineRider.WeightKg, item.UserId, onlineRider.Power);
|
||||
}
|
||||
else
|
||||
{
|
||||
var diff = item.EndDistance % mapData.TotalDistance - CurrentPlayer.totalDistance % mapData.TotalDistance;
|
||||
if (Math.Abs(diff*1000) < 200)
|
||||
if (Math.Abs(diff*1000) <= 50)
|
||||
{
|
||||
var obj = Instantiate(OnlinePlayer, transform);
|
||||
var online = obj.GetComponent<OnlineVideoPlayer>();
|
||||
online.SetPlayer(onlineRider.NickName, onlineRider.EndDistance, item.Cadence, item.HeartRate, onlineRider.WeightKg, item.UserId);
|
||||
online.SetPlayer(onlineRider.NickName, onlineRider.EndDistance - onlineRider.PreDistance, onlineRider.EndDistance, item.Cadence, item.HeartRate, onlineRider.WeightKg, item.UserId, onlineRider.Power);
|
||||
obj.transform.DOMoveX(slots[currentOnlineCount], 1);
|
||||
currentOnlineCount++;
|
||||
}
|
||||
@@ -237,12 +239,13 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
else
|
||||
{
|
||||
var onlineRiders = cyclingController.riders;
|
||||
var onlineRider = onlineRiders.Where(c => c.UserId == userId).FirstOrDefault();
|
||||
if (onlineRider != null)
|
||||
var currentPlayer = onlineRiders.Where(c => c.UserId == userId).FirstOrDefault();
|
||||
if (currentPlayer != null)
|
||||
{
|
||||
var onlineRider = currentPlayer as OnlineRiderModel;
|
||||
var obj = Instantiate(OnlinePlayer, transform);
|
||||
var online = obj.GetComponent<OnlineVideoPlayer>();
|
||||
online.SetPlayer(onlineRider.NickName, onlineRider.EndDistance, onlineRider.Cadence, onlineRider.HeartRate, 0, onlineRider.UserId);
|
||||
online.SetPlayer(onlineRider.NickName, onlineRider.EndDistance-onlineRider.PreDistance, onlineRider.EndDistance, onlineRider.Cadence, onlineRider.HeartRate, 0, onlineRider.UserId, onlineRider.Power);
|
||||
obj.transform.position = origin;
|
||||
CurrentPlayer = online;
|
||||
var currentFrames = DistanceToFrames(CurrentPlayer.totalDistance);
|
||||
@@ -462,10 +465,6 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
cyclingController.recorderData.LastFrame = GetCurrentFrame();
|
||||
RankingId = cyclingController.recorderData.SaveWithLocalRecordAysnc(cyclingModel, selectParamModel, imageFileName, recordId, path);
|
||||
}
|
||||
public void GetUIPanel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void AddEvent(GameObject sender, EventTriggerType eventType, UnityAction<BaseEventData> unityAction)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
{
|
||||
base.Start();
|
||||
animator.Play("idle");
|
||||
power = 200;;
|
||||
UserId = App.CurrentUser.Id;
|
||||
UserName = App.CurrentUser.Nickname;
|
||||
}
|
||||
@@ -51,7 +50,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
power = manager.UpdatePower();
|
||||
cadance = manager.UpdateCadence();
|
||||
#if UNITY_EDITOR
|
||||
power = 350;
|
||||
power = 0;
|
||||
cadance = 150;
|
||||
heartRate = 160;
|
||||
#endif
|
||||
@@ -79,7 +78,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
Ticks = ticks,
|
||||
_Power = power,
|
||||
_Speed = speed,
|
||||
_Distance = totalDistance > mapData.TotalDistance ? mapData.TotalDistance : totalDistance,
|
||||
_Distance = totalDistance,//totalDistance > mapData.TotalDistance ? mapData.TotalDistance : totalDistance,
|
||||
_Cadence = cadance,
|
||||
_HeartRate = heartRate,
|
||||
_Lat = currentlatLon.x,
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Assets.Scripts.Scenes.VideoRide
|
||||
//ftp
|
||||
ftpImage.fillAmount = (float)(manager.CurrentPlayer.wkg / MAXWKG);
|
||||
wkg.text = $"{manager.CurrentPlayer.wkg}w/kg";
|
||||
explosive.SetActive(manager.CurrentPlayer.power > 600);
|
||||
explosive.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Assets.Scripts.UI.Prefab.Player;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using DG.Tweening;
|
||||
|
||||
namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
public class ChangePlayerController : PFUIPanel
|
||||
{
|
||||
public Transform Panel;
|
||||
public Transform InfoPanel;
|
||||
|
||||
public GameObject BikeBtn;
|
||||
public GameObject HelmetBtn;
|
||||
public GameObject UniformBtn;
|
||||
public GameObject SkinBtn;
|
||||
public GameObject SuitBtn;
|
||||
|
||||
public GameObject SaveBtn;
|
||||
public GameObject ViewBtn;
|
||||
|
||||
public GameObject CaputureBtn;
|
||||
public GameObject BackBtn;
|
||||
|
||||
public Transform Content;
|
||||
|
||||
|
||||
public GameObject BikePrefab;
|
||||
public GameObject HelmetPrefab;
|
||||
public GameObject UniformPrefab;
|
||||
public GameObject SkinPrefab;
|
||||
public GameObject SuitPrefab;
|
||||
|
||||
List<EquitmentModel> data { get; set; }
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
UIManager.AddEvent(BikeBtn, EventTriggerType.PointerClick, BikeBtn_Click);
|
||||
UIManager.AddEvent(HelmetBtn, EventTriggerType.PointerClick, HelmetBtn_Click);
|
||||
UIManager.AddEvent(UniformBtn, EventTriggerType.PointerClick, UniformBtn_Click);
|
||||
UIManager.AddEvent(SkinBtn, EventTriggerType.PointerClick, SkinBtn_Click);
|
||||
UIManager.AddEvent(SuitBtn, EventTriggerType.PointerClick, SuitBtn_Click);
|
||||
|
||||
UIManager.AddEvent(SaveBtn, EventTriggerType.PointerClick, SuitBtn_Click);
|
||||
UIManager.AddEvent(ViewBtn, EventTriggerType.PointerClick, ViewBtn_Click);
|
||||
UIManager.AddEvent(CaputureBtn, EventTriggerType.PointerClick, SuitBtn_Click);
|
||||
UIManager.AddEvent(BackBtn, EventTriggerType.PointerClick, BackBtn_Click);
|
||||
}
|
||||
protected override void Start()
|
||||
{
|
||||
transform.Find("MainNav").GetComponent<MainNav>().ShowBack();
|
||||
GetData();
|
||||
}
|
||||
|
||||
private void GetData()
|
||||
{
|
||||
//获取装备信息列表初始化
|
||||
var res = ConfigHelper.userApi.GetEquitmentList();
|
||||
if (res.Result.result)
|
||||
{
|
||||
data = res.Result.data;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
private void Refresh(int type = 1)
|
||||
{
|
||||
if (data == null)
|
||||
return;
|
||||
|
||||
BikeBtn.transform.Find("bg").gameObject.SetActive(type == 0);
|
||||
HelmetBtn.transform.Find("bg").gameObject.SetActive(type == 1);
|
||||
UniformBtn.transform.Find("bg").gameObject.SetActive(type == 2);
|
||||
SkinBtn.transform.Find("bg").gameObject.SetActive(type == 3);
|
||||
SuitBtn.transform.Find("bg").gameObject.SetActive(type == 4);
|
||||
|
||||
var list = data.Where(c => c.Type == type).ToList();
|
||||
|
||||
//清空内容
|
||||
Utils.DestroyChildren(Content);
|
||||
GameObject prefab = null;
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
prefab = BikePrefab;
|
||||
break;
|
||||
case 1:
|
||||
prefab = HelmetPrefab;
|
||||
break;
|
||||
case 2:
|
||||
prefab = UniformPrefab;
|
||||
break;
|
||||
case 3:
|
||||
prefab = SkinPrefab;
|
||||
break;
|
||||
case 4:
|
||||
prefab = SuitPrefab;
|
||||
break;
|
||||
}
|
||||
|
||||
if (type == 3)
|
||||
{
|
||||
GameObject colorPicker = null;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
colorPicker = Instantiate(prefab, Content);
|
||||
colorPicker.SetActive(true);
|
||||
var left = colorPicker.transform.Find("Left");
|
||||
left.GetComponent<AbstractEquipmentScript>().Init(item.Id, item.Name, item.Remark, item.Url, item.IsLock);
|
||||
}
|
||||
else
|
||||
{
|
||||
var right = colorPicker.transform.Find("Right");
|
||||
right.GetComponent<AbstractEquipmentScript>().Init(item.Id, item.Name, item.Remark, item.Url, item.IsLock);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
var o = Instantiate(prefab, Content);
|
||||
o.GetComponent<AbstractEquipmentScript>().Init(item.Id, item.Name, item.Remark, item.Url, item.IsLock);
|
||||
o.SetActive(true);
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)Content);
|
||||
}
|
||||
}
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)Content);
|
||||
}
|
||||
|
||||
private void ViewBtn_Click(BaseEventData baseEventData)
|
||||
{
|
||||
Panel.DOLocalMoveX(-1007, 1f);
|
||||
InfoPanel.DOLocalMoveX(931, 1f);
|
||||
ViewBtn.SetActive(false);
|
||||
SaveBtn.SetActive(false);
|
||||
}
|
||||
private void BackBtn_Click(BaseEventData baseEventData)
|
||||
{
|
||||
Panel.DOLocalMoveX(-538.5f, 1f);
|
||||
InfoPanel.DOLocalMoveX(541, 1f);
|
||||
ViewBtn.SetActive(true);
|
||||
SaveBtn.SetActive(true);
|
||||
}
|
||||
|
||||
private void BikeBtn_Click(BaseEventData baseEventData)
|
||||
{
|
||||
Refresh(0);
|
||||
}
|
||||
private void HelmetBtn_Click(BaseEventData baseEventData)
|
||||
{
|
||||
Refresh(1);
|
||||
}
|
||||
private void UniformBtn_Click(BaseEventData baseEventData)
|
||||
{
|
||||
Refresh(2);
|
||||
}
|
||||
private void SkinBtn_Click(BaseEventData baseEventData)
|
||||
{
|
||||
Refresh(3);
|
||||
}
|
||||
private void SuitBtn_Click(BaseEventData baseEventData)
|
||||
{
|
||||
Refresh(4);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 12590f2048a2e184f96275f612967772
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,406 @@
|
||||
using Assets.Scenes.Ride.Scripts;
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Assets.Scripts.UI.Control;
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class NewHomeController : PFUIPanel
|
||||
{
|
||||
//[SerializeField] Text Ftp;
|
||||
//[SerializeField] RawImage Avatar;
|
||||
//[SerializeField] Text Weight;
|
||||
//[SerializeField] Text WKG;
|
||||
//[SerializeField] Text Calories;
|
||||
//[SerializeField] Text KM;
|
||||
//[SerializeField] Text Climb;
|
||||
//[SerializeField] Text NickName;
|
||||
//[SerializeField] Button More;
|
||||
[SerializeField] Button BtnRide;
|
||||
[SerializeField] Transform userInfo;
|
||||
Transform BtnMatch, BtnTraining;
|
||||
private MainNav mainNav;
|
||||
private Dictionary<string, Sprite[]> dict;
|
||||
// Start is called before the first frame update
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
UIManager.AddEvent(transform.Find("TodayData/Avatar").gameObject, EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
UIManager.ShowUserInfoPanel();
|
||||
});
|
||||
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
var nav = transform.Find("MainNav-mobile").GetComponent<NewMainNav>();
|
||||
nav.SetButtonActive(new List<int> { 1, 3, 4, 6 });
|
||||
newNav = nav;
|
||||
UIManager.AddEvent(transform.Find("TodayData/Datas/Distance").gameObject, EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
UIManager.ShowResultListPanel();
|
||||
});
|
||||
#else
|
||||
UIManager.AddEvent(transform.Find("TodayData/Distance").gameObject, EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
UIManager.ShowUserInfoPanel();
|
||||
});
|
||||
UIManager.AddEvent(transform.Find("ProfileBtn").gameObject, EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
UIManager.ShowEditUserPanel();
|
||||
});
|
||||
UIManager.AddEvent(transform.Find("ChangeBtn").gameObject, EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
UIManager.ShowChangePlayerPanel();
|
||||
});
|
||||
mainNav = this.transform.Find("MainNav").GetComponent<MainNav>();
|
||||
mainNav.ShowExit();
|
||||
#endif
|
||||
var BtnContainer = transform.Find("MainFuncContainer");
|
||||
UIManager.AddEvent(BtnRide.gameObject, EventTriggerType.PointerClick, GoRide);
|
||||
UIManager.AddEvent(BtnRide.gameObject, EventTriggerType.PointerEnter, OnHover);
|
||||
UIManager.AddEvent(BtnRide.gameObject, EventTriggerType.PointerExit, OnExit);
|
||||
BtnMatch = BtnContainer.Find("BtnMatch");
|
||||
//BtnMatch.GetComponent<Button>().onClick.AddListener(() =>
|
||||
//{
|
||||
// Debug.Log(45);
|
||||
//});
|
||||
UIManager.AddEvent(BtnMatch.gameObject, EventTriggerType.PointerClick, GoMatch);
|
||||
UIManager.AddEvent(BtnMatch.gameObject, EventTriggerType.PointerEnter, OnHover);
|
||||
UIManager.AddEvent(BtnMatch.gameObject, EventTriggerType.PointerExit, OnExit);
|
||||
BtnTraining = BtnContainer.Find("BtnTraining");
|
||||
UIManager.AddEvent(BtnTraining.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
Debug.Log(Application.platform);
|
||||
goTraining(e);
|
||||
});
|
||||
UIManager.AddEvent(BtnTraining.gameObject, EventTriggerType.PointerEnter, OnHover);
|
||||
UIManager.AddEvent(BtnTraining.gameObject, EventTriggerType.PointerExit, OnExit);
|
||||
var avatar = userInfo.Find("Avatar").GetComponent<RawImage>();
|
||||
var rect = ((RectTransform)avatar.transform).rect;
|
||||
SetRounded(avatar.transform, rect.height);
|
||||
|
||||
UIManager.AddEvent(avatar.gameObject, EventTriggerType.PointerClick, x =>
|
||||
{
|
||||
UIManager.ShowUserInfoPanel();
|
||||
});
|
||||
|
||||
UIManager.AddEvent(userInfo.Find("BtnMore").gameObject, EventTriggerType.PointerClick, x =>
|
||||
{
|
||||
UIManager.ShowUserInfoPanel();
|
||||
//UIManager.ShowConfirm("Quit", "Do you want to quit PowerFun?", null);
|
||||
});
|
||||
if (transform.Find("Other/BtnRower"))
|
||||
{
|
||||
UIManager.AddEvent(transform.Find("Other/BtnRower").gameObject, EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
UIManager.ShowRowerPanel();
|
||||
});
|
||||
}
|
||||
|
||||
//GetSummary();
|
||||
dict = new Dictionary<string, Sprite[]>
|
||||
{
|
||||
//{
|
||||
// "BtnMatch",new Sprite[]
|
||||
// {
|
||||
// Resources.Load<Sprite>("Images/home/Entrance - MATCH_soon"),
|
||||
// Resources.Load<Sprite>("Images/home/Entrance - MATCH_soon_hover"),
|
||||
// }
|
||||
//},
|
||||
//{
|
||||
// "BtnTraining",new Sprite[]
|
||||
// {
|
||||
// Resources.Load<Sprite>("Images/home/Entrance - TRAINING_soon"),
|
||||
// Resources.Load<Sprite>("Images/home/Entrance - TRAINING_soon_hover"),
|
||||
// }
|
||||
//},
|
||||
};
|
||||
|
||||
}
|
||||
private void GoRide(BaseEventData e)
|
||||
{
|
||||
Debug.Log(App.firstEnter.ToString());
|
||||
//UIManager.ShowEarthPanel(App.latitude, App.longitude);
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
UIManager.ShowNewRouteOverviewPanel();
|
||||
#else
|
||||
if (App.firstEnter == 0)
|
||||
{
|
||||
App.firstEnter = 1;
|
||||
UIManager.ShowEarthPanel(App.latitude, App.longitude);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.ShowNewRouteOverviewPanel();
|
||||
}
|
||||
|
||||
#endif
|
||||
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
|
||||
if (App.weChatController.isApplicationAvilible("com.zhixingpai.powerfun", "powerfun"))
|
||||
{
|
||||
UIManager.ShowConfirm("Switch to PowerFun Workouts?", "We will close the Powerfun and start PowerFun Workouts.", () =>
|
||||
{
|
||||
UIManager.CloseConfirm();
|
||||
Application.OpenURL("powerfun://app");
|
||||
Application.Quit();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.ShowConfirm("Workouts not installed", "Go to the official website to download?", () =>
|
||||
{
|
||||
UIManager.CloseConfirm();
|
||||
Application.OpenURL(App.WorkoutsUrl);
|
||||
});
|
||||
}
|
||||
#endif
|
||||
}
|
||||
//进入比赛
|
||||
private void GoMatch(BaseEventData e)
|
||||
{
|
||||
UIManager.ShowRaceHomePanel();
|
||||
OnExit(e);
|
||||
}
|
||||
private void OnHover(BaseEventData e)
|
||||
{
|
||||
var pe = (PointerEventData)e;
|
||||
var parent = pe.pointerEnter.transform.parent;
|
||||
if (dict.ContainsKey(parent.name))
|
||||
{
|
||||
parent.Find("Image").GetComponent<Image>().sprite = dict[parent.name][1];
|
||||
}
|
||||
//parent.Find("Image").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/home/Entrance - ROUTES_hover");
|
||||
//parent.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
parent.DOScale(new Vector3(1.05f, 1.05f, 0), 0.3f);
|
||||
//parent.GetComponent<RectTransform>().localScale = ;
|
||||
}
|
||||
private void OnExit(BaseEventData e)
|
||||
{
|
||||
var pe = (PointerEventData)e;
|
||||
var parent = pe.pointerEnter.transform.parent;
|
||||
//parent.Find("Image").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/home/Entrance - ROUTES_nomal");
|
||||
//parent.Find("Text").GetComponent<Text>().color = Utils.HexToColorHtml("#5C5C6E");
|
||||
if (dict.ContainsKey(parent.name))
|
||||
{
|
||||
parent.Find("Image").GetComponent<Image>().sprite = dict[parent.name][0];
|
||||
}
|
||||
parent.DOScale(new Vector3(1f, 1f, 0), 0.3f);
|
||||
//parent.GetComponent<RectTransform>().localScale = new Vector3(1f, 1f, 0);
|
||||
}
|
||||
void MoreFunc()
|
||||
{
|
||||
//Utils.showToast(gameObject, "更多信息", 1);
|
||||
|
||||
//DOTween.ToAlpha(() => )
|
||||
}
|
||||
|
||||
void SetCurrentUser(SummaryResultModel summary)
|
||||
{
|
||||
userInfo.Find("NickName").GetComponent<Text>().text = App.CurrentUser.Nickname;
|
||||
userInfo.Find("GroupTop").Find("FtpContainer").Find("FtpValue").GetComponent<Text>().text = App.CurrentUser.FTP.ToString();
|
||||
userInfo.Find("GroupTop").Find("WeightContainer").Find("WeightValue").GetComponent<Text>().text = App.CurrentUser.Weight.ToString();
|
||||
userInfo.Find("GroupTop").Find("WKGContainer").Find("WKGValue").GetComponent<Text>().text = $"{ (App.CurrentUser.FTP/ App.CurrentUser.Weight).ToString("0.0") }";
|
||||
userInfo.Find("IDText").GetComponent<Text>().text = "ID:" + App.CurrentUser.Id.ToString("000000");
|
||||
if (!string.IsNullOrWhiteSpace(App.CurrentUser.Unionid))
|
||||
{
|
||||
userInfo.Find("Wx").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/Wechat_person_1");
|
||||
}
|
||||
if (App.CurrentUser.Sex == 2)
|
||||
{
|
||||
userInfo.Find("SexIcon").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/woman");
|
||||
}
|
||||
else
|
||||
{
|
||||
userInfo.Find("SexIcon").GetComponent<Image>().sprite = Resources.Load<Sprite>("Images/man");
|
||||
}
|
||||
Utils.DisplayHead(userInfo.Find("Avatar").GetComponent<RawImage>(), App.CurrentUser.WxHeadImg);
|
||||
|
||||
userInfo.Find("Country").GetComponent<RawImage>().texture = UIManager.Instance.loginRegOptions.GetCountryImageByName(App.CurrentUser.Country);
|
||||
userInfo.Find("CaloriesContainer").Find("CaloriesValue").GetComponent<Text>().text = double.Parse(summary.Kcal,CultureInfo.InvariantCulture).ToString("0") +" KCAL";
|
||||
userInfo.Find("KMContainer").Find("KMValue").GetComponent<Text>().text = summary.TotalDistance.ToString("0") +" KM";
|
||||
userInfo.Find("ClimbContainer").Find("ClimbValue").GetComponent<Text>().text = double.Parse(summary.TotalClimb,CultureInfo.InvariantCulture).ToString("0") + " M";
|
||||
|
||||
userInfo.Find("GroupTop").Find("FtpContainer").Find("FtpTime").GetComponent<Text>().text = App.CurrentUser.LastUpdateFtpTime.ToString("dd.MM.yyyy");
|
||||
userInfo.Find("GroupTop").Find("WeightContainer").Find("WeightTime").GetComponent<Text>().text = App.CurrentUser.LastUpdateWeightTime.ToString("dd.MM.yyyy");
|
||||
userInfo.Find("GroupTop").Find("WKGContainer").Find("WKGTime").GetComponent<Text>().text =
|
||||
DateTime.Compare(App.CurrentUser.LastUpdateFtpTime, App.CurrentUser.LastUpdateWeightTime)>0
|
||||
? App.CurrentUser.LastUpdateFtpTime.ToString("dd.MM.yyyy")
|
||||
: App.CurrentUser.LastUpdateWeightTime.ToString("dd.MM.yyyy");
|
||||
//新版设计稿
|
||||
var todayData = transform.Find("TodayData");
|
||||
if (todayData)
|
||||
{
|
||||
Utils.DisplayHead(todayData.Find("Avatar").GetComponent<RawImage>(), App.CurrentUser.WxHeadImg);
|
||||
todayData.Find("Distance/Value").GetComponent<Text>().text = $"{summary.ContinuesDay}"+ (summary.ContinuesDay > 1 ? App.GetLocalString("DAYS") : App.GetLocalString("DAY"));
|
||||
todayData.Find("Datas/Climb/Value").GetComponent<Text>().text = $"{summary.ContinuesKm.ToString("#0.0")}";//$"{double.Parse(summary.TotalClimb, CultureInfo.InvariantCulture).ToString("0")}M";
|
||||
todayData.Find("Datas/Carlories/Value").GetComponent<Text>().text = $"{summary.ContinuesKcal.ToString("#0")}";
|
||||
//todayData.Find("Datas/Distance/Rank").GetComponent<Text>().text = summary.CurrentTotalDistance == 0 ? "——" : $"+{summary.CurrentTotalDistance.ToString("#0")}";
|
||||
todayData.Find("Datas/Climb/Rank").GetComponent<Text>().text = summary.CurrentTotalDistance == 0 ? "——" : $"+{summary.CurrentTotalDistance.ToString("#0.0")}";
|
||||
todayData.Find("Datas/Carlories/Rank").GetComponent<Text>().text = summary.CurrentTotalKcal == 0 ? "——" : $"+{summary.CurrentTotalKcal.ToString("#0")}";
|
||||
#if UNITY_STANDALONE_WIN
|
||||
//todayData.Find("NickName").GetComponent<Text>().text = App.CurrentUser.Nickname;
|
||||
//todayData.Find("ID").GetComponent<Text>().text = $"ID:{App.CurrentUser.Id.ToString("000000")}";
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
async void GetSummary()
|
||||
{
|
||||
var res = await ConfigHelper.userApi.GetSummary();
|
||||
if (res.result)
|
||||
{
|
||||
//App.CurrentUser.Distance = res.data.TotalDistance;
|
||||
//App.CurrentUser.Climb = res.data.TotalClimb;
|
||||
//App.CurrentUser.Carlories = res.data.Kcal;
|
||||
SetCurrentUser(res.data);
|
||||
//Climb.text = $"{res.data.TotalClimb.ToString()}M";
|
||||
//Calories.text = $"{res.data.Kcal.ToString()}KCAL";
|
||||
//Calories.text = res.data.
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.showToast(gameObject, res.errMsg);
|
||||
}
|
||||
//var res = await NoAuthApi.GetCurrentUser();
|
||||
//if (res.result)
|
||||
//{
|
||||
// Global.CurrentUser = res.data;
|
||||
// SetCurrentUser();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Utils.showToast(gameObject, res.errMsg);
|
||||
//}
|
||||
}
|
||||
float maxt = 0f; //用于获取全服最值内容
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//maxt -= Time.deltaTime;
|
||||
//if (maxt <= 0)
|
||||
//{
|
||||
// GetMaxRanking();
|
||||
// maxt += 60f * 5;
|
||||
//}
|
||||
//if (maxdataTime > 0)
|
||||
//{
|
||||
// maxdataTime -= Time.deltaTime;
|
||||
//}
|
||||
//else if (maxdataTime < 0)
|
||||
//{
|
||||
// DORotateMaxData();
|
||||
// maxdataTime += 10f;
|
||||
//}
|
||||
}
|
||||
private async void GetMaxRanking()
|
||||
{
|
||||
var res = await ConfigHelper.mapApi.GetMaxRanking();
|
||||
if (res.result)
|
||||
{
|
||||
maxList = res.data;
|
||||
if (maxList.Count > 0)
|
||||
{
|
||||
maxdataTime = 3;
|
||||
maxdataIndex = 0;
|
||||
SetMessage(maxList[maxdataIndex++]);
|
||||
//Transform p = transform.Find("MaxRankingData/Power"),
|
||||
//d = transform.Find("MaxRankingData/Distance"),
|
||||
//c = transform.Find("MaxRankingData/Climb");
|
||||
//Utils.DisplayHead(p.Find("Avatar").GetComponent<RawImage>(), list[1].WxHeadImg);
|
||||
//Utils.DisplayHead(d.Find("Avatar").GetComponent<RawImage>(), list[0].WxHeadImg);
|
||||
//Utils.DisplayHead(c.Find("Avatar").GetComponent<RawImage>(), list[2].WxHeadImg);
|
||||
//p.Find("NickName").GetComponent<Text>().text = list[1].NickName;
|
||||
//d.Find("NickName").GetComponent<Text>().text = list[0].NickName;
|
||||
//c.Find("NickName").GetComponent<Text>().text = list[2].NickName;
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.Find("MaxRankingData").gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int maxdataIndex = 0;
|
||||
float maxdataTime = 0;
|
||||
private List<MapMaxRanking> maxList;
|
||||
|
||||
private void DORotateMaxData()
|
||||
{
|
||||
var t = transform.Find("MaxRankingData");
|
||||
var se = DOTween.Sequence();
|
||||
var s1 = t.DORotate(new Vector3(-90, 0, 0), 0.5f);
|
||||
s1.onComplete = () =>
|
||||
{
|
||||
SetMessage(maxList[(maxdataIndex++) % maxList.Count]);
|
||||
};
|
||||
se.Append(s1);
|
||||
se.Append(t.DORotate(Vector3.zero, 0.5f));
|
||||
}
|
||||
void SetMessage(MapMaxRanking e)
|
||||
{
|
||||
var m = transform.Find("MaxRankingData");
|
||||
Utils.DisplayHead(m.transform.Find("Avatar").GetComponent<RawImage>(), e.WxHeadImg);
|
||||
m.transform.Find("Nickname").GetComponent<Text>().text = e.NickName;
|
||||
var txt = m.transform.Find("TextContainer/Content").GetComponent<RectTransform>();
|
||||
txt.GetComponent<Text>().text = e.Message;
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(txt);
|
||||
m.GetComponent<HomeMessageController>().Initial(txt.sizeDelta.x);
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
transform.MyDOFade();
|
||||
GetSummary();
|
||||
#if UNITY_STANDALONE_WIN
|
||||
//GetNotify();
|
||||
#endif
|
||||
//transform.Find("Panel (1)").GetComponent<test>().startPage();
|
||||
}
|
||||
|
||||
private async Task GetNotify()
|
||||
{
|
||||
var r = await ConfigHelper.userApi.GetNotify();
|
||||
if (r.result)
|
||||
{
|
||||
var lm = transform.Find("LongMessage");
|
||||
if (r.data.Value<int>("Id") > 1)
|
||||
{
|
||||
lm.gameObject.SetActive(true);
|
||||
lm.GetComponent<LongMessageScript>().Initial(r.data["Content"].ToString().Replace("\r\n"," "));
|
||||
}
|
||||
else
|
||||
{
|
||||
lm.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c6e427bcdfce6c747a8ffae9688f1583
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b68882e4f82116149b50cdcd42bb2e5e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,89 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Assets.Scripts.UI.Prefab.Player
|
||||
{
|
||||
public abstract class AbstractEquipmentScript : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler, IPointerUpHandler
|
||||
{
|
||||
public Image Content;//装备图片
|
||||
public GameObject bglock;
|
||||
public GameObject bglockLight;//选中样式
|
||||
public GameObject Click;//选中勾选
|
||||
public GameObject lockGrey;//灰色的锁定
|
||||
public GameObject lockLight;//白色的锁定 选中时使用
|
||||
public Text Title;
|
||||
public Text Desc;
|
||||
|
||||
protected int Id { get; set; }
|
||||
protected string Name { get; set; }
|
||||
protected string Remark { get; set; }
|
||||
|
||||
protected string URL { get; set; }
|
||||
protected bool IsLock { get; set; }
|
||||
protected virtual void Start()
|
||||
{
|
||||
var btn = GetComponent<Button>();
|
||||
btn.onClick.AddListener(() =>
|
||||
{
|
||||
Select();
|
||||
});
|
||||
}
|
||||
public virtual void Init(int id, string name, string remark, string url, bool isLock)
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
Remark = remark;
|
||||
IsLock = isLock;
|
||||
URL = url;
|
||||
Utils.DisplayImage(Content, url);
|
||||
}
|
||||
|
||||
public virtual void Select()
|
||||
{
|
||||
UnSelectAll();
|
||||
bglockLight.SetActive(true);
|
||||
if (lockGrey != null && lockLight != null)
|
||||
{
|
||||
lockLight.SetActive(IsLock);
|
||||
lockGrey.SetActive(false);
|
||||
}
|
||||
Title.text = Name;
|
||||
Desc.text = Remark;
|
||||
}
|
||||
|
||||
public virtual void UnSelect()
|
||||
{
|
||||
bglockLight.SetActive(false);
|
||||
if (lockGrey != null && lockLight != null)
|
||||
{
|
||||
lockGrey.SetActive(IsLock);
|
||||
lockLight.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void UnSelectAll()
|
||||
{
|
||||
var list = FindObjectsOfType<AbstractEquipmentScript>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
item.UnSelect();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
Cursor.SetCursor(Resources.Load<Texture2D>("Images/PointerButtonHover"), Vector2.zero, CursorMode.Auto);
|
||||
}
|
||||
|
||||
public void OnPointerUp(PointerEventData eventData)
|
||||
{
|
||||
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81da3ad384a6846459d84bd58925d0ad
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Assets.Scripts.UI.Prefab.Player
|
||||
{
|
||||
public class HelmetCardScript : AbstractEquipmentScript
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b43f05d0792ff6749a81a69b0cabdda4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Assets.Scripts.UI.Prefab.Player
|
||||
{
|
||||
public class SkinCardScript : AbstractEquipmentScript
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00e2ed46366547b449f316f20524f2bd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Assets.Scripts.UI.Prefab.Player
|
||||
{
|
||||
public class SuitCardScript : AbstractEquipmentScript
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ad006bec4fe71b42838dc07592fcb99
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Assets.Scripts.UI.Prefab.Player
|
||||
{
|
||||
public class UniformCardScript : AbstractEquipmentScript
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ac75d1b22152d54c94bf747ca64c677
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -56,6 +56,15 @@ public class UIManager : MonoBehaviour
|
||||
return this.GetPanelInstance("HomePanel", ref this.mHomePanel);
|
||||
}
|
||||
}
|
||||
|
||||
private NewHomeController mNewHomePanel;
|
||||
public NewHomeController NewHomePanel
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetPanelInstance("NewHomePanel", ref this.mNewHomePanel);
|
||||
}
|
||||
}
|
||||
public static void RunOnUnityThread(Action action)
|
||||
{
|
||||
// is this right?
|
||||
@@ -165,6 +174,14 @@ public class UIManager : MonoBehaviour
|
||||
return this.GetPanelInstance("EditUserPanel", ref this.mEditUserController);
|
||||
}
|
||||
}
|
||||
private ChangePlayerController mChangePlayerPanel;
|
||||
public ChangePlayerController ChangePlayerPanel
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.GetPanelInstance("ChangePlayerPanel", ref this.mChangePlayerPanel);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetModalPanel(PFUIPanel p)
|
||||
{
|
||||
@@ -667,7 +684,8 @@ public class UIManager : MonoBehaviour
|
||||
}
|
||||
if (UIManager.Instance.MainPanel != null && parent == UIManager.Instance.MainPanel)
|
||||
{
|
||||
App.currentPageIsHome = panelToShow.Equals(UIManager.Instance.HomePanel);
|
||||
//App.currentPageIsHome = panelToShow.Equals(UIManager.Instance.HomePanel);
|
||||
App.currentPageIsHome = panelToShow.Equals(UIManager.Instance.NewHomePanel);
|
||||
}
|
||||
|
||||
if (modal)
|
||||
@@ -797,6 +815,10 @@ public class UIManager : MonoBehaviour
|
||||
|
||||
public static void ShowHomePanel()
|
||||
{
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
ShowNewHomePanel();
|
||||
return;
|
||||
#endif
|
||||
App.IsRowerMode = false;
|
||||
stack.Clear();
|
||||
UIManager.Instance.MainPanel.GetComponent<Image>().sprite =
|
||||
@@ -804,6 +826,15 @@ public class UIManager : MonoBehaviour
|
||||
UIManager.Show(UIManager.Instance.HomePanel, UIManager.Instance.MainPanel);
|
||||
}
|
||||
|
||||
public static void ShowNewHomePanel()
|
||||
{
|
||||
App.IsRowerMode = false;
|
||||
stack.Clear();
|
||||
UIManager.Instance.MainPanel.GetComponent<Image>().sprite =
|
||||
Resources.Load<Sprite>("Images/main-bg");
|
||||
UIManager.Show(UIManager.Instance.NewHomePanel, UIManager.Instance.MainPanel);
|
||||
}
|
||||
|
||||
public static void ShowDevicePanel()
|
||||
{
|
||||
UIManager.Show(UIManager.Instance.DevicePanel, null, true);
|
||||
@@ -828,6 +859,10 @@ public class UIManager : MonoBehaviour
|
||||
{
|
||||
UIManager.Show(UIManager.Instance.EditUserPanel, UIManager.Instance.MainPanel);
|
||||
}
|
||||
public static void ShowChangePlayerPanel()
|
||||
{
|
||||
UIManager.Show(UIManager.Instance.ChangePlayerPanel, UIManager.Instance.MainPanel);
|
||||
}
|
||||
|
||||
public static RaceAlertController ShowRaceAlertPanel()
|
||||
{
|
||||
|
||||
@@ -500,6 +500,8 @@ namespace Assets.Scripts
|
||||
var fs = File.Create(filepath);
|
||||
fs.Write(request.downloadHandler.data, 0, request.downloadHandler.data.Length);
|
||||
fs.Close();
|
||||
fs.Dispose();
|
||||
fs = null;
|
||||
local = filepath;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user