Exemplo n.º 1
0
        public static void Init()
        {
            AlienwareFXManager.LightFX = (ILightFXController) new LightFXController();
            if (AlienwareFXManager.LightFX.LFX_Initialize() != LFX_Result.LFX_Success)
            {
                return;
            }
            int numDevices = (int)AlienwareFXManager.LightFX.LFX_GetNumDevices(out AlienwareFXManager.numDevices);

            for (uint devIndex = 0; devIndex < AlienwareFXManager.numDevices; ++devIndex)
            {
                uint numLights1;
                int  numLights2 = (int)AlienwareFXManager.LightFX.LFX_GetNumLights(devIndex, out numLights1);
                AlienwareFXManager.deviceLightCounts.Add(numLights1);
                List <string> stringList = new List <string>();
                StringBuilder lightDesc  = new StringBuilder((int)byte.MaxValue);
                for (uint lightIndex = 0; lightIndex < numLights1; ++lightIndex)
                {
                    int lightDescription = (int)AlienwareFXManager.LightFX.LFX_GetLightDescription(devIndex, lightIndex, lightDesc, (int)byte.MaxValue);
                    stringList.Add(lightDesc.ToString());
                }
                AlienwareFXManager.deviceLightDescriptions.Add(stringList);
            }
            AlienwareFXManager.TimeStarted = DateTime.Now;
            AlienwareFXManager.IsRunning   = true;
        }
Exemplo n.º 2
0
    private void Startup()
    {
        fxControl = new LightFXController();

        devices = new List<FXDevice>();
        zones = new List<FXZone>();

        var result = fxControl.LFX_Initialize();
        if (result == LFX_Result.LFX_Success)
        {
            Debug.Log("AlienFX: Initialized.");

            isInit = true;

            const byte MAX_BUFFER = 255;
            uint numDevices;

            fxControl.LFX_GetNumDevices(out numDevices);
            for (uint devIndex = 0; devIndex < numDevices; ++devIndex)
            {
                // get the device type.
                var desc = new StringBuilder(MAX_BUFFER);
                LFX_DeviceType devType;

                fxControl.LFX_GetDeviceDescription(devIndex, desc, MAX_BUFFER, out devType);

                FXDevice dev = new FXDevice(devIndex, desc.ToString(), devType);

                devices.Add(dev);
                
                // get the zones for this device.
                uint numLights;
                fxControl.LFX_GetNumLights(devIndex, out numLights);

                for (uint lightIndex = 0; lightIndex < numLights; ++lightIndex)
                {
                    LFX_Position position;

                    desc = new StringBuilder(MAX_BUFFER);

                    fxControl.LFX_GetLightDescription(devIndex, lightIndex, desc, MAX_BUFFER);
                    fxControl.LFX_GetLightLocation(devIndex, lightIndex, out position);

                    FXLightController light = new FXLightController(lightIndex, desc.ToString(), position);

                    //Debug.Log("Adding: " + light.name);

                    dev.lights.Add(light);
                }
            }

            StartCoroutine("Run");
        }
        else
        {
            Debug.LogError("AlienFX: Failed Init.");
        }
    }