예제 #1
0
        public override void Update(GameTime gameTime)
        {
            guiSystem.Update(gameTime);

            var provider = CultureInfo.CurrentCulture;

            // sync
            textBoxR.Text = Nocubeless.Player.NextColorToLay.Red.ToString(provider);
            textBoxG.Text = Nocubeless.Player.NextColorToLay.Green.ToString(provider);
            textBoxB.Text = Nocubeless.Player.NextColorToLay.Blue.ToString(provider);

            #region Text Boxes
            textBoxR.Update(gameTime);
            textBoxG.Update(gameTime);
            textBoxB.Update(gameTime);

            try // textBox Picker Event
            {
                int r = Convert.ToInt32(textBoxR.Text.ToString(provider), provider),
                    g = Convert.ToInt32(textBoxG.Text.ToString(provider), provider),
                    b = Convert.ToInt32(textBoxB.Text.ToString(provider), provider);

                var newColor = new CubeColor(r, g, b);

                Nocubeless.Player.NextColorToLay = newColor;
            }
            catch (FormatException) { } // conversion error (e.g. is not a number)
            #endregion

            base.Update(gameTime);
        }
예제 #2
0
        private void ReadChunkData(ref CubeChunk chunk, int dataOffset)
        {
            var stream = File.OpenRead(FilePath);

            stream.Seek((int)dataOffset, SeekOrigin.Begin);

            using (var reader = new BinaryReader(stream))
            {
                for (int i = 0; i < CubeChunk.TotalSize; i++)
                {
                    int r = reader.Read(),
                        g = reader.Read(),
                        b = reader.Read();

                    if (Convert.ToChar(r) == 'N')
                    {
                        chunk[i] = null;
                    }
                    else
                    {
                        chunk[i] = new CubeColor(r, g, b);
                    }
                }
            }
        }
예제 #3
0
 public Cube(CubeColor color, CubeCoordinates position)
 {
     Coordinates = position;
     Color       = color;
 }