Esempio n. 1
0
        private static EffectResponseId CreateEffectCustom2D(ChromaApi api, ChromaDevice2DEnum device, EffectArray2dInput input)
        {
            if (null == api)
            {
                Debug.LogError("CreateEffectCustom2D: Parameter api is null!");
                return(null);
            }
            if (null == input)
            {
                Debug.LogError("CreateEffectCustom2D: Parameter input is null!");
                return(null);
            }
            int maxRow    = GetMaxRow(device);
            int maxColumn = GetMaxColumn(device);

            if (maxRow != input.Count ||
                (input.Count > 0 &&
                 maxColumn != input[0].Count))
            {
                Debug.LogError(string.Format("CreateEffectCustom2D Array size mismatch row: %d==%d column: %d==%d!",
                                             maxRow,
                                             input.Count,
                                             maxColumn,
                                             input.Count > 0 ? input[0].Count : 0));
            }

            try
            {
                switch (device)
                {
                case ChromaDevice2DEnum.Keyboard:
                    return(api.PostKeyboardCustom(input));

                case ChromaDevice2DEnum.Keypad:
                    return(api.PostKeypadCustom(input));

                case ChromaDevice2DEnum.Mouse:
                    return(api.PostMouseCustom(input));
                }
            }
            catch (Exception)
            {
            }
            return(null);
        }