public void ImportColors()
    {
        string filePath         = Path.Combine(Application.streamingAssetsPath, "GelColors.json");
        string gelColorDataRead = File.ReadAllText(filePath);

        gelColorsList = JsonConvert.DeserializeObject <GelColorListData>(gelColorDataRead);

        foreach (GelColorData gelColor in gelColorsList.gelColors)
        {
            gelColorsDictionary.Add(gelColor.gelColor, gelColor);
        }

        gameManager.gelColorsList       = gelColorsList;
        gameManager.gelColorsDictionary = gelColorsDictionary;

        //Debug.Log("Imported " + gelColorsList.gelColors.Count + " Gel Colors from " + filePath);

        //gameManager.CaptureImport();
    }
Exemple #2
0
    public void Setup()
    {
        //Debug.LogWarning("SETUP");

        lightPosX.GetComponent <Image>().color = inputFieldColor;
        lightPosY.GetComponent <Image>().color = inputFieldColor;
        lightPosZ.GetComponent <Image>().color = inputFieldColor;

        gelColorsList = gameManager.gelColorsList;
        gelColorDropdown.options.Clear();
        foreach (GelColorData gelColor in gelColorsList.gelColors)
        {
            gelColorDropdown.options.Add(new Dropdown.OptionData()
            {
                text = gelColor.gelColor + " " + gelColor.gelName
            });
        }
        ;

        // TODO: reflect filters here -- might need a new UI system, considering there can be multiple
        // Add/remove from list?
        //if (lightFixture.captureData.filters)

        lightTranform = lightFixture.lightTransform;  // Controls the pan/tilt

        label.text = string.Format("Selected Light: {0}", lightFixture.captureData.id);


        lightIntensity.value = Globals.AdjustLightReverse(lightFixture.spotlight.intensity);


        lightIntensityInput.text = lightIntensity.value.ToString();

        channelNumber.text = lightFixture.captureData.channel.ToString();

        //lightRange.value = lightFixture.spotlight.range;

        lightColorR.value = lightFixture.captureData.colorR;
        lightColorG.value = lightFixture.captureData.colorG;
        lightColorB.value = lightFixture.captureData.colorB;

        lightColorRInput.text = lightFixture.captureData.colorR.ToString();
        lightColorGInput.text = lightFixture.captureData.colorG.ToString();
        lightColorBInput.text = lightFixture.captureData.colorB.ToString();

        lightPosX.text = lightFixture.transform.position.x.ToString();
        lightPosY.text = lightFixture.transform.position.y.ToString();
        lightPosZ.text = lightFixture.transform.position.z.ToString();

        errorPosition.SetActive(false);

        colorPreview.color = new Color(lightColorR.value / 255.0f, lightColorG.value / 255.0f, lightColorB.value / 255.0f);

        lightPan.value  = lightFixture.captureData.focusPan;
        lightTilt.value = lightFixture.captureData.focusTilt;

        lightPanInput.text  = lightFixture.captureData.focusPan.ToString();
        lightTiltInput.text = lightFixture.captureData.focusTilt.ToString();
        //lightAngle.value = lightFixture.spotlight.spotAngle;

        // TODO: Replace "Cookie" with "Gobo" throughout
        lightGoboDropdown.options.Clear();
        gelColorDropdown.options.Add(new Dropdown.OptionData()
        {
            text = ""
        });
        int cookieIndex = 0;

        foreach (Texture cookie in gameManager.cookies)
        {
            if (lightFixture.captureData.gobos == cookie.name)
            {
                lightFixture.cookieIndex = cookieIndex;
            }
            lightGoboDropdown.options.Add(new Dropdown.OptionData()
            {
                text = cookie.name
            });
            cookieIndex++;
        }
        if (lightFixture.cookieIndex != 0)
        {
            lightGoboDropdown.value = lightFixture.cookieIndex;
            int TempInt = lightGoboDropdown.value;
            lightGoboDropdown.value = lightGoboDropdown.value + 1;
            lightGoboDropdown.value = TempInt;
        }

        lightColorR.onValueChanged.AddListener(delegate { ValueChangeCheck(); });
        lightColorG.onValueChanged.AddListener(delegate { ValueChangeCheck(); });
        lightColorB.onValueChanged.AddListener(delegate { ValueChangeCheck(); });

        lightIntensity.onValueChanged.AddListener(delegate { IntensityChangeCheck(); });
        lightIntensityInput.onEndEdit.AddListener(delegate { IntensityChangeTextCommit(); });

        lightPan.onValueChanged.AddListener(delegate { ValueChangeCheck(); });
        lightTilt.onValueChanged.AddListener(delegate { ValueChangeCheck(); });

        lightColorRInput.onValueChanged.AddListener(delegate { ValueChangeCheckText(); });
        lightColorGInput.onValueChanged.AddListener(delegate { ValueChangeCheckText(); });
        lightColorBInput.onValueChanged.AddListener(delegate { ValueChangeCheckText(); });

        lightPanInput.onValueChanged.AddListener(delegate { ValueChangeCheckText(); });
        lightTiltInput.onValueChanged.AddListener(delegate { ValueChangeCheckText(); });

        lightPosX.onValueChanged.AddListener(delegate { ValueChangeCheckText(); });
        lightPosY.onValueChanged.AddListener(delegate { ValueChangeCheckText(); });
        lightPosZ.onValueChanged.AddListener(delegate { ValueChangeCheckText(); });

        gelColorDropdown.onValueChanged.AddListener(delegate { GelColorDropdownChanged(); });
        lightGoboDropdown.onValueChanged.AddListener(delegate { GoboDropdownChanged(); });

        editChannel.onClick.AddListener(delegate { SelectChannel(lightFixture.captureData.channel); });

        showChannel.onClick.AddListener(delegate { HighlightChannel(lightFixture); });
        deleteLight.onClick.AddListener(delegate { DeleteLight(lightFixture); });

        setupComplete = true;
    }