public void Init() { for (int i = 0; i < 6; i++) { var paper = new HorizontalPaper(); AddChild(paper); paper.SetVector(-1, i); paper.Sprite.Position += new Vector2(30 - 3 * i, 0); paper.Tag = 1; IsHas[i] = true; } //for (int i = 0; i < GameConfig.CardCount; i++) //{ // var card = new CardBox(); // AddChild(card); // card.SetPoint(new Vector2(132 + i * 76, 713)); //} }
public override bool TouchesEnded(Microsoft.Xna.Framework.Input.MouseState touch, Point point) { if (!Istouch) return base.TouchesEnded(touch, point); if (MainGameScene.ShardMainGame().InDayOrNightSprite(point)) { return base.TouchesEnded(touch, point); } if (_box != null) { var vector = IntVector.ToGridIntVector(new Vector2(point.X,point.Y)); if (vector.X < 0 || vector.X > GameConfig.WidthX - 1 || vector.Y < 0 || vector.Y > GameConfig.HightY - 1) { _box.MouseCancel(); } else { _box.MouseEnd(); Card.CardShowLayer.SharedCardShow().RemoveChild(_box); for (int i = 0; i < Card.CardShowLayer.SharedCardShow().Boxs.Count; i++) { CardBox cardBox = Card.CardShowLayer.SharedCardShow().Boxs[i]; cardBox.SetPoint(i); } //todo: xx Paper paper = new Paper(); switch (_box.Id) { case 1: paper = new RandomWirePaper(); break; case 2: paper = new IcePaper(); break; case 3: paper = new RocketPaper(); break; case 4: paper = new XWirePaper(); break; case 5: paper = new BombPaper(); break; case 6: paper = new BigIcePaper(); break; case 7: paper = new BigBombPaper(); break; case 8: paper = new HorizontalPaper(); break; } paper.SetVector(vector.X, vector.Y); CardShowLayer.SharedCardShow().AddChild(paper); } } _box = null; return base.TouchesEnded(touch, point); }