public ButtonRollover() { Add( // new Tween // { // Property = "Alpha", // Duration = 0.3f, // Easer = Linear.EaseNone, // StartValue = 0f, // EndValue = 1f // }, new Action(delegate(IAnimation anim) { AudioPlayerMapper.GetDefault().PlaySound("portlet_add"); }), new Tween { Property = "Scale", Interpolator = new Vector2Interpolator(), Duration = 0.4f, Easer = Quint.EaseOut, StartValueReaderFunction = StartValueReaderFunc, EndValue = new Vector2(1.1f, 1.1f) } ); }
/// <summary> /// Initializes the Singleton instance /// </summary> private void Initialize() { var player = AudioPlayerMapper.GetDefault(); if (null != player) { _volume = player.Volume; } _inspectorActive = GuiInspector.Instance.enabled; }
private void Hide() { if (!_isShown) { return; } _hide.Play(_vbox); AudioPlayerMapper.GetDefault().PlaySound("panel_hide"); _isShown = false; }
private void Show() { if (_isShown) { return; } _show.Play(_vbox); AudioPlayerMapper.GetDefault().PlaySound("panel_show"); _options.UpdateValues(); _isShown = true; }
public DialogResizeUp() { Add( new Action(delegate { AudioPlayerMapper.GetDefault().PlaySound("pager_click"); }), new Tween { Property = "Bounds", Interpolator = new RectangleInterpolator(), Duration = 0.4f, Easer = Quad.EaseInOut, EndValueReaderFunction = EndValueReaderFunc, StartValueReaderFunction = StartValueReaderFunc } ); }
public ToolbarShow() { Add( new Action(delegate { AudioPlayerMapper.GetDefault().PlaySound("dialog_open"); }), new Action(delegate(IAnimation anim) { GetParent(anim.Target).AutoLayout = false; }), /*new Tween * { * Property = "X", * Duration = 2f, * Easer = Linear.EaseNone, * StartValue = 0f, * EndValue = 100f * },*/ // BUG!? /*new Tween * { * Property = "Y", * Duration = 2f, * Easer = Linear.EaseNone, * EndValue = 50f * }.SetOptions( * new TweenOption(TweenOptionType.StartValueReaderFunction, (Tween.PropertyReaderFunction)GetStartValue), * new TweenOption(TweenOptionType.EndValueReaderFunction, (Tween.PropertyReaderFunction)GetEndValue) * ),*/ /*Tween.New() * .SetProperty("Y") * .SetOptions( * new TweenOption(TweenOptionType.Duration, 1f), * new TweenOption(TweenOptionType.Easer, (Tween.EasingFunction)Sine.EaseOut), * new TweenOption(TweenOptionType.StartValueReaderFunction, (Tween.PropertyReaderFunction)GetStartValue), * new TweenOption(TweenOptionType.EndValueReaderFunction, (Tween.PropertyReaderFunction)GetEndValue)),*/ new Action(delegate(IAnimation anim) { GetParent(anim.Target).AutoLayout = true; }), new Action(delegate { AudioPlayerMapper.GetDefault().PlaySound("dialog_open"); }) ); }
private void SpawnObject() { // position float dx = Randomizer.RandomizeAround(0, 0.5f); float dy = Randomizer.RandomizeAround(0, 0.5f); float dz = Randomizer.RandomizeAround(0, 0.5f); Vector3 position = transform.position + new Vector3(dx, dy, dz); // instantiation GameObject go = (GameObject)Instantiate(Prefab, position, Quaternion.identity); // re-parenting go.transform.parent = transform; AudioPlayerMapper.GetDefault().PlaySound("spawn"); }
private void OnDragEnter(Event e) { //Debug.Log("OnDragEnter: " + e.Target.GetType().Name); Component comp = (Component)e.Target; if (null == comp) { return; } AudioPlayerMapper.GetDefault().PlaySound("pager_click", new AudioOption(AudioOptionType.Volume, 0.3f)); // check if drag enter item is child of _pnlDest or _pnlSource itself // allow the whole box to be drop target when moving if (_pnlDest.ContentContains(comp) || comp == _pnlDest.ContentGroup) { DragDropManager.AcceptDragDrop((Component)e.Target); DragDropManager.ShowFeedback(DragDropManager.Action.Move); } }
void OnGUI() { if (GUI.Button(new Rect(10, 10, 100, 30), "Start timer")) { AudioPlayerMapper.GetDefault().PlaySound("button_click1"); _timer.Start(); } if (GUI.Button(new Rect(120, 10, 100, 30), "Pause timer")) { AudioPlayerMapper.GetDefault().PlaySound("button_click2"); _timer.Pause(); } if (GUI.Button(new Rect(230, 10, 100, 30), "Reset")) { AudioPlayerMapper.GetDefault().PlaySound("button_click2"); _timer.Stop(); Cleanup(); } }
private void OnDragDrop(Event e) { DragEvent dragEvent = (DragEvent)e; //Debug.Log("OnDragDrop: " + e.Target.GetType().Name); Component src = dragEvent.DragInitiator; //(UiComponent)dragEvent.DragSource.Formats["control"]; Component dest = (Component)e.Target; Panel srcPanel = _pnlSource.ContentContains(src) ? _pnlSource : _pnlDest; if (dest == _pnlDest.ContentGroup) { srcPanel.RemoveContentChild(src); _pnlDest.AddContentChild(src); } else if (_pnlDest.ContentContains(dest)) { srcPanel.RemoveContentChild(src); // NOTE: needed for drag&drop, because src and dest could be the same _pnlDest.AddContentChildAt(src, _pnlDest.GetContentChildIndex(dest)); } AudioPlayerMapper.GetDefault().PlaySound("drag_drop", new AudioOption(AudioOptionType.Volume, 0.3f)); }
override protected void CreateChildren() { base.CreateChildren(); TitleLabel titleLabel = new TitleLabel { StyleName = "title", HorizontalCenter = 0, Top = 20 }; AddChild(titleLabel); new TextRotator { Delay = 5, // 5 seconds delay Lines = new[] { "Cursor Demo", "Created with eDriven.Gui", //"Author: Danko Kozar", "Cursor packages are loaded dynamically", "You can set the priority to each cursor operation" }, Callback = delegate(string line) { titleLabel.Text = line; } } .Start(); var buttonStyles = new Hashtable { { "cursor", "pointer" } }; #region VBox var vbox = new VGroup { HorizontalCenter = 0, VerticalCenter = 0, Gap = 10 }; AddChild(vbox); #endregion vbox.AddChild(new Label { Text = "Load cursor package:" }); #region HBox var hbox = new HGroup(); /*hbox.Click += delegate(Event e) * { * var me = (MouseEvent)e; * if (me.Target is Button) * AudioPlayerMapper.GetDefault().PlaySound("button_click"); * };*/ vbox.AddChild(hbox); #endregion #region Cursor package 1 var btnCursor1 = new Button { Text = "Load cursor package 1", Icon = (Texture)Resources.Load("Icons/drive_disk"), FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Styles = buttonStyles, MinWidth = 200, MinHeight = 120, ToggleMode = true, Selected = true }; hbox.AddChild(btnCursor1); #endregion #region Cursor package 2 var btnCursor2 = new Button { Text = "Load cursor package 2", Icon = (Texture)Resources.Load("Icons/drive_disk"), FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Styles = buttonStyles, MinWidth = 200, MinHeight = 120, ToggleMode = true, Selected = false }; hbox.AddChild(btnCursor2); // button 1 press btnCursor1.Click += delegate { if (_selectedButton != 0) { AudioPlayerMapper.GetDefault().PlaySound("button_click"); } _selectedButton = 0; DeferManager.Instance.Defer(delegate { btnCursor1.Selected = _selectedButton == 0; btnCursor2.Selected = _selectedButton == 1; CursorManager.Instance.LoadPackage("Cursors/antialiased-classic/package"); }, 1); }; // button 2 press btnCursor2.Click += delegate { if (_selectedButton != 1) { AudioPlayerMapper.GetDefault().PlaySound("button_click"); } _selectedButton = 1; DeferManager.Instance.Defer(delegate { btnCursor1.Selected = _selectedButton == 0; btnCursor2.Selected = _selectedButton == 1; CursorManager.Instance.LoadPackage("Cursors/blueglass-vista/package"); }, 1); }; #endregion #region Spacer vbox.AddChild(new Spacer { Height = 30 }); #endregion vbox.AddChild(new Label { Text = "Hover cursor over buttons:" }); TileGroup tileGroup = new TileGroup { PercentWidth = 100, RequestedRowCount = 2 }; vbox.AddChild(tileGroup); #region Crosshair var btnCrosshair = new Button { Text = "Crosshair", Icon = (Texture)Resources.Load("Icons/star"), SkinClass = typeof(ImageButtonSkin), FocusEnabled = false, Styles = new Hashtable { { "cursor", "crosshair" } }, MinWidth = 200, MinHeight = 120 }; tileGroup.AddChild(btnCrosshair); #endregion #region Move var btnMove = new Button { Text = "Move", Icon = (Texture)Resources.Load("Icons/star"), SkinClass = typeof(ImageButtonSkin), FocusEnabled = false, Styles = new Hashtable { { "cursor", "move" } }, MinWidth = 200, MinHeight = 120 }; tileGroup.AddChild(btnMove); #endregion #region Help var btnHelp = new Button { Text = "Help", Icon = (Texture)Resources.Load("Icons/star"), SkinClass = typeof(ImageButtonSkin), FocusEnabled = false, Styles = new Hashtable { { "cursor", "help" } }, MinWidth = 200, MinHeight = 120 }; tileGroup.AddChild(btnHelp); #endregion #region E-Resize var btnEResize = new Button { Text = "E-Resize", Icon = (Texture)Resources.Load("Icons/star"), SkinClass = typeof(ImageButtonSkin), FocusEnabled = false, Styles = new Hashtable { { "cursor", "e-resize" } }, MinWidth = 200, MinHeight = 120 }; tileGroup.AddChild(btnEResize); #endregion #region Spacer vbox.AddChild(new Spacer { Height = 30 }); #endregion vbox.AddChild(new Label { Text = "Click the button for a high-priority cursor:" }); #region Cursor progress var btnProgress = new Button { Text = "Show progress cursor (5 sec)", Icon = (Texture)Resources.Load("Icons/star"), SkinClass = typeof(ImageButtonSkin), FocusEnabled = false, Styles = buttonStyles, MinWidth = 200, MinHeight = 120, PercentWidth = 100 }; btnProgress.Press += new eDriven.Core.Events.EventHandler(delegate { int id = CursorManager.Instance.SetCursor("wait", 1); var t = new Timer(5, 1); t.Complete += delegate { t.Dispose(); CursorManager.Instance.RemoveCursor(id); }; t.Start(); }); vbox.AddChild(btnProgress); #endregion }