Пример #1
0
 private void Hand_CardAdded(Deck sender, CardEventArgs e)
 {
     e.Card.IsFaceUp = true;
     e.Card.LeftClick += Hand_CardLeftClick;
     e.Card.RightClick += Hand_CardRightClick;
     e.Card.Hovered += Hand_CardOnHover;
     e.Card.OutHovered += Hand_CardOutHover;
 }
Пример #2
0
 protected virtual void OnCardRemoved(CardEventArgs e)
 {
     isListCardChanged = true;
     if (CardRemoved != null)
     {
         CardRemoved(this, e);
     }
 }
Пример #3
0
 private void Graveyard_CardAdded_SetPosition(Deck sender, CardEventArgs e)
 {
     if (e.Card.STATUS == STATUS.TRIBUTE)
         return;
     if ((e.Card as Monster).BattlePosition == eBattlePosition.DEF)
         e.Card.Sprite.Rotation = 0f;
     (e.Card as Monster).BattlePosition = eBattlePosition.ATK;
     e.Card.STATUS = STATUS.NORMAL;
     e.Card.Sprite.Origin = Vector2.Zero;
 }
Пример #4
0
 private void MonsterField_CardRemoved(Deck sender, CardEventArgs e)
 {
     for (int i = 0; i < m_cardslot.Length; i++)
     {
         if (object.ReferenceEquals(m_cardslot[i], e.Card) == true)
         {
             m_cardslot[i] = null;
             return;
         }
     }
     (e.Card as Monster).ClearBattlePoint();
 }
Пример #5
0
 private void Hand_CardAdded_ScaleCard(Deck sender, CardEventArgs e)
 {
     //e.Card.AddScaleTo(new ScaleTo(0.10f, new Vector2(0.2f, 1.5f)));
     float dep = (float)1 / this.Hand.Count;
     int i = 0;
     foreach (var card in Hand.ListCard)
     {
         card.Sprite.Depth = dep * i++;
     }
     sender.ListCard.Last.Value.Sprite.WaitFor(MainDeck.Backside);
     e.Card.Scale = new Vector2(0.0f, 1.5f);
     e.Card.AddScaleTo(new ScaleTo(0.25f, new Vector2(1.5f, 1.5f)));
 }
Пример #6
0
        private void MonsterField_CardAdded(Deck sender, CardEventArgs e)
        {
            while (m_cardslot[CurrentSlot] != null)
            {
                CurrentSlot++;
            }
            m_cardslot[CurrentSlot] = e.Card;
            Vector2 position = Vector2.Zero;

            if (PlayerID == ePlayerId.PLAYER)
            {
                position = GlobalSetting.Default.PlayerMonF + new Vector2(5, 90)
                           + GlobalSetting.Default.FieldSlot.X * CurrentSlot * Vector2.UnitX;
            }
            else
            {
                position = ComputerSetting.Default.MonsterField + new Vector2(5, 0)
                           - ComputerSetting.Default.FieldSlot.X * CurrentSlot * Vector2.UnitX;
            }
            //if (this.PlayerID != ePlayerId.COMPUTER || (e.Card as Monster).BattlePosition != eBattlePosition.DEF)
            (e.Card as Monster).ShowBattlePoint(position);
        }
Пример #7
0
 private void Deck_CardAddedPlaySound(Deck sender, CardEventArgs e)
 {
     EffectManager.GetInstance().Play(eSoundId.card_move);
 }
Пример #8
0
 private void MonsterField_CardAdded(Deck sender, CardEventArgs e)
 {
     e.Card.Sprite.Depth = 0.5f;
 }
Пример #9
0
 private void MainDeck_CardRemoved(Deck sender, CardEventArgs e)
 {
     if ((sender as MainDeck).Count == 0)
         this.IsLose = true;
 }
Пример #10
0
        private void Hand_SetPosition(Deck sender, CardEventArgs e)
        {
            int count = sender.Count;
            if (count == 0) return;
            Vector2[] _position = new Vector2[sender.Count];

            if (count <= 6) //if (true)//
            {
                _position[0] = new Vector2(
                    GlobalSetting.Default.CenterField.X + (sender.ListCard.First.Value.Sprite.Bound.Width + GlobalSetting.Default.HandDistance.X) * (count - 2) / 2,
                    sender.Position.Y);
                for (int i = 1; i < _position.Length; i++)
                {
                    _position[i] = new Vector2(
                        _position[i - 1].X - sender.ListCard.First.Value.Sprite.Bound.Width - GlobalSetting.Default.HandDistance.X,
                        sender.Position.Y);
                }
            }//if
            else
            {
                _position[_position.Length-1] = new Vector2(299,555);
                int dis = 410 / (count - 1);
                for (int i = _position.Length - 2; i >= 0; i--)
                {
                    _position[i] = new Vector2(
                        _position[i + 1].X + dis,
                        _position[i + 1].Y);
                }
            }//else
            sender.ListCard.Last.Value.AddMoveTo(new MoveTo(0.5f, _position[0]));
            LinkedListNode<Card> node = sender.ListCard.Last.Previous;
            int j = 1;
            while (node != null)
            {
                node.Value.AddMoveTo(new MoveTo(0.5f, _position[j++]));
                node = node.Previous;
            }//while
        }
Пример #11
0
 protected virtual void OnCardRemoved(CardEventArgs e)
 {
     isListCardChanged = true;
     if (CardRemoved != null)
         CardRemoved(this, e);
 }
Пример #12
0
 private void MonsterField_CardRemove(Deck sender, CardEventArgs e)
 {
     e.Card.LeftClick -= MonsterField_CardLeftClick;
     e.Card.RightClick -= MonsterField_CardRightClick;
     e.Card.OutHovered -= MonsterField_CardOutHover;
     e.Card.Hovered -= MonsterField_CardOnHover;
 }
Пример #13
0
        private void MonsterField_CardAdded(Deck sender, CardEventArgs e)
        {
            e.Card.IsFaceUp = ((e.Card as Monster).BattlePosition == eBattlePosition.ATK) ? true : false;

            e.Card.LeftClick += MonsterField_CardLeftClick;
            e.Card.RightClick += MonsterField_CardRightClick;
            e.Card.OutHovered += MonsterField_CardOutHover;
            e.Card.Hovered += MonsterField_CardOnHover;
            (e.Card as Monster).SwitchBattlePosition = false;
        }
Пример #14
0
 private void Hand_CardRemoved_ScaleCard(Deck sender, CardEventArgs e)
 {
     e.Card.Sprite.Depth = 1.0f;
     e.Card.AddScaleTo(new ScaleTo(0.5f, new Vector2(1.0f)));
 }
Пример #15
0
 private void GraveYard_CardRemove(Deck sender, CardEventArgs e)
 {
 }
Пример #16
0
        private void MonsterField_CardAdded_SetPosition(Deck sender, CardEventArgs e)
        {
            //switch (e.Card.STATUS)
            //{
            //    case STATUS.DEF:
            switch ((e.Card as Monster).BattlePosition)
            {
                case eBattlePosition.DEF:
                    e.Card.Origin = new Vector2(e.Card.Sprite.Texture.Bounds.Center.X, e.Card.Sprite.Texture.Bounds.Center.Y);

                    e.Card.AddMoveTo(new MoveTo(0.3f, new Vector2(
                        sender.Position.X + ((MonsterField)sender).CurrentSlot * GlobalSetting.Default.FieldSlot.X + 15,
                        sender.Position.Y + 15) + e.Card.Origin
                        ));
                    e.Card.AddRotateTo(new RotateTo(0.3f, 90));
                    ((MonsterField)sender).CurrentSlot++;
                    break;
                case eBattlePosition.ATK:
                    e.Card.AddMoveTo(new MoveTo(0.3f, new Vector2(
                        sender.Position.X + ((MonsterField)sender).CurrentSlot * GlobalSetting.Default.FieldSlot.X + 13,
                        sender.Position.Y + 15)));
                    ((MonsterField)sender).CurrentSlot++;
                    break;
                default:
                    break;
            } //switch
        }
Пример #17
0
 private void SpellField_CardAdded_SetPosition(Deck sender, CardEventArgs e)
 {
     e.Card.Position = new Vector2(
         sender.Position.X + ((SpellField)sender).CurrentSlot * GlobalSetting.Default.FieldSlot.X + 13,
         sender.Position.Y + 15);
     ((SpellField)sender).CurrentSlot++;
 }
Пример #18
0
 private void SpellField_CardAdded(Deck sender, CardEventArgs e)
 {
     e.Card.LeftClick += SpellField_CardLeftClick;
     e.Card.RightClick += SpellField_CardRightClick;
     e.Card.Hovered += SpellField_CardOnHover;
     e.Card.OutHovered += SpellField_CardOutHover;
 }
Пример #19
0
 private void MonsterField_CardRemove(Deck sender, CardEventArgs e)
 {
     e.Card.LeftClick -= MonsterField_CardLeftClick;
     e.Card.RightClick -= MonsterField_CardRightClick;
     e.Card.OutHovered -= MonsterField_CardOutHover;
     e.Card.Hovered -= MonsterField_CardOnHover;
     //if (e.Card.Origin != Vector2.Zero)
     //    e.Card.Origin = Vector2.Zero;
 }
Пример #20
0
        private void GraveYard_CardAdded(Deck sender, CardEventArgs e)
        {
            //if ((e.Card as Monster).BattlePosition == eBattlePosition.DEF)
            //    e.Card.Sprite.Rotation = 0f;
            //if (e.Card.STATUS == STATUS.TRIBUTE)
            //{
            //    e.Card.Sprite.Origin = new Vector2(e.Card.Sprite.Size.X, e.Card.Sprite.Size.Y);
            //    e.Card.Sprite.Position += e.Card.Sprite.Origin;
            //}
            //(e.Card as Monster).BattlePosition = eBattlePosition.ATK;

            if (e.Card.STATUS == STATUS.TRIBUTE)
                return;

            if ((e.Card as Monster).BattlePosition == eBattlePosition.DEF)
                e.Card.Sprite.Rotation = 0f;

            (e.Card as Monster).BattlePosition = eBattlePosition.ATK;
            e.Card.STATUS = STATUS.NORMAL;
            e.Card.Sprite.Origin = Vector2.Zero;
        }
Пример #21
0
 private void UpdateNum(Deck sender, CardEventArgs e)
 {
     this.num_sprite.Show(this.Count, this.Position + new Vector2(22,76));
 }
Пример #22
0
 private void Hand_CardAdded_ScaleCard(Deck sender, CardEventArgs e)
 {
     float dep = (float)1 / this.Hand.Count;
     int i = 0;
     foreach (var card in Hand.ListCard)
     {
         card.Sprite.Depth = dep * i++;
     }
     e.Card.Scale = new Vector2(1.5f);
 }
Пример #23
0
 protected override void OnCardAdded(CardEventArgs e)
 {
     base.OnCardAdded(e);
 }
Пример #24
0
        private void Hand_SetPosition(Deck sender, CardEventArgs e)
        {
            int count = sender.Count;
            if (count == 0) return;

            Vector2[] _position = new Vector2[sender.Count];
            if (count <= 6)
            {
                _position[0] = new Vector2(
                        GlobalSetting.Default.CenterField.X - (sender.ListCard.First.Value.Sprite.Bound.Width + GlobalSetting.Default.HandDistance.X) * count / 2,
                        sender.Position.Y - sender.ListCard.First.Value.Sprite.Bound.Height);
                for (int i = 1; i < _position.Length; i++)
                {
                    _position[i] = new Vector2(
                        _position[i - 1].X + sender.ListCard.First.Value.Sprite.Bound.Width + GlobalSetting.Default.HandDistance.X,
                        sender.Position.Y - sender.ListCard.First.Value.Sprite.Bound.Height);
                }
            }
            else
            {
                _position[0] = new Vector2(297, ComputerSetting.Default.Hand.Y - Hand.ListCard.First.Value.Sprite.Bound.Height);
                int dis = 410 / (count - 1);
                for (int i = 1; i < count ; i++)
                {
                    _position[i] = new Vector2(
                        _position[i - 1].X + dis,
                        _position[i - 1].Y);
                }
            }//else
            e.Card.Sprite.WaitFor(this.MainDeck.Backside);
            sender.ListCard.Last.Value.AddMoveTo(new MoveTo(0.5f, _position[0]));
            int j = 1;

            LinkedListNode<Card> node = sender.ListCard.Last.Previous;
            while (node != null)
            {
                node.Value.AddMoveTo(new MoveTo(0.5f,_position[j++]));
                node = node.Previous;
            }
        }
Пример #25
0
 private void MonsterField_CardAdded(Deck sender, CardEventArgs e)
 {
     while(m_cardslot[CurrentSlot] != null)
     {
         CurrentSlot++;
     }
     m_cardslot[CurrentSlot] = e.Card;
     Vector2 position = Vector2.Zero;
     if (PlayerID == ePlayerId.PLAYER)
     {
         position = GlobalSetting.Default.PlayerMonF + new Vector2(5, 90)
             + GlobalSetting.Default.FieldSlot.X * CurrentSlot * Vector2.UnitX;
     }
     else
     {
         position = ComputerSetting.Default.MonsterField + new Vector2(5, 0)
             - ComputerSetting.Default.FieldSlot.X * CurrentSlot * Vector2.UnitX;
     }
     //if (this.PlayerID != ePlayerId.COMPUTER || (e.Card as Monster).BattlePosition != eBattlePosition.DEF)
         (e.Card as Monster).ShowBattlePoint(position);
 }
Пример #26
0
        private void MonsterField_CardAdded_SetPosition(Deck sender, CardEventArgs e)
        {
            //switch (e.Card.STATUS)
            //{
            //    case STATUS.DEF:
            switch ((e.Card as Monster).BattlePosition)
            {
                case eBattlePosition.DEF:
                    e.Card.Sprite.Origin = new Vector2(e.Card.Sprite.Texture.Bounds.Center.X, e.Card.Sprite.Texture.Bounds.Center.Y);

                    var position = new Vector2(
                        sender.Position.X - ((MonsterField)sender).CurrentSlot * ComputerSetting.Default.FieldSlot.X + 15,
                        this.MonsterField.Position.Y + 15);
                    e.Card.AddMoveTo(new MoveTo(0.3f, position +e.Card.Origin));
                    e.Card.AddRotateTo(new RotateTo(0.3f, 90));
                    ((MonsterField)sender).CurrentSlot++;
                    //e.Card.Sprite.Rotation = (float)(Math.PI / 2);
                    //e.Card.Sprite.Position += new Vector2(e.Card.Sprite.Bound.Width / 2, e.Card.Sprite.Bound.Width / 2);

                    break;
                case eBattlePosition.ATK:

                    e.Card.AddMoveTo(new MoveTo(0.3f,new Vector2(
                        sender.Position.X - ((MonsterField)sender).CurrentSlot * ComputerSetting.Default.FieldSlot.X + 13,
                        sender.Position.Y + 15)));
                    ((MonsterField)sender).CurrentSlot++;
                    break;
                default:
                    break;
            } //switch
        }
Пример #27
0
 private void MonsterField_CardRemoved(Deck sender, CardEventArgs e)
 {
     for (int i = 0; i < m_cardslot.Length; i++)
     {
         if (object.ReferenceEquals(m_cardslot[i], e.Card) == true)
         {
             m_cardslot[i] = null;
             return;
         }
     }
     (e.Card as Monster).ClearBattlePoint();
 }
Пример #28
0
 protected override void OnCardAdded(CardEventArgs e)
 {
     base.OnCardAdded(e);
 }
Пример #29
0
 private void UpdateNum(Deck sender, CardEventArgs e)
 {
     this.num_sprite.Show(this.Count, this.Position + new Vector2(20, 76));
 }
Пример #30
0
 private void Deck_CardAddedPlaySound(Deck sender, CardEventArgs e)
 {
     EffectManager.GetInstance().Play(eSoundId.card_move);
 }
Пример #31
0
 private void GraveYard_CardAdded(Deck sender, CardEventArgs e)
 {
     e.Card.Sprite.Depth = 0.8f;
 }