Compare commits

...

4 Commits

10 changed files with 3912 additions and 477 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 List<GameObject> Treelist = new List<GameObject>();
public List<GameObject> ChineseZodiac = new List<GameObject>();
public List<GameObject> Schedulelist;
public Text chart_title;
@ -60,16 +61,24 @@ public class WaterPanel : MonoBehaviour
}
InvokeRepeating("Updated_water", 1f, 1f);
}
private void OnDisable()
{
CancelInvoke("Updated_water");
}
// Start is called before the first frame update
async void Start()
{
instance = this;
Updated_water();
TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS();
Updated_interface(info);
Updated_water(info);
petBettleInfoResponse petinfo = await Scene_main_jiekou.instance.getPetBettleInfos();
Updated_petinfo(petinfo);
PlayerInfoData playerinfo = await Scene_main_jiekou.instance.PlayerInfos();
@ -95,6 +104,15 @@ public class WaterPanel : MonoBehaviour
Updated_Tree(info.Data.Level);
LevelShow.text = 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);
}
@ -141,9 +159,10 @@ public class WaterPanel : MonoBehaviour
Treelist[4].SetActive(false);
}
public void Updated_water(TreeInfo info)//更新水滴数据
public async void Updated_water()//¸üÐÂË®µÎÊý¾Ý
{
waterCountText.text = info.Data.Water.ToString("F2");
CapitalbalanceIndefo CapitalbalanceData = await Scene_main_jiekou.instance.CapitalbalanceInfos();
waterCountText.text = CapitalbalanceData.data.water.ToString("F2");
}

View File

@ -107,7 +107,7 @@ public class Lottery : MonoBehaviour
Update_itemClick();
TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS();
WaterText.text = info.Data.Water.ToString();
WaterPanel.instance.Updated_water(info);
WaterPanel.instance.Updated_water();
Debug.Log(response);
}
else

View File

@ -21,7 +21,7 @@ public class FeedBtn : MonoBehaviour
Promptmgr.Instance.PromptBubble(response.message);
petBettleInfoResponse info = await Scene_main_jiekou.instance.getPetBettleInfos();
TreeInfo treeinfo = await Scene_main_jiekou.instance.TreeInfoS();
WaterPanel.instance.Updated_water(treeinfo);
WaterPanel.instance.Updated_water();
WaterPanel.instance.Updated_petinfo(info);
}

View File

@ -44,7 +44,7 @@ public class WaterDrop : MonoBehaviour
transform.DOScale(new Vector3(0.5f, 0.5f, 0.5f), 0.5f).OnComplete(() =>
{
transform.DOScale(Vector3.one, 0.5f);
WaterPanel.instance.Updated_water(info);
WaterPanel.instance.Updated_water();
Destroy(this.gameObject);
});
});

View File

@ -20,7 +20,7 @@ public class WateringBtn : MonoBehaviour
Debug.Log("浇水成功");
TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS();
WaterPanel.instance. Updated_interface(info);
WaterPanel.instance.Updated_water(info);
WaterPanel.instance.Updated_water();
}
else
{

View File

@ -20,8 +20,8 @@ public class IllustrationsAssetDetails : MonoBehaviour
private bool isUpdating = false;
void Start()
{
Updatatasset();
UpDateText();
if (Genbtn != null)
{
Genbtn.onClick.AddListener(() =>
@ -46,13 +46,17 @@ public class IllustrationsAssetDetails : MonoBehaviour
UpdateTaxt();
}
async void Updatatasset()
{
CapitalbalanceIndefo CapitalbalanceData = await Scene_main_jiekou.instance.CapitalbalanceInfos();
GemText.text = CapitalbalanceData.data.gem.ToString("F2");
WaterText.text = CapitalbalanceData.data.water.ToString("F2");
}
async void UpdateTaxt()
{
isUpdating = true;
PlayerInfoData _PlayerInfoData = await Scene_main_jiekou.instance.PlayerInfos();
GemText.text = _PlayerInfoData.gem.ToString("F2");
WaterText.text = _PlayerInfoData.water.ToString("F2");
UserName.text = _PlayerInfoData.nickname.ToString();
UserID.text = _PlayerInfoData.uid.ToString();
UserHead.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(_PlayerInfoData.avatar_url);
@ -63,12 +67,14 @@ public class IllustrationsAssetDetails : MonoBehaviour
private void OnEnable()
{
InvokeRepeating("UpDateText", 1f, 1f);
InvokeRepeating("UpDateText", 5f, 1f);
InvokeRepeating("Updatatasset", 2f, 1f);
}
private void OnDisable()
{
CancelInvoke("UpDateText");
CancelInvoke("Updatatasset");
}

View File

@ -48,10 +48,10 @@ public class ShopAssetDetails : MonoBehaviour
{
isUpdating = true;
PlayerInfoData _PlayerInfoData = await Scene_main_jiekou.instance.PlayerInfos();
GemText .text = _PlayerInfoData.gem.ToString("F2");
OreText.text = _PlayerInfoData.forge.ToString("F2");
_PlayerInfoData = null;
CapitalbalanceIndefo CapitalbalanceData = await Scene_main_jiekou.instance.CapitalbalanceInfos();
GemText .text = CapitalbalanceData.data.gem.ToString("F2");
OreText.text = CapitalbalanceData.data.forge.ToString("F2");
CapitalbalanceData = null;
// 异步操作完成,标记为未执行
isUpdating = false;
}

View File

@ -1,10 +1,30 @@
using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using Unity.VisualScripting.Antlr3.Runtime;
using UnityEngine;
using UnityEngine.UI;
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 oreBtn;
public Button lingpaiBtn;
@ -94,9 +114,9 @@ public class ShopScroll : MonoBehaviour
HidePropertyScroll();
PropertySoilHideScroll();
HideMyScroll();
SkinCloseButtons(SkincategoryButtons);
MyCloseButtons(MycategoryButtons);
gemmage.sprite = Checked;
Propertybtnlist.gameObject.SetActive(false);
myBtnlist.gameObject.SetActive(false);
Gemscroll.gameObject.SetActive(true);
}
@ -105,9 +125,9 @@ public class ShopScroll : MonoBehaviour
HidePropertyScroll();
PropertySoilHideScroll();
HideMyScroll();
SkinCloseButtons(SkincategoryButtons);
MyCloseButtons(MycategoryButtons);
oreImage.sprite = Checked;
Propertybtnlist.gameObject.SetActive(false);
myBtnlist.gameObject.SetActive(false);
OreScroll.gameObject.SetActive(true);
}
@ -116,21 +136,23 @@ public class ShopScroll : MonoBehaviour
HidePropertyScroll();
PropertySoilHideScroll();
HideMyScroll();
SkinCloseButtons(SkincategoryButtons);
MyCloseButtons(MycategoryButtons);
lingpaiImage.sprite = Checked;
Propertybtnlist.gameObject.SetActive(false);
myBtnlist.gameObject.SetActive(false);
lingpaiScroll.gameObject.SetActive(true);
}
void mengyaoClick()
void mengyaoClick()
{
HidePropertyScroll();
PropertySoilHideScroll();
HideMyScroll();
SkinCloseButtons(SkincategoryButtons);
MyOpenButtons(MycategoryButtons);
mengyaoImage.sprite = Checked;
Propertybtnlist.gameObject.SetActive(false);
myBtnlist.gameObject.SetActive(true);
MengyaoScroll.gameObject.SetActive(true);
}
void skinClick()
@ -138,10 +160,12 @@ public class ShopScroll : MonoBehaviour
HidePropertyScroll();
PropertySoilHideScroll();
HideMyScroll();
MyCloseButtons(MycategoryButtons);
SkinOpenButtons(SkincategoryButtons);
skinImage.sprite = Checked;
SkinScroll.gameObject.SetActive(true);
myBtnlist.gameObject.SetActive(false);
Propertybtnlist.gameObject.SetActive(true);
}
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()
{
}

View File

@ -57,5 +57,7 @@ public class TreeInfoReward
public class TreeInfoChart
{
public string Name { get; set; }
public int status;
public string Reward { get; set; }
}