using System; using UnityEngine; public class WindowPartsPointLight : MonoBehaviour { public void Awake() { if (this.execAwake) { return; } this.execAwake = true; this.partsTransForm.onChangeAxisVisibleType.Add(new Action(this.OnChangeAxisVisibleType)); this.intensityInput.onChangeValue.Add(delegate(WindowPartsInputSliderSet.SliderAndInputSet input_object, float val) { if (this.light == null) { return; } this.light.intensity = val; this.intensity = val; }); this.rangeInput.onChangeValue.Add(delegate(WindowPartsInputSliderSet.SliderAndInputSet input_object, float val) { if (this.light == null) { return; } this.light.range = val; this.range = val; }); this.colorInput.onChangeValue.Add(delegate(WindowPartsInputColorrPalette input_object, Color color) { if (this.light == null) { return; } this.light.color = color; this.color = color; this.updateButtonFunction(); }); } public void Init(Light light, PhotoTransTargetObject targetObject, Action updateButtonFunction) { this.Awake(); this.light = light; this.targetObject = targetObject; this.updateButtonFunction = updateButtonFunction; this.partsTransForm.SetObject(targetObject.obj, new Vector3(0f, 1f, 0f), Vector3.zero, Vector3.one); this.partsTransForm.SetEnabledAxisButton(true, false); this.intensity = light.intensity; this.range = light.range; this.color = light.color; this.UpdateGui(); } public void UpdateGui() { this.OnChangeAxisVisibleType(); PhotoSliderAndInput sliderAndInput = this.intensityInput.GetSliderAndInput("str"); PhotoSliderAndInput sliderAndInput2 = this.rangeInput.GetSliderAndInput("str"); sliderAndInput.value = this.intensity; sliderAndInput2.value = this.range; this.colorInput.value = this.color; } protected void OnChangeAxisVisibleType() { if (this.targetObject == null) { return; } WindowPartsTransform.AxisVisibleType axis_visible_type = this.partsTransForm.axis_visible_type; PhotoTransTargetObject photoTransTargetObject = this.targetObject; if (axis_visible_type == WindowPartsTransform.AxisVisibleType.UnVisible || photoTransTargetObject == null || photoTransTargetObject.obj == null) { if (photoTransTargetObject.axis_obj != null) { photoTransTargetObject.axis_obj.Visible = false; } if (photoTransTargetObject.rotate_obj != null) { photoTransTargetObject.rotate_obj.Visible = false; } } else if (axis_visible_type == WindowPartsTransform.AxisVisibleType.Position) { if (photoTransTargetObject.axis_obj != null) { photoTransTargetObject.axis_obj.Visible = true; } if (photoTransTargetObject.rotate_obj != null) { photoTransTargetObject.rotate_obj.Visible = false; } } else if (axis_visible_type == WindowPartsTransform.AxisVisibleType.Rotate) { if (photoTransTargetObject.axis_obj != null) { photoTransTargetObject.axis_obj.Visible = false; } if (photoTransTargetObject.rotate_obj != null) { photoTransTargetObject.rotate_obj.Visible = true; } } } [SerializeField] private WindowPartsTransform partsTransForm; [SerializeField] private WindowPartsInputSliderSet intensityInput; [SerializeField] private WindowPartsInputSliderSet rangeInput; [SerializeField] private WindowPartsInputColorrPalette colorInput; private Light light; private PhotoTransTargetObject targetObject; private Action updateButtonFunction; private float intensity; private float range; private Color color; private bool execAwake; }