Exemplo n.º 1
0
 public static EffectIdentifierResponse RemoveEffect(string effectId)
 {
     if (ChromaConnectionManager.Instance.Connected)
     {
         ChromaApi apiChromaInstance = ChromaConnectionManager.Instance.ApiChromaInstance;
         return(ChromaUtils.RemoveEffect(apiChromaInstance, effectId));
     }
     return(null);
 }
Exemplo n.º 2
0
 public static EffectResponseId CreateEffectCustom2D(ChromaDevice2DEnum device, EffectArray2dInput input)
 {
     if (ChromaConnectionManager.Instance.Connected)
     {
         ChromaApi apiChromaInstance = ChromaConnectionManager.Instance.ApiChromaInstance;
         return(ChromaUtils.CreateEffectCustom2D(apiChromaInstance, device, input));
     }
     return(null);
 }
Exemplo n.º 3
0
        public static EffectArray1dInput CreateColors1D(ChromaDevice1DEnum device)
        {
            int maxLeds = ChromaUtils.GetMaxLeds(device);
            EffectArray1dInput effectArray1dInput = new EffectArray1dInput();

            for (int i = 0; i < maxLeds; i++)
            {
                effectArray1dInput.Add(new int?(0));
            }
            return(effectArray1dInput);
        }
Exemplo n.º 4
0
        public static EffectArray2dInput CreateColors2D(ChromaDevice2DEnum device)
        {
            int maxRow    = ChromaUtils.GetMaxRow(device);
            int maxColumn = ChromaUtils.GetMaxColumn(device);
            EffectArray2dInput effectArray2dInput = new EffectArray2dInput();

            for (int i = 0; i < maxRow; i++)
            {
                List <int> list = new List <int>();
                for (int j = 0; j < maxColumn; j++)
                {
                    list.Add(0);
                }
                effectArray2dInput.Add(list);
            }
            return(effectArray2dInput);
        }
Exemplo n.º 5
0
        private static EffectResponseId CreateEffectCustom2D(ChromaApi api, ChromaDevice2DEnum device, EffectArray2dInput input)
        {
            if (api == null)
            {
                Debug.LogError("CreateEffectCustom2D: Parameter api is null!");
                return(null);
            }
            if (input == null)
            {
                Debug.LogError("CreateEffectCustom2D: Parameter input is null!");
                return(null);
            }
            int maxRow    = ChromaUtils.GetMaxRow(device);
            int maxColumn = ChromaUtils.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!", new object[]
                {
                    maxRow,
                    input.Count,
                    maxColumn,
                    (input.Count <= 0) ? 0 : input[0].Count
                }));
            }
            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);
        }
Exemplo n.º 6
0
        private static EffectResponseId CreateEffectCustom1D(ChromaApi api, ChromaDevice1DEnum device, EffectArray1dInput input)
        {
            if (api == null)
            {
                Debug.LogError("CreateEffectCustom1D: Parameter api is null!");
                return(null);
            }
            if (input == null)
            {
                Debug.LogError("CreateEffectCustom1D: Parameter input is null!");
                return(null);
            }
            int maxLeds = ChromaUtils.GetMaxLeds(device);

            if (maxLeds != input.Count)
            {
                Debug.LogError(string.Format("CreateEffectCustom1D Array size mismatch element: %d==%d!", maxLeds, input.Count));
            }
            try
            {
                switch (device)
                {
                case ChromaDevice1DEnum.ChromaLink:
                    return(api.PostChromaLinkCustom(input));

                case ChromaDevice1DEnum.Headset:
                    return(api.PostHeadsetCustom(input));

                case ChromaDevice1DEnum.Mousepad:
                    return(api.PostMousepadCustom(input));
                }
            }
            catch (Exception)
            {
            }
            return(null);
        }