修改新设计稿,保存每次划船的影子id;修改细节,增加c2适配前暂存
This commit is contained in:
1 parent
ab653b994f
commit
e0649f7ea1
20 files changed
+4964
-4083
No files matched your search
@@ -48,11 +48,15 @@ public class NewMainNav : MonoBehaviour
|
||||
/// <param name="indexs">仅展开显示的按钮:1:"Exit",3:"Device",4:"Delay",5:"Setting",6:"Support",7:"Avatar"</param>
|
||||
/// <param name="shrinkIndex">合上后仍显示的按钮:0:"Back",2:"Home",null:仅PF</param>
|
||||
/// <param name="custom">自定义按钮 8:c1 9:c2 11:c3</param>
|
||||
public void SetButtonActive(List<int> indexs,int? shrinkIndex = null, CustomButton custom = null, CustomButton custom2 = null,CustomButton custom3 = null)
|
||||
public void SetButtonActive(List<int> indexs,int? shrinkIndex = null, CustomButton custom = null, CustomButton custom2 = null,CustomButton custom3 = null,bool ShowMail = true)
|
||||
{
|
||||
this.indexs = indexs;
|
||||
//邮箱常驻
|
||||
this.indexs.Add(10);
|
||||
|
||||
if (ShowMail)
|
||||
{
|
||||
//邮箱常驻(除划船机)
|
||||
this.indexs.Add(10);
|
||||
}
|
||||
this.shrinkIndex = shrinkIndex;
|
||||
this.custom = custom;
|
||||
this.custom2 = custom2;
|
||||
|
||||
@@ -201,7 +201,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
{
|
||||
ReturnHome();
|
||||
}, false);
|
||||
nav.SetButtonActive(new List<int> { 3, 7 }, null, c1, null, c3);
|
||||
nav.SetButtonActive(new List<int> { 3, 7 }, null, c1, null, c3, false);
|
||||
newNav = nav;
|
||||
#endif
|
||||
UIManager.AddEvent(transform.Find("Stopped/Confirm/BtnSave").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
@@ -224,8 +224,10 @@ public class RowerHomeScript : PFUIPanel
|
||||
Rower.Reset();
|
||||
}
|
||||
//RowerPanel/Rower/Bottom/Expected/Title
|
||||
var dw = rowerType.type == 1 ? $"{rowerType.value}M" : $"{(rowerType.value / 60).ToString("#0.00")}Min";
|
||||
bottom.Find("Expected/Title").GetComponent<Text>().text = $"EST\n/ {dw}";
|
||||
//var dw = rowerType.type == 1 ? $"{rowerType.value}M" : $"{(rowerType.value / 60).ToString("#0.00")}Min";
|
||||
//bottom.Find("Expected/Title").GetComponent<Text>().text = $"EST\n/ {dw}";
|
||||
var dw = rowerType.type == 1 ? $"" : $"\nM";
|
||||
bottom.Find("Expected/Title").GetComponent<Text>().text = $"EST{dw}";
|
||||
Init();
|
||||
//Utils.showToast(null, "请滑动划船机并开始", isLowest: true, type: 1);
|
||||
}
|
||||
@@ -268,6 +270,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
isPause = true;
|
||||
btnStart.GetComponent<Image>().sprite = spriteDict["Start"];
|
||||
btnStart.tag = "Start";
|
||||
transform.Find("Stopped").gameObject.SetActive(false);
|
||||
Save();
|
||||
Init();
|
||||
}
|
||||
@@ -389,6 +392,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
model.TotalDistance = RowerData.TotalDistance;
|
||||
model.Type = rowerType.type == 0 ? (int?)null : rowerType.type;
|
||||
model.TypeValue = rowerType.value == 0 ? (float?)null : rowerType.value;
|
||||
model.ShadowIds = string.Join(",",GetComponent<RowerMultiModeScript>().shadowList.Select(x=>x.Nid));
|
||||
var path = PFConstants.RowerRecordFolder + "/" + model.Id;
|
||||
Helper.CreateDirectoryIfNotExsit(path);
|
||||
var files = new List<string>();
|
||||
@@ -416,7 +420,14 @@ public class RowerHomeScript : PFUIPanel
|
||||
Debug.Log(ex.Message);
|
||||
}
|
||||
var res = ConfigHelper.rowerApi.Add(model, files);
|
||||
UIManager.ShowRowerWelldone(model.Id);
|
||||
if (res.result)
|
||||
{
|
||||
UIManager.ShowRowerWelldone(model.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.showToast(null, res.errMsg);
|
||||
}
|
||||
//Disconnect();
|
||||
}
|
||||
|
||||
@@ -441,9 +452,25 @@ public class RowerHomeScript : PFUIPanel
|
||||
pullList = new List<DoubleVector2>();
|
||||
mid.Find("GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
|
||||
openTimer = false;
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = "---";
|
||||
//bottom.Find("TrueTime/Value").GetComponent<Text>().text = "---";
|
||||
bottom.Find("KM/Value").GetComponent<Text>().text = "---";
|
||||
if (rowerType.type == 0)
|
||||
{
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = "---";
|
||||
bottom.Find("KM/Value").GetComponent<Text>().text = "---";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rowerType.type == 1)
|
||||
{
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = "---";
|
||||
bottom.Find("KM/Value").GetComponent<Text>().text = $"{rowerType.value}M";
|
||||
}
|
||||
else
|
||||
{
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(rowerType.value).ToPFString();
|
||||
bottom.Find("KM/Value").GetComponent<Text>().text = "---";
|
||||
}
|
||||
}
|
||||
|
||||
mid.Find("W/Value").GetComponent<Text>().text = "---";
|
||||
//bottom.Find("W/AvgValue").GetComponent<Text>().text = "---";
|
||||
bottom.Find("500/Value").GetComponent<Text>().text = "---";
|
||||
@@ -533,6 +560,8 @@ public class RowerHomeScript : PFUIPanel
|
||||
var distance = (int)RowerData.TotalDistance;
|
||||
var energy = RowerData.TotalEnergy;
|
||||
var strokeCount = RowerData.StrokeCount;
|
||||
var power = RowerData.InstantaneousPower;
|
||||
var rate = RowerData.StrokeRate;
|
||||
TempRowerCalc tmpdata = null;
|
||||
if (totalDistance == RowerData.TotalDistance)
|
||||
{
|
||||
@@ -567,14 +596,19 @@ public class RowerHomeScript : PFUIPanel
|
||||
var remainTime = rowerType.value - (seconds++);
|
||||
if (remainTime == 0)
|
||||
{
|
||||
records.Add($"{strokeCount},{RowerData.ElapsedTime},{distance},0,0,0,{RowerData.ResistanceLevel},{heartRate},{energy}");
|
||||
tmpdata = new TempRowerCalc() { strokeCount = strokeCount, pace = 0, power = 0, rate = 0, heartRate = heartRate, distance = distance, energy = energy };
|
||||
values.Add(tmpdata);
|
||||
SendDataToRace(tmpdata);
|
||||
HandleSaveDirect();
|
||||
return;
|
||||
}
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(remainTime).ToString();
|
||||
TimeSpan.FromSeconds(remainTime).ToPFString();
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(remainTime).ToPFString();
|
||||
}
|
||||
else
|
||||
{
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(seconds++).ToString();
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(seconds++).ToPFString();
|
||||
}
|
||||
mid.Find("W/Value").GetComponent<Text>().text = "---";
|
||||
//bottom.Find("W/AvgValue").GetComponent<Text>().text = "---";
|
||||
@@ -598,21 +632,28 @@ public class RowerHomeScript : PFUIPanel
|
||||
var remainTime = rowerType.value - (seconds++);
|
||||
if (remainTime == 0)
|
||||
{
|
||||
records.Add($"{strokeCount},{RowerData.ElapsedTime},{distance},{RowerData.InstantaneousPower},{RowerData.InstantaneousPace},{RowerData.StrokeRate},{RowerData.ResistanceLevel},{heartRate},{energy}");
|
||||
tmpdata = new TempRowerCalc() { strokeCount = strokeCount, pace = pace, power = power, rate = rate, heartRate = heartRate, distance = distance, energy = energy };
|
||||
values.Add(tmpdata);
|
||||
SendDataToRace(tmpdata);
|
||||
HandleSaveDirect();
|
||||
return;
|
||||
}
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(remainTime).ToString();
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(remainTime).ToPFString();
|
||||
}
|
||||
else
|
||||
{
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(seconds++).ToString();
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(seconds++).ToPFString();
|
||||
}
|
||||
//bottom.Find("TrueTime/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(RowerData.ElapsedTime).ToString();
|
||||
if (rowerType.type == 1)
|
||||
{
|
||||
var remainDistance = rowerType.value - totalDistance;
|
||||
if (remainDistance < 0)
|
||||
{
|
||||
records.Add($"{strokeCount},{RowerData.ElapsedTime},{distance},{RowerData.InstantaneousPower},{RowerData.InstantaneousPace},{RowerData.StrokeRate},{RowerData.ResistanceLevel},{heartRate},{energy}");
|
||||
tmpdata = new TempRowerCalc() { strokeCount = strokeCount, pace = pace, power = power, rate = rate, heartRate = heartRate, distance = distance, energy = energy };
|
||||
values.Add(tmpdata);
|
||||
SendDataToRace(tmpdata);
|
||||
HandleSaveDirect();
|
||||
return;
|
||||
}
|
||||
@@ -629,33 +670,39 @@ public class RowerHomeScript : PFUIPanel
|
||||
//设置里程时 显示预估时间 当前时间+剩余里程/配速(转换)
|
||||
var remainDistance = rowerType.value - totalDistance;
|
||||
var time = values.Count + (remainDistance / (500f / pace));
|
||||
bottom.Find("Expected/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(time).ToString(@"hh\:mm\:ss");
|
||||
bottom.Find("Expected/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(time).ToPFString();
|
||||
}
|
||||
else if (rowerType.type == 2)
|
||||
{
|
||||
var remainTime = rowerType.value - values.Count;
|
||||
var dis = totalDistance + (remainTime * (500f / pace));
|
||||
//设置时间时 显示预估里程 当前里程+剩余时间*配速
|
||||
bottom.Find("Expected/Value").GetComponent<Text>().text = $"{dis.ToString("#0")}M";
|
||||
bottom.Find("Expected/Value").GetComponent<Text>().text = $"{dis.ToString("#0")}";
|
||||
}
|
||||
else
|
||||
{
|
||||
//自由滑 显示30min里程 当前里程+剩余时间*配速
|
||||
var remainTime = 30 * 60 - values.Count;
|
||||
var dis = totalDistance + (remainTime * (500f / pace));
|
||||
var count30 = ((int)Math.Ceiling(values.Count / 1800f));
|
||||
var remainTime = count30 * 1800 - values.Count;
|
||||
var dif = 0;
|
||||
if (count30 > 1 && (count30 - 1) * 1800 - 1 < values.Count)
|
||||
{
|
||||
dif = values[(count30 - 1) * 1800 - 1].distance;
|
||||
}
|
||||
var dis = totalDistance - dif + (remainTime * (500f / pace));
|
||||
//设置时间时 显示预估里程 当前里程+剩余时间*配速
|
||||
bottom.Find("Expected/Value").GetComponent<Text>().text = $"{dis.ToString("#0")}M";
|
||||
bottom.Find("Expected/Value").GetComponent<Text>().text = $"{dis.ToString("#0")}";
|
||||
}
|
||||
}
|
||||
|
||||
//RowerPanel/Rower/Bottom/Expected/Value
|
||||
var power = RowerData.InstantaneousPower;
|
||||
|
||||
mid.Find("W/Value").GetComponent<Text>().text = power.ToString();
|
||||
//bottom.Find("W/AvgValue").GetComponent<Text>().text = RowerData.AveragePower.ToString();
|
||||
|
||||
bottom.Find("500/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(pace).ToString(@"mm\:ss");
|
||||
bottom.Find("500/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(pace).ToPFString();
|
||||
//bottom.Find("500/AvgValue").GetComponent<Text>().text = TimeSpan.FromSeconds(RowerData.AveragePace).ToString(@"mm\:ss");
|
||||
var rate = RowerData.StrokeRate;
|
||||
|
||||
bottom.Find("MS/Value").GetComponent<Text>().text = rate.ToString();
|
||||
//bottom.Find("MS/AvgValue").GetComponent<Text>().text = RowerData.AverageStrokeRate.ToString();
|
||||
//if (ushort.TryParse(left.Find("Times/Value").GetComponent<Text>().text, out ushort originStroke))
|
||||
@@ -670,7 +717,6 @@ public class RowerHomeScript : PFUIPanel
|
||||
mid.Find("AvgForce/Value").GetComponent<Text>().text = RowerCommonDataInstance.AverageDriveForce.ToString("#0");
|
||||
mid.Find("PeakForce/Value").GetComponent<Text>().text = RowerCommonDataInstance.PeakDriveForce.ToString("#0");
|
||||
records.Add($"{strokeCount},{RowerData.ElapsedTime},{distance},{RowerData.InstantaneousPower},{RowerData.InstantaneousPace},{RowerData.StrokeRate},{RowerData.ResistanceLevel},{heartRate},{energy}");
|
||||
print(records.Count);
|
||||
tmpdata = new TempRowerCalc() { strokeCount = strokeCount, pace = pace, power = power, rate = rate, heartRate = heartRate, distance = distance, energy = energy };
|
||||
values.Add(tmpdata);
|
||||
SendDataToRace(tmpdata);
|
||||
@@ -802,8 +848,8 @@ public class RowerHomeScript : PFUIPanel
|
||||
{
|
||||
var flag = Rower != null && RowerData != null;
|
||||
transform.Find("Ready/DeviceStatus").gameObject.SetActive(!flag);
|
||||
transform.Find("Ready/Img").gameObject.SetActive(!flag);
|
||||
transform.Find("Ready/Text").gameObject.SetActive(!flag);
|
||||
transform.Find("Ready/Img").gameObject.SetActive(flag);
|
||||
transform.Find("Ready/Text").gameObject.SetActive(flag);
|
||||
transform.Find("Ready/DeviceStatusConnect").gameObject.SetActive(flag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,28 @@ public class RouteItem : MonoBehaviour
|
||||
row1.Find("Distance").GetComponent<Text>().text = $"<color=#5c5c6e>{App.GetLocalString("Distance")}:</color>{result.TotalDistance}M";
|
||||
row2.Find("Device").GetComponent<Text>().text = $"<color=#5c5c6e>{App.GetLocalString("Rowing equipment")}:</color>{result.ManufacturerName}";
|
||||
left.Find("Progress").gameObject.SetActive(false);
|
||||
left.Find("Main/Name").GetComponent<Text>().text = $"{result.CreateTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")} Free Rowing";
|
||||
string typeStr = "Free";
|
||||
if (result.Type == 1)
|
||||
{
|
||||
typeStr = $"{result.TypeValue}M";
|
||||
}
|
||||
else if (result.Type == 2 && result.TypeValue.HasValue)
|
||||
{
|
||||
var ts = TimeSpan.FromSeconds(result.TypeValue.Value);
|
||||
if (ts.TotalHours >= 1)
|
||||
{
|
||||
typeStr = ts.TotalHours.ToString("#0.0") + "h";
|
||||
}
|
||||
else if (ts.TotalMinutes >= 1)
|
||||
{
|
||||
typeStr = ts.TotalMinutes.ToString("#0.0") + "min";
|
||||
}
|
||||
else
|
||||
{
|
||||
typeStr = result.TypeValue.Value + "s";
|
||||
}
|
||||
}
|
||||
left.Find("Main/Name").GetComponent<Text>().text = $"{result.CreateTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")} {typeStr} Rowing";
|
||||
left.Find("Main/Time").GetComponent<Text>().text = $"{result.StartTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")} ~ {result.CreateTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")}";
|
||||
var rect = left.Find("Main").GetComponent<RectTransform>();
|
||||
rect.sizeDelta = new Vector2(399,rect.sizeDelta.y);
|
||||
|
||||
@@ -38,6 +38,7 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
public bool isMine { get; set; }
|
||||
public int currentDistance { get; set; }
|
||||
public string Country { get; set; }
|
||||
public int currentRank { get; set; }
|
||||
}
|
||||
List<Trace> traceList;
|
||||
List<float> initialPosYList;
|
||||
@@ -48,6 +49,18 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
if (PlayerPrefs.GetFloat("RowerMultiModeLocationX") != 0f)
|
||||
{
|
||||
scroll.localPosition = new Vector3(PlayerPrefs.GetFloat("RowerMultiModeLocationX"), startPosition.y, startPosition.z);
|
||||
foreach (Transform t in transform.Find("Rower/Dots"))
|
||||
{
|
||||
t.GetComponent<Image>().color = Utils.HexToColorHtml("#ffffff");
|
||||
}
|
||||
if (scroll.localPosition.x >= startPosition.x - (730 / 2))
|
||||
{
|
||||
transform.Find("Rower/Dots/d1").GetComponent<Image>().color = Utils.HexToColorHtml("#f93086");
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.Find("Rower/Dots/d2").GetComponent<Image>().color = Utils.HexToColorHtml("#f93086");
|
||||
}
|
||||
}
|
||||
AddTouchEvent();
|
||||
m2 = transform.Find("Rower/Modes/Scroll/M2");
|
||||
@@ -75,6 +88,7 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
|
||||
public void HandleTimeTick(RowerChartModel data)
|
||||
{
|
||||
//rowerType = GetComponent<RowerHomeScript>().rowerType;
|
||||
currentSecond++;
|
||||
myData.list.Add(data);
|
||||
SortByCurrentDistance();
|
||||
@@ -105,6 +119,10 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
});
|
||||
}
|
||||
userList = userList.OrderByDescending(x => x.currentDistance).ToList();
|
||||
for (int i = 0; i < userList.Count; i++)
|
||||
{
|
||||
userList[i].currentRank = i + 1;
|
||||
}
|
||||
}
|
||||
private List<TraceData> HandleData()
|
||||
{
|
||||
@@ -126,21 +144,15 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
|
||||
List<TraceData> userList;
|
||||
TraceData myData;
|
||||
List<RowerRank> shadowList;
|
||||
private async void Start()
|
||||
{
|
||||
rowerType = GetComponent<RowerHomeScript>().rowerType;
|
||||
//#if UNITY_EDITOR
|
||||
// rowerType = new RowerTaskPanel.RowerType { type = 1, value = 250 };
|
||||
//#endif
|
||||
GetShadowList(rowerType);
|
||||
}
|
||||
public List<RowerRank> shadowList { get; private set; }
|
||||
|
||||
public async void GetShadowList(RowerTaskPanel.RowerType rowerType)
|
||||
{
|
||||
this.rowerType = rowerType;
|
||||
currentSecond = -1;
|
||||
var res = await ConfigHelper.rowerApi.GetShadowList(rowerType);
|
||||
shadowList = res.data;
|
||||
|
||||
var _tmpList = shadowList.Select(x => new TraceData
|
||||
{
|
||||
list = x.list,
|
||||
@@ -161,6 +173,10 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
myData.Country = App.CurrentUser.Country;
|
||||
_tmpList.Add(myData);
|
||||
userList = _tmpList.OrderByDescending(x => x.currentDistance).ToList();
|
||||
for (int i = 0; i < userList.Count; i++)
|
||||
{
|
||||
userList[i].currentRank = i + 1;
|
||||
}
|
||||
DisplayUserRanks(true);
|
||||
DisplayTraces();
|
||||
}
|
||||
@@ -263,16 +279,20 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
}
|
||||
var width = t.Find("Main").GetComponent<RectTransform>().sizeDelta.x - t.Find("Main/Boat").GetComponent<RectTransform>().sizeDelta.x;
|
||||
var diffWidth = data.currentDistance - mineData.currentDistance + 50;
|
||||
if (diffWidth >= 0 && diffWidth <= 100)
|
||||
if (data.currentDistance <= 50)
|
||||
{
|
||||
if (data.currentDistance <= 50)
|
||||
{
|
||||
diffWidth = data.currentDistance;
|
||||
}
|
||||
else if (rowerType.type == 1 && rowerType.value - data.currentDistance <= 50)
|
||||
{
|
||||
diffWidth = 100 - ((int)rowerType.value - data.currentDistance);
|
||||
}
|
||||
diffWidth = data.currentDistance;
|
||||
}
|
||||
else if (rowerType.type == 1 && rowerType.value - data.currentDistance <= 50)
|
||||
{
|
||||
diffWidth = 100 - ((int)rowerType.value - data.currentDistance);
|
||||
}
|
||||
if (data.isMine)
|
||||
{
|
||||
print("diff:" + diffWidth + ";"+ rowerType.type);
|
||||
}
|
||||
if (diffWidth >= 0 && diffWidth <= 100)
|
||||
{
|
||||
var tWidth = (diffWidth / 100f) * width;
|
||||
t.Find("Main/Boat").gameObject.SetActive(true);
|
||||
//t.Find("Main/Boat").localPosition = new Vector3(25 + tWidth, t.Find("Main/Boat").localPosition.y, t.Find("Main/Boat").localPosition.z);
|
||||
@@ -331,7 +351,7 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
|
||||
private void SetRank(GameObject game, TraceData item,int i)
|
||||
{
|
||||
game.transform.Find("Content/Rank").GetComponent<Text>().text = (i + 1).ToString("00");
|
||||
game.transform.Find("Content/Rank").GetComponent<Text>().text = item.currentRank.ToString("00");
|
||||
game.transform.Find("Content/NickName").GetComponent<Text>().text = item.NickName;
|
||||
Utils.DisplayImageTempDict(game.transform.Find("Content/Avatar").GetComponent<RawImage>(), item.Avatar, caches);
|
||||
var _c = countryList.FirstOrDefault(x => item.Country == x.country);
|
||||
@@ -339,7 +359,7 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
{
|
||||
game.transform.Find("Content/Country").GetComponent<Image>().sprite = Resources.Load<Sprite>(_c.source);
|
||||
}
|
||||
if (currentSecond < 0)
|
||||
if (currentSecond < 0 || item.list.Count == 0)
|
||||
{
|
||||
game.transform.Find("Content/Time").GetComponent<Text>().text = "0M";
|
||||
game.transform.Find("Content/Power").GetComponent<Text>().text = "0W";
|
||||
@@ -369,17 +389,42 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
game.transform.Find("Content/Rank").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
}
|
||||
}
|
||||
private List<TraceData> Get8UserList()
|
||||
{
|
||||
var resRanks = userList;
|
||||
var ind = resRanks.FindIndex(x => x.UserId == App.CurrentUser.Id);
|
||||
if (ind >= 8)
|
||||
{
|
||||
var tops = resRanks.Take(3).ToList();
|
||||
List<TraceData> mys = null;
|
||||
if (resRanks.Count - 1 - ind < 2)
|
||||
{
|
||||
mys = resRanks.GetRange(resRanks.Count - 5, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
mys = resRanks.GetRange(ind - 2, 5);
|
||||
}
|
||||
resRanks = tops.Concat(mys).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
resRanks = resRanks.Take(8).ToList();
|
||||
}
|
||||
return resRanks;
|
||||
}
|
||||
private void DisplayUserRanks(bool isRefresh = false)
|
||||
{
|
||||
if (isRefresh)
|
||||
{
|
||||
scrollRank.content.DestroyChildren();
|
||||
}
|
||||
var list = Get8UserList();
|
||||
if (scrollRank.content.childCount == 0)
|
||||
{
|
||||
for (int i = 0; i < userList.Count; i++)
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
var item = userList[i];
|
||||
var item = list[i];
|
||||
var game = Instantiate<GameObject>(rank);
|
||||
SetRank(game, item, i);
|
||||
game.transform.SetParent(scrollRank.content);
|
||||
@@ -392,7 +437,7 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
int i = 0;
|
||||
foreach (Transform t in scrollRank.content)
|
||||
{
|
||||
var item = userList[i];
|
||||
var item = list[i];
|
||||
SetRank(t.gameObject, item, i);
|
||||
i++;
|
||||
}
|
||||
@@ -419,13 +464,19 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
pan.gestureCompleteEvent += (r) =>
|
||||
{
|
||||
float x = 0;
|
||||
foreach (Transform t in transform.Find("Rower/Dots"))
|
||||
{
|
||||
t.GetComponent<Image>().color = Utils.HexToColorHtml("#ffffff");
|
||||
}
|
||||
if (scroll.localPosition.x >= startPosition.x - (730 / 2))
|
||||
{
|
||||
x = startPosition.x;
|
||||
transform.Find("Rower/Dots/d1").GetComponent<Image>().color = Utils.HexToColorHtml("#f93086");
|
||||
}
|
||||
else
|
||||
{
|
||||
x = startPosition.x - 730;
|
||||
transform.Find("Rower/Dots/d2").GetComponent<Image>().color = Utils.HexToColorHtml("#f93086");
|
||||
}
|
||||
scroll.DOLocalMoveX(x, 0.5f);
|
||||
PlayerPrefs.SetFloat("RowerMultiModeLocationX", x);
|
||||
@@ -518,7 +569,7 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
int currentSecond = -1;
|
||||
private List<CountryModel> countryList;
|
||||
|
||||
public RowerTaskPanel.RowerType rowerType { get; private set; }
|
||||
public RowerTaskPanel.RowerType rowerType { get; set; }
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
@@ -533,9 +584,8 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
//ChangeTrace(a, a+1);
|
||||
HandleTimeTick(new RowerChartModel()
|
||||
{
|
||||
Distance = 0,
|
||||
Distance = 15,
|
||||
});
|
||||
currentSecond++;
|
||||
timer += 1f;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -41,6 +41,16 @@ public class RowerTaskPanel : PFUIPanel
|
||||
{
|
||||
Close();
|
||||
});
|
||||
UIManager.AddEvent(transform.Find("Main/BtnFreeMode").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
rowerType.type = 0;
|
||||
rowerType.value = 0;
|
||||
if (callBack != null)
|
||||
{
|
||||
callBack.Invoke(rowerType);
|
||||
}
|
||||
Close();
|
||||
});
|
||||
//var bg = transform.Find("Main/Time/Inputbg").gameObject;
|
||||
//UIManager.AddEvent(bg, UnityEngine.EventSystems.EventTriggerType.PointerEnter, b =>
|
||||
// {
|
||||
@@ -59,6 +69,7 @@ public class RowerTaskPanel : PFUIPanel
|
||||
formList = new List<object>
|
||||
{
|
||||
distance.Find("Btn500").GetComponent<Button>(),
|
||||
distance.Find("Btn1000").GetComponent<Button>(),
|
||||
distance.Find("Btn2000").GetComponent<Button>(),
|
||||
distance.Find("Btn5000").GetComponent<Button>(),
|
||||
distance.Find("Btn10000").GetComponent<Button>(),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Facebook.Unity;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -41,6 +42,26 @@ public class RowerWelldone : PFUIPanel
|
||||
Close();
|
||||
Application.OpenURL($"{App.websiteDict[App.Host]}rower/record/{id}?Token={App.CurrentUser.cookie}");
|
||||
});
|
||||
UIManager.AddEvent(transform.Find("Container/Share/Wx").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
if (data == null) return;
|
||||
App.weChatController.ShareWebpageToWX(0, $"{App.websiteDict[App.Host]}rower/record/{id}?UserId={App.CurrentUser.Id}", $"PowerFun {data.info.TypeStr} Rowing", $"By {App.CurrentUser.Nickname}",null);
|
||||
});
|
||||
|
||||
UIManager.AddEvent(transform.Find("Container/Share/WxMoment").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
if (data == null) return;
|
||||
App.weChatController.ShareWebpageToWX(1, $"{App.websiteDict[App.Host]}rower/record/{id}?UserId={App.CurrentUser.Id}", $"PowerFun {data.info.TypeStr} Rowing", $"By {App.CurrentUser.Nickname}", null);
|
||||
});
|
||||
|
||||
UIManager.AddEvent(transform.Find("Container/Share/Fb").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
if (data == null) return;
|
||||
FB.ShareLink(contentURL: new Uri($"{App.websiteDict[App.Host]}rower/record/{id}?UserId={App.CurrentUser.Id}"),
|
||||
contentTitle: $"PowerFun {data.info.TypeStr} Rowing",
|
||||
contentDescription: $"By {App.CurrentUser.Nickname}");
|
||||
//App.weChatController.ShareWebpageToWX(1, , , , null);
|
||||
});
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@@ -66,6 +87,7 @@ public class RowerWelldone : PFUIPanel
|
||||
|
||||
float timer = 1f, remainTime = 10f;
|
||||
bool startTime = false;
|
||||
RowerSegmentData data;
|
||||
public async void Initial(string id)
|
||||
{
|
||||
Debug.Log("Initial");
|
||||
@@ -74,6 +96,7 @@ public class RowerWelldone : PFUIPanel
|
||||
var res = await ConfigHelper.rowerApi.GetSegmentDataAndRanking(id);
|
||||
if (res.result)
|
||||
{
|
||||
this.data = res.data;
|
||||
DisplayData(res.data, caches);
|
||||
startTime = true;
|
||||
remainTime = 10f;
|
||||
@@ -123,7 +146,7 @@ public class RowerWelldone : PFUIPanel
|
||||
content.Find("Power").GetComponent<Text>().text = item.Power.ToString("#0");
|
||||
content.Find("HR").GetComponent<Text>().text = item.HeartRate.ToString("#0");
|
||||
content.Find("Count").GetComponent<Text>().text = item.StrokeCount.ToString("#0");
|
||||
content.Find("Carlories").GetComponent<Text>().text = item.Energy.ToString("#0");
|
||||
content.Find("Carlories").GetComponent<Text>().text = item.Rate.ToString("#0");
|
||||
//game.transform.Find("Content/Rank").GetComponent<Text>().text = (i + 1).ToString("00");
|
||||
//game.transform.Find("Content/NickName").GetComponent<Text>().text = item.NickName;
|
||||
//Utils.DisplayImageTempDict(game.transform.Find("Content/Avatar").GetComponent<RawImage>(), item.WxHeadImg, caches);
|
||||
|
||||
Reference in new issue
Block a user