private void OnPileFocusedChanged(BoardPlayerLayer.PileFocused newPileFocused)
 {
     lock (this.objectLock)
     {
         this.PileFocused = newPileFocused;
     }
 }
        private void OnCardUnpicked(CardEntity obj, BoardPlayerLayer.PileFocused pilePicked)
        {
            CardEntity2D cardUnpicked = this.GetEntity2DFromEntity(obj) as CardEntity2D;

            cardUnpicked.PlaySound("cardDrawn");

            switch (pilePicked)
            {
            case BoardPlayerLayer.PileFocused.HAND:
                this.cardsHand.Add(cardUnpicked);
                break;

            case BoardPlayerLayer.PileFocused.CEMETERY:
                this.cardsCemetery.Add(cardUnpicked);
                break;
            }

            cardUnpicked.SetCooldownFocus(COOLDOWN_FOCUS);

            switch (pilePicked)
            {
            case BoardPlayerLayer.PileFocused.HAND:
                this.UpdateCardHandPriority();
                break;

            case BoardPlayerLayer.PileFocused.CEMETERY:
                this.UpdateCardCimeteryPriority();
                break;
            }
        }
        public BoardPlayerLayer2D(World2D world2D, IObject2DFactory factory, BoardPlayerLayer layer) :
            base(world2D, factory, layer)
        {
            this.Area = new Vector2i(int.MaxValue, int.MaxValue);

            this.hittableEntities2D = new List <AEntity2D>();

            layer.CardDrawn            += OnCardDrawn;
            layer.NbCardsToDrawChanged += OnNbCardToDrawsChanged;

            layer.CardFocused += OnCardFocused;

            layer.CardPicked   += OnCardPicked;
            layer.CardUnpicked += OnCardUnpicked;

            layer.PileFocusedChanged += OnPileFocusedChanged;

            layer.CardDestroyed += OnCardDestroyed;
            // layer.CardResurrected += OnCardResurrected;

            layer.SourceCardEntitiesSet += OnSourceCardEntitiesSet;

            //this.cardToolTip = new CardToolTip(this);
            //this.endTurnButton = new EndTurnButton2D(this);
            this.scoreLabel = new ScoreLabel2D(this);

            this.cardsDeck     = new List <CardEntity2D>();
            this.cardsCemetery = new List <CardEntity2D>();
            this.cardsHand     = new List <CardEntity2D>();

            this.pileFocused = BoardPlayerLayer.PileFocused.NONE;

            layer.BoardToLayerPositionConverter = this;
        }
Exemple #4
0
        protected virtual void FowardFocusPileEvent(World world)
        {
            if (this.pendingGameEvents.TryGetValue(EventType.FOCUS_CARD_PILE, out List <GameEvent> gameEventsList))
            {
                foreach (GameEvent gameEvent in gameEventsList)
                {
                    BoardPlayerLayer.PileFocused pileFocused = (BoardPlayerLayer.PileFocused) int.Parse(gameEvent.Details);

                    (gameEvent.Layer as BoardPlayerLayer).CardPileFocused = pileFocused;
                }
            }
        }
        private void OnCardPicked(CardEntity obj, BoardPlayerLayer.PileFocused pilePicked)
        {
            CardEntity2D cardPicked = this.GetEntity2DFromEntity(obj) as CardEntity2D;

            switch (pilePicked)
            {
            case BoardPlayerLayer.PileFocused.HAND:
                this.cardsHand.Remove(cardPicked);
                this.UpdateCardHandPriority();
                break;

            case BoardPlayerLayer.PileFocused.CEMETERY:
                this.cardsCemetery.Remove(cardPicked);
                this.UpdateCardCimeteryPriority();
                break;
            }
        }
        private void OnCardUnpicked(CardEntity obj, BoardPlayerLayer.PileFocused pilePicked)
        {
            lock (this.objectLock)
            {
                AICardEntity cardUnpicked = this.objectToObjectAIs[obj] as AICardEntity;

                switch (pilePicked)
                {
                case BoardPlayerLayer.PileFocused.HAND:
                    this.cardsHand.Add(cardUnpicked);
                    break;

                case BoardPlayerLayer.PileFocused.CEMETERY:
                    this.cardsCemetery.Add(cardUnpicked);
                    break;
                }
            }
        }
        public override void InitializeLayer(IAIObjectFactory factory)
        {
            this.cardsDeck.Clear();
            this.cardsCemetery.Clear();
            this.cardsHand.Clear();

            this.pileFocused = (this.parentLayer as BoardPlayerLayer).CardPileFocused;

            base.InitializeLayer(factory);

            foreach (AAIEntity entity in this.objectToObjectAIs.Values)
            {
                if (entity is AICardEntity)
                {
                    AICardEntity cardEntity2D = entity as AICardEntity;

                    this.cardsDeck.Add(cardEntity2D);
                }
            }
        }
        public override void InitializeLayer(IObject2DFactory factory)
        {
            this.cardsDeck.Clear();
            this.cardsCemetery.Clear();
            this.cardsHand.Clear();

            this.maxPriority = 0;

            this.nbCardsToDraw = 0;

            this.currentCooldownDraw = 0;

            this.LevelTurnPhase = TurnPhase.VOID;

            this.cardDrawn   = null;
            this.cardFocused = null;

            this.sourceCardEntities = null;
            //this.cardPicked = null;

            this.pileFocused = (this.parentLayer as BoardPlayerLayer).CardPileFocused;

            base.InitializeLayer(factory);

            BoardPlayerLayer parentBoardPlayerLayer = (this.parentLayer as BoardPlayerLayer);

            this.scoreLabel.DisplayScore(parentBoardPlayerLayer.IndexPlayer, parentBoardPlayerLayer.SupportedPlayer);
            this.scoreLabel.Score = 0;

            foreach (AEntity2D entity in this.objectToObject2Ds.Values)
            {
                if (entity is CardEntity2D)
                {
                    CardEntity2D cardEntity2D = entity as CardEntity2D;

                    cardEntity2D.Priority = this.maxPriority++;

                    this.cardsDeck.Add(cardEntity2D);
                }
            }
        }
 private void OnPileFocusedChanged(BoardPlayerLayer.PileFocused newPileFocused)
 {
     this.PileFocused = newPileFocused;
 }