void Start()
 {
     CommandHub.Subscribe <GetCard>(
         x => {
         Debug.Log("GetCard Command Received");
         cardList.Add(x.card);
     });
 }
Beispiel #2
0
        public IEnumerator Run(
            Model.CardList dishCardListModel,
            Model.CardList poolCardListModel)
        {
            Debug.Log("MultipleCardChoose.SetUp");
            done = false;

            dishCardList.SetUp(dishCardListModel, card => true, card => true);
            poolCardList.SetUp(
                poolCardListModel,
                card => true,
                card => dishCardListModel.IndexOf(card) < 0);

            var a1 = poolCardList.OnSelect.Subscribe(
                card => {
                if (dishCardListModel.Count < maxCount)
                {
                    dishCardListModel.Add(card);
                    poolCardList.Hide(card);
                }
            });
            var a2 = dishCardList.OnSelect.Subscribe(
                card => {
                if (minCount < dishCardListModel.Count)
                {
                    dishCardListModel.Remove(card);
                    poolCardList.Show(card);
                }
            }).AddTo(gameObject);
            var a3 = dishCardListModel.Cards.ObserveCountChanged(true)
                     .Select(x => x == maxCount || x == poolCardListModel.Count)
                     .SubscribeToInteractable(okButton);

            yield return(new WaitUntil(() => done));

            a1.Dispose();
            a2.Dispose();
            a3.Dispose();

            dishCardList.TearDown();
            poolCardList.TearDown();
        }