商店动画的调整

This commit is contained in:
liuliang 2025-01-08 17:38:44 +08:00
parent 73d6cd84b7
commit e0f07a4aaf
4 changed files with 3778 additions and 361 deletions

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,7 @@ public class WaterPanel : MonoBehaviour
public Texture NightSp; public Texture NightSp;
public List<GameObject> Treelist = new List<GameObject>(); public List<GameObject> Treelist = new List<GameObject>();
public List<GameObject> ChineseZodiac = new List<GameObject>(); public List<GameObject> ChineseZodiac = new List<GameObject>();
public List<GameObject> Schedulelist;
public Text chart_title; public Text chart_title;
@ -60,7 +61,7 @@ public class WaterPanel : MonoBehaviour
} }
InvokeRepeating("Updated_water", 1f, 1f); InvokeRepeating("Updated_water", 1f, 1f);
} }
@ -75,10 +76,9 @@ public class WaterPanel : MonoBehaviour
async void Start() async void Start()
{ {
instance = this; instance = this;
Updated_water();
TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS(); TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS();
Updated_interface(info); Updated_interface(info);
petBettleInfoResponse petinfo = await Scene_main_jiekou.instance.getPetBettleInfos(); petBettleInfoResponse petinfo = await Scene_main_jiekou.instance.getPetBettleInfos();
Updated_petinfo(petinfo); Updated_petinfo(petinfo);
PlayerInfoData playerinfo = await Scene_main_jiekou.instance.PlayerInfos(); PlayerInfoData playerinfo = await Scene_main_jiekou.instance.PlayerInfos();
@ -104,6 +104,15 @@ public class WaterPanel : MonoBehaviour
Updated_Tree(info.Data.Level); Updated_Tree(info.Data.Level);
LevelShow.text = info.Data.Exp + "/" + info.Data.upgrade_exp; LevelShow.text = info.Data.Exp + "/" + info.Data.upgrade_exp;
TreeExpFill.fillAmount =(float)info.Data.Exp / info.Data.upgrade_exp; TreeExpFill.fillAmount =(float)info.Data.Exp / info.Data.upgrade_exp;
for (int i = 0; i < info.Data.Charts.Count; i++)
{
if (info.Data.Charts[i].status == 2)
{
Schedulelist[i].gameObject.SetActive(true);
break;
}
}
Debug.Log(TreeExpFill.fillAmount); Debug.Log(TreeExpFill.fillAmount);
} }

View File

@ -20,8 +20,8 @@ public class IllustrationsAssetDetails : MonoBehaviour
private bool isUpdating = false; private bool isUpdating = false;
void Start() void Start()
{ {
UpDateText();
Updatatasset(); Updatatasset();
UpDateText();
if (Genbtn != null) if (Genbtn != null)
{ {
Genbtn.onClick.AddListener(() => Genbtn.onClick.AddListener(() =>
@ -68,13 +68,13 @@ public class IllustrationsAssetDetails : MonoBehaviour
private void OnEnable() private void OnEnable()
{ {
InvokeRepeating("UpDateText", 5f, 1f); InvokeRepeating("UpDateText", 5f, 1f);
InvokeRepeating("Updatatasset", 1f, 1f); InvokeRepeating("Updatatasset", 2f, 1f);
} }
private void OnDisable() private void OnDisable()
{ {
CancelInvoke("UpDateText"); CancelInvoke("UpDateText");
InvokeRepeating("Updatatasset", 1f, 1f); CancelInvoke("Updatatasset");
} }

View File

@ -1,10 +1,30 @@
using DG.Tweening;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
using Unity.VisualScripting.Antlr3.Runtime;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
public class ShopScroll : MonoBehaviour public class ShopScroll : MonoBehaviour
{ {
public RectTransform[] SkincategoryButtons; // 所有分类按钮的 RectTransform
public RectTransform[] MycategoryButtons; // 所有分类按钮的 RectTransform
public Vector2 SkinopenPosition; // 按钮展开时的位置(例如,按钮的目标位置)
public Vector2 MyopenPosition; // 按钮展开时的位置(例如,按钮的目标位置)
public Vector2 closedPosition; // 按钮收起时的位置(例如,按钮完全在屏幕外面)
public Vector2 myclosedPosition;
public float slideDuration = 0.5f; // 滑动的时间
public float delayBetweenButtons = 0.1f; // 按钮之间的延迟
private bool isSkinOpen = false; // 按钮是否展开的状态
private bool isMyOpen = false;
public Button GemBtn; public Button GemBtn;
public Button oreBtn; public Button oreBtn;
public Button lingpaiBtn; public Button lingpaiBtn;
@ -94,9 +114,9 @@ public class ShopScroll : MonoBehaviour
HidePropertyScroll(); HidePropertyScroll();
PropertySoilHideScroll(); PropertySoilHideScroll();
HideMyScroll(); HideMyScroll();
SkinCloseButtons(SkincategoryButtons);
MyCloseButtons(MycategoryButtons);
gemmage.sprite = Checked; gemmage.sprite = Checked;
Propertybtnlist.gameObject.SetActive(false);
myBtnlist.gameObject.SetActive(false);
Gemscroll.gameObject.SetActive(true); Gemscroll.gameObject.SetActive(true);
} }
@ -105,9 +125,9 @@ public class ShopScroll : MonoBehaviour
HidePropertyScroll(); HidePropertyScroll();
PropertySoilHideScroll(); PropertySoilHideScroll();
HideMyScroll(); HideMyScroll();
SkinCloseButtons(SkincategoryButtons);
MyCloseButtons(MycategoryButtons);
oreImage.sprite = Checked; oreImage.sprite = Checked;
Propertybtnlist.gameObject.SetActive(false);
myBtnlist.gameObject.SetActive(false);
OreScroll.gameObject.SetActive(true); OreScroll.gameObject.SetActive(true);
} }
@ -116,21 +136,23 @@ public class ShopScroll : MonoBehaviour
HidePropertyScroll(); HidePropertyScroll();
PropertySoilHideScroll(); PropertySoilHideScroll();
HideMyScroll(); HideMyScroll();
SkinCloseButtons(SkincategoryButtons);
MyCloseButtons(MycategoryButtons);
lingpaiImage.sprite = Checked; lingpaiImage.sprite = Checked;
Propertybtnlist.gameObject.SetActive(false);
myBtnlist.gameObject.SetActive(false);
lingpaiScroll.gameObject.SetActive(true); lingpaiScroll.gameObject.SetActive(true);
} }
void mengyaoClick() void mengyaoClick()
{ {
HidePropertyScroll(); HidePropertyScroll();
PropertySoilHideScroll(); PropertySoilHideScroll();
HideMyScroll(); HideMyScroll();
SkinCloseButtons(SkincategoryButtons);
MyOpenButtons(MycategoryButtons);
mengyaoImage.sprite = Checked; mengyaoImage.sprite = Checked;
Propertybtnlist.gameObject.SetActive(false);
myBtnlist.gameObject.SetActive(true);
MengyaoScroll.gameObject.SetActive(true); MengyaoScroll.gameObject.SetActive(true);
} }
void skinClick() void skinClick()
@ -138,10 +160,12 @@ public class ShopScroll : MonoBehaviour
HidePropertyScroll(); HidePropertyScroll();
PropertySoilHideScroll(); PropertySoilHideScroll();
HideMyScroll(); HideMyScroll();
MyCloseButtons(MycategoryButtons);
SkinOpenButtons(SkincategoryButtons);
skinImage.sprite = Checked; skinImage.sprite = Checked;
SkinScroll.gameObject.SetActive(true); SkinScroll.gameObject.SetActive(true);
myBtnlist.gameObject.SetActive(false);
Propertybtnlist.gameObject.SetActive(true);
} }
void PropertyGoldClick() void PropertyGoldClick()
@ -277,8 +301,62 @@ public class ShopScroll : MonoBehaviour
} }
// Update is called once per frame
void Update() // 展开按钮
void SkinOpenButtons(RectTransform[] cateButtons)
{
Propertybtnlist.gameObject.SetActive(true);
for (int i =1; i <= cateButtons.Length; i++)
{
// 为每个按钮设置延迟,按顺序展开
cateButtons[i-1].DOAnchorPos(i* SkinopenPosition, slideDuration).SetEase(Ease.OutCubic).SetDelay(i * delayBetweenButtons);
}
}
// 收起按钮
async void SkinCloseButtons(RectTransform[] cateButtons)
{
for (int i = 0; i < cateButtons.Length; i++)
{
cateButtons[i].DOAnchorPos(closedPosition, slideDuration)
.SetEase(Ease.InCubic)
.SetDelay(i * delayBetweenButtons);
}
await Task.Delay(800);
Propertybtnlist.gameObject.SetActive(false);
}
void MyOpenButtons(RectTransform[] cateButtons)
{
cateButtons[cateButtons.Length - 1].DOAnchorPos(new Vector2(0, -1155), slideDuration).SetEase(Ease.InCubic);
myBtnlist.gameObject.SetActive(true);
for (int i = 1; i <cateButtons.Length; i++)
{
// 为每个按钮设置延迟,按顺序展开
cateButtons[i - 1].DOAnchorPos(i * MyopenPosition, slideDuration).SetEase(Ease.OutCubic).SetDelay(i * delayBetweenButtons);
}
}
// 收起按钮
async void MyCloseButtons(RectTransform[] cateButtons)
{
for (int i = 1; i < cateButtons.Length-1; i++)
{
// 为每个按钮设置延迟,按顺序展开
cateButtons[i - 1].DOAnchorPos(i * MyopenPosition, slideDuration)
.SetEase(Ease.OutCubic)
.SetDelay(i * delayBetweenButtons);
}
// 最后一个按钮的动画
cateButtons[cateButtons.Length - 1].DOAnchorPos(new Vector2(0, -597), slideDuration).SetEase(Ease.InCubic);
await Task.Delay(500);
myBtnlist.gameObject.SetActive(false);
}
// Update is called once per frame
void Update()
{ {
} }