Exemplo n.º 1
0
        public static bool LoadOverlayImage(this DeviceInfo deviceInfo, DeviceHandle handle)
        {
            if (deviceInfo.Meta.overlayImage != null)
            {
                return(true);
            }

            if (string.IsNullOrEmpty(deviceInfo.Meta.overlay))
            {
                return(false);
            }

            var overlayBytes = File.ReadAllBytes(Path.Combine(handle.Directory, deviceInfo.Meta.overlay));
            var texture      = new Texture2D(2, 2, TextureFormat.Alpha8, false)
            {
                alphaIsTransparency = true
            };

            if (!texture.LoadImage(overlayBytes, false))
            {
                return(false);
            }

            deviceInfo.Meta.overlayImage = texture;
            return(true);
        }
Exemplo n.º 2
0
        public DeviceInfo GetDevice(DeviceHandle handle)
        {
            var deviceInfo = m_Devices[handle.Id];

            if (!deviceInfo.LoadOverlayImage(handle) && deviceInfo.Meta.overlayOffset == Vector4.zero)
            {
                deviceInfo.Meta.overlayOffset = new Vector4(40, 60, 40, 60);
            }

            return(deviceInfo);
        }