Exemplo n.º 1
0
        private void LoadMahjongPics()
        {
            var dir = Environment.CurrentDirectory;

            ImageDict.Clear();
            var suitCh    = new string[] { "红桃", "方片", "草花", "黑桃", };
            var rankNames = new string[] { "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A" };
            // 4张牌
            var index = 0;

            for (var i = 0; i < 13; i++)
            {
                for (var suit = 0; suit < 4; suit++)
                {
                    var suitC    = suitCh[suit];
                    var rank     = rankNames[i];
                    var fileName = $"{suitC}{rank}.png";
                    var path     = System.IO.Path.Combine(dir, "images", fileName);

                    var bitmap = new BitmapImage(new Uri(path));
                    ImageDict.Add(index++, bitmap);
                }
            }

            // 大小wang
            {
                var jokersName = new string[] { "小王", "大王" };
                for (var suit = 0; suit < 2; suit++)
                {
                    var joker = jokersName[suit];

                    var fileName = $"{joker}.png";
                    var path     = System.IO.Path.Combine(dir, "images", fileName);

                    var bitmap = new BitmapImage(new Uri(path));
                    ImageDict.Add(index++, bitmap);
                }
            }

            Auc.SetImageSrc(ImageDict, this);
            Buc.SetImageSrc(ImageDict, this);
            Cuc.SetImageSrc(ImageDict, this);
            Duc.SetImageSrc(ImageDict, this);
        }
Exemplo n.º 2
0
        private void LoadMahjongPics()
        {
            var dir = Environment.CurrentDirectory;

            ImageDict.Clear();

            // 条子 MJs7.png
            for (var i = 1; i < 10; i++)
            {
                var fileName = $"MJs{i}.png";
                var path     = System.IO.Path.Combine(dir, "images", fileName);

                var bitmap = new BitmapImage(new Uri(path));
                ImageDict.Add(AgariIndex.SOU1 + i - 1, bitmap);
            }
            // 筒子 MJt1.png
            for (var i = 1; i < 10; i++)
            {
                var fileName = $"MJt{i}.png";
                var path     = System.IO.Path.Combine(dir, "images", fileName);

                var bitmap = new BitmapImage(new Uri(path));
                ImageDict.Add(AgariIndex.PIN1 + i - 1, bitmap);
            }
            // 万子 MJw7.png
            for (var i = 1; i < 10; i++)
            {
                var fileName = $"MJw{i}.png";
                var path     = System.IO.Path.Combine(dir, "images", fileName);

                var bitmap = new BitmapImage(new Uri(path));
                ImageDict.Add(AgariIndex.MAN1 + i - 1, bitmap);
            }

            // 风牌 MJf1.png
            for (var i = 1; i < 5; i++)
            {
                var fileName = $"MJf{i}.png";
                var path     = System.IO.Path.Combine(dir, "images", fileName);

                var bitmap = new BitmapImage(new Uri(path));
                ImageDict.Add(AgariIndex.TON + i - 1, bitmap);
            }

            // 箭牌 中:MJd1.png, 发:MJd2.png,白:MJd3.png
            for (var i = 1; i < 4; i++)
            {
                var fileName = $"MJd{i}.png";
                var path     = System.IO.Path.Combine(dir, "images", fileName);

                var bitmap = new BitmapImage(new Uri(path));
                ImageDict.Add(AgariIndex.HAK + i - 1, bitmap);
            }

            // 花牌 MJh8.png
            for (var i = 1; i < 9; i++)
            {
                var fileName = $"MJh{i}.png";
                var path     = System.IO.Path.Combine(dir, "images", fileName);

                var bitmap = new BitmapImage(new Uri(path));
                ImageDict.Add(AgariIndex.FlowerBegin + i - 1, bitmap);
            }

            Auc.SetImageSrc(ImageDict, this);
            Buc.SetImageSrc(ImageDict, this);
            Cuc.SetImageSrc(ImageDict, this);
            Duc.SetImageSrc(ImageDict, this);
        }