Ejemplo n.º 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;
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
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)));
 }
Ejemplo n.º 4
0
 public Duelist(ePlayerId _id)
 {
     DuelDisk = new Deck[] {
         new MainDeck( _id),
         new Hand( _id),
         new GraveYard(_id),
         new MonsterField(_id),
         new SpellField(_id)
     };
     this.Init();
     transfer = new Transfer();
     this.DuelistID = _id;
     MainDeck.CardRemoved+=new CardRemoveEventHandler(MainDeck_CardRemoved);
     MonsterField.CardAdded += MonsterField_CardAdded;
     GraveYard.CardAdded += GraveYard_CardAdded;
 }
Ejemplo n.º 5
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;
        }
Ejemplo n.º 6
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
        }
Ejemplo n.º 7
0
 private void removeFrom(Deck _deck)
 {
     this.DestDeck = _deck.DestDeck;
     _deck.DestDeck = eDeckId.NONE;
     this.TranferedCard = _deck.OutCard;
     _deck.OutCard = null;
 }
Ejemplo n.º 8
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;
 }
Ejemplo n.º 9
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;
        }
Ejemplo n.º 10
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)));
 }
Ejemplo n.º 11
0
 private void UpdateNum(Deck sender, CardEventArgs e)
 {
     this.num_sprite.Show(this.Count, this.Position + new Vector2(22,76));
 }
Ejemplo n.º 12
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++;
 }
Ejemplo n.º 13
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;
 }
Ejemplo n.º 14
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;
 }
Ejemplo n.º 15
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
        }
Ejemplo n.º 16
0
 private void GraveYard_CardRemove(Deck sender, CardEventArgs e)
 {
 }
Ejemplo n.º 17
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);
 }
Ejemplo n.º 18
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);
 }
Ejemplo n.º 19
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;
            }
        }
Ejemplo n.º 20
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();
 }
Ejemplo n.º 21
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
        }
Ejemplo n.º 22
0
 private void GraveYard_CardAdded(Deck sender, CardEventArgs e)
 {
     e.Card.Sprite.Depth = 0.8f;
 }
Ejemplo n.º 23
0
 private void removeTo(Deck _deck)
 {
     _deck.AddTop(this.TranferedCard.Value);
     this.TranferedCard = null;
     this.DestDeck = eDeckId.NONE;
 }
Ejemplo n.º 24
0
 private void MainDeck_CardRemoved(Deck sender, CardEventArgs e)
 {
     if ((sender as MainDeck).Count == 0)
         this.IsLose = true;
 }
Ejemplo n.º 25
0
 private void Deck_CardAddedPlaySound(Deck sender, CardEventArgs e)
 {
     EffectManager.GetInstance().Play(eSoundId.card_move);
 }
Ejemplo n.º 26
0
 private void MonsterField_CardAdded(Deck sender, CardEventArgs e)
 {
     e.Card.Sprite.Depth = 0.5f;
 }