Esempio n. 1
0
        public static Image GetBevelImage(StandardColouredBlock.BlockStyle DisplayStyle, Color DisplayColor)
        {
            String baseimage = "block_lightbevel_red";

            if (DisplayStyle == StandardColouredBlock.BlockStyle.Style_CloudBevel)
            {
                baseimage = "block_lightbevel_red";
            }
            else if (DisplayStyle == StandardColouredBlock.BlockStyle.Style_Shine)
            {
                baseimage = "block_shine_red";
            }
            else if (DisplayStyle == StandardColouredBlock.BlockStyle.Style_HardBevel)
            {
                baseimage = "block_std_red";
            }
            else if (DisplayStyle == StandardColouredBlock.BlockStyle.Style_Chisel)
            {
                baseimage = "block_chisel_red";
            }
            else if (DisplayStyle == StandardColouredBlock.BlockStyle.Style_Pixeled)
            {
                baseimage = "block_pixeled_red";
            }

            Size TargetSize = new Size(100, 100);

            if (StandardColourBlocks == null)
            {
                StandardColourBlocks = new Dictionary <StandardColouredBlock.BlockStyle, Dictionary <Color, Image> >();
            }

            if (!StandardColourBlocks.ContainsKey(DisplayStyle))
            {
                StandardColourBlocks.Add(DisplayStyle, new Dictionary <Color, Image>());
            }

            if (StandardColourBlocks[DisplayStyle].Count == 0)
            {
                foreach (Color c in new Color[] { Color.Cyan, Color.Yellow, Color.Purple, Color.Green, Color.Blue, Color.Red, Color.Orange })
                {
                    StandardColourBlocks[DisplayStyle].Add(c, ResizeImage(GDIPlusHelpers.RecolorImage(TetrisGame.Imageman[baseimage], c), TargetSize));
                }
            }

            if (!StandardColourBlocks[DisplayStyle].ContainsKey(DisplayColor))
            {
                StandardColourBlocks[DisplayStyle].Add(DisplayColor, ResizeImage(GDIPlusHelpers.RecolorImage(TetrisGame.Imageman[baseimage], DisplayColor), TargetSize));
            }


            return(StandardColourBlocks[DisplayStyle][DisplayColor]);
        }
Esempio n. 2
0
        private Image GetBevelImage(StandardColouredBlock Source)
        {
            String baseimage = "block_lightbevel_red";

            if (Source.DisplayStyle == StandardColouredBlock.BlockStyle.Style_CloudBevel)
            {
                baseimage = "block_lightbevel_red";
            }
            else if (Source.DisplayStyle == StandardColouredBlock.BlockStyle.Style_Shine)
            {
                baseimage = "block_shine_red";
            }
            else if (Source.DisplayStyle == StandardColouredBlock.BlockStyle.Style_HardBevel)
            {
                baseimage = "block_std_red";
            }
            else if (Source.DisplayStyle == StandardColouredBlock.BlockStyle.Style_Chisel)
            {
                baseimage = "block_chisel_red";
            }
            else if (Source.DisplayStyle == StandardColouredBlock.BlockStyle.Style_Pixeled)
            {
                baseimage = "block_pixeled_red";
            }
            else if (Source.DisplayStyle == StandardColouredBlock.BlockStyle.Style_Pixeled_Outline)
            {
                baseimage = "block_pixeled_red_outline";
            }

            else if (Source.DisplayStyle == StandardColouredBlock.BlockStyle.Style_Mottled)
            {
                baseimage = "block_mottled";
            }
            Size   TargetSize = new Size(100, 100);
            String sBlockKey  = baseimage;

            if (StandardColourBlocks == null)
            {
                StandardColourBlocks = new Dictionary <String, Dictionary <Color, Image> >();
            }

            if (!StandardColourBlocks.ContainsKey(sBlockKey))
            {
                StandardColourBlocks.Add(sBlockKey, new Dictionary <Color, Image>());
            }

            if (StandardColourBlocks[sBlockKey].Count == 0)
            {
                foreach (Color c in new Color[] { Color.Cyan, Color.Yellow, Color.Purple, Color.Green, Color.Blue, Color.Red, Color.Orange })
                {
                    StandardColourBlocks[sBlockKey].Add(c, ResizeImage(GDIPlusHelpers.RecolorImage(TetrisGame.Imageman[baseimage], c), TargetSize));
                }
            }

            if (!StandardColourBlocks[sBlockKey].ContainsKey(Source.BlockColor))
            {
                StandardColourBlocks[sBlockKey].Add(Source.BlockColor, ResizeImage(GDIPlusHelpers.RecolorImage(TetrisGame.Imageman[baseimage], Source.BlockColor), TargetSize));
            }


            return(StandardColourBlocks[sBlockKey][Source.BlockColor]);
        }