Files
back_cantanBuilding/Assets/Scripts/FishingBox/FishingBoxProgressBar.cs
2026-05-26 16:15:54 +08:00

113 lines
3.1 KiB
C#

//using asap.core;
//using GameCore;
//using System.Collections;
//using System.Collections.Generic;
//using TMPro;
//using UniRx;
//using UnityEngine;
//using UnityEngine.UI;
//public class FishingBoxProgressBar : MonoBehaviour
//{
// private FishingBoxDataProvier _dataProvider;
// private FlyingFishingBox _flyingBox;
// [SerializeField]
// private Image
// img_progress,
// img_icon;
// [SerializeField]
// private TMP_Text
// txt_progress;
// [SerializeField]
// private Button
// btn_getReward;
// [SerializeField]
// private GameObject
// go_redPoint;
// [SerializeField]
// private Transform
// tran_flyingBox;
// [SerializeField]
// private GameObject
// go_vfx;
// bool _canClick;
// protected CompositeDisposable disposables = new CompositeDisposable();
// void Awake()
// {
// GContext.OnEvent<ChangeBoxScoreEvent>().Subscribe(x => OnChangeFishingBoxScore(x)).AddTo(disposables);
// GContext.OnEvent<OpenFishingBoxEvent>().Subscribe(x => { ReInit(); }).AddTo(disposables);
// _dataProvider = GContext.container.Resolve<FishingBoxDataProvier>();
// btn_getReward.OnClickAsObservable().Subscribe(x=>OnGetReward(x)).AddTo(disposables);
// ReInit();
// }
// private void ReInit()
// {
// RefreshImg();
// RefreshProgressBar();
// }
// private void OnDestroy()
// {
// disposables.Dispose();
// }
// private void RefreshImg()
// {
// var uiService = GContext.container.Resolve<IUIService>();
// var icon = _dataProvider.GetBoxRewardIcon();
// uiService.SetImageSprite(img_icon, icon);
// }
// private void RefreshProgressBar()
// {
// var curScore = _dataProvider.GetCurScore();
// var needScore = _dataProvider.GetRequriedScore();
// if ( curScore >= needScore )
// {
// img_progress.fillAmount = 1;
// _canClick = true;
// go_redPoint.gameObject.SetActive(true);
// go_vfx.SetActive(true);
// }
// else
// {
// var progress = (float) curScore / needScore;
// _canClick = false;
// img_progress.fillAmount = progress ;
// go_redPoint.gameObject.SetActive(false);
// go_vfx.SetActive(false);
// }
// txt_progress.text = curScore.ToString() + "/" + needScore.ToString();
// }
// private void OnGetReward(Unit unit)
// {
// if(_canClick)
// {
// var go = Instantiate(tran_flyingBox.gameObject, tran_flyingBox.position, tran_flyingBox.rotation, tran_flyingBox.parent);
// _flyingBox = go.transform.GetComponent<FlyingFishingBox>();
// GContext.Publish(_flyingBox);
// _dataProvider.OnGetBoxReward();
// ReInit();
// }
// else
// {
// ToastPanel.Show(LocalizationMgr.GetFormatTextValue("UI_ToastPanel_52"));
// }
// }
// void OnChangeFishingBoxScore(ChangeBoxScoreEvent data)
// {
// RefreshProgressBar();
// }
//}