Mission報酬獲得処理追加

GameDataにパラメータ追加
WindowのCloseアニメーション追加
This commit is contained in:
kimura 2021-10-01 14:10:12 +09:00
parent 28f4dc8772
commit 48379ad2bd
6 changed files with 68 additions and 80 deletions

View File

@ -878,6 +878,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5f2a9cddac65495987f3657236411f7a, type: 3}
m_Name:
m_EditorClassIdentifier:
backgroundAnimator: {fileID: 7864277048177254395}
normalMissionObject: {fileID: 7864277047117909270}
dailyMissionObject: {fileID: 7864277046940800487}
closeButton: {fileID: 7864277046190771840}
coinText: {fileID: 7864277047470455966}
--- !u!1 &7864277047470455960
@ -1168,7 +1171,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 0.9372549, a: 0.19607843}
m_RaycastTarget: 0
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:

View File

@ -2184,9 +2184,9 @@ RectTransform:
m_Father: {fileID: 2660639677693138925}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 420, y: -1072}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 840, y: 224}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4386114712436735115
@ -3752,6 +3752,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 2660639678456833894}
- component: {fileID: 3595932897297885638}
m_Layer: 5
m_Name: Window
m_TagString: Untagged
@ -3780,6 +3781,22 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 990, y: 1466}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &3595932897297885638
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2660639678456833889}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f36629f9262b466a9fab4c31cdf6f56c, type: 3}
m_Name:
m_EditorClassIdentifier:
backgroundAnimator: {fileID: 2660639677613226246}
closeButton: {fileID: 2660639677226912964}
listView: {fileID: 8549305145373062209}
timeLimitText: {fileID: 2660639677480706697}
--- !u!1 &2660639678575329506
GameObject:
m_ObjectHideFlags: 0
@ -4584,7 +4601,6 @@ RectTransform:
m_Children:
- {fileID: 2660639677613226241}
- {fileID: 2660639678456833894}
- {fileID: 1562495386435245073}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -5460,9 +5476,9 @@ RectTransform:
m_Father: {fileID: 2660639677693138925}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 420, y: -592}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 840, y: 224}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5505592798233738046
@ -5537,9 +5553,9 @@ RectTransform:
m_Father: {fileID: 2660639677693138925}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 420, y: -352}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 840, y: 224}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7028437475535944935
@ -6224,9 +6240,9 @@ RectTransform:
m_Father: {fileID: 2660639677693138925}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 420, y: -832}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 840, y: 224}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6662879993327949048
@ -7712,9 +7728,9 @@ RectTransform:
m_Father: {fileID: 2660639677693138925}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 420, y: -1312}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 840, y: 224}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1247240408328266133
@ -7903,57 +7919,6 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &8352207781554674669
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1562495386435245073}
- component: {fileID: 7948226140012961288}
m_Layer: 5
m_Name: Manager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1562495386435245073
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8352207781554674669}
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: 2660639679028779574}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &7948226140012961288
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8352207781554674669}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f36629f9262b466a9fab4c31cdf6f56c, type: 3}
m_Name:
m_EditorClassIdentifier:
closeButton: {fileID: 2660639677226912964}
listView: {fileID: 8549305145373062209}
timeLimitText: {fileID: 2660639677480706697}
--- !u!1 &8355235653002523563
GameObject:
m_ObjectHideFlags: 0
@ -9139,7 +9104,7 @@ PrefabInstance:
- target: {fileID: 1628107519061200455, guid: 1559aa4b9e5d85c46ae00275092f8d28,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1628107519061200455, guid: 1559aa4b9e5d85c46ae00275092f8d28,
type: 3}
@ -9149,7 +9114,7 @@ PrefabInstance:
- target: {fileID: 1628107519061200455, guid: 1559aa4b9e5d85c46ae00275092f8d28,
type: 3}
propertyPath: m_AnchorMin.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1628107519061200455, guid: 1559aa4b9e5d85c46ae00275092f8d28,
type: 3}
@ -9199,12 +9164,12 @@ PrefabInstance:
- target: {fileID: 1628107519061200455, guid: 1559aa4b9e5d85c46ae00275092f8d28,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 415
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1628107519061200455, guid: 1559aa4b9e5d85c46ae00275092f8d28,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -112
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1628107519061200455, guid: 1559aa4b9e5d85c46ae00275092f8d28,
type: 3}

View File

@ -473,6 +473,7 @@ MonoBehaviour:
rewardButton: {fileID: 1628107518696448699}
disableObject: {fileID: 1628107520490624917}
rewardedObject: {fileID: 1628107518883220827}
coinFrame: {fileID: 1628107518996228242}
coinText: {fileID: 1628107519630045354}
missionText: {fileID: 1628107520295442136}
progressText: {fileID: 1628107520281042222}

View File

@ -7,6 +7,10 @@ public class MissionManager : MonoBehaviour
{
public static readonly string MissionDataTag = "MissionData";
private static readonly string TimeFormat = "更新まで:{0}時間{1}分{2}秒";
private static readonly int OpenTrigger = Animator.StringToHash("OpenTrigger");
private static readonly int CloseTrigger = Animator.StringToHash("CloseTrigger");
[SerializeField] private Animator backgroundAnimator;
[SerializeField] private Button closeButton;
[SerializeField] private MissionListView listView;
[SerializeField] private Text timeLimitText;
@ -16,7 +20,12 @@ public class MissionManager : MonoBehaviour
closeButton.OnClickAsObservable().Subscribe(_ =>
{
LocalCacheManager.Remove(MissionDataTag);
TransitionManager.Instance.UnloadScene(GameScenes.Mission);
transform.SetLocalScale(0);
backgroundAnimator.SetTrigger(CloseTrigger);
this.CallWaitForSeconds(.25f, () =>
{
TransitionManager.Instance.UnloadScene(GameScenes.Mission);
});
}).AddTo(this);
listView.SelectedTab.Subscribe(category =>
@ -34,18 +43,20 @@ public class MissionManager : MonoBehaviour
var progressValue = GetProgressValue(missionData);
missionView.SetData(missionData, progressValue);
missionView.SetButtonActive(missionData.count <= progressValue);
// if () // 達成済み
// {
// missionView.SetRewarded();
// }
// 達成処理
missionView.RewardButton.Take(1).Subscribe(_ =>
if (GameDataManager.GameData.AchievedMission.Contains(missionData.id)) // 達成済み
{
missionView.SetRewarded();
}
// リワード獲得
missionView.RewardButton.ThrottleFirst(TimeSpan.FromSeconds(1f)).Subscribe(_ =>
{
LocalCacheManager.Save(MissionDataTag, (missionData, new Action(() =>
{
GetReward(missionData);
missionView.SetRewarded();
// 達成ID保存
GameDataManager.GameData.AchievedMission.Add(missionData.id);
})));
TransitionManager.Instance.LoadSceneAdditive(GameScenes.MissionAchievement);
}).AddTo(missionView);

View File

@ -10,6 +10,7 @@ public class MissionView : MonoBehaviour
[SerializeField] private Button rewardButton;
[SerializeField] private GameObject disableObject;
[SerializeField] private GameObject rewardedObject;
[SerializeField] private GameObject coinFrame;
[SerializeField] private Text coinText;
[SerializeField] private Text missionText;
[SerializeField] private TextMeshProUGUI progressText;
@ -32,6 +33,7 @@ public class MissionView : MonoBehaviour
public void SetRewarded()
{
coinFrame.SetActive(false);
rewardButton.gameObject.SetActive(false);
disableObject.SetActive(false);
rewardedObject.SetActive(true);

View File

@ -62,6 +62,7 @@ public sealed class GameData {
[DataMember(Name = "Data12")]
public List<PlantLineData> PlantLineDataList = new List<PlantLineData>();
// [DataMember(Name = "Data13")]
[DataMember(Name = "Data14")]
public int MachineLevel = 1;
[DataMember(Name = "Data15")]
@ -92,9 +93,12 @@ public sealed class GameData {
[DataMember(Name = "Data22")]
public int[] Pans;
// [DataMember(Name = "Data23")]
[DataMember(Name = "Data24")]
public ProductRefillMode RefillMode;
// [DataMember(Name = "Data25")]
[DataMember(Name = "Data25")]
private int[] achievedMission;
public List<int> AchievedMission;
// mission
[DataMember(Name = "Data1001")]
@ -195,6 +199,7 @@ public sealed class GameData {
ShopStock = shopStock?.ToList() ?? new List<int>();
Pans = Pans ?? new int[0];
TotalSalesList = TotalSalesList ?? new List<ProductStockData>();
AchievedMission = achievedMission?.ToList() ?? new List<int>();
}
private Dictionary<int, int> ArrayToDictionary(KeyValueOfintint[] array){
var dictionary = new Dictionary<int, int>();
@ -210,6 +215,7 @@ public sealed class GameData {
// newAvatarIdArray = newAvatarIdList.ToArray();
// lastAdRewardTimeArray = lastAdRewardTimeList.ToArray();
shopStock = ShopStock.ToArray();
achievedMission = AchievedMission.ToArray();
}
private KeyValueOfintint[] DictionaryToArray(Dictionary<int, int> dictionary){
var array = new KeyValueOfintint[dictionary.Count];