Esempio n. 1
0
        private void SelectSaveButton(int id)
        {
            for (int i = 0; i < PartySavesGrid.Children.Count; i++)
            {
                Button button = PartySavesGrid.Children[i] as Button;
                Border border = button.Content as Border;

                border.BorderThickness = new Thickness(0);
            }

            Button saveButton = PartySavesGrid.Children[id] as Button;
            Border saveBorder = saveButton.Content as Border;

            saveBorder.BorderThickness = new Thickness(2);

            switch (id)
            {
            default:
                break;

            case 0:
                SaveOneDeactivated();
                SaveZeroActivated();
                break;

            case 1:
                SaveZeroDeactivated();
                SaveOneActivated();
                break;
            }
            PartyOptions.useRGBColor = LightInformation.IsInRGBMode();
        }
        //Temperture Color Picker

        private void SetTemperatureColorPicker()
        {
            int colorTemperature = 250;

            foreach (Light light in BridgeInformation.lights)
            {
                if (BridgeInformation.usedLights.Contains(light.Id))
                {
                    if (LightInformation.IsTemperatureType(light))
                    {
                        colorTemperature = Convert.ToInt32(light.State.ColorTemperature);
                    }
                    else
                    {
                        Color color = ColorAssistant.ConvertRGBColorToColor(light.State.ToRGBColor());
                        int   temp  = ColorAssistant.TryToConvertColorToColorTemperatur(color);

                        if (temp != -1)
                        {
                            colorTemperature = temp;
                        }
                    }
                }
            }

            ((TemperatureColorPicker)ColorPickerFrame.Content).SetColorTemperatureSliderPosition(colorTemperature);
        }
 void ButtonPress(LightInformation device)
 {
     if (inactive)
     {
         return;
     }
     active = false;
     device.selectable.AddInteractionPunch();
     StartCoroutine(PressRoutine(device));
     if (solution[stage] == device.colourInitial)
     {
         stage++;
         Debug.LogFormat("[Simons Squawks #{0}] You pressed {1}. That is correct.", moduleId, device.lightColour);
     }
     else
     {
         Debug.LogFormat("[Simons Squawks #{0}] Strike! You pressed {1}. That is not correct.", moduleId, device.lightColour);
         GetComponent <KMNeedyModule>().HandleStrike();
         stage = 2;
     }
     if (stage == 2)
     {
         stage    = 0;
         inactive = true;
         OnNeedyDeactivation();
         StartCoroutine(IdleFlash());
     }
 }
Esempio n. 4
0
        static void ReadMOLT(BinaryReader br, WMORoot wmo)
        {
            wmo.LightInfo = new LightInformation[wmo.Header.LightCount];

            for (int i = 0; i < wmo.LightInfo.Length; i++)
            {
                var light = new LightInformation
                {
                    Byte_1     = br.ReadByte(),
                    Byte_2     = br.ReadByte(),
                    Byte_3     = br.ReadByte(),
                    Byte_4     = br.ReadByte(),
                    Color      = br.ReadColor4(),
                    Position   = br.ReadVector3(),
                    Intensity  = br.ReadSingle(),
                    AttenStart = br.ReadSingle(),
                    AttenEnd   = br.ReadSingle(),
                    Float_4    = br.ReadSingle(),
                    Float_5    = br.ReadSingle(),
                    Float_6    = br.ReadSingle(),
                    Float_7    = br.ReadSingle()
                };

                //FixVector3(ref light.position);

                wmo.LightInfo[i] = light;
            }
        }
Esempio n. 5
0
 void Awake()
 {
     moduleId = moduleIdCounter++;
     foreach (LightInformation button in lightDevices)
     {
         LightInformation pressedButton = button;
         button.connectedButton.OnInteract += delegate() { ButtonPress(pressedButton); return(false); };
     }
 }
 void Awake()
 {
     moduleId       = moduleIdCounter++;
     ignoredModules = BossModule.GetIgnoredModules(Module, defaultIgnoredModules);
     foreach (LightInformation button in lightDevices)
     {
         LightInformation pressedButton = button;
         button.connectedButton.OnInteract += delegate() { ButtonPress(pressedButton); return(false); };
     }
 }
Esempio n. 7
0
    IEnumerator PressFlash(LightInformation device)
    {
        device.greyBase.enabled = false;
        device.ledGlow.enabled  = true;
        yield return(new WaitForSeconds(0.4f));

        device.greyBase.enabled = true;
        device.ledGlow.enabled  = false;
        moduleLocked            = false;
    }
Esempio n. 8
0
        public void LightSelectionChanged()
        {
            PartyOptions.useRGBColor = LightInformation.IsInRGBMode();
            partyOptionsFrameContent.LightSelectionChanged();

            if (!LightInformation.CheckIfTurnedOn())
            {
                BasicLightController.TurnOn();
            }
        }
        //RGB Color Picker

        private void SetRGBColorPicker()
        {
            Color color = Color.FromArgb(255, 255, 255, 255);

            if (!LightInformation.IsTemperatureType(BridgeInformation.mainLightTarget))
            {
                color = ColorAssistant.ConvertRGBColorToColor(BridgeInformation.mainLightTarget.State.ToRGBColor());
            }

            ((RGBColorPicker)ColorPickerFrame.Content).SetRGBColorPickerColor(color);
        }
Esempio n. 10
0
 private void StopColorButton_Click(object sender, RoutedEventArgs e)
 {
     if (LightInformation.IsInRGBMode())
     {
         popupClass.OpenColorRGBPickerPopup <ColorGradientTwo>(StopColor.Color, this, 1);
     }
     else
     {
         popupClass.OpenTemperatureColorPickerPopup <ColorGradientTwo>(Convert.ToInt32(StopColorButton.Content), this, 1);
     }
 }
Esempio n. 11
0
        public LightInformation GetAllClientsLight()
        {
            var result = new LightInformation
            {
                Groups           = new List <string>(),
                OperatingSystems = new List <string>(),
                Clients          = new List <LightClientInformation>()
            };

            var   clients = _tcpServerInfo.DatabaseManager.GetAllClients().ToList();
            short id      = 0;

            foreach (var group in clients.GroupBy(x => x.Group))
            {
                result.Groups.Add(group.Key);
                foreach (var client in group)
                {
                    var lightClient = new LightClientInformation
                    {
                        GroupId        = id,
                        Id             = client.Id,
                        UserName       = client.UserName,
                        OsType         = client.OsType,
                        Language       = client.Language,
                        LocatedCountry = client.LocatedCountry
                    };

                    if (result.OperatingSystems.Contains(client.OsName))
                    {
                        lightClient.OsNameId = (short)result.OperatingSystems.IndexOf(client.OsName);
                    }
                    else
                    {
                        lightClient.OsNameId = (short)result.OperatingSystems.Count;
                        result.OperatingSystems.Add(client.OsName);
                    }

                    if (_tcpServerInfo.Clients.ContainsKey(client.Id))
                    {
                        var onlineClient = _tcpServerInfo.Clients[client.Id].GetOnlineClientInformation();
                        lightClient.ApiVersion       = onlineClient.ApiVersion;
                        lightClient.IsServiceRunning = onlineClient.IsServiceRunning;
                        lightClient.IsAdministrator  = onlineClient.IsAdministrator;
                        lightClient.IsOnline         = true;
                    }

                    result.Clients.Add(lightClient);
                }

                id++;
            }

            return(result);
        }
Esempio n. 12
0
    public void ChangeLightState(int _position)
    {
        LightInformation lightInformation = lights[_position].GetComponent <LightInformation>();

        if (lightInformation.State)
        {
            lightInformation.setLight(false, turnOffMaterial);
        }
        else
        {
            lightInformation.setLight(true, turnOnMaterial);
        }
    }
 void Awake()
 {
     moduleId    = moduleIdCounter++;
     needyModule = GetComponent <KMNeedyModule>();
     needyModule.OnNeedyActivation   += OnNeedyActivation;
     needyModule.OnNeedyDeactivation += OnNeedyDeactivation;
     needyModule.OnTimerExpired      += OnTimerExpired;
     foreach (LightInformation button in buttons)
     {
         LightInformation pressedButton = button;
         button.selectable.OnInteract += delegate() { ButtonPress(pressedButton); return(false); };
     }
 }
    IEnumerator PressRoutine(LightInformation device)
    {
        yield return(new WaitForSeconds(0.1f));

        Audio.PlaySoundAtTransform(device.connectedSound.name, transform);
        device.lightObject.enabled = true;
        ColourizeText();
        yield return(new WaitForSeconds(0.3f));

        device.lightObject.enabled = false;
        for (int i = 0; i < buttons.Count(); i++)
        {
            squawkLetters[i].color = squawkColours[8];
        }
    }
Esempio n. 15
0
        public ClientProvider(LightInformation clientInfo, DtpFactory dtpFactory)
        {
            _clientData = clientInfo.Clients.Select(x =>
            {
                x.Group  = clientInfo.Groups[x.GroupId];
                x.OsName = clientInfo.OperatingSystems[x.OsNameId];
                return(x);
            }).ToDictionary(x => new ClientViewModel(x), y => (BaseClientInformation)y);

            Clients = new ObservableCollection <ClientViewModel>(_clientData.Select(x => x.Key));

            _clientsUpdating = new List <int>();
            _dtpFactory      = dtpFactory;
            Groups           = new ObservableCollection <string>(Clients.GroupBy(x => x.Group).Select(x => x.Key));
        }
Esempio n. 16
0
        public async Task UpdateLightButtons()
        {
            await Task.Delay(10);

            await BasicLightController.GetAllLights();

            foreach (Button lightButton in LightGrid.Children)
            {
                Light light = BridgeInformation.lights[Convert.ToInt32(lightButton.Tag) - 1];
                lightButton.Background = new LinearGradientBrush(GenerateGradientStopCollection(LightInformation.GetLightColor(light)), 0);

                Grid        buttonGrid  = (Grid)((Border)lightButton.Content).Child;
                ProgressBar progressBar = buttonGrid.Children[1] as ProgressBar;
                progressBar.Value = LightInformation.GetBrightnessInPercent(light);
            }
        }
        private bool CheckRGBColorPickerVisibility()
        {
            bool show = true;

            foreach (Light light in BridgeInformation.lights)
            {
                if (BridgeInformation.usedLights.Contains(light.Id))
                {
                    if (LightInformation.IsTemperatureType(light))
                    {
                        show = false;
                    }
                }
            }

            return(show);
        }
Esempio n. 18
0
        public void UpdateInputs()
        {
            if (LightInformation.IsInRGBMode() && rgbMode != true)
            {
                SetColor(rgbStartColor, 0);
                SetColor(rgbStopColor, 1);

                rgbMode = true;
                onColorClass.ColorGradientTwoChanged(StartColor.Color, StopColor.Color);
            }
            if (!LightInformation.IsInRGBMode() && rgbMode != false)
            {
                SetColorTemperature(startColorTemperature, 0);
                SetColorTemperature(stopColorTemperature, 1);

                rgbMode = false;
                onColorClass.ColorTemperatureGradientTwoChanged(Convert.ToInt32(StartColorButton.Content), Convert.ToInt32(StopColorButton.Content));
            }
        }
    public void ButtonPress(LightInformation device)
    {
        if (moduleSolved || moduleLocked || !gameOn || checking)
        {
            return;
        }
        else if (!readyToSolve)
        {
            device.connectedButton.AddInteractionPunch();
            GetComponent <KMBombModule>().HandleStrike();
            Debug.LogFormat("[Simon's Stages #{0}] Strike! The module is not yet ready to be solved.", moduleId);
            return;
        }
        moduleLocked = true;
        if (secondAttemptLock)
        {
            secondAttemptLock = false;
        }

        Audio.PlaySoundAtTransform(device.connectedSound.name, transform);
        StartCoroutine(PressFlash(device));

        if (device.colorName == solutionNames[totalPresses])
        {
            lightsSolved[totalPresses] = true;
            clearLights.Add(totalPresses);
            Debug.LogFormat("[Simon's Stages #{0}] You pressed {1}. That is correct.", moduleId, device.colorName);
        }
        else
        {
            clearLights.Clear();
            Debug.LogFormat("[Simon's Stages #{0}] You pressed {1}. That is incorrect.", moduleId, device.colorName);
        }
        stagePresses++;
        totalPresses++;
        if (stagePresses == solveLengths[increaser])
        {
            device.connectedButton.AddInteractionPunch();
            stagePresses = 0;
            for (int i = solutionStartLocation[increaser]; i <= solutionStartLocation[increaser] + solveLengths[increaser] - 1; i++)
            {
                if (!lightsSolved[i])
                {
                    stagesSolved[increaser] = false;
                    break;
                }
                else
                {
                    stagesSolved[increaser] = true;
                }
            }
            if (stagesSolved[increaser])
            {
                result = "passed";
                for (int i = 0; i < clearLights.Count; i++)
                {
                    completeLights.Add(clearLights[i]);
                }
            }
            else
            {
                ReCompileLists();
            }
            clearLights.Clear();
            Debug.LogFormat("[Simon's Stages #{0}] END OF STAGE {1}. You {2} this stage.", moduleId, absoluteLevelPosition[increaser] + 1, result);
            increaser++;
            if (totalPresses < solutionNames.Count)
            {
                Debug.LogFormat("[Simon's Stages #{0}] STAGE {1} RESPONSE:", moduleId, absoluteLevelPosition[increaser] + 1, result);
            }
        }
        else
        {
            device.connectedButton.AddInteractionPunch(0.25f);
        }

        if (totalPresses >= solutionNames.Count)
        {
            moduleLocked = true;
            checking     = true;
            CheckEndGame();
        }
    }
Esempio n. 20
0
    public void ButtonPress(LightInformation device)
    {
        if (moduleSolved || moduleLocked || !gameOn || checking)
        {
            return;
        }
        canPlaySound = true;
        moduleLocked = true;
        if (totalPresses == 0)
        {
            Debug.LogFormat("[Simon Stages #{0}] SEQUENCE {1} RESPONSE:", moduleId, absoluteLevelPosition[0] + 1, result);
        }
        Audio.PlaySoundAtTransform(device.connectedSound.name, transform);
        StartCoroutine(PressFlash(device));

        if (device.colorName == solutionNames[totalPresses])
        {
            lightsSolved[totalPresses] = true;
            clearLights.Add(totalPresses);
            Debug.LogFormat("[Simon Stages #{0}] You pressed {1}. That is correct.", moduleId, device.colorName);
        }
        else
        {
            clearLights.Clear();
            lightsSolved[totalPresses] = false;
            Debug.LogFormat("[Simon Stages #{0}] You pressed {1}. That is incorrect.", moduleId, device.colorName);
        }
        stagePresses++;
        totalPresses++;
        if (stagePresses == solveLengths[increaser])
        {
            device.connectedButton.AddInteractionPunch();
            stagePresses = 0;
            for (int i = solutionStartLocation[increaser]; i <= solutionStartLocation[increaser] + solveLengths[increaser] - 1; i++)
            {
                if (!lightsSolved[i])
                {
                    stagesSolved[increaser] = false;
                    break;
                }
                else
                {
                    stagesSolved[increaser] = true;
                }
            }
            if (stagesSolved[increaser])
            {
                result = "correct";
                for (int i = 0; i < clearLights.Count; i++)
                {
                    completeLights.Add(clearLights[i]);
                }
            }
            else
            {
                result = "incorrect";
            }
            clearLights.Clear();
            Debug.LogFormat("[Simon Stages #{0}] END OF SEQUENCE {1}. The given sequence of inputs are {2}.", moduleId, absoluteLevelPosition[increaser] + 1, result);
            increaser++;
            if (totalPresses < solutionNames.Count)
            {
                Debug.LogFormat("[Simon Stages #{0}] SEQUENCE {1} RESPONSE:", moduleId, absoluteLevelPosition[increaser] + 1, result);
            }
        }
        else
        {
            device.connectedButton.AddInteractionPunch(0.25f);
        }

        if (totalPresses >= solutionNames.Count)
        {
            moduleLocked = true;
            checking     = true;
            CheckEndGame();
        }
    }
Esempio n. 21
0
        async void CreateLightButtons()
        {
            await BasicLightController.GetAllLights();

            int currentColumn = 0;

            foreach (Light light in BridgeInformation.lights)
            {
                Button newButton = new Button()
                {
                    Name = light.Name + "LightButton",
                    Tag  = light.Id,

                    HorizontalAlignment        = HorizontalAlignment.Stretch,
                    VerticalAlignment          = VerticalAlignment.Stretch,
                    HorizontalContentAlignment = HorizontalAlignment.Stretch,
                    VerticalContentAlignment   = VerticalAlignment.Stretch,

                    Padding = new Thickness(-2),
                    Margin  = new Thickness(0, 0, 30, 0),

                    Background = new LinearGradientBrush(GenerateGradientStopCollection(LightInformation.GetLightColor(light)), 0)
                };
                newButton.Click += LightButtonClick;
                LightGrid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = GridLength.Auto
                });
                Grid.SetColumn(newButton, currentColumn);

                Border border = new Border()
                {
                    BorderThickness = new Thickness(0, 0, 0, 0),
                    BorderBrush     = new SolidColorBrush((Color)this.Resources["SystemAccentColor"])
                };

                Grid buttonGrid = new Grid();
                buttonGrid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
                buttonGrid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(6, GridUnitType.Pixel)
                });

                TextBlock lightNameBlock = new TextBlock()
                {
                    Text       = light.Name,
                    Style      = (Style)Application.Current.Resources["MediumInformation"],
                    Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)),

                    Padding = new Thickness(10, 0, 10, 0),

                    VerticalAlignment = VerticalAlignment.Center,
                    TextAlignment     = TextAlignment.Center
                };
                Grid.SetRowSpan(lightNameBlock, 2);
                Grid.SetRow(lightNameBlock, 0);
                buttonGrid.Children.Add(lightNameBlock);

                ProgressBar progressBar = new ProgressBar()
                {
                    Value   = LightInformation.GetBrightnessInPercent(light),
                    Minimum = 1,
                    Maximum = 100,

                    Foreground = new SolidColorBrush(Color.FromArgb(25, 0, 0, 0)),
                    Background = new SolidColorBrush(Color.FromArgb(22, 0, 0, 0)),

                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    VerticalAlignment   = VerticalAlignment.Stretch
                };
                Grid.SetRow(progressBar, 1);
                buttonGrid.Children.Add(progressBar);

                border.Child      = buttonGrid;
                newButton.Content = border;
                LightGrid.Children.Add(newButton);

                if (BridgeInformation.usedLights.Contains(light.Id.ToString()) && light.Id.ToString() != BridgeInformation.mainLightTarget.ToString())
                {
                    SetLightButtonOutline(newButton, true, otherTargetOutlineThickness);
                }

                if (BridgeInformation.mainLightTarget != null)
                {
                    if (light.Id.ToString() == BridgeInformation.mainLightTarget.Id.ToString())
                    {
                        SetLightButtonOutline(newButton, true, mainTargetOutlineThickness);
                    }
                }

                currentColumn++;
            }

            if (BridgeInformation.usedLights.Count > 0)
            {
                uiParent.LightSelectionChanged();
            }
        }
        //Brightness Slider

        void SetBrightnessSlider()
        {
            int brightness = LightInformation.GetBrightnessInPercent(BridgeInformation.mainLightTarget);

            BrightnessSlider.Value = brightness;
        }