예제 #1
0
        private void OpenCharacter(CharacterCard card)
        {
            ulong price = GameData.GetCharacterInfo(card.Character).Price;

            GameData.Instance.CurrentGameinfo.Coins -= price;
            ChangePrice(GameData.Instance.CurrentGameinfo.Coins.ToString(), ((-1) * (int)price).ToString());
            card.IsOpen = true;
            GameData.UnlockCharacter(card.Character);
            InfoToCard(card);
            ScrollMover.Instance().ActivateCurrentCard();
        }
예제 #2
0
        public void ButtonPressed()
        {
            ScrollMover instance = ScrollMover.Instance();

            if (instance == null || instance.ActiveCard == null)
            {
                return;
            }
            if (instance.ActiveCard.IsOpen)
            {
                StartGame();
            }
            else
            {
                TryToBuyCharacter(instance.ActiveCard);
            }
        }
예제 #3
0
        public void Setter(RectTransform scrollerUi, float proportion, float distanceX, float startOffSet)
        {
            _instance       = this;
            BuyingContainer = CharactersUiController.Instance().BuyingContainer;
            ScrollerUi      = scrollerUi;
            Proportion      = proportion;
            RangeX          = distanceX / 2;

            _leftCards  = new Stack <CharacterCard>();
            _rightCards = new Stack <CharacterCard>();
            var temp = (from t in transform.Cast <Transform>()
                        where t.gameObject.GetComponent <CharacterCard>() != null
                        select t).ToArray();

            if (temp.Length < 1)
            {
                throw new InvalidOperationException("We got no elements in for moving");
            }
            foreach (var t in temp)
            {
                var card = t.gameObject.GetComponent <CharacterCard>();
                if (t.position.x < -RangeX)
                {
                    _leftCards.Push(card);
                }
                else if (t.position.x > RangeX)
                {
                    _rightCards.Push(card);
                }
                else
                {
                    SetActiveCard(card);
                }
            }
            _rightCards = new Stack <CharacterCard>(_rightCards.ToArray());
            //Making position just prefect on the First item
            scrollerUi.localPosition = new Vector3((scrollerUi.sizeDelta.x / 2), 0, 0);
        }
예제 #4
0
 public void StartGame()
 {
     GameData.Instance.CurrentGameinfo.CurrentCharacter = ScrollMover.Instance().ActiveCard.Character;
     SceneManager.LoadGame();
 }