增加跳转
This commit is contained in:
parent
2eaf562cb4
commit
7395170a10
|
|
@ -2034,7 +2034,7 @@ MonoBehaviour:
|
|||
backgroundAnimator: {fileID: 858120093}
|
||||
cancelButton: {fileID: 843133640}
|
||||
nextButton: {fileID: 1853630204}
|
||||
disabledNextButton: {fileID: 1037294270}
|
||||
disabledNextButton: {fileID: 1037294272}
|
||||
tankCaution: {fileID: 1464412873}
|
||||
panSelector: {fileID: 1160535648}
|
||||
flavorName: {fileID: 707887860}
|
||||
|
|
@ -2183,7 +2183,7 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 0
|
||||
m_RaycastTarget: 1
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class RecipeDetailView : MonoBehaviour
|
|||
[SerializeField] private Animator backgroundAnimator;
|
||||
[SerializeField] private Button cancelButton;
|
||||
[SerializeField] private Button nextButton;
|
||||
[SerializeField] private GameObject disabledNextButton;
|
||||
[SerializeField] private Button disabledNextButton;
|
||||
[SerializeField] private GameObject tankCaution;
|
||||
[SerializeField] private PanSelector panSelector;
|
||||
[SerializeField] private Text flavorName;
|
||||
|
|
@ -79,18 +79,45 @@ public class RecipeDetailView : MonoBehaviour
|
|||
case ProductViewType.Default:
|
||||
nextButton.interactable = isPassedAmount && isPassedTank;
|
||||
panSelector.gameObject.SetActive(!isPassedAmount || isPassedTank);
|
||||
disabledNextButton.SetActive(!isPassedAmount || !isPassedTank);
|
||||
disabledNextButton.gameObject.SetActive(!isPassedAmount || !isPassedTank);
|
||||
tankCaution.SetActive(isPassedAmount && !isPassedTank);
|
||||
break;
|
||||
case ProductViewType.BulkOrder:
|
||||
nextButton.interactable = isPassedAmount;
|
||||
panSelector.gameObject.SetActive(true);
|
||||
disabledNextButton.SetActive(!nextButton.interactable);
|
||||
disabledNextButton.gameObject.SetActive(!nextButton.interactable);
|
||||
tankCaution.SetActive(false);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
disabledNextButton.OnClickAsObservable().Take(1).Subscribe(_ =>
|
||||
{
|
||||
onClichJump(data);
|
||||
|
||||
}).AddTo(this);
|
||||
}
|
||||
|
||||
void onClichJump(ProductData productData)
|
||||
{
|
||||
var checkResult = CheckAmount(productData);
|
||||
if (!checkResult.material1)
|
||||
{
|
||||
|
||||
TransitionManager.Instance.LoadScene(GameScenes.CornField);
|
||||
}
|
||||
if (!checkResult.material2)
|
||||
{
|
||||
TransitionManager.Instance.JumpId = productData.MaterialList[1].id;
|
||||
TransitionManager.Instance.LoadScene(GameScenes.shopping);
|
||||
}
|
||||
if (!checkResult.material3)
|
||||
{
|
||||
TransitionManager.Instance.JumpId = productData.MaterialList[1].id;
|
||||
TransitionManager.Instance.LoadScene(GameScenes.shopping);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void ConsumeMaterial(ProductData productData)
|
||||
|
|
|
|||
|
|
@ -54,5 +54,6 @@ public class ShopItemPurchaseButton : MonoBehaviour
|
|||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using MyGame.Scripts;
|
||||
using TMPro;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
|
|
@ -23,6 +25,8 @@ public class ShopItemView : MonoBehaviour
|
|||
[SerializeField] private GameObject soldOutObject;
|
||||
[SerializeField] private Button exchangeButton;
|
||||
|
||||
public Action jumpPurchase;
|
||||
|
||||
public IObservable<Unit> DetailButtonObservable => detailButton.OnClickAsObservable().TakeUntilDestroy(this);
|
||||
public IObservable<Unit> PurchaseButtonObservable => purchaseButton.ClickObservable;
|
||||
public IObservable<Unit> ExchangeButtonObservable => exchangeButton.OnClickAsObservable().TakeUntilDestroy(this);
|
||||
|
|
@ -49,8 +53,22 @@ public class ShopItemView : MonoBehaviour
|
|||
progressText.text = string.Format(ProgressFormat, GameDataManager.GameData.adCount, shopData.price);
|
||||
onObject.SetActive(shopData.price <= GameDataManager.GameData.adCount);
|
||||
offObject.SetActive(!onObject.activeSelf);
|
||||
|
||||
|
||||
var gameData = GameDataManager.GameData;
|
||||
if (shopData.price <= gameData.Coin&& TransitionManager.Instance.JumpId!=-1)
|
||||
{
|
||||
if (null!= jumpPurchase&& TransitionManager.Instance.JumpId== shopData.itemId)
|
||||
{
|
||||
jumpPurchase();
|
||||
TransitionManager.Instance.JumpId = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void SetStockCount(int stock)
|
||||
{
|
||||
stockCount.text = $"{stock}";
|
||||
|
|
|
|||
|
|
@ -59,6 +59,31 @@ public class Shopping : MonoBehaviour
|
|||
continue;
|
||||
}
|
||||
var itemView = listView.AddItemView(shopData);
|
||||
|
||||
itemView.jumpPurchase = () =>
|
||||
{
|
||||
ShopItemPurchaseView.ShowDialog((shopData, GetItemAmount(shopData)), amount =>
|
||||
{
|
||||
// アイテムを増やす
|
||||
AddItem(shopData, amount);
|
||||
itemView.SetStockCount(GetItemAmount(shopData));
|
||||
CoinManager.Instance.SubCoin(shopData.price * amount);
|
||||
gameData.Coin = CoinManager.Instance.OwnCoin;
|
||||
changeCoinSubject.OnNext(gameData.Coin);
|
||||
GameDataManager.SaveGameData();
|
||||
|
||||
if (isTutorial)
|
||||
{
|
||||
TutorialManager.Instance.ShowTutorialConversation(8, () =>
|
||||
{
|
||||
isTutorial = false;
|
||||
gameData.FinishedFlags |= TutorialFlag.Shopping;
|
||||
GameDataManager.SaveGameData();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
itemView.SetData(shopData);
|
||||
itemView.SetStockCount(GetItemAmount(shopData));
|
||||
// コインを監視して購入可能状態を切り替え
|
||||
|
|
@ -93,7 +118,10 @@ public class Shopping : MonoBehaviour
|
|||
}
|
||||
});
|
||||
}).AddTo(itemView);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 広告視聴獲得
|
||||
itemView.ExchangeButtonObservable
|
||||
.ThrottleFirst(TimeSpan.FromSeconds(.3f))
|
||||
|
|
|
|||
|
|
@ -53,23 +53,43 @@ public sealed class TransitionManager : SingletonMonoBehaviour<TransitionManager
|
|||
{
|
||||
private List<(SceneType, GameScenes)> loadedSceneList = new List<(SceneType, GameScenes)>();
|
||||
|
||||
// void Awake(){
|
||||
// #if UNITY_EDITOR
|
||||
// GameScenes currentScene;
|
||||
// try{
|
||||
// currentScene = (GameScenes)Enum.Parse(typeof(GameScenes), SceneManager.GetActiveScene().name, false);
|
||||
// }catch{
|
||||
// currentScene = GameScenes.TransitionManager;
|
||||
// }
|
||||
// if(currentScene != GameScenes.TransitionManager){
|
||||
// loadedSceneList.Add((SceneType.Default, currentScene));
|
||||
// SceneManager.LoadScene("TransitionManager", LoadSceneMode.Additive);
|
||||
// return ;
|
||||
// }
|
||||
// #endif
|
||||
|
||||
// TransitionManager.Instance.LoadScene(GameScenes.Main);
|
||||
// }
|
||||
|
||||
private int jumpId=-1;
|
||||
|
||||
public int JumpId
|
||||
{
|
||||
get
|
||||
{
|
||||
return jumpId;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != jumpId)
|
||||
{
|
||||
jumpId = value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// void Awake(){
|
||||
// #if UNITY_EDITOR
|
||||
// GameScenes currentScene;
|
||||
// try{
|
||||
// currentScene = (GameScenes)Enum.Parse(typeof(GameScenes), SceneManager.GetActiveScene().name, false);
|
||||
// }catch{
|
||||
// currentScene = GameScenes.TransitionManager;
|
||||
// }
|
||||
// if(currentScene != GameScenes.TransitionManager){
|
||||
// loadedSceneList.Add((SceneType.Default, currentScene));
|
||||
// SceneManager.LoadScene("TransitionManager", LoadSceneMode.Additive);
|
||||
// return ;
|
||||
// }
|
||||
// #endif
|
||||
|
||||
// TransitionManager.Instance.LoadScene(GameScenes.Main);
|
||||
// }
|
||||
|
||||
public void LoadScene(GameScenes scene)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue