曲线调整

This commit is contained in:
CaiYanPeng 2022-04-27 20:03:56 +08:00
parent f47f5c9ff6
commit 3c4ecf3e83
8 changed files with 2279 additions and 1977 deletions

File diff suppressed because it is too large Load Diff

View File

@ -83,6 +83,6 @@ Material:
m_Colors: m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 0} - _Color: {r: 1, g: 1, b: 1, a: 0}
- _ColorFrom: {r: 0.9764706, g: 0.1882353, b: 0.5254902, a: 0.29803923} - _ColorFrom: {r: 0.9764706, g: 0.1882353, b: 0.5254902, a: 0.29803923}
- _ColorTo: {r: 0.9764706, g: 0.1882353, b: 0.5254902, a: 0.459} - _ColorTo: {r: 0.9764706, g: 0.1882353, b: 0.5254902, a: 0.8}
- _Combine: {r: 1, g: 1, b: 1, a: 0} - _Combine: {r: 1, g: 1, b: 1, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -82,7 +82,7 @@ Material:
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 0} - _Color: {r: 1, g: 1, b: 1, a: 0}
- _ColorFrom: {r: 0.2509804, g: 0.6431373, b: 0.9882353, a: 1} - _ColorFrom: {r: 0.2509804, g: 0.6431373, b: 0.9882353, a: 0.69803923}
- _ColorTo: {r: 0.2509804, g: 0.6431373, b: 0.9882353, a: 1} - _ColorTo: {r: 0.2509804, g: 0.6431373, b: 0.9882353, a: 0.69803923}
- _Combine: {r: 0.2509804, g: 0.6431373, b: 0.9882353, a: 0} - _Combine: {r: 0.2509804, g: 0.6431373, b: 0.9882353, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -0,0 +1,88 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: LineGray
m_Shader: {fileID: 4800000, guid: 818b0e872599e3948b6cceff71a30540, type: 3}
m_ShaderKeywords: _EMISSION
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 9959c8d64e68c9b49a96dd9de08c4315, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _Angle: 90
- _BumpScale: 1
- _ChartTiling: 1
- _ColorMask: 15
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 0}
- _ColorFrom: {r: 0.36078432, g: 0.36078432, b: 0.43137255, a: 1}
- _ColorTo: {r: 0.36078432, g: 0.36078432, b: 0.43137255, a: 1}
- _Combine: {r: 0.36078432, g: 0.36078432, b: 0.43137255, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1e8eb23bbff1f6a428c2fa87bc69dbdb
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -89,7 +89,7 @@ public class RowerHomeScript : PFUIPanel
GameObject btnStart; GameObject btnStart;
Transform left, bottom, mid; Transform left, bottom, mid;
float timer = 1.0f; 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; public Dictionary<object, Sprite> spriteDict,spriteDict2;
List<string> records; List<string> records;
List<TempRowerCalc> values; List<TempRowerCalc> values;
@ -597,6 +597,7 @@ public class RowerHomeScript : PFUIPanel
left.Find("Calories/Value").GetComponent<Text>().text = "---"; left.Find("Calories/Value").GetComponent<Text>().text = "---";
pullList = new List<DoubleVector2>(); pullList = new List<DoubleVector2>();
historyPullList = new List<DoubleVector2>();
mid.Find("GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList); mid.Find("GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
openTimer = false; openTimer = false;
if (rowerType.type == 0) if (rowerType.type == 0)
@ -698,14 +699,16 @@ public class RowerHomeScript : PFUIPanel
#if UNITY_EDITOR #if UNITY_EDITOR
List<ushort> tempList = new List<ushort>() 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; int tempx = 0;
#endif #endif
void TimerTicks() void TimerTicks()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
PaintPullCurve(tempList[(tempx++) % tempList.Count]); var a = tempList[(tempx++) % tempList.Count];
PaintPullCurve((ushort)(a / 10));
if (RowerData == null) return;
#endif #endif
#if !UNITY_EDITOR #if !UNITY_EDITOR
if (Rower == null) if (Rower == null)
@ -916,17 +919,18 @@ public class RowerHomeScript : PFUIPanel
if (pullList.Count == 0) if (pullList.Count == 0)
{ {
isPlay = true; isPlay = true;
x = 0; x = 0.1;
pullList.Add(new DoubleVector2(x, y)); 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) else if (pullList.Count > 1)
{ {
x += 0.1; x += 0.1;
pullList.Add(new DoubleVector2(x, y)); 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(); pullList.Clear();
x = 0; x = 0.1;
isPlay = true; isPlay = true;
pullList.Add(new DoubleVector2(x, y)); pullList.Add(new DoubleVector2(x, y));
} }
@ -935,7 +939,7 @@ public class RowerHomeScript : PFUIPanel
//只有0并且两秒没拉曲线消失 //只有0并且两秒没拉曲线消失
if (stopSeconds == 1) 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; isPlay = false;
left.Find("Rower").GetComponent<RowerAnimation>().StartAnimation(); 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}"); //Debug.Log($"{x},{y}");
//transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList); //transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
@ -967,7 +971,11 @@ public class RowerHomeScript : PFUIPanel
float staticTimer = 1f,shortTimer = 0.1f; float staticTimer = 1f,shortTimer = 0.1f;
void Update() void Update()
{ {
#if UNITY_EDITOR
if (openTimer || true)
#else
if (openTimer) if (openTimer)
#endif
{ {
timer -= Time.deltaTime; timer -= Time.deltaTime;
if (timer <= 0) if (timer <= 0)

View File

@ -32,7 +32,7 @@ public class RowerGraphChartFeed : MonoBehaviour
// StartCoroutine(ClearAll()); // StartCoroutine(ClearAll());
} }
public void SetData(List<DoubleVector2> list) public void SetData(List<DoubleVector2> list,List<DoubleVector2> list2 = null)
{ {
GraphChartBase graph = GetComponent<GraphChartBase>(); GraphChartBase graph = GetComponent<GraphChartBase>();
if (graph != null) 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.HorizontalValueToStringMap[0.0] = "Zero"; // example of how to set custom axis strings
graph.DataSource.StartBatch(); graph.DataSource.StartBatch();
graph.DataSource.ClearCategory("Player 1"); graph.DataSource.ClearCategory("Player 1");
graph.DataSource.ClearCategory("Player 2");
for (int i = 0; i < list.Count; i++) for (int i = 0; i < list.Count; i++)
{ {
var item = list[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) //if (i == 0)
// graph.DataSource.SetCurveInitialPoint("Player 1", item.x, item.y); // graph.DataSource.SetCurveInitialPoint("Player 1", item.x, item.y);
//else //else
// graph.DataSource.AddLinearCurveToCategory("Player 1", new DoubleVector2(item.x, item.y)); // 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.MakeCurveCategorySmooth("Player 1");
graph.DataSource.EndBatch(); graph.DataSource.EndBatch();
} }

View File

@ -375,7 +375,8 @@ public class RowerMultiModeScript : MonoBehaviour
rightPositionX = ((diffWidth + rightDiff) / 100f) * width + 43; rightPositionX = ((diffWidth + rightDiff) / 100f) * width + 43;
if (leftPositionX >= -30 && leftPositionX<=415) 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 else
{ {
@ -383,7 +384,8 @@ public class RowerMultiModeScript : MonoBehaviour
} }
if (rightPositionX >= 0 && rightPositionX <= 415) 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 else
{ {
@ -401,7 +403,8 @@ public class RowerMultiModeScript : MonoBehaviour
float finishPositionX = ((diffWidth + finishDiff) / 100f) * width + 43; float finishPositionX = ((diffWidth + finishDiff) / 100f) * width + 43;
if (finishPositionX >= 0 && finishPositionX <= 415) 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 else
{ {
@ -419,13 +422,13 @@ public class RowerMultiModeScript : MonoBehaviour
{ {
var tWidth = (diffWidth / 100f) * width; var tWidth = (diffWidth / 100f) * width;
t.Find("Main/Boat").gameObject.SetActive(true); 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) if (isAni)
{ {
t.Find("Main/Boat").DOLocalMoveX(21.5f + tWidth, 0.9f); t.Find("Main/Boat").DOLocalMoveX(21.5f + tWidth, 0.9f);
var rowed = t.Find("Main/Rowed").GetComponent<RectTransform>(); var rowed = t.Find("Main/Rowed").GetComponent<RectTransform>();
//rowed.GetComponent<UIGradient>().color1 = data.isMine ? Utils.HexToColorHtml("#f9308633") : Utils.HexToColorHtml("#27bac033"); //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.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); rowed.DOSizeDelta(new Vector2(tWidth, rowed.sizeDelta.y), 0.9f);
} }
else else
@ -449,11 +452,11 @@ public class RowerMultiModeScript : MonoBehaviour
var spDict = GetComponent<RowerHomeScript>().spriteDict2; var spDict = GetComponent<RowerHomeScript>().spriteDict2;
int spDictIndex = 0; 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(() => ani.AppendCallback(() =>
{ {
int spDictIndex2 = 14; 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(); ani.Play();
//var _pred = data.list[currentSecond - 1]; //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() private int getStartIndexByMineData()
{ {
var list = userList; var list = userList;