Example #1
0
    public void SelectChannel(CustomizationColorsMenuChannel channel)
    {
        if (selectedChannel != null)
        {
            if (colorApplied)
            {
                colorApplied = false;
                CustomizationController.instance.SetColor(selectedChannel.part, selectedChannel.number, colorBackup);
            }
            selectedChannel.SetActive(active: false);
        }
        selectedChannel = channel;
        selectedChannel.SetActive(active: true);
        CustomizationController.instance.cameraController.FocusPart(channel.part);
        ShowColorPalette(show: true);
        colorBackup = CustomizationController.instance.GetColor(selectedChannel.part, selectedChannel.number);
        int   num  = -1;
        float num2 = (transparent.color - colorBackup).sqrMagnitude();

        for (int i = 0; i < colorButtons.Count; i++)
        {
            float num3 = (colorButtons[i].color - colorBackup).sqrMagnitude();
            if (num3 < num2)
            {
                num2 = num3;
                num  = i;
            }
        }
        transparent.SetActive(-1 == num);
        for (int j = 0; j < colorButtons.Count; j++)
        {
            colorButtons[j].SetActive(j == num);
        }
        if (num >= 0)
        {
            EventSystem.current.SetSelectedGameObject(colorButtons[num].gameObject);
        }
        else
        {
            EventSystem.current.SetSelectedGameObject(transparent.gameObject);
        }
    }
Example #2
0
 public void MaskButtonToggle(CustomizationColorsMenuChannel channel)
 {
     channel.SetActive(!channel.GetActive());
     paint.SetMask(channel.part, channel.number, channel.GetActive());
 }