备份CatanBuilding瘦身独立工程
This commit is contained in:
18
Assets/Scripts/FishingBox/FishingBoxFxHider.cs
Normal file
18
Assets/Scripts/FishingBox/FishingBoxFxHider.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class FishingBoxFxHider : MonoBehaviour
|
||||
{
|
||||
private GameObject _fx;
|
||||
private void Awake()
|
||||
{
|
||||
char s = gameObject.name[^1];
|
||||
_fx = transform.Find($"fx_fishingbox_open_0{s}").gameObject;
|
||||
}
|
||||
private void OnEnable()
|
||||
{
|
||||
_fx.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
11
Assets/Scripts/FishingBox/FishingBoxFxHider.cs.meta
Normal file
11
Assets/Scripts/FishingBox/FishingBoxFxHider.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c84c80d79385f044bfdf5beb1b1dbe1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
125
Assets/Scripts/FishingBox/FishingBoxInfoBar.cs
Normal file
125
Assets/Scripts/FishingBox/FishingBoxInfoBar.cs
Normal file
@@ -0,0 +1,125 @@
|
||||
//using asap.core;
|
||||
//using GameCore;
|
||||
//using System.Collections;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Threading.Tasks;
|
||||
//using TMPro;
|
||||
//using UniRx;
|
||||
//using UnityEngine;
|
||||
//using UnityEngine.Rendering.LookDev;
|
||||
//using UnityEngine.UI;
|
||||
|
||||
//public class FishingBoxInfoBar : MonoBehaviour
|
||||
//{
|
||||
// public class RewardItemInfo
|
||||
// {
|
||||
// public Transform Tran;
|
||||
// public TMP_Text Txt_Name;
|
||||
// public Image Img;
|
||||
// public TMP_Text Txt_Desc;
|
||||
|
||||
// public RewardItemInfo(Transform go)
|
||||
// {
|
||||
// this.Tran = go;
|
||||
// Txt_Name = go.Find("text_name").GetComponent<TMP_Text>();
|
||||
// Txt_Desc = go.Find("text_num").GetComponent<TMP_Text>();
|
||||
|
||||
// Img = go.Find("icon").GetComponent<Image>();
|
||||
// }
|
||||
|
||||
// public void Reset(string name, string desc)
|
||||
// {
|
||||
// Txt_Name.text = name;
|
||||
// Txt_Desc.text = desc;
|
||||
// }
|
||||
// }
|
||||
|
||||
// [SerializeField]
|
||||
// private TMP_Text
|
||||
// txt_desc,
|
||||
// txt_boxName;
|
||||
// [SerializeField]
|
||||
// private Button
|
||||
// btn_info;
|
||||
|
||||
// [SerializeField]
|
||||
// private Image
|
||||
// //img_reward,
|
||||
// img_info;
|
||||
|
||||
// public Transform pos;
|
||||
// //[Header("Reward Tips")]
|
||||
// //[SerializeField]
|
||||
// //private Button
|
||||
// // btn_closeRewardTips;
|
||||
// //[SerializeField]
|
||||
// //private Transform
|
||||
// // tran_rewardTips;
|
||||
// //[SerializeField]
|
||||
// //private TMP_Text
|
||||
// // txt_tipName;
|
||||
// //List<RewardItemInfo> _rewardItems=new();
|
||||
|
||||
// private FishingBoxDataProvier _dataProvider;
|
||||
// protected CompositeDisposable disposables = new CompositeDisposable();
|
||||
|
||||
// private void Awake()
|
||||
// {
|
||||
// btn_info.onClick.AddListener(OnOpen);
|
||||
// //btn_closeRewardTips.onClick.AddListener(OnClose);
|
||||
// GContext.OnEvent<ChangeSelectedFishingBoxEvent>().Subscribe(x => OnChangeSelectedBox(x)).AddTo(disposables);
|
||||
|
||||
|
||||
// //var trans = tran_rewardTips.GetChild(1).GetChild(0);
|
||||
// //for (int i = 1; i < trans.childCount; i++)
|
||||
// //{
|
||||
// // var tran= trans.GetChild(i);
|
||||
// // var rewardItem = new RewardItemInfo(tran);
|
||||
// // _rewardItems.Add(rewardItem);
|
||||
// //}
|
||||
// }
|
||||
|
||||
// private void Start()
|
||||
// {
|
||||
// _dataProvider = GContext.container.Resolve<FishingBoxDataProvier>();
|
||||
// //tran_rewardTips.gameObject.SetActive(false);
|
||||
// ReInit();
|
||||
// }
|
||||
// private void OnDestroy()
|
||||
// {
|
||||
// disposables.Dispose();
|
||||
// }
|
||||
|
||||
// private void ReInit()
|
||||
// {
|
||||
// txt_desc.text = _dataProvider.GetFishingBoxDesc();
|
||||
// txt_boxName.text = _dataProvider.GetFishingBoxName();
|
||||
|
||||
// //初始化标题
|
||||
// //txt_tipName.text = _dataProvider.GetFishingBoxRewardTitle() ;
|
||||
// var uiService = GContext.container.Resolve<IUIService>();
|
||||
// uiService.SetImageSprite(img_info, _dataProvider.GetFishingBoxTitleImg());
|
||||
// //uiService.SetImageSprite(img_reward, _dataProvider.GetFishingBoxTipImg());
|
||||
|
||||
|
||||
// // _dataProvider.GetRewardsInfo(_rewardItems);
|
||||
// }
|
||||
// private void OnChangeSelectedBox(ChangeSelectedFishingBoxEvent e)
|
||||
// {
|
||||
// ReInit();
|
||||
// }
|
||||
// private void OnOpen()
|
||||
// {
|
||||
// GContext.container.Resolve<PlayerItemData>().ShowItemTips(_dataProvider.CurSelectedID, pos);
|
||||
// // tran_rewardTips.gameObject.SetActive(true);
|
||||
// // _dataProvider.CanSwitchBox = false;
|
||||
// }
|
||||
// private void OnClose()
|
||||
// {
|
||||
// // tran_rewardTips.gameObject.SetActive(false);
|
||||
// // await Task.Yield();
|
||||
// // _dataProvider.CanSwitchBox = true;
|
||||
|
||||
// }
|
||||
|
||||
//}
|
||||
11
Assets/Scripts/FishingBox/FishingBoxInfoBar.cs.meta
Normal file
11
Assets/Scripts/FishingBox/FishingBoxInfoBar.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95c647826617a4d4696d78e868bceef7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
112
Assets/Scripts/FishingBox/FishingBoxProgressBar.cs
Normal file
112
Assets/Scripts/FishingBox/FishingBoxProgressBar.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
//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();
|
||||
// }
|
||||
//}
|
||||
11
Assets/Scripts/FishingBox/FishingBoxProgressBar.cs.meta
Normal file
11
Assets/Scripts/FishingBox/FishingBoxProgressBar.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7eb289f173e7464a84a1b341c3f6333
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
123
Assets/Scripts/FishingBox/FishingBoxRewardPanel.cs
Normal file
123
Assets/Scripts/FishingBox/FishingBoxRewardPanel.cs
Normal file
@@ -0,0 +1,123 @@
|
||||
using asap.core;
|
||||
using DG.Tweening;
|
||||
using GameCore;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
//奖励不叠加,Grip展示
|
||||
public class FishingBoxRewardPanel : BasePanel
|
||||
{
|
||||
[SerializeField]
|
||||
private RewardItemNew rewardItem;
|
||||
[SerializeField]
|
||||
private Transform tran_rewardParent;
|
||||
[SerializeField]
|
||||
private GameObject go_row;
|
||||
[SerializeField] private PanelScroll ps;
|
||||
private FishingBoxDataProvier dataProvider;
|
||||
|
||||
|
||||
[SerializeField]
|
||||
private Button
|
||||
btn_close,
|
||||
btn_skip;
|
||||
private List<RewardItemNew> rewards = new();
|
||||
private List<GameObject> rows = new();
|
||||
public bool IsShow;
|
||||
private void Awake()
|
||||
{
|
||||
btn_close.OnClickAsObservable().Subscribe(x => OnClose()).AddTo(disposables);
|
||||
btn_skip.onClick.AddListener(OnClick);
|
||||
|
||||
}
|
||||
public async Task InitAsync(List<ItemData> dropItems)
|
||||
{
|
||||
var x = 4;
|
||||
clickCount = 0;
|
||||
jump = false;
|
||||
IsShow = true;
|
||||
gameObject.SetActive(true);
|
||||
var curParent = tran_rewardParent;
|
||||
btn_skip.gameObject.SetActive(true);
|
||||
btn_close.gameObject.SetActive(false);
|
||||
dataProvider = GContext.container.Resolve<FishingBoxDataProvier>();
|
||||
dataProvider.CanSwitchBox = false;
|
||||
|
||||
for (int i = 0; i < dropItems.Count; i++)
|
||||
{
|
||||
var index = i % 4;
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
curParent = Instantiate(go_row, tran_rewardParent).transform;
|
||||
curParent.gameObject.SetActive(true);
|
||||
rows.Add(curParent.gameObject);
|
||||
var count = dropItems.Count - i;
|
||||
for (int j = 0; j < x; j++)
|
||||
{
|
||||
curParent.GetChild(j).gameObject.SetActive(j < count);
|
||||
}
|
||||
}
|
||||
|
||||
var item = dropItems[i];
|
||||
|
||||
var reward = Instantiate(rewardItem.gameObject, curParent.GetChild(index)).GetComponent<RewardItemNew>();
|
||||
reward.SetData(item, isCanClick: true);
|
||||
reward.gameObject.SetActive(true);
|
||||
reward.PlayOpen();
|
||||
rewards.Add(reward);
|
||||
|
||||
if (jump)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
// if ( index == 0 && i/ 4 > 3 && i!= rewards.Count )
|
||||
// {
|
||||
//
|
||||
// }
|
||||
await Awaiters.NextFrame;
|
||||
ps.verticalNormalizedPosition = 0f;
|
||||
await new WaitForSeconds(0.1f);
|
||||
|
||||
}
|
||||
}
|
||||
await Awaiters.NextFrame;
|
||||
ps.verticalNormalizedPosition = 0f;
|
||||
btn_skip.gameObject.SetActive(false);
|
||||
btn_close.gameObject.SetActive(true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private int clickCount;
|
||||
private bool jump;
|
||||
private void OnClick()
|
||||
{
|
||||
if (IsShow)
|
||||
{
|
||||
clickCount++;
|
||||
if (clickCount == 2)
|
||||
{
|
||||
jump = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClose()
|
||||
{
|
||||
rewards.ForEach(x => Destroy(x.gameObject));
|
||||
rows.ForEach(x => Destroy(x.gameObject));
|
||||
rewards.Clear();
|
||||
rows.Clear();
|
||||
IsShow = false;
|
||||
gameObject.SetActive(false);
|
||||
dataProvider.CanSwitchBox = true;
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Scripts/FishingBox/FishingBoxRewardPanel.cs.meta
Normal file
11
Assets/Scripts/FishingBox/FishingBoxRewardPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e3eb7c1e3097004280746c33f477522
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
31
Assets/Scripts/FishingBox/FlyingFishingBox.cs
Normal file
31
Assets/Scripts/FishingBox/FlyingFishingBox.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using asap.core;
|
||||
using com.fpnn.livedata;
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class FlyingFishingBox:MonoBehaviour
|
||||
{
|
||||
private Image img;
|
||||
public Action ArriveAction;
|
||||
|
||||
public void DoFly(Vector3 targetPos, string icon)
|
||||
{
|
||||
img = transform.Find("icon").GetComponent<Image>();
|
||||
|
||||
GContext.container.Resolve<IUIService>().SetImageSprite(img, icon);
|
||||
gameObject.SetActive(true);
|
||||
transform.DOScale(Vector3.one * 0.92f,0.7f).SetEase(Ease.InOutBounce);
|
||||
transform.DOMove(targetPos, 0.7f).OnComplete(OnArrive);
|
||||
}
|
||||
|
||||
public void OnArrive()
|
||||
{
|
||||
ArriveAction?.Invoke();
|
||||
ArriveAction = null;
|
||||
gameObject.SetActive(false);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Scripts/FishingBox/FlyingFishingBox.cs.meta
Normal file
11
Assets/Scripts/FishingBox/FlyingFishingBox.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6836f591b8d85544a827fa9d3a91ea40
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user