羽所持数表示追加

This commit is contained in:
kimura 2022-05-20 11:40:20 +09:00
parent 3dc67359fe
commit 89476907b8
7 changed files with 105 additions and 6 deletions

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using I2.Loc;
using MyGame.Scripts;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
@ -511,6 +512,10 @@ public class MissionManager : MonoBehaviour
CoinManager.Instance.AddCoin(missionData.reward);
GameDataManager.GameData.Coin = CoinManager.Instance.OwnCoin;
break;
case MissionRewardType.ShopCustomizeCoin when ShopCustomizeCoinManager.ExistsInstance:
ShopCustomizeCoinManager.Instance.AddCoin(missionData.reward);
GameDataManager.GameData.ShopCustomizeCoin = ShopCustomizeCoinManager.Instance.OwnCoin;
break;
case MissionRewardType.ShopCustomizeCoin:
GameDataManager.GameData.ShopCustomizeCoin += missionData.reward;
break;

View File

@ -517,6 +517,36 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6ae614796715fc949a96921656b66a62, type: 3}
--- !u!1 &238780954
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 3099811789230852685}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 238780955}
m_Layer: 0
m_Name: Cart_c (Missing Prefab)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &238780955
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 3099811789230852685}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 238780954}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1826383572}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &247710335
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -91,6 +91,7 @@ GameObject:
- component: {fileID: 1275687393892332067}
- component: {fileID: 1275687393892332066}
- component: {fileID: 1275687393892332065}
- component: {fileID: 6236916451255634275}
m_Layer: 5
m_Name: StockRainbowWings
m_TagString: Untagged
@ -195,6 +196,20 @@ MonoBehaviour:
m_ChildControlHeight: 0
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
--- !u!114 &6236916451255634275
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1275687393892332079}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 12819c5a8c234fa2bdf10a248f20e09c, type: 3}
m_Name:
m_EditorClassIdentifier:
coinCountText: {fileID: 1275687393837241563}
coinUpDuration: 0.5
--- !u!1 &1275687394498706116
GameObject:
m_ObjectHideFlags: 0

View File

@ -44,6 +44,7 @@ public class MarketManager : MonoBehaviour
// カスタマイズ読み込み
marketView.SetAllItem();
stockView = marketView.GetTarget(ShopCustomizeCategory.Category4).GetComponentInChildren<ShopStockView>();
ShopCustomizeCoinManager.Instance.ChangeCoin(gameData.ShopCustomizeCoin);
if (!gameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay))
{

View File

@ -12,11 +12,12 @@ namespace MyGame.Scenes.marketing.Scripts
[SerializeField] private MarketView marketView;
[SerializeField] private ShopCustomizeView customizeView;
[SerializeField] private ShopCustomizeSelector customizeSelector;
private readonly Subject<int> levelNotify = new Subject<int>();
private readonly Subject<Unit> purchasedNotify = new Subject<Unit>();
private void Start()
{
levelNotify.AddTo(this);
purchasedNotify.AddTo(this);
SoundManager.Instance.PlayBGM("bgm_marketing");
var gameData = GameDataManager.GameData;
var customizeDataList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopCustomizeData>(Const.ShopCustomizeDataSheet);
#if UNITY_EDITOR
@ -33,6 +34,8 @@ myItems {string.Join(",", gameData.ShopCustomizeMyItems.Select(x => x.ToString()
ShopCustomizeTutorialDialog.ShowDialog();
}
customizeView.SetLevel(gameData.ShopCustomizeLevel);
ShopCustomizeCoinManager.Instance.ChangeCoin(gameData.ShopCustomizeCoin);
customizeView.OnCloseObservable.Subscribe(_ =>
{
GameDataManager.SaveGameData(); // 設定を保存
@ -74,8 +77,8 @@ myItems {string.Join(",", gameData.ShopCustomizeMyItems.Select(x => x.ToString()
else
{
item.SetState(ShopCustomizeItemState.Lock);
levelNotify.Distinct()
.Where(x => x >= customizeData.level)
purchasedNotify.Distinct()
.Where(_ => gameData.ShopCustomizeLevel >= customizeData.level)
.Take(1)
.Subscribe(x =>
{
@ -126,15 +129,17 @@ myItems {string.Join(",", gameData.ShopCustomizeMyItems.Select(x => x.ToString()
private void PurchaseItem(ShopCustomizeData customizeData)
{
var gameData = GameDataManager.GameData;
gameData.ShopCustomizeCoin -= customizeData.price;
ShopCustomizeCoinManager.Instance.SubCoin(customizeData.price);
gameData.ShopCustomizeCoin = ShopCustomizeCoinManager.Instance.OwnCoin;
gameData.ShopCustomizePoint += customizeData.point;
gameData.ShopCustomizeMyItems = gameData.ShopCustomizeMyItems.Append(customizeData.id).ToArray();
var customizeLevelList = SpreadsheetDataManager.Instance.GetBaseDataList<ShopCustomizeLevelData>(Const.ShopCustomizeLevelDataSheet);
var level = customizeLevelList.LastOrDefault(data => data.point <= gameData.ShopCustomizePoint)?.level ?? 1;
levelNotify.OnNext(level);
gameData.ShopCustomizeLevel = level;
GameDataManager.SaveGameData();
customizeView.SetLevel(gameData.ShopCustomizeLevel);
purchasedNotify.OnNext(Unit.Default);
}
/*

View File

@ -0,0 +1,40 @@
using UnityEngine;
namespace MyGame.Scripts
{
public class ShopCustomizeCoinManager : SingletonMonoBehaviour<ShopCustomizeCoinManager>
{
[SerializeField] private TextWithCountUpInt coinCountText;
[SerializeField] private float coinUpDuration = 0.5f;
private int ownCoin;
public int OwnCoin => ownCoin;
private string coinTextFormat = "{0}";
void Awake(){
if(CheckInstance()) return ;
}
public void ChangeCoin(int count)
{
ownCoin = count;
coinCountText.ChangeValue(coinTextFormat, ownCoin);
}
public void AddCoin(int count)
{
ownCoin += count;
SoundManager.Instance.PlaySE("se_coin_get");
coinCountText.CountUpAnimation(coinTextFormat, ownCoin, coinUpDuration);
}
public void SubCoin(int coin){
ownCoin -= coin;
if(coinCountText.gameObject.activeInHierarchy){
coinCountText.CountUpAnimation(coinTextFormat, ownCoin, coinUpDuration);
}else{
coinCountText.ChangeValue(coinTextFormat, ownCoin);
}
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 12819c5a8c234fa2bdf10a248f20e09c
timeCreated: 1653009837