Example #1
0
        public void PointerUpdate(BaseEventData e)
        {
            Vector2 v = FlexibleColorPicker.GetNormalizedPointerPosition(_parentRectTransform, e);

            Time = v.x;
            UpdateMarker(v);
            _onKeyUpdatedCallback.Invoke();
        }
Example #2
0
File: Face.cs Project: ruttuk/kubik
    void Start()
    {
        KubeQueue   = KubeQueue.Instance;
        ModeManager = ModeManager.Instance;

        colorPicker = FindObjectOfType <FlexibleColorPicker>();
        pointerKube = PointerKube.Instance;

        m_Renderer = GetComponent <MeshRenderer>();
    }
 private void OnEnable()
 {
     if (picker == null)
     {
         picker = GetComponent <FlexibleColorPicker>();
     }
     settingsController.PrepareCustomColor();
     Assert.IsFalse(pickerColor.Value == ColorType.None);
     Assert.IsFalse(picker == null, "No FlexibleColor Picker assigned to " + this.name);
     variableName.text = ColorTypeVar.GetColorTypeName(pickerColor.Value);
     picker.color      = currentColorScheme.GetColor(pickerColor.Value);
 }
Example #4
0
 // Start is called before the first frame update
 void Start()
 {
     if (fcp != null)
     {
         fcp.SetActive(false);
         fcp_image = fcp.GetComponent <FlexibleColorPicker> ();
     }
     if (m_ProgressBar != null)
     {
         m_ProgressBar.SetActive(false);
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     myTMP       = gameObject.GetComponentInChildren <TMPro.TextMeshProUGUI>();
     fcp         = FindObjectOfType <FlexibleColorPicker>();
     myTMP.text  = myVal.ToString();
     myTMP.color = PlayerPrefsValueToColor(myVal);
     myButton    = gameObject.GetComponent <Button>();
     legend      = gameObject.GetComponentInParent <ColorEditLegend>();
     myButton.onClick.AddListener(() => {
         legend.SetActiveNumber(this);
         SetFCPColor();
     });
 }
Example #6
0
 public void CreateColorKey(BaseEventData e)
 {
     if (_colorsKeys.Count < 8)
     {
         Vector2 v          = FlexibleColorPicker.GetNormalizedPointerPosition(_colorKeysParent, e);
         Vector2 parentSize = _colorKeysParent.rect.size;
         Vector2 localPos   = Vector2.zero;
         localPos.x = (v.x - _colorKeysParent.pivot.x) * parentSize.x + (parentSize.x / 2);
         GradientKey gradientKey = InstantiateGradientKey(localPos, _colorKeysParent, false, v.x);
         _colorsKeys.Add(gradientKey);
         UpdateGradient();
     }
 }
Example #7
0
    // Awake is called before Start
    void Awake()
    {
        // create a new plane in front of the main camera
        planeObj = new Plane(Camera.main.transform.forward * -1, this.transform.position);

        trailRenderer = drawPrefab.GetComponent <TrailRenderer>();
        fcp           = colourPickerPanel.GetComponent <FlexibleColorPicker>();

        // set starting width and colour
        trailRenderer.startWidth = brushStartWidth;
        trailRenderer.startColor = fcp.startingColor;
        trailRenderer.endColor   = fcp.startingColor;
        currentBrushColour       = fcp.startingColor;

        colourPickerPanel.SetActive(false);
    }
Example #8
0
    // Start is called before the first frame update
    void Start()
    {
        editPanel              = GameObject.Find("PlayPanel");
        xField                 = GameObject.Find("x-input").GetComponent <InputField>();
        yField                 = GameObject.Find("y-input").GetComponent <InputField>();
        massField              = GameObject.Find("mass-input").GetComponent <InputField>();
        xF                     = GameObject.Find("x-inputText");
        yF                     = GameObject.Find("y-inputText");
        mF                     = GameObject.Find("mass-inputText");
        xVelField              = GameObject.Find("xvel-input").GetComponent <InputField>();
        yVelField              = GameObject.Find("yvel-input").GetComponent <InputField>();
        xvF                    = GameObject.Find("xvel-inputText");
        yvF                    = GameObject.Find("yvel-inputText");
        selectedPanel          = GameObject.Find("SelectedPanel");
        DeleteButton           = GameObject.Find("DeleteBodyButton").GetComponent <Button>();
        GravitySlider          = GameObject.Find("GravitySlider").GetComponent <Slider>();
        GravitySliderValueText = GameObject.Find("GravitySliderValueText").GetComponent <Text>();
        TrailSlider            = GameObject.Find("TrailSlider").GetComponent <Slider>();
        TrailSliderValueText   = GameObject.Find("TrailSliderValueText").GetComponent <Text>();
        ResetButton            = GameObject.Find("ResetButton").GetComponent <Button>();
        MassCenterToggle       = GameObject.Find("MassCenterToggle").GetComponent <Toggle>();
        GridToggle             = GameObject.Find("GridToggle").GetComponent <Toggle>();
        versionText            = GameObject.Find("VersionText").GetComponent <Text>();
        colorCanvas            = GameObject.Find("ColorPickerCanvas");
        ColorButton            = GameObject.Find("ColorButton").GetComponent <Image>();
        DarkModeButton         = GameObject.Find("DarkModeButton").GetComponent <Button>();
        LightModeButton        = GameObject.Find("LightModeButton").GetComponent <Button>();
        StarryModeButton       = GameObject.Find("StarryModeButton").GetComponent <Button>();
        HexInput               = GameObject.Find("HexInput").GetComponent <InputField>();
        ColorPicker            = GameObject.Find("FlexibleColorPicker").GetComponent <FlexibleColorPicker>();
        PresetNameCanvas       = GameObject.Find("PresetNameCanvas");
        NameInput              = GameObject.Find("NameInputField").GetComponent <InputField>();
        grid                   = GameObject.Find("GridObject");

        NewBody();
        NewBody();
        xField.onEndEdit.AddListener(OnXInput);
        yField.onEndEdit.AddListener(OnYInput);
        massField.onEndEdit.AddListener(OnMassInput);
        xVelField.onEndEdit.AddListener(OnXVelInput);
        yVelField.onEndEdit.AddListener(OnYVelInput);
        DeleteButton.onClick.AddListener(OnDelete);
        GridToggle.isOn = true;
    }
Example #9
0
        public void Initialize(string guid, bool isAlpha, float time, FlexibleColorPicker colorPicker, Action <GradientKey> onKeySelectedCallback, Action <GradientKey> onKeyDeletedCallback, Action onKeyUpdatedCallback)
        {
            _parentRectTransform     = transform.parent.GetComponent <RectTransform>();
            _rectTransform           = GetComponent <RectTransform>();
            _rectTransform.sizeDelta = new Vector2(10, 4);
            _colorPicker             = colorPicker;

            Guid    = guid;
            IsAlpha = isAlpha;
            Time    = time;
            _onKeySelectedCallback = onKeySelectedCallback;
            _onKeyDeletedCallback  = onKeyDeletedCallback;
            _onKeyUpdatedCallback  = onKeyUpdatedCallback;
            _icon.vectorImageData  = isAlpha
                ? MaterialUIIconHelper.GetIcon("CommunityMD", "arrow_down_bold").vectorImageData
                : MaterialUIIconHelper.GetIcon("CommunityMD", "arrow_up_bold").vectorImageData;

            _backgroundIcon.vectorImageData = isAlpha
                ? MaterialUIIconHelper.GetIcon("CommunityMD", "arrow_down_bold").vectorImageData
                : MaterialUIIconHelper.GetIcon("CommunityMD", "arrow_up_bold").vectorImageData;
            SetColor();
        }
 private void Start()
 {
     picker = GetComponent <FlexibleColorPicker>();
 }
Example #11
0
 void Start()
 {
     m_ColorPicker       = GetComponent <FlexibleColorPicker>();
     m_ColorPicker.color = defaultKubeColor;
 }
Example #12
0
 private void Start()
 {
     fcp = fcpGo.GetComponent <FlexibleColorPicker>();
     fcpGo.SetActive(false);
 }
Example #13
0
    //Start is called before the first frame update
    public void Start()
    {
        //Loads the guitar body assets into an array
        guitars = new GuitarAssets[]
        {
            new GuitarAssets("Strat", GameObject.Find("BodyStrat"), GameObject.Find("BodyStratKnobs"), GameObject.Find("GuardStrat"), GameObject.Find("HeadStrat")),
            new GuitarAssets("Tele", GameObject.Find("BodyTele"), GameObject.Find("BodyTeleKnobs"), GameObject.Find("GuardTele"), GameObject.Find("HeadTele"))
        };

        //Set the display text for the starting body and headstock
        bodyText.text = guitars[body].Name;
        headText.text = guitars[head].Name;

        //Loads the pickup assets into an array
        pickups = new PickupAssets[]
        {
            new PickupAssets("Single", new GameObject[] { GameObject.Find("PickupSingleNeck"), GameObject.Find("PickupSingleMid"), GameObject.Find("PickupSingleBridge") }),
            new PickupAssets("Humbucker", new GameObject[] { GameObject.Find("PickupHumNeck"), GameObject.Find("PickupHumMid"), GameObject.Find("PickupHumBridge") })
        };
        //Sets the first GuitarAssets objects to be the only ones active
        for (int i = 1; i < guitars.Length; i++)
        {
            guitars[i].Body.SetActive(false);
            guitars[i].Knobs.SetActive(false);
            guitars[i].Guard.SetActive(false);
            guitars[i].Head.SetActive(false);
        }
        //Sets previous body and head buttons to be inactive, since the first
        //body and head are enabled at application start
        prevBodyButton.interactable = false;
        prevHeadButton.interactable = false;

        //Deactivates the humbucker pickups so that the single pickups are the default when the app is first loaded
        //Also sets the display text to "Single" for all pickups initially
        for (int i = 0; i < pickupTypes.Length; i++)
        {
            pickups[1].Positions[i].SetActive(false);
            pickupNames[i].text = pickups[pickupTypes[i]].Name;
            prevPickupButtons[i].interactable = false;
        }

        //Sets the default body color to body material
        Color bodyColor = new Color(1f, 0.9f, 0.56f);

        bodyMat.color = bodyColor;
        colorPicker   = colorPickerObj.GetComponent <FlexibleColorPicker>();
        //Sets default body color to color picker
        colorPicker.color = bodyColor;

        //Hides color picker initially
        colorPickerObj.SetActive(false);

        //Hides the save panel initially
        saveDisplay.SetActive(false);

        //Sets guard color to white at startup
        ChangeGuardColor(0);

        //Sets fretboard material to maple initially
        ChangeFretMat(0);

        //Initially hide save success message
        Color tempColor = saveSuccess.GetComponent <Text>().color;

        tempColor.a = 0;
        saveSuccess.GetComponent <Text>().color = tempColor;

        //Name field will always start empty, so defaults save button to un-interactable at start
        saveButton.interactable = false;
    }