调整后提交
This commit is contained in:
1 parent
a2de06fede
commit
affc775226
100 files changed
+6319
-2125
No files matched your search
@@ -9,6 +9,7 @@ using System.Linq;
|
||||
using UnityEngine.UI;
|
||||
using Assets.Scripts.UI.Prefab.Login;
|
||||
using Newtonsoft.Json;
|
||||
using Assets.Scripts.UI.UIEffect;
|
||||
|
||||
public class RowerMultiModeScript : MonoBehaviour
|
||||
{
|
||||
@@ -176,8 +177,10 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
{
|
||||
this.rowerType = rowerType;
|
||||
currentSecond = -1;
|
||||
//if(Application.internetReachability == NetworkReachability.NotReachable)
|
||||
var res = reRowData ==null? await ConfigHelper.rowerApi.GetShadowList(rowerType): await ConfigHelper.rowerApi.GetReRowShadowList(reRowData.Id);
|
||||
shadowList = res.data;
|
||||
|
||||
//foreach (var t in traceList)
|
||||
//{
|
||||
// t.userId = 0;
|
||||
@@ -213,6 +216,16 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
DisplayUserRanks(true);
|
||||
DisplayTraces(true);
|
||||
}
|
||||
float GetStrokeSpeed(uint rate)
|
||||
{
|
||||
//0 10 20 30 35
|
||||
//0.9 0.8 0.7 0.6 0.5
|
||||
if (rate < 10) return 0.9f;
|
||||
else if (rate < 20) return 0.7f;
|
||||
else if (rate < 30) return 0.5f;
|
||||
else if (rate < 35) return 0.4f;
|
||||
else return 0.3f;
|
||||
}
|
||||
private void DisplayTrace(Transform t,TraceData data,TraceData mineData,bool isAni = false)
|
||||
{
|
||||
if (string.IsNullOrEmpty(data.Avatar))
|
||||
@@ -320,6 +333,11 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
if (isAni)
|
||||
{
|
||||
t.Find("Main/Boat").DOLocalMoveX(21.5f + tWidth, 0.6f);
|
||||
var rowed = t.Find("Main/Rowed").GetComponent<RectTransform>();
|
||||
rowed.GetComponent<UIGradient>().color1 = data.isMine ? Utils.HexToColorHtml("#f9308633") : Utils.HexToColorHtml("#27bac033");
|
||||
rowed.GetComponent<UIGradient>().color2 = data.isMine ? Utils.HexToColorHtml("#f930864d") : Utils.HexToColorHtml("#27bac04d");
|
||||
rowed.Find("Rank").GetComponent<Text>().text = (userList.FindIndex(x => x.UserId == data.UserId) + 1).ToString("00");
|
||||
rowed.DOSizeDelta(new Vector2(tWidth, rowed.sizeDelta.y), 0.6f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -335,15 +353,16 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
{
|
||||
var ani = DOTween.Sequence();
|
||||
var _d = data.list[currentSecond];
|
||||
if (currentSecond > 0 && _d.Pace > 0)
|
||||
if (currentSecond > 0 && _d.Rate > 0)
|
||||
{
|
||||
var spDict = GetComponent<RowerHomeScript>().spriteDict;
|
||||
var spDict = data.isMine?GetComponent<RowerHomeScript>().spriteDict2: GetComponent<RowerHomeScript>().spriteDict;
|
||||
int spDictIndex = 0;
|
||||
ani.Join(DOTween.To(() => spDictIndex, x => t.Find("Main/Boat").GetComponent<Image>().sprite = spDict[x], 14, 0.2f));
|
||||
|
||||
ani.Join(DOTween.To(() => spDictIndex, x => t.Find("Main/Boat").GetComponent<Image>().sprite = spDict[x], 14, 0.3f));
|
||||
ani.AppendCallback(() =>
|
||||
{
|
||||
int spDictIndex2 = 14;
|
||||
DOTween.To(() => spDictIndex2, x => t.Find("Main/Boat").GetComponent<Image>().sprite = spDict[x], 0, 0.4f);
|
||||
DOTween.To(() => spDictIndex2, x => t.Find("Main/Boat").GetComponent<Image>().sprite = spDict[x], 0, 0.6f);
|
||||
});
|
||||
ani.Play();
|
||||
//var _pred = data.list[currentSecond - 1];
|
||||
@@ -414,13 +433,15 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
{
|
||||
var list = userList;
|
||||
var listc = transform.Find("Rower/Modes/Scroll/M2/Track/Container/List");
|
||||
print(listc.localPosition.ToString());
|
||||
var mineData = list.FirstOrDefault(x => x.isMine);
|
||||
var sindex = getStartIndexByMineData();
|
||||
int i = 0;
|
||||
if (isRefresh)
|
||||
{
|
||||
traceList.Clear();
|
||||
listc.localPosition = new Vector3(0, 115.5f);
|
||||
listc.GetComponent<RectTransform>().sizeDelta = new Vector2(550f, 43 + 47 * (list.Count - 1));
|
||||
print(listc.localPosition.ToString());
|
||||
listc.DestroyChildren();
|
||||
for (i = 0; i < list.Count; i++)
|
||||
{
|
||||
@@ -428,14 +449,14 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
var g = Instantiate<GameObject>(trace);
|
||||
g.name = i.ToString();
|
||||
DisplayTrace(g.transform.Find("T1/p1"), data, mineData);
|
||||
g.transform.SetParent(listc);
|
||||
g.transform.parent = listc;
|
||||
g.SetActive(true);
|
||||
g.transform.localScale = Vector3.one;
|
||||
g.transform.localPosition = new Vector3(0, -21.5f - 47f * i);
|
||||
print($"{i},{g.transform.localPosition}");
|
||||
//g.transform.Find("T1/p1").GetComponent<Image>().color = RandomColor();
|
||||
traceList.Add(new Trace { userId = data.UserId, trace = g.transform.Find("T1") });
|
||||
}
|
||||
listc.GetComponent<RectTransform>().sizeDelta = new Vector2(550f, 43 + 47 * (list.Count - 1));
|
||||
listc.DOLocalMoveY(47 * sindex + 115.5f, 0.8f);
|
||||
return;
|
||||
}
|
||||
@@ -464,11 +485,13 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
|
||||
sq.Join(t.parent.DOLocalMoveY(-47 * (diff.rank - 1) - 21.5f, 1.5f));
|
||||
var sq1 = DOTween.Sequence();
|
||||
sq1.Append(t.GetComponent<CanvasGroup>().DOFade(0.2f, 0.75f));
|
||||
sq1.Append(t.GetComponent<CanvasGroup>().DOFade(1f, 0.75f));
|
||||
//sq1.SetEase(Ease.InOutCubic);
|
||||
if (diff.sumdiff < 0)
|
||||
{
|
||||
sq1.Append(t.GetComponent<CanvasGroup>().DOFade(0.2f, 0.75f));
|
||||
sq1.Append(t.GetComponent<CanvasGroup>().DOFade(1f, 0.75f));
|
||||
}
|
||||
sq.Join(sq1);
|
||||
sq.SetEase(Ease.InOutCubic);
|
||||
//sq.SetEase(Ease.InOutCubic);
|
||||
//sq.Append(t.GetComponent)
|
||||
}
|
||||
//t.parent.name = i.ToString();
|
||||
@@ -1003,7 +1026,7 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
void Update()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
//return;
|
||||
return;
|
||||
timer -= Time.deltaTime;
|
||||
if (timer < 0)
|
||||
{
|
||||
@@ -1014,6 +1037,7 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
HandleTimeTick(new RowerChartModel()
|
||||
{
|
||||
Distance = 15,
|
||||
Rate = 35,
|
||||
});
|
||||
timer += 1f;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ public class RowerWelldone : PFUIPanel
|
||||
GameObject AllRecord, Record,Rank;
|
||||
Dictionary<string, Texture> caches;
|
||||
Transform rankContent, gradeContent;
|
||||
private Action initFunc;
|
||||
|
||||
public string id { get; private set; }
|
||||
|
||||
@@ -32,14 +33,13 @@ public class RowerWelldone : PFUIPanel
|
||||
{
|
||||
UIManager.AddEvent(transform.Find("Container/BtnDefine").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
startTime = false;
|
||||
Close();
|
||||
CloseModal();
|
||||
//UIManager.ShowHomePanel();
|
||||
//UIManager.ShowUserInfoPanel();
|
||||
});
|
||||
UIManager.AddEvent(transform.Find("Container/BtnView").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
Close();
|
||||
CloseModal();
|
||||
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 =>
|
||||
@@ -80,8 +80,7 @@ public class RowerWelldone : PFUIPanel
|
||||
remainTime--;
|
||||
if (remainTime == 0)
|
||||
{
|
||||
startTime = false;
|
||||
Close();
|
||||
CloseModal();
|
||||
return;
|
||||
}
|
||||
transform.Find("Container/BtnDefine/Text").GetComponent<Text>().text = $"{App.GetLocalString("DEFINE")}({remainTime.ToString("#0")})";
|
||||
@@ -93,10 +92,10 @@ public class RowerWelldone : PFUIPanel
|
||||
float timer = 1f, remainTime = 10f;
|
||||
bool startTime = false;
|
||||
RowerSegmentData data;
|
||||
public async void Initial(string id)
|
||||
public async void Initial(string id,Action init)
|
||||
{
|
||||
Debug.Log("Initial");
|
||||
if (string.IsNullOrEmpty(id)) return;
|
||||
this.initFunc = init;
|
||||
this.id = id;
|
||||
var res = await ConfigHelper.rowerApi.GetSegmentDataAndRanking(id);
|
||||
if (res.result)
|
||||
@@ -125,7 +124,7 @@ public class RowerWelldone : PFUIPanel
|
||||
game.transform.SetParent(rankContent);
|
||||
game.transform.localScale = Vector3.one;
|
||||
game.SetActive(true);
|
||||
if (item.UserId == App.CurrentUser.Id)
|
||||
if (new Guid(item.Id) == new Guid(id))
|
||||
{
|
||||
game.transform.Find("Content/Rank").GetComponent<Text>().color = Utils.HexToColorHtml("#f93086");
|
||||
game.transform.Find("Content/NickName").GetComponent<Text>().color = Utils.HexToColorHtml("#f93086");
|
||||
@@ -163,4 +162,14 @@ public class RowerWelldone : PFUIPanel
|
||||
transform.Find("Container/Left/MyRank").GetComponent<Text>().text = data.info.MyRank;
|
||||
transform.Find("Container/Right/Time").GetComponent<Text>().text = data.info.CreateTime;
|
||||
}
|
||||
|
||||
public void CloseModal()
|
||||
{
|
||||
startTime = false;
|
||||
if (initFunc != null)
|
||||
{
|
||||
initFunc.Invoke();
|
||||
}
|
||||
Close();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user