public EditorFloatSliderField(string label, float value, float min, float max, EventCallback <ChangeEvent <float> > callback) { slider = new Slider(label, min, max, SliderDirection.Horizontal); slider.name = nameof(slider); slider.value = value; labelElement.StylePadding(0, 8, 0, 0); Add(slider); floatField = new FloatField(); floatField.name = nameof(floatField); floatField.StyleWidth(64); floatField.style.paddingLeft = 4; floatField.style.marginRight = 0; floatField.value = value; floatField.RegisterValueChangedCallback(callback); floatField.RegisterValueChangedCallback((callbackChangedSlider) => { slider.value = callbackChangedSlider.newValue; }); slider.Add(floatField); slider.RegisterValueChangedCallback((callbackSlide) => { floatField.value = callbackSlide.newValue; }); }
public void SetUp() { center = Rectangle.FromCenter(0.5f, 0.5f, 0.5f, 0.1f); slider = new Slider(center); slider.Add(new FontText(Font.Default, "", new Rectangle(0.5f, 0.7f, 0.2f, 0.1f))); slider.Start <DisplaySliderValue>(); InitializeMouse(); }
public void InitPanel() { _MusicSoundComponent = Game.Scene.GetComponent <MusicSoundComponent>(); mCloseBtn.Add(Hide); mOutBtn.Add(OutBtnEvent); mRuleBtn.Add(RuleBtnEvent); mMusicSlider.Add(MusiceSliderEvent); mSoundSlider.Add(SoundSliderEvent); }
public override void Bind(Entity entity, Main main, bool creating = false) { Slider slider = entity.GetOrCreate <Slider>("Slider"); JointFactory.Bind(entity, main, slider.CreateJoint, false, creating); Components.Joint joint = entity.GetOrCreate <Components.Joint>("Joint"); slider.Add(new Binding <Direction>(slider.Direction, joint.Direction)); DynamicVoxel voxel = entity.Get <DynamicVoxel>(); voxel.KineticFriction.Value = voxel.StaticFriction.Value = 0; AkGameObjectTracker.Attach(entity, voxel.Transform); SoundKiller.Add(entity, AK.EVENTS.STOP_ALL_OBJECT); if (main.EditorEnabled) { entity.Add(new Binding <Matrix>(entity.GetOrCreate <SliderCommon>("SliderCommon").OriginalTransform, voxel.Transform)); } entity.Add("Forward", slider.Forward); entity.Add("Backward", slider.Backward); entity.Add("OnHitMax", slider.OnHitMax); entity.Add("OnHitMin", slider.OnHitMin); entity.Add("MovementLoop", slider.MovementLoop, new PropertyEntry.EditorData { Options = WwisePicker.Get(main) }); entity.Add("MovementStop", slider.MovementStop, new PropertyEntry.EditorData { Options = WwisePicker.Get(main) }); entity.Add("Direction", joint.Direction); entity.Add("Minimum", slider.Minimum); entity.Add("Maximum", slider.Maximum); entity.Add("Locked", slider.Locked); entity.Add("Speed", slider.Speed); entity.Add("Goal", slider.Goal); entity.Add("Servo", slider.Servo); entity.Add("StartAtMinimum", slider.StartAtMinimum); entity.Add("MaxForce", slider.MaxForce); entity.Add("UVRotation", voxel.UVRotation); entity.Add("UVOffset", voxel.UVOffset); entity.Add("CannotSuspendByDistance", voxel.CannotSuspendByDistance); }
public override void Bind(Entity entity, Main main, bool creating = false) { Slider slider = entity.GetOrCreate <Slider>("Slider"); JointFactory.Bind(entity, main, slider.CreateJoint, false, creating); Components.Joint joint = entity.GetOrCreate <Components.Joint>("Joint"); slider.Add(new Binding <Direction>(slider.Direction, joint.Direction)); DynamicVoxel voxel = entity.Get <DynamicVoxel>(); voxel.KineticFriction.Value = voxel.StaticFriction.Value = 0; if (main.EditorEnabled) { entity.Add(new Binding <Matrix>(entity.GetOrCreate <SliderCommon>("SliderCommon").OriginalTransform, voxel.Transform)); } entity.Add("Forward", slider.Forward); entity.Add("Backward", slider.Backward); entity.Add("OnHitMax", slider.OnHitMax); entity.Add("OnHitMin", slider.OnHitMin); entity.Add("Direction", joint.Direction); entity.Add("Minimum", slider.Minimum); entity.Add("Maximum", slider.Maximum); entity.Add("Locked", slider.Locked); entity.Add("Speed", slider.Speed); entity.Add("Goal", slider.Goal); entity.Add("Servo", slider.Servo); entity.Add("StartAtMinimum", slider.StartAtMinimum); entity.Add("MaxForce", slider.MaxForce); entity.Add("UVRotation", voxel.UVRotation); entity.Add("UVOffset", voxel.UVOffset); entity.Add("CannotSuspendByDistance", voxel.CannotSuspendByDistance); }
/// <summary> /// Create a Control /// </summary> /// <param name="text">case string of the created control</param> /// <param name="position">A position the created control will be located</param> /// <returns>View for the created control</returns> private View CreateControl(string text, Position position) { // A View that contain a control element View view = new View(); // CheckBox sample if (text == mCaseString[0]) { // TextLabel for the checkbox mtextLabelCheckBox = new TextLabel("CheckBox"); mtextLabelCheckBox.Size = new Size(250, 60); mtextLabelCheckBox.HorizontalAlignment = HorizontalAlignment.Center; mtextLabelCheckBox.VerticalAlignment = VerticalAlignment.Center; // Set the position of checkbox. mtextLabelCheckBox.PositionUsesPivotPoint = true; mtextLabelCheckBox.PivotPoint = PivotPoint.Center; mtextLabelCheckBox.ParentOrigin = ParentOrigin.Center; mtextLabelCheckBox.Position = new Position(0, -55, 0); mtextLabelCheckBox.PointSize = mLargePointSize; mtextLabelCheckBox.BackgroundColor = Color.White; mtextLabelCheckBox.FontFamily = "SamsungOneUI_200"; view.Add(mtextLabelCheckBox); // Create three CheckBoxs Position checkBoxStartPosition = new Position(100, 0, 0); CheckBox[] checkBox = new CheckBox[3]; for (int i = 0; i < 3; ++i) { // New CheckBox checkBox[i] = new CheckBox(); // Set the CheckBox position checkBox[i].Position = checkBoxStartPosition + new Position(0, 40, 0) * i; checkBox[i].PositionUsesPivotPoint = true; checkBox[i].PivotPoint = PivotPoint.CenterLeft; checkBox[i].ParentOrigin = ParentOrigin.CenterLeft; if (checkBox[i].IsSelected) { // Make Image Visual for the selected checkbox visual checkBox[i].BackgroundImage = mResourceUrl + "/CheckBox/Selected.png"; } else { // Make Image Visual for the unselected checkbox visual checkBox[i].BackgroundImage = mResourceUrl + "/CheckBox/Unselected.png"; } checkBox[i].Scale = new Vector3(0.8f, 0.8f, 0.8f); // Add a callback function for the StateChanged signal checkBox[i].StateChangedEvent += OnCheckBoxChanged; view.Add(checkBox[i]); } // Make Text Visual // Set the Label of Checkbox checkBox[0].Text = "Shadow"; checkBox[0].PointSize = mMiddlePointSize + 2; checkBox[0].TextColor = Color.White; checkBox[1].Text = "Color"; checkBox[1].PointSize = mMiddlePointSize + 2; checkBox[1].TextColor = Color.White; checkBox[2].Text = "Underline"; checkBox[2].PointSize = mMiddlePointSize + 2; checkBox[2].TextColor = Color.White; } else if (text == mCaseString[1]) { // TextLabel for the RadioButton mtextLabelRadio = new TextLabel("Radio Button"); mtextLabelRadio.Size = new Size(250, 60); mtextLabelRadio.HorizontalAlignment = HorizontalAlignment.Center; mtextLabelRadio.VerticalAlignment = VerticalAlignment.Center; // Set the position of textLabel. mtextLabelRadio.PositionUsesPivotPoint = true; mtextLabelRadio.PivotPoint = PivotPoint.Center; mtextLabelRadio.ParentOrigin = ParentOrigin.Center; mtextLabelRadio.Position = new Position(0, -55, 0); mtextLabelRadio.PointSize = mLargePointSize; mtextLabelRadio.BackgroundColor = Color.White; mtextLabelRadio.FontFamily = "SamsungOneUI_200"; view.Add(mtextLabelRadio); // Create three RadioButton Position checkBoxStartPosition = new Position(100, 0, 0); RadioButton[] radioButton = new RadioButton[3]; for (int i = 0; i < 3; ++i) { // New RadioButton radioButton[i] = new RadioButton(); // Set the RadioButton position radioButton[i].Position = checkBoxStartPosition + new Position(0, 40, 0) * i; radioButton[i].PositionUsesPivotPoint = true; radioButton[i].PivotPoint = PivotPoint.CenterLeft; radioButton[i].ParentOrigin = ParentOrigin.CenterLeft; if (radioButton[i].IsSelected) { // Make Image Visual for the selected RadioButton visual radioButton[i].BackgroundImage = mResourceUrl + "/RadioButton/Selected.png"; } else { // Make Image Visual for the unselected RadioButton visual radioButton[i].BackgroundImage = mResourceUrl + "/RadioButton/Unselected.png"; } radioButton[i].Scale = new Vector3(0.5f, 0.5f, 0.5f); // Add a callback function for the StateChanged signal radioButton[i].StateChangedEvent += OnRadioButtonChanged; view.Add(radioButton[i]); } // Make Text Visual // Set the Label of RadioButton radioButton[0].Text = "Red"; radioButton[0].PointSize = mMiddlePointSize * 2.0f; radioButton[0].Color = Color.White; radioButton[1].Text = "Green"; radioButton[1].PointSize = mMiddlePointSize * 2.0f; radioButton[1].Color = Color.White; radioButton[2].Text = "Blue"; radioButton[2].PointSize = mMiddlePointSize * 2.0f; radioButton[2].Color = Color.White; } else if (text == mCaseString[2]) { // TextLabel for Slider TextLabel mtextLabelSlider = new TextLabel("Slider"); mtextLabelSlider.Size = new Size(250, 60); mtextLabelSlider.HorizontalAlignment = HorizontalAlignment.Center; mtextLabelSlider.VerticalAlignment = VerticalAlignment.Center; // Set the position of textLabel. mtextLabelSlider.PositionUsesPivotPoint = true; mtextLabelSlider.PivotPoint = PivotPoint.Center; mtextLabelSlider.ParentOrigin = ParentOrigin.Center; mtextLabelSlider.Position = new Position(0, -55, 0); mtextLabelSlider.PointSize = mLargePointSize; mtextLabelSlider.BackgroundColor = Color.White; mtextLabelSlider.FontFamily = "SamsungOneUI_200"; view.Add(mtextLabelSlider); // A new Slider mSlider = new Slider(); // Set the Slider position mSlider.PositionUsesPivotPoint = true; mSlider.PivotPoint = PivotPoint.Center; mSlider.ParentOrigin = ParentOrigin.Center; mSlider.Size = new Size(300, 25); // Set the Lower Bound and Upper Bound values of the Slider mSlider.MinValue = 0.0f; mSlider.MaxValue = 100.0f; // Set the start value mSlider.CurrentValue = 50; // Create progress visual map. ImageView progressImage = new ImageView() { Size = new Size(10, 4), BackgroundImage = mResourceUrl + "/Slider/img_slider_progress.png" }; mSlider.Add(progressImage); // Create track visual map. ImageView trackImage = new ImageView() { Size = new Size(10, 4), BackgroundImage = mResourceUrl + "/Slider/img_slider_track.png" }; mSlider.Add(trackImage); view.Add(mSlider); } else if (text == mCaseString[3]) { // TextLabel for ProgressBar TextLabel mtextLabelProgressBar = new TextLabel("Progress Bar"); mtextLabelProgressBar.Size = new Size(250, 60); mtextLabelProgressBar.HorizontalAlignment = HorizontalAlignment.Center; mtextLabelProgressBar.VerticalAlignment = VerticalAlignment.Center; // Set the position of textLabel. mtextLabelProgressBar.PositionUsesPivotPoint = true; mtextLabelProgressBar.PivotPoint = PivotPoint.Center; mtextLabelProgressBar.ParentOrigin = ParentOrigin.Center; mtextLabelProgressBar.Position = new Position(0, -55, 0); mtextLabelProgressBar.PointSize = mLargePointSize; mtextLabelProgressBar.BackgroundColor = Color.White; mtextLabelProgressBar.FontFamily = "SamsungOneUI_200"; view.Add(mtextLabelProgressBar); // A new ProgressBar mProgress = new Progress(); // Set the Slider position mProgress.PositionUsesPivotPoint = true; mProgress.PivotPoint = PivotPoint.Center; mProgress.ParentOrigin = ParentOrigin.Center; mProgress.Size = new Size(300, 4); // Create ProgressVisual ImageView progressImage = new ImageView() { BackgroundImage = mResourceUrl + "/ProgressBar/img_viewer_progress_0_129_198_100.9.png" }; mProgress.Add(progressImage); // Create TrackVisual ImageView trackImage = new ImageView() { BackgroundImage = mResourceUrl + "/ProgressBar/img_viewer_progress_255_255_255_100.9.png" }; mProgress.Add(trackImage); mProgress.MinValue = 0.0f; mProgress.MaxValue = 100.0f; mProgress.ProgressState = Tizen.NUI.Components.Progress.ProgressStatusType.Indeterminate; mProgress.TooltipText = "progressBar"; view.Add(mProgress); // Create TextLabel that notices current progress TextLabel progressText = new TextLabel(); // Set TextLabel position progressText.PositionUsesPivotPoint = true; progressText.HorizontalAlignment = HorizontalAlignment.Center; progressText.VerticalAlignment = VerticalAlignment.Center; progressText.ParentOrigin = ParentOrigin.Center; progressText.PivotPoint = PivotPoint.Center; progressText.FontFamily = "Samsung One 400"; progressText.Position = new Position(150, 20); progressText.PointSize = mMiddlePointSize; // Set the default Text progressText.Text = (mProgress.CurrentValue * 100).ToString() + "%"; // Set the text color progressText.TextColor = Color.White; view.Add(progressText); // Create Timer to show the intermediate progress state Timer timer = new Timer(50); // Timer Callback function timer.Tick += (obj, e) => { if (mProgress != null) { // Compute current progress float progress = (float)Math.Round(mProgress.CurrentValue, 2); // If the progress is complete // Reset the progressValue to 0.0f if (progress == 1.0f) { mProgress.CurrentValue = 0.0f; progressText.Text = (mProgress.CurrentValue * 100).ToString() + "%"; return(true); } // For the every step, add progressValue uniformly else { mProgress.CurrentValue = progress + 0.01f; progressText.Text = (mProgress.CurrentValue * 100).ToString() + "%"; return(true); } } else { return(true); } }; timer.Start(); } // Set the common properties view.Size = mWindowSize; view.PositionUsesPivotPoint = true; view.PivotPoint = PivotPoint.CenterLeft; view.ParentOrigin = ParentOrigin.CenterLeft; view.Position = position; return(view); }