消息轮播bug修改;内容滚动匀速播放;收藏图标变大

This commit is contained in:
CaiYanPeng 2021-12-31 11:23:16 +08:00
parent 333c99fb46
commit 7f7318fb36
5 changed files with 35 additions and 18 deletions

View File

@ -17,7 +17,13 @@ public class HomeMessageController : MonoBehaviour
}
float timer = 2;
public float? textWidth = null;
[HideInInspector]public bool isAnimated = false;
private bool isAnimated = false;
public void Initial()
{
transform.Find("TextContainer/Content").localPosition = new Vector2(startX, transform.Find("TextContainer/Content").localPosition.y);
isAnimated = false;
}
float playtime = 0;
// Update is called once per frame
void Update()
{
@ -30,14 +36,17 @@ public class HomeMessageController : MonoBehaviour
isAnimated = true;
var offset = textWidth.Value - 180;
var game = transform.Find("TextContainer/Content");
game.DOLocalMoveX(startX - offset, 0.5f).onComplete
var v = 20 / 0.3f;
playtime = offset / v;
//匀速播放
game.DOLocalMoveX(startX - offset, playtime).onComplete
= () => Invoke("returnAni", 1.5f);
}
timer += 4;
timer += 3;
}
}
void returnAni()
{
transform.Find("TextContainer/Content").DOLocalMoveX(startX, 0.5f);
transform.Find("TextContainer/Content").DOLocalMoveX(startX, playtime);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 614 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 804 B

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -61,7 +61,7 @@ public class MainController : BaseScene
//切换页面后
private void OnIsHomeChanged(object sender, EventArgs e)
{
DOTween.KillAll();
//DOTween.KillAll();
FinishMessage(sender);
}
@ -100,6 +100,7 @@ public class MainController : BaseScene
rightMessage.transform.SetParent(go);
rightMessage.transform.localScale = Vector3.one;
rightMessage.transform.localPosition = 1 * msgLocation;
rightMessage.alpha = 0;
msgs = new List<CanvasGroup> { rightMessage };
for (int i = 0; i < 5; i++)
{
@ -131,7 +132,7 @@ public class MainController : BaseScene
DoMessageRight(e);
}
#else
if (App.currentPageIsHome)
if (App.currentPageIsHome)
{
DoMessage6(e);
}
@ -176,12 +177,14 @@ public class MainController : BaseScene
if (msgIndex >= 6) //
{
//msgIndex = 0;
Sequence se = DOTween.Sequence();
//m.transform.DOLocalMoveY(m.transform.localPosition.y - 38, 0.5f);
foreach (var item in msgs)
{
item.transform.DOLocalMoveY(item.transform.localPosition.y - 38, 0.5f);
se.Join(item.transform.DOLocalMoveY(item.transform.localPosition.y - 38, 0.5f));
}
m.DOFade(0, 0.5f).onComplete = () =>
se.Join(m.DOFade(0, 0.5f));
se.Play().onComplete = () =>
{
SetMessage(m, e);
m.transform.localPosition = 1 * msgLocation;
@ -192,12 +195,14 @@ public class MainController : BaseScene
{
Debug.Log(191);
SetMessage(m, e);
Sequence se = DOTween.Sequence();
for (int i = 0; i < msgIndex; i++)
{
var rect = msgs[i].GetComponent<RectTransform>();
rect.DOLocalMoveY(rect.localPosition.y - 38, 0.5f);
se.Join(rect.DOLocalMoveY(rect.localPosition.y - 38, 0.5f));
}
m.DOFade(1, 0.5f);
se.Join(m.DOFade(1, 0.5f));
se.Play();
}
m.transform.SetAsLastSibling();
msgIndex++;
@ -215,14 +220,17 @@ public class MainController : BaseScene
FinishMessageLeft();
}
#else
if (!(bool)sender)
{
//FinishMessage6();
transform.Find("GameObject").SetAsFirstSibling();
//DOTween.CompleteAll(true);
DOTween.CompleteAll(true);
transform.Find("GameObject").gameObject.SetActive(false);
}
else
{
transform.Find("GameObject").SetSiblingIndex(1);
transform.Find("GameObject").gameObject.SetActive(true);
}
#endif
}
@ -276,7 +284,7 @@ public class MainController : BaseScene
txt.GetComponent<Text>().text = e.content;
LayoutRebuilder.ForceRebuildLayoutImmediate(txt);
Debug.Log(e.content + txt.sizeDelta.x);
m.GetComponent<HomeMessageController>().isAnimated = false;
m.GetComponent<HomeMessageController>().Initial();
m.GetComponent<HomeMessageController>().textWidth = txt.sizeDelta.x;
}
CanvasGroup msg;
@ -434,19 +442,19 @@ public class MainController : BaseScene
//速度35
if (item.Speed >= 35)
{
var message = lang == "zh" ? $"骑行速度突破<color=#e3d427>{Math.Round(item.Speed, 2)}</color>KM/H" : $"riding speed reaches <color=#e3d427>{Math.Round(item.Speed, 2)}</color>KM/H!";
var message = lang == "zh" ? $"骑行速度突破<color=#e3d427>{Math.Round(item.Speed, 2)}KM/H</color>" : $"riding speed reaches <color=#e3d427>{Math.Round(item.Speed, 2)}KM/H</color>!";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName), $"{item.RouteId}{item.Name}35KM/H");
}
//速度50
if (item.Speed >= 50)
{
var message = lang == "zh" ? $"骑行速度突破<color=#e3d427>{Math.Round(item.Speed,2)}</color>KM/H" : $"riding speed reaches <color=#e3d427>{Math.Round(item.Speed, 2)}</color>KM/H!";
var message = lang == "zh" ? $"骑行速度突破<color=#e3d427>{Math.Round(item.Speed,2)}KM/H</color>" : $"riding speed reaches <color=#e3d427>{Math.Round(item.Speed, 2)}KM/H</color>!";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName), $"{item.RouteId}{item.Name}50KM/H");
}
//功体比
if (item.WeightKg >= 3)
{
var message = lang == "zh" ? $"骑行功体比突破<color=#e3d427>{Math.Round(item.WeightKg, 2)}</color>w/kg" : $" riding w/kg reaches <color=#e3d427>{Math.Round(item.WeightKg, 2)}</color>w/kg!";
var message = lang == "zh" ? $"骑行功体比突破<color=#e3d427>{Math.Round(item.WeightKg, 2)}w/kg</color>" : $" riding PWR reaches <color=#e3d427>{Math.Round(item.WeightKg, 2)}w/kg</color>!";
EventQueueSystem.QueueEventOnce(new LinkedMessageEvent(item.RouteId, message, item.HeadImage, item.Name, item.RouteName), $"{item.RouteId}{item.Name}3WeightKg");
}
}

View File

@ -256,7 +256,7 @@ PlayerSettings:
clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea
templatePackageId: com.unity.template.3d@4.2.8
templateDefaultScene: Assets/Scenes/SampleScene.unity
AndroidTargetArchitectures: 1
AndroidTargetArchitectures: 3
AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0}
AndroidKeystoreName: '{inproject}: Assets/Plugins/Android/powerfun.keystore'
@ -868,7 +868,7 @@ PlayerSettings:
platformArchitecture:
iPhone: 1
scriptingBackend:
Android: 0
Android: 1
Standalone: 0
il2cppCompilerConfiguration:
Standalone: 0