コード例 #1
0
ファイル: Player.cs プロジェクト: Baratock/SynCLK
        public bool onMouseClick(MouseClickEventArgs e)
        {
            EntityManager.findCriteria d = delegate(Entity en)
            {
                if (en is Board)
                {
                    int x = MetaData.InputManager.MouseX;
                    int y = MetaData.InputManager.MouseY;

                    return (en as Board).detectMouseAt(new Vector2(x, y));
                }
                return false;
            };

            Entity[] entity = EntityManager.FindEntities(d);

            if (entity.Length > 0)
            {
                Board b = (entity[0] as Board);
                if (b != null)
                {
                    Vector2 coord = b.GetGridAt(e.X, e.Y);
                    BoardComponent c = b.GridOccipiedWithAt(coord);

                    if (c == null && e.Button == EMouseButton.Left)
                        b.AddComponent(new DummyComponent(), coord);
                    else if(e.Button == EMouseButton.Right)
                    {
                        b.RemoveComponent(c);
                        EntityManager.Manager.RemoveEntity(c);
                    }
                }
            }
            return true;
        }
コード例 #2
0
ファイル: EntityManager.cs プロジェクト: Baratock/SynCLK
 public void onMouseClick(MouseClickEventArgs e)
 {
     foreach (Entity en in entities)
     {
         if (en is IMouseEvents)
         {
             if ((en as IMouseEvents).detectMouseAt(new Vector2(e.X, e.Y)))
                 if ((en as IMouseEvents).onMouseClick(e))
                     return;
         }
     }
 }
コード例 #3
0
ファイル: BoardComponent.cs プロジェクト: Baratock/SynCLK
 public bool onMouseClick(MouseClickEventArgs e)
 {
     return false; ;
 }
コード例 #4
0
ファイル: Dummy.cs プロジェクト: Baratock/SynCLK
 public bool onMouseClick(MouseClickEventArgs e)
 {
     toggleMouse();
     return false;
 }
コード例 #5
0
ファイル: GameApp.cs プロジェクト: Baratock/SynCLK
 public void onMouseClick(object sender, MouseClickEventArgs e)
 {
     EntityManager.Manager.onMouseClick(e);
     player.onMouseClick(e);
 }