Esempio n. 1
0
 public void UpdateValues(WingProperty prop)
 {
     value = prop.Value;
     defaultValue = prop.defaultValue;
     decPlaces = prop.decPlaces;
     min = prop.min;
     max = prop.max;
     tooltip = prop.tooltip;
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="prefab"></param>
        public PropertySlider(WingProperty propRef, Color foreColour, Action<float> onChange)
        {
            propertyInstance = UnityEngine.Object.Instantiate(StaticWingGlobals.UI_PropertyPrefab);

            inputSlider = propertyInstance.GetChild("InputSlider").GetComponent<Slider>();
            inputSlider.fillRect.GetComponent<Image>().color = foreColour;

            propertyLabel = inputSlider.gameObject.GetChild("PropertyLabel").GetComponent<Text>();
            propertyLabel.text = propRef.name;
            input = inputSlider.gameObject.GetChild("UserInput").GetComponent<InputField>();

            Refresh(propRef);

            input.onValueChange.AddListener(TextValueChanged);
            inputSlider.onValueChanged.AddListener(SliderValueChanged);
            onValueChanged += onChange;
        }
        public void Refresh(WingProperty p)
        {
            if (p == null)
                return;

            propertyRef = p;
            AsInt = p.decPlaces == 0; // 0 dec places => integer values only
            Min = p.min;
            Max = p.max;
            Value = p.Value;
            SetText(Value);
        }
Esempio n. 4
0
        public void SetLastModifiedProperty(WingProperty wp)
        {
            if (wp.ID == "scale")
                return;

            lastModifiedPropertyTooltip.text = wp.tooltip;
            lastModifiedProperty.text = wp.name;
        }
Esempio n. 5
0
 public void UpdateProperty(WingProperty wp)
 {
     if (lastEditedPropertyRef.propertyRef.ID != wp.ID)
     {
         PropertySlider slider;
         if (propertiesDict.TryGetValue(wp.ID, out slider))
         {
             lastEditedPropertyRef = slider;
             SetLastModifiedProperty(wp);
         }
     }
     lastEditedPropertyRef.Refresh(wp);
 }
Esempio n. 6
0
 public WingProperty(WingProperty prop)
 {
     ID = prop.ID;
     name = prop.name;
     UpdateValues(prop);
 }
 public PropertySlider_GeometryScaled(WingProperty propRef, Color foreColour, Action<float> onChange) : base(propRef, foreColour, onChange)
 {
 }
 public void SetLastModifiedProperty(WingProperty wp)
 {
     lastModifiedPropertyTooltip.text = wp.tooltip;
     lastModifiedProperty.text = wp.name;
 }