カスタマイズ機能 ハイライト実装
This commit is contained in:
parent
37a2199cb2
commit
0fbf6f33f9
|
|
@ -28,7 +28,14 @@ namespace MyGame.Scenes.marketing.Scripts
|
|||
{
|
||||
ShopCustomizeInfoDialog.ShowDialog();
|
||||
}).AddTo(this);
|
||||
customizeSelector.Initialize();
|
||||
|
||||
customizeSelector.Initialize(ShopCustomizeCategory.Category1);
|
||||
customizeSelector.SelecedCategory.Pairwise().Subscribe(x =>
|
||||
{
|
||||
marketView.SetHighlight(x.Previous, false);
|
||||
marketView.SetHighlight(x.Current, true);
|
||||
}).AddTo(this);
|
||||
|
||||
// カード生成
|
||||
var categories = (ShopCustomizeCategory[])Enum.GetValues(typeof(ShopCustomizeCategory));
|
||||
foreach (var category in categories)
|
||||
|
|
@ -65,6 +72,10 @@ namespace MyGame.Scenes.marketing.Scripts
|
|||
item.SetState(ShopCustomizeItemState.Selected);
|
||||
gameData.ShopCustomizeSettings.SetSetting(customizeData);
|
||||
marketView.SetItem(customizeData);
|
||||
if (customizeSelector.SelecedCategory.Value == category)
|
||||
{
|
||||
marketView.SetHighlight(category, true);
|
||||
}
|
||||
}).AddTo(this);
|
||||
item.DetailObservable.Subscribe(_ =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,11 +19,18 @@ namespace MyGame.Scenes.marketing.Scripts
|
|||
[SerializeField] private Transform listPrefab;
|
||||
[SerializeField] private ScrollRect scrollRect;
|
||||
|
||||
public IReadOnlyReactiveProperty<ShopCustomizeCategory> SelecedCategory => selectedCategory;
|
||||
private readonly ReactiveProperty<ShopCustomizeCategory> selectedCategory = new ReactiveProperty<ShopCustomizeCategory>();
|
||||
private readonly Dictionary<ShopCustomizeCategory, Transform> targetDict = new Dictionary<ShopCustomizeCategory, Transform>();
|
||||
private readonly Dictionary<ShopCustomizeCategory, ButtonOnOff> buttonDict = new Dictionary<ShopCustomizeCategory, ButtonOnOff>();
|
||||
private readonly CompositeDisposable initializeCompositeDisposable = new CompositeDisposable();
|
||||
|
||||
public void Initialize()
|
||||
private void Start()
|
||||
{
|
||||
selectedCategory.AddTo(this);
|
||||
}
|
||||
|
||||
public void Initialize(ShopCustomizeCategory firstSelectCategory)
|
||||
{
|
||||
var viewport = scrollRect.viewport;
|
||||
viewport.DestroyAllChildrens();
|
||||
|
|
@ -42,10 +49,11 @@ namespace MyGame.Scenes.marketing.Scripts
|
|||
initializeCompositeDisposable.Clear();
|
||||
buttonDict.Select(pair => pair.Value.OnClickObservable.Select(_ => pair.Key))
|
||||
.Merge()
|
||||
.StartWith(ShopCustomizeCategory.Category1)
|
||||
.StartWith(firstSelectCategory)
|
||||
.ThrottleFirst(TimeSpan.FromSeconds(.2f))
|
||||
.Subscribe(ChangeCategory)
|
||||
.Subscribe(x => selectedCategory.Value = x)
|
||||
.AddTo(initializeCompositeDisposable);
|
||||
selectedCategory.Subscribe(ChangeCategory).AddTo(this);
|
||||
}
|
||||
|
||||
public ShopCustomizeItem GenerateItem(ShopCustomizeCategory category)
|
||||
|
|
|
|||
Loading…
Reference in New Issue