AnimationWindow.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using BansheeEngine;
  4. namespace BansheeEditor
  5. {
  6. /** @addtogroup Windows
  7. * @{
  8. */
  9. /// <summary>
  10. /// Displays animation curve editor window.
  11. /// </summary>
  12. internal class AnimationWindow : EditorWindow
  13. {
  14. private GUITimeline timeline;
  15. private GUIFloatField startField;
  16. private GUIFloatField endField;
  17. private GUIIntField fpsField;
  18. /// <summary>
  19. /// Opens the animation window.
  20. /// </summary>
  21. [MenuItem("Windows/Animation", ButtonModifier.CtrlAlt, ButtonCode.A, 6000)]
  22. private static void OpenGameWindow()
  23. {
  24. OpenWindow<AnimationWindow>();
  25. }
  26. /// <inheritdoc/>
  27. protected override LocString GetDisplayName()
  28. {
  29. return new LocEdString("Animation");
  30. }
  31. private void OnInitialize()
  32. {
  33. startField = new GUIFloatField(new LocEdString("Start"), 50);
  34. endField = new GUIFloatField(new LocEdString("End"), 50);
  35. fpsField = new GUIIntField(new LocEdString("FPS"), 50);
  36. endField.Value = 60.0f;
  37. fpsField.Value = 1;
  38. startField.OnChanged += x => timeline.SetRange(x, endField.Value);
  39. endField.OnChanged += x => timeline.SetRange(startField.Value, x);
  40. fpsField.OnChanged += x => timeline.SetFPS(x);
  41. GUILayout buttonLayout = GUI.AddLayoutX();
  42. buttonLayout.AddElement(startField);
  43. buttonLayout.AddElement(endField);
  44. buttonLayout.AddElement(fpsField);
  45. timeline = new GUITimeline(GUI, 300, 20);
  46. }
  47. private void OnEditorUpdate()
  48. {
  49. //int position = (int)(MathEx.Sin(Time.RealElapsed)*50.0f + 50.0f);
  50. //canvas.SetPosition(position, 0);
  51. }
  52. private void OnDestroy()
  53. {
  54. // TODO
  55. }
  56. }
  57. /** @} */
  58. }