歩み表示内部修正
This commit is contained in:
parent
0a678bcd5c
commit
224e6ffd62
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using I2.Loc;
|
using I2.Loc;
|
||||||
using UniRx;
|
using UniRx;
|
||||||
|
|
@ -41,6 +42,8 @@ public class Information : MonoBehaviour
|
||||||
[SerializeField] private Text shopLevelText;
|
[SerializeField] private Text shopLevelText;
|
||||||
[SerializeField] private Text progressText;
|
[SerializeField] private Text progressText;
|
||||||
|
|
||||||
|
private bool isOdd;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
closeButton.OnClickAsObservable().Take(1).Subscribe(_ =>
|
closeButton.OnClickAsObservable().Take(1).Subscribe(_ =>
|
||||||
|
|
@ -88,33 +91,16 @@ public class Information : MonoBehaviour
|
||||||
|
|
||||||
// shopLevel
|
// shopLevel
|
||||||
historyTarget.DestroyAllChildrens();
|
historyTarget.DestroyAllChildrens();
|
||||||
var shopLevelIndex = 1;
|
SetHistory(shopLevelList[0], new List<BrotherScriptData>(), false);
|
||||||
foreach (var levelData in shopLevelList)
|
|
||||||
|
for (var index = 1; index < shopLevelList.Count; index++)
|
||||||
{
|
{
|
||||||
|
var levelData = shopLevelList[index];
|
||||||
var scriptList = shopScriptList.Where(data => data.id == levelData.shopLevel).ToList();
|
var scriptList = shopScriptList.Where(data => data.id == levelData.shopLevel).ToList();
|
||||||
var view = Instantiate(historyPrefab, historyTarget);
|
SetHistory(levelData, scriptList, levelData.shopLevel > gameData.ViewedShopLevel);
|
||||||
view.SetOddBG(shopLevelIndex % 2 == 0);
|
|
||||||
shopLevelIndex++;
|
|
||||||
if (levelData.shopLevel > gameData.ViewedShopLevel)
|
|
||||||
{
|
|
||||||
view.SetUnreleased(true);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
view.SetData(levelData);
|
|
||||||
if (scriptList.Count > 0)
|
|
||||||
{
|
|
||||||
view.PlayButton.ThrottleFirst(TimeSpan.FromSeconds(1f)).Subscribe(_ =>
|
|
||||||
{
|
|
||||||
LocalCacheManager.Save(BrotherConversation.ScriptDataTag, scriptList);
|
|
||||||
TransitionManager.Instance.LoadSceneAdditive(GameScenes.Conversation);
|
|
||||||
}).AddTo(view);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
view.SetButtonAcive(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// product
|
// product
|
||||||
productTarget.DestroyAllChildrens();
|
productTarget.DestroyAllChildrens();
|
||||||
if (totalStockList.Sum(data => data.Stock) == 0)
|
if (totalStockList.Sum(data => data.Stock) == 0)
|
||||||
|
|
@ -164,4 +150,30 @@ public class Information : MonoBehaviour
|
||||||
scrollRect.verticalNormalizedPosition = 1;
|
scrollRect.verticalNormalizedPosition = 1;
|
||||||
shopInfoButton.onClick.Invoke();
|
shopInfoButton.onClick.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetHistory(ShopLevelData levelData, List<BrotherScriptData> scriptList, bool unreleased, bool withoutLevelText = false)
|
||||||
|
{
|
||||||
|
var view = Instantiate(historyPrefab, historyTarget);
|
||||||
|
isOdd = !isOdd;
|
||||||
|
view.SetOddBG(isOdd);
|
||||||
|
if (unreleased)
|
||||||
|
{
|
||||||
|
view.SetUnreleased(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
view.SetData(levelData, withoutLevelText);
|
||||||
|
if (scriptList.Count > 0)
|
||||||
|
{
|
||||||
|
view.PlayButton.ThrottleFirst(TimeSpan.FromSeconds(1f)).Subscribe(_ =>
|
||||||
|
{
|
||||||
|
LocalCacheManager.Save(BrotherConversation.ScriptDataTag, scriptList);
|
||||||
|
TransitionManager.Instance.LoadSceneAdditive(GameScenes.Conversation);
|
||||||
|
}).AddTo(view);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
view.SetButtonAcive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,16 @@ using UnityEngine.UI;
|
||||||
|
|
||||||
public class ShopHistoryItemView : MonoBehaviour
|
public class ShopHistoryItemView : MonoBehaviour
|
||||||
{
|
{
|
||||||
private static readonly string acivementFormat = "Lv.{0} {1}";
|
private static readonly string levelTextFormat = "Lv.{0} ";
|
||||||
[SerializeField] private Text achievementText;
|
[SerializeField] private Text achievementText;
|
||||||
[SerializeField] private Button playButton;
|
[SerializeField] private Button playButton;
|
||||||
[SerializeField] private GameObject oddColorBG;
|
[SerializeField] private GameObject oddColorBG;
|
||||||
[SerializeField] private GameObject viewObject;
|
[SerializeField] private GameObject viewObject;
|
||||||
[SerializeField] private GameObject unreleasedObject;
|
[SerializeField] private GameObject unreleasedObject;
|
||||||
public IObservable<Unit> PlayButton => playButton.OnClickAsObservable().TakeUntilDestroy(this);
|
public IObservable<Unit> PlayButton => playButton.OnClickAsObservable().TakeUntilDestroy(this);
|
||||||
public void SetData(ShopLevelData levelData)
|
public void SetData(ShopLevelData levelData, bool withoutLevelText)
|
||||||
{
|
{
|
||||||
achievementText.text = String.Format(acivementFormat, levelData.shopLevel, levelData.Achievement);
|
achievementText.text = (withoutLevelText ? "" : String.Format(levelTextFormat, levelData.shopLevel)) + levelData.Achievement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetUnreleased(bool active)
|
public void SetUnreleased(bool active)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue