public static void SendKeyEffect(Keyboard.EFFECT_TYPE effectType, Keyboard.CUSTOM_EFFECT_TYPE effect)
        {
            var effectSize = effect.Color.Length * sizeof(uint);
            var result     = new byte[effectSize + 1];

            //Write header byte
            result[0] = (byte)Messages.KeyboardCustomEffectType;
            Buffer.BlockCopy(effect.Color, 0, result, 1, effectSize);

            SendMessage(result);
        }
Пример #2
0
        public static long CreateKeyboardEffect(Keyboard.EFFECT_TYPE Effect, IntPtr pParam, IntPtr pEffectId)
        {
            if (pParam == IntPtr.Zero)
            {
                return(0);
            }

            var customEffectType = ReadUsingMarshalPtr <Keyboard.CUSTOM_EFFECT_TYPE>(pParam);

            SocketClient.SendKeyEffect(Effect, customEffectType);
            return(0);
        }
Пример #3
0
        public static long CreateKeyboardEffect(Keyboard.EFFECT_TYPE Effect, IntPtr pParam, IntPtr pEffectId)
        {
            Util.WriteLog("CreatKeyboardEffect");

            if (pParam == IntPtr.Zero)
            {
                return(0);
            }
            var customEffectType = ReadUsingMarshalPtr <Keyboard.CUSTOM_EFFECT_TYPE>(pParam);

            Gamesense.ReplicateKeyEffect(Effect, customEffectType);

            return(0);
        }
Пример #4
0
        internal static void ReplicateKeyEffect(Keyboard.EFFECT_TYPE effect, Keyboard.CUSTOM_EFFECT_TYPE customEffectType)
        {
            Util.WriteLog($"Replicating KeyEffect: {effect}");
            var colList = RGBA.FromUintArray(customEffectType.Color);

            int key = 4;
            var b   = EventBinding.GetOverwatchBinding("TEST", new List <BaseHandler>());

            foreach (var c in colList)
            {
                var h = PerKeyHandler.GetHandler(c, key);
                b.Handlers.Add(h);
                key++;
            }

            var e = GameEvent.GetGameEvent("TEST");

            Util.WriteLog("Binding TEST event");
            http.PostAsync("bind_game_event", b).ConfigureAwait(true);

            Util.WriteLog("Sending game event");
            http.PostAsync("game_event", e).ConfigureAwait(true);
        }
Пример #5
0
        internal static void ReplicateKeyboardEffect(Keyboard.EFFECT_TYPE effect, Keyboard.CUSTOM_EFFECT_TYPE customEffectType)
        {
            Util.WriteLog("Incoming effect: " + http.Serializer.Serialize(customEffectType));
            var colList = Colors.RGBA.FromUintArray(customEffectType.Color);

            Util.WriteLog("Creating new event");
            var gEvent = new GameEvent
            {
                Game  = GameMetaData.GetRgsRegistration().GameName,
                Event = "COLORPUSH",
                Data  = new GameEventData()
            };

            for (int i = 0; i < KeyboardLayout.HidKeyboardKeys.Count; i++)
            {
                if (keyIdLayout[i] == 0)
                {
                    gEvent.Data.Colors.Add(new List <int> {
                        255, 255, 255
                    });
                    continue;
                }

                var c = colList[i];
                gEvent.Data.Colors.Add(new List <int> {
                    c.Red, c.Green, c.Blue
                });
            }

            gEvent.Data.Hids = keyIdLayout;
            Util.WriteLog("Sending COLORPUSH event:");
            Util.WriteLog(http.Serializer.Serialize(gEvent));
            Util.WriteLog(" ");

            http.PostAsync("game_event", gEvent).ConfigureAwait(true);
        }