예제 #1
0
 protected Shape(ShapeColor shapecolor, bool canBeRotated)
 {
     ShapeColor        = shapecolor;
     CanBeRotated      = canBeRotated;
     GameGridXPosition = 3;
     GameGridYPosition = 0;
 }
예제 #2
0
    public static Color ToColor(ShapeColor sc)
    {
        switch (sc)
        {
        case ShapeColor.BLUE:
            return(Color.blue);

        case ShapeColor.GREEN:
            return(Color.green);

        case ShapeColor.GREY:
            return(Color.gray);

        case ShapeColor.PURPLE:
            return(new Color(1.0f, 0.0f, 1.0f, 1.0f));

        case ShapeColor.RED:
            return(Color.red);

        case ShapeColor.ORANGE:
            return(new Color(1.0f, 0.5f, 0.0f, 1.0f));

        default:
            return(Color.white);
        }
    }
예제 #3
0
 public Block(int xPosition, int yPosition, ShapeColor color, bool isFilled = true)
 {
     XPosition = xPosition;
     YPosition = yPosition;
     Color     = color;
     IsFilled  = isFilled;
 }
예제 #4
0
파일: Shape.cs 프로젝트: westerlunn/Tetris
 protected Shape(int xPosition, int yPosition, ShapeColor color)
 {
     //Type = type; ShapeType type,
     //Rotation = rotation;
     XPosition = xPosition;
     YPosition = yPosition;
     Color     = color;
 }
예제 #5
0
 public Card(CardShape _shape, ShapeCount _shapeCount, ShapeColor _shapeColor, ShapeFill _shapeFill)
 {
     Shape      = _shape;
     ShapeCount = _shapeCount;
     ShapeColor = _shapeColor;
     ShapeFill  = _shapeFill;
     IsClicked  = false;
 }
예제 #6
0
파일: GameState.cs 프로젝트: Zihn/Shapes
        public ShapeData(Shape shape)
        {
//			Debug.Log ("Storing data of " + shape.GetType());
            shapeType = shape.GetType().ToString();
            sizeDelta = new ShapeVector(shape.GetComponent <RectTransform>().sizeDelta);
            name      = shape.name;
            rotation  = shape.transform.eulerAngles.z;
            position  = new ShapeVector(shape.transform.position);
            color     = new ShapeColor(shape.color);
        }
예제 #7
0
    private ShapeColor _CombineColors(ShapeColor color1, ShapeColor color2)
    {
        ShapeColor product = color1;

        if (color1 == ShapeColor.RED)
        {
            switch (color2)
            {
            case ShapeColor.BLUE:
                product = ShapeColor.PURPLE;
                break;

            case ShapeColor.YELLOW:
                product = ShapeColor.ORANGE;
                break;

            default:
                break;
            }
        }
        else if (color1 == ShapeColor.YELLOW)
        {
            switch (color2)
            {
            case ShapeColor.BLUE:
                product = ShapeColor.GREEN;
                break;

            case ShapeColor.RED:
                product = ShapeColor.ORANGE;
                break;

            default:
                break;
            }
        }
        else if (color1 == ShapeColor.BLUE)
        {
            switch (color2)
            {
            case ShapeColor.YELLOW:
                product = ShapeColor.GREEN;
                break;

            case ShapeColor.RED:
                product = ShapeColor.PURPLE;
                break;

            default:
                break;
            }
        }

        return(product);
    }
예제 #8
0
        public override System.Windows.Forms.MenuItem[] ShapeMenu()
        {
            List <MenuItem> list = new List <MenuItem>();

            MenuItem menu1 = new MenuItem(ShapeColor.ToArgb() == Color.Red.ToArgb() ? "退出运行" : "投入运行");
            menu1.Click   += new EventHandler(KBSShape_Click);
            list.Add(menu1);
            list.Add(new MenuItem("-"));
            list.AddRange(base.ShapeMenu());
            return(list.ToArray());
        }
예제 #9
0
 public ShapeViewDrawable(ShapeColor shapeColor, ShapeType shapeType, Rectangle creationRectangle)
     : base(shapeColor,shapeType)
 {
     Rectangle = creationRectangle;
     switch (ShapeColor)
     {
         case ShapeColor.Blue:
             Texture = Globals.Content.Load<Texture2D>("triangle");
             _shapeDrawColor = Color.Blue;
             break;
         case ShapeColor.Green:
             Texture = Globals.Content.Load<Texture2D>("rectangle");
             _shapeDrawColor = Color.Green;
             break;
         case ShapeColor.Orange:
             Texture = Globals.Content.Load<Texture2D>("pentagon");
             _shapeDrawColor = Color.Orange;
             break;
         case ShapeColor.Red:
             Texture = Globals.Content.Load<Texture2D>("hexagon");
             _shapeDrawColor = Color.Red;
             break;
         case ShapeColor.Violet:
             Texture = Globals.Content.Load<Texture2D>("heptagon");
             _shapeDrawColor = Color.Violet;
             break;
         case ShapeColor.White:
             Texture = Globals.Content.Load<Texture2D>("rotatedRectangle");
             _shapeDrawColor = Color.White;
             break;
         case ShapeColor.Yellow:
             Texture = Globals.Content.Load<Texture2D>("circle");
             _shapeDrawColor = Color.Yellow;
             break;
         default:
             //load an invisible texture
             Texture = Globals.Content.Load<Texture2D>("pixel");
             _shapeDrawColor = Color.Transparent;
             break;
     }
     if (ShapeType == ShapeType.Blast)
         _overlayTexture = Globals.Content.Load<Texture2D>("bomb-icon");
     if (ShapeType == ShapeType.Cross)
         _overlayTexture = Globals.Content.Load<Texture2D>("cross");
     if(ShapeType == ShapeType.Star)
     {
         Texture = Globals.Content.Load<Texture2D>("star");
         _shapeDrawColor = Color.Black;
     }
 }
예제 #10
0
        public static NSColor GetColor(ShapeColor color)
        {
            switch (color)
            {
            case ShapeColor.Red:     //red
                return(Settings.Colors.RedShapeColor);


            case ShapeColor.Blue:     //Blue
                return(Settings.Colors.BlueShapeColor);

            default:
                //case CardColor.Purple: //Purple
                return(Settings.Colors.PurpleShapeColor);
            }
        }
예제 #11
0
        private Color GetColor(ShapeColor color)
        {
            switch (color)
            {
            case ShapeColor.Red:
                return(Color.Red);

            case ShapeColor.Blue:
                return(Color.Blue);

            case ShapeColor.Green:
                return(Color.Green);

            default:
                throw new ArgumentException(string.Format("Unknown ShapeColor: {0}.", color), "color");
            }
        }
예제 #12
0
    public void Initialize(Vector3 initialPosition, ShapeColor color, bool canBeMoved)
    {
        m_canBeMoved = canBeMoved;

        if (m_canBeMoved)
        {
            m_color = color;
        }
        else
        {
            m_color = ShapeColor.GREY;
        }

        if (this.gameObject != null)
        {
            gameObject.transform.position = initialPosition;
        }
    }
예제 #13
0
    void OnTriggerEnter(Collider col)
    {
        // Default behavior
        Shape shape = col.transform.parent.GetComponent <Shape>();

        if (shape == null)
        {
            return;
        }

        if (!shape.CanBeMoved)
        {
            shape.CurrentColor = m_color;
            shape.CanBeMoved   = true;
        }

        ShapeColor oldColor = m_color;

        MixColor(shape.CurrentColor);
        shape.MixColor(oldColor);

        _OnTriggerEnter(col);
    }
예제 #14
0
 public ShapeView(ShapeColor color,ShapeType type)
 {
     ShapeModel = new ShapeModel(color, type);
     RecentlyCreated = true;
 }
예제 #15
0
 public ShapeViewDrawable(ShapeColor shapeColor,ShapeType shapeType)
     : this(shapeColor,shapeType,new Rectangle(0,-50,50,50))
 {
 }
예제 #16
0
        public void Render()
        {
            if (!isRunning)
            {
                return;
            }

            Device device = this.Host.Device;

            if (device == null)
            {
                return;
            }

            device.InputAssembler.InputLayout       = this.ParticleLayout;
            device.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.PrimitiveTopology.TriangleStrip;

            ParticlePass.Apply();

            device.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(this.Particles, 32, 0));
            ParticleProjection.Set(new Vector2(Host.Width, Host.Height));
            ParticleCamera.Set(new Vector2(0, -PlayerShip.Instance.Position.Y));
            device.Draw(ParticleManager.particleList.Count, 0);

            device.InputAssembler.InputLayout       = this.ShapeLayout;
            device.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.PrimitiveTopology.TriangleStrip;

            ShapeCamera.Set(new Vector2(0, -PlayerShip.Instance.Position.Y));
            ShapeProjection.Set(new Vector2(Host.Width, Host.Height));

            foreach (Entity entity in EntityManager.Entities)
            {
                device.InputAssembler.SetVertexBuffers(0, entity.Shape.Buffer);

                ShapeColor.Set(entity.Color);
                ShapePosition.Set(new Vector3(entity.Position, entity.Orientation));

                ShapePass.Apply();
                device.Draw(entity.Shape.Vertices.Length * 2 + 2, 0);
            }

            if (Math.Abs(Profiles.Current.State.LinesPosition - PlayerShip.Instance.Position.Y) < Height)
            {
                device.InputAssembler.InputLayout       = this.LineLayout;
                device.InputAssembler.PrimitiveTopology = SharpDX.Direct3D.PrimitiveTopology.PointList;

                device.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(LineBuffer, 8, 0));

                LineEffect.GetVariableByName("Step").AsScalar().Set(0.1f);
                LineEffect.GetVariableByName("Width").AsScalar().Set(2.0f / Width);
                LineEffect.GetVariableByName("Height").AsScalar().Set(1.0f - Math.Abs(Profiles.Current.State.LinesPosition - PlayerShip.Instance.Position.Y) / Height);
                LineEffect.GetVariableByName("Color").AsVector().Set(Color.Yellow);

                Vector4[] disturb = new Vector4[16];
                float     maxX = 0.05f, maxY = 0.02f;

                for (int i = 0; i < linesCount; i++)
                {
                    for (int k = 0; k < 16; k++)
                    {
                        disturb[k] = new Vector4(Rand.NextFloat(-maxX, maxX), Rand.NextFloat(-maxY, maxY), Rand.NextFloat(-maxX, maxX), Rand.NextFloat(-maxY, maxY));
                    }
                    LineEffect.GetVariableByName("Disturb").AsVector().Set(disturb);
                    LineEffect.GetTechniqueByIndex(0).GetPassByIndex(0).Apply();

                    device.Draw(1, i);
                }
            }
        }
예제 #17
0
        // no default constructor

        public Line(int x1, int y1, int x2, int y2, ShapeColor c)
            : base(c)
        {
            this.v1 = new Vertex(x1, y1);
            this.v2 = new Vertex(x2, y2);
        }
예제 #18
0
        // no default constructor

        public Circle(int x1, int y1, int radius, ShapeColor c) : base(c)
        {
            this.origin = new Vertex(x1, y1);
            Radius      = radius;
        }
예제 #19
0
 protected RotatableShape(int xPosition, int yPosition, ShapeColor color, ShapeRotation rotation = ShapeRotation.Zero) : base(xPosition, yPosition, color)
 {
     Rotation = rotation;
 }
예제 #20
0
 public Line(int x1, int y1, int x2, int y2, ShapeColor colorIn) : base(colorIn)
 {
     v1 = new Vertex(x1, y1);
     v2 = new Vertex(x2, y2);
 }
예제 #21
0
 override public String ToString()
 {
     return("Card(" + Shape.ToString() + ", " + ShapeCount.ToString() + ", " + ShapeColor.ToString() + ", " + ShapeFill.ToString() + ")");
 }
예제 #22
0
 public void MixColor(ShapeColor s)
 {
     m_color = _CombineColors(m_color, s);
 }
예제 #23
0
 public ShapeModel(ShapeColor shapeColor,ShapeType shapeType)
 {
     ShapeColor = shapeColor;
     ShapeType = shapeType;
 }
예제 #24
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainWindowViewModel(IOpenDDSharpService dds, IViewService view, IConfigurationService config)
        {
            _dds = dds;
            _dds.SquareUpdated   += DdsSquareUpdated;
            _dds.CircleUpdated   += DdsCircleUpdated;
            _dds.TriangleUpdated += DdsTriangleUpdated;

            _view   = view;
            _config = config;

            _publishedSquares    = new ObservableCollection <SquareType>();
            _publishedCircles    = new ObservableCollection <CircleType>();
            _publishedTriangles  = new ObservableCollection <TriangleType>();
            _subscribedSquares   = new ObservableCollection <SquareType>();
            _subscribedCircles   = new ObservableCollection <CircleType>();
            _subscribedTriangles = new ObservableCollection <TriangleType>();

            Shapes = new CompositeCollection
            {
                new CollectionContainer()
                {
                    Collection = _publishedSquares
                },
                new CollectionContainer()
                {
                    Collection = _publishedCircles
                },
                new CollectionContainer()
                {
                    Collection = _publishedTriangles
                },
                new CollectionContainer()
                {
                    Collection = _subscribedSquares
                },
                new CollectionContainer()
                {
                    Collection = _subscribedCircles
                },
                new CollectionContainer()
                {
                    Collection = _subscribedTriangles
                }
            };

            PublishShapeCommand   = new RelayCommand(PublishShape, () => true);
            WriterQosCommand      = new RelayCommand(WriterQos, () => true);
            ReaderQosCommand      = new RelayCommand(ReaderQos, () => true);
            ReaderFilterCommand   = new RelayCommand(ReaderFilter, () => true);
            SubscribeShapeCommand = new RelayCommand(SubscribeShape, () => true);

            _rect   = new Rect(0, 0, 321, 361);
            _random = new Random();
            _selectedSubscriberShape = ShapeKind.Circle;
            _selectedPublisherShape  = ShapeKind.Circle;
            _selectedColor           = ShapeColor.Green;
            _selectedSize            = 45;
            _selectedSpeed           = 45;

            BindingOperations.EnableCollectionSynchronization(_publishedSquares, _lockPublishedSquares);
            BindingOperations.EnableCollectionSynchronization(_publishedCircles, _lockPublishedCircles);
            BindingOperations.EnableCollectionSynchronization(_publishedTriangles, _lockPublishedTriangles);
            BindingOperations.EnableCollectionSynchronization(_subscribedSquares, _lockSubscribedSquares);
            BindingOperations.EnableCollectionSynchronization(_subscribedCircles, _lockSubscribedCircles);
            BindingOperations.EnableCollectionSynchronization(_subscribedTriangles, _lockSubscribedTriangles);

            Messenger.Default.Register <FilterConfigMessage>(this, OnFilterConfigMessage);
        }
 public Shape()
 {
     Color = new ShapeColor();
 }
예제 #26
0
 // constructor
 public Shape(ShapeColor color)
 {
     Color = color;
 }
 public Shape(Shape shape)
 {
     Color       = new ShapeColor();
     Color.Color = System.Drawing.Color.FromArgb(shape.Color.Color.A, shape.Color.Color.R, shape.Color.Color.G, shape.Color.Color.B);
 }
예제 #28
0
 public Shape(ShapeColor c)
 {
     color = c;
 }
예제 #29
0
 public void SetColor(ShapeColor color)
 {
     Color = color;
 }