曲线调整

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:
- _Color: {r: 1, g: 1, b: 1, a: 0}
- _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}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -82,7 +82,7 @@ Material:
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 0}
- _ColorFrom: {r: 0.2509804, g: 0.6431373, b: 0.9882353, a: 1}
- _ColorTo: {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: 0.69803923}
- _Combine: {r: 0.2509804, g: 0.6431373, b: 0.9882353, a: 0}
- _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;
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 UNITY_EDITOR
if (openTimer || true)
#else
if (openTimer)
#endif
{
timer -= Time.deltaTime;
if (timer <= 0)

View File

@ -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();
}

View File

@ -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;