コード例 #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
ファイル: Deck.cs プロジェクト: luuthevinh/yugioh-new-gen
 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
ファイル: Deck.cs プロジェクト: luuthevinh/yugioh-new-gen
 private void Deck_CardAddedPlaySound(Deck sender, CardEventArgs e)
 {
     EffectManager.GetInstance().Play(eSoundId.card_move);
 }
コード例 #8
0
ファイル: Duelist.cs プロジェクト: luuthevinh/yugioh-new-gen
 private void MonsterField_CardAdded(Deck sender, CardEventArgs e)
 {
     e.Card.Sprite.Depth = 0.5f;
 }
コード例 #9
0
ファイル: Duelist.cs プロジェクト: luuthevinh/yugioh-new-gen
 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
ファイル: Deck.cs プロジェクト: luuthevinh/yugioh-new-gen
 protected virtual void OnCardRemoved(CardEventArgs e)
 {
     isListCardChanged = true;
     if (CardRemoved != null)
         CardRemoved(this, e);
 }
コード例 #12
0
ファイル: Computer.cs プロジェクト: luuthevinh/yugioh-new-gen
 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
ファイル: Computer.cs プロジェクト: luuthevinh/yugioh-new-gen
        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
ファイル: Computer.cs プロジェクト: luuthevinh/yugioh-new-gen
 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
ファイル: Computer.cs プロジェクト: luuthevinh/yugioh-new-gen
 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
ファイル: Computer.cs プロジェクト: luuthevinh/yugioh-new-gen
        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
ファイル: Computer.cs プロジェクト: luuthevinh/yugioh-new-gen
 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
ファイル: Hand.cs プロジェクト: luuthevinh/yugioh-new-gen
 protected override void OnCardAdded(CardEventArgs e)
 {
     base.OnCardAdded(e);
 }
コード例 #24
0
ファイル: Computer.cs プロジェクト: luuthevinh/yugioh-new-gen
        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
ファイル: Computer.cs プロジェクト: luuthevinh/yugioh-new-gen
        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
ファイル: MainDeck.cs プロジェクト: luuthevinh/yugioh-new-gen
 private void UpdateNum(Deck sender, CardEventArgs e)
 {
     this.num_sprite.Show(this.Count, this.Position + new Vector2(20, 76));
 }
コード例 #30
0
ファイル: Deck.cs プロジェクト: luuthevinh/yugioh-new-gen
 private void Deck_CardAddedPlaySound(Deck sender, CardEventArgs e)
 {
     EffectManager.GetInstance().Play(eSoundId.card_move);
 }
コード例 #31
0
ファイル: Duelist.cs プロジェクト: luuthevinh/yugioh-new-gen
 private void GraveYard_CardAdded(Deck sender, CardEventArgs e)
 {
     e.Card.Sprite.Depth = 0.8f;
 }