曲线调整
This commit is contained in:
1 parent
f47f5c9ff6
commit
3c4ecf3e83
8 files changed
+2279
-1977
No files matched your search
@@ -89,7 +89,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
GameObject btnStart;
|
||||
Transform left, bottom, mid;
|
||||
float timer = 1.0f;
|
||||
List<DoubleVector2> pullList = new List<DoubleVector2>();
|
||||
List<DoubleVector2> pullList = new List<DoubleVector2>(), historyPullList = new List<DoubleVector2>();
|
||||
public Dictionary<object, Sprite> spriteDict,spriteDict2;
|
||||
List<string> records;
|
||||
List<TempRowerCalc> values;
|
||||
@@ -597,6 +597,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
left.Find("Calories/Value").GetComponent<Text>().text = "---";
|
||||
|
||||
pullList = new List<DoubleVector2>();
|
||||
historyPullList = new List<DoubleVector2>();
|
||||
mid.Find("GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
|
||||
openTimer = false;
|
||||
if (rowerType.type == 0)
|
||||
@@ -698,14 +699,16 @@ public class RowerHomeScript : PFUIPanel
|
||||
#if UNITY_EDITOR
|
||||
List<ushort> tempList = new List<ushort>()
|
||||
{
|
||||
0,1230,4,500,12,13,16,0,0,0,20,30,40,50,60,500
|
||||
0,300,200,1100,400,500,120,130,160,0,0,0,200,300,400,500,600,500
|
||||
};
|
||||
int tempx = 0;
|
||||
#endif
|
||||
void TimerTicks()
|
||||
{
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
PaintPullCurve(tempList[(tempx++) % tempList.Count]);
|
||||
var a = tempList[(tempx++) % tempList.Count];
|
||||
PaintPullCurve((ushort)(a / 10));
|
||||
if (RowerData == null) return;
|
||||
#endif
|
||||
#if !UNITY_EDITOR
|
||||
if (Rower == null)
|
||||
@@ -916,17 +919,18 @@ public class RowerHomeScript : PFUIPanel
|
||||
if (pullList.Count == 0)
|
||||
{
|
||||
isPlay = true;
|
||||
x = 0;
|
||||
x = 0.1;
|
||||
pullList.Add(new DoubleVector2(x, y));
|
||||
mid.Find("GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
|
||||
mid.Find("GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList, historyPullList);
|
||||
}
|
||||
else if (pullList.Count > 1)
|
||||
{
|
||||
x += 0.1;
|
||||
pullList.Add(new DoubleVector2(x, y));
|
||||
mid.Find("GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
|
||||
mid.Find("GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList, historyPullList);
|
||||
historyPullList = pullList.Select(x => x).ToList();
|
||||
pullList.Clear();
|
||||
x = 0;
|
||||
x = 0.1;
|
||||
isPlay = true;
|
||||
pullList.Add(new DoubleVector2(x, y));
|
||||
}
|
||||
@@ -935,7 +939,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
//只有0并且两秒没拉,曲线消失
|
||||
if (stopSeconds == 1)
|
||||
{
|
||||
mid.Find("GraphChart").GetComponent<RowerGraphChartFeed>().SetData(new List<DoubleVector2>());
|
||||
mid.Find("GraphChart").GetComponent<RowerGraphChartFeed>().SetData(new List<DoubleVector2>(), new List<DoubleVector2>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -949,7 +953,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
isPlay = false;
|
||||
left.Find("Rower").GetComponent<RowerAnimation>().StartAnimation();
|
||||
}
|
||||
mid.Find("GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
|
||||
mid.Find("GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList, historyPullList);
|
||||
}
|
||||
//Debug.Log($"{x},{y}");
|
||||
//transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
|
||||
@@ -967,7 +971,11 @@ public class RowerHomeScript : PFUIPanel
|
||||
float staticTimer = 1f,shortTimer = 0.1f;
|
||||
void Update()
|
||||
{
|
||||
if (openTimer)
|
||||
#if UNITY_EDITOR
|
||||
if (openTimer || true)
|
||||
#else
|
||||
if (openTimer)
|
||||
#endif
|
||||
{
|
||||
timer -= Time.deltaTime;
|
||||
if (timer <= 0)
|
||||
|
||||
@@ -32,7 +32,7 @@ public class RowerGraphChartFeed : MonoBehaviour
|
||||
// StartCoroutine(ClearAll());
|
||||
}
|
||||
|
||||
public void SetData(List<DoubleVector2> list)
|
||||
public void SetData(List<DoubleVector2> list,List<DoubleVector2> list2 = null)
|
||||
{
|
||||
GraphChartBase graph = GetComponent<GraphChartBase>();
|
||||
if (graph != null)
|
||||
@@ -41,15 +41,24 @@ public class RowerGraphChartFeed : MonoBehaviour
|
||||
//graph.HorizontalValueToStringMap[0.0] = "Zero"; // example of how to set custom axis strings
|
||||
graph.DataSource.StartBatch();
|
||||
graph.DataSource.ClearCategory("Player 1");
|
||||
graph.DataSource.ClearCategory("Player 2");
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
graph.DataSource.AddPointToCategory("Player 1", item.x, item.y);
|
||||
graph.DataSource.AddPointToCategory("Player 2", item.x, item.y);
|
||||
//if (i == 0)
|
||||
// graph.DataSource.SetCurveInitialPoint("Player 1", item.x, item.y);
|
||||
//else
|
||||
// graph.DataSource.AddLinearCurveToCategory("Player 1", new DoubleVector2(item.x, item.y));
|
||||
}
|
||||
if (list2 != null)
|
||||
{
|
||||
for (int i = 0; i < list2.Count; i++)
|
||||
{
|
||||
var item = list2[i];
|
||||
graph.DataSource.AddPointToCategory("Player 1", item.x, item.y);
|
||||
}
|
||||
}
|
||||
//graph.DataSource.MakeCurveCategorySmooth("Player 1");
|
||||
graph.DataSource.EndBatch();
|
||||
}
|
||||
|
||||
@@ -375,7 +375,8 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
rightPositionX = ((diffWidth + rightDiff) / 100f) * width + 43;
|
||||
if (leftPositionX >= -30 && leftPositionX<=415)
|
||||
{
|
||||
leftLine.DOLocalMoveX(leftPositionX - 207.5f, 0.9f);
|
||||
StartCoroutine(MoveLine(leftLine, leftLine.localPosition, new Vector3(leftPositionX - 207.5f, leftLine.localPosition.y, leftLine.localPosition.z)));
|
||||
//leftLine.DOLocalMoveX(leftPositionX - 207.5f, 0.9f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -383,7 +384,8 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
}
|
||||
if (rightPositionX >= 0 && rightPositionX <= 415)
|
||||
{
|
||||
rightLine.DOLocalMoveX(rightPositionX - 207.5f, 0.9f);
|
||||
StartCoroutine(MoveLine(rightLine, rightLine.localPosition, new Vector3(rightPositionX - 207.5f, rightLine.localPosition.y, rightLine.localPosition.z)));
|
||||
//rightLine.DOLocalMoveX(rightPositionX - 207.5f, 0.9f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -401,7 +403,8 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
float finishPositionX = ((diffWidth + finishDiff) / 100f) * width + 43;
|
||||
if (finishPositionX >= 0 && finishPositionX <= 415)
|
||||
{
|
||||
finishLine.DOLocalMoveX(finishPositionX - 207.5f, 0.9f);
|
||||
StartCoroutine(MoveLine(finishLine, finishLine.localPosition, new Vector3(finishPositionX - 207.5f, finishLine.localPosition.y, finishLine.localPosition.z)));
|
||||
//finishLine.DOLocalMoveX(finishPositionX - 207.5f, 0.9f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -419,13 +422,13 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
{
|
||||
var tWidth = (diffWidth / 100f) * width;
|
||||
t.Find("Main/Boat").gameObject.SetActive(true);
|
||||
t.Find("Left/Rank").GetComponent<Text>().text = (userList.FindIndex(x => x.UserId == data.UserId) + 1).ToString("00");
|
||||
if (isAni)
|
||||
{
|
||||
t.Find("Main/Boat").DOLocalMoveX(21.5f + tWidth, 0.9f);
|
||||
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");
|
||||
t.Find("Left/Rank").GetComponent<Text>().text = (userList.FindIndex(x => x.UserId == data.UserId) + 1).ToString("00");
|
||||
rowed.DOSizeDelta(new Vector2(tWidth, rowed.sizeDelta.y), 0.9f);
|
||||
}
|
||||
else
|
||||
@@ -449,11 +452,11 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
var spDict = GetComponent<RowerHomeScript>().spriteDict2;
|
||||
int spDictIndex = 0;
|
||||
|
||||
ani.Join(DOTween.To(() => spDictIndex, x => t.Find("Main/Boat/Image").GetComponent<Image>().sprite = spDict[x], 14, 0.3f));
|
||||
ani.Join(DOTween.To(() => spDictIndex, x => t.Find("Main/Boat/Image").GetComponent<Image>().sprite = spDict[x], 14, 0.225f));
|
||||
ani.AppendCallback(() =>
|
||||
{
|
||||
int spDictIndex2 = 14;
|
||||
DOTween.To(() => spDictIndex2, x => t.Find("Main/Boat/Image").GetComponent<Image>().sprite = spDict[x], 0, 0.6f);
|
||||
DOTween.To(() => spDictIndex2, x => t.Find("Main/Boat/Image").GetComponent<Image>().sprite = spDict[x], 0, 0.675f);
|
||||
});
|
||||
ani.Play();
|
||||
//var _pred = data.list[currentSecond - 1];
|
||||
@@ -474,6 +477,17 @@ public class RowerMultiModeScript : MonoBehaviour
|
||||
|
||||
}
|
||||
}
|
||||
private IEnumerator MoveLine(Transform line, Vector3 originLocation, Vector3 targetLocation)
|
||||
{
|
||||
float t = 0;
|
||||
while (t < 1)
|
||||
{
|
||||
t += Time.deltaTime;
|
||||
Vector3 v = Vector3.Lerp(originLocation, targetLocation, t);
|
||||
line.localPosition = v;
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
}
|
||||
private int getStartIndexByMineData()
|
||||
{
|
||||
var list = userList;
|
||||
|
||||
Reference in new issue
Block a user