コード例 #1
0
        private Image GetSocket(Socket socket, string suffix)
        {
            const string socketFormat = "pack://application:,,,/Images/Sockets/{0}.png";
            string color;
            switch (socket.Attribute)
            {
                case "D":
                    color = "green" + suffix;
                    break;
                case "I":
                    color = "blue" + suffix;
                    break;
                case "S":
                    color = "red" + suffix;
                    break;
                default:
                    color = "white" + suffix;
                    break;
            }

            var url = string.Format(socketFormat, color);

            var img = new AlphaHittestedImage
            {
                Stretch = Stretch.None,
                Source = ApplicationState.BitmapCache.GetByLocalUrl(url)
            };

            return img;
        }
コード例 #2
0
        private bool isSocketed(Tuple<int, int> nextAvail, Socket socket, int socketIndex, Gear item)
        {
            if (item.SocketedItems == null || item.SocketedItems.Count == 0)
                return false;

            return item.SocketedItems.Exists(i => i.Socket == socketIndex && (socket.Attribute == i.Color || socket.Attribute == "G" || i.Color == "G"));
        }
コード例 #3
0
 private Gem getSocketItemAt(Tuple<int, int> nextAvail, Socket socket, int socketIndex, Gear item)
 {
     return item.SocketedItems.First(i => i.Socket == socketIndex && (socket.Attribute == i.Color || socket.Attribute == "G" || i.Color == "G"));
 }
コード例 #4
0
        private Image getSocket(Tuple<int, int> current, Socket socket, string suffix)
        {
            string socketFormat = "pack://application:,,,/POEBuildOptimizer;component/Procurement/Images/Sockets/{0}.png";
            string color = null;
            switch (socket.Attribute)
            {
                case "D":
                    color = "green" + suffix;
                    break;
                case "I":
                    color = "blue" + suffix;
                    break;
                case "S":
                    color = "red" + suffix;
                    break;
                default:
                    color = "white" + suffix;
                    break;
            }

            Image img = new Image();

            var bitmap = new BitmapImage(new Uri(string.Format(socketFormat, color), UriKind.Absolute));
            img.Stretch = System.Windows.Media.Stretch.None;
            bitmap.CacheOption = BitmapCacheOption.OnLoad;
            bitmap.Freeze();
            img.Source = bitmap;

            return img;
        }