uipopupscripteditorsettings.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. class UIPopupScriptEditorSettings extends UIPopupScript
  2. {
  3. private CheckBoxWidget m_WgtTglSeleHighlight;
  4. private CheckBoxWidget m_WgtTglSavePlayerPos;
  5. private EditBoxWidget m_EdxRotationDelta;
  6. private ButtonWidget m_BtnCancel;
  7. private PluginSceneManager m_ModuleSceneManager;
  8. //================================================
  9. // UIPopupScriptEditorSettings
  10. //================================================
  11. void UIPopupScriptEditorSettings(Widget wgt)
  12. {
  13. m_ModuleSceneManager = PluginSceneManager.Cast( GetPlugin(PluginSceneManager) );
  14. m_WgtTglSeleHighlight = CheckBoxWidget.Cast( wgt.FindAnyWidget("cbx_ppp_est_flag_selection") );
  15. m_WgtTglSavePlayerPos = CheckBoxWidget.Cast( wgt.FindAnyWidget("cbx_ppp_est_flag_load_player_pos") );
  16. m_EdxRotationDelta = EditBoxWidget.Cast( wgt.FindAnyWidget("ebx_ppp_est_rotation_delta_value") );
  17. m_BtnCancel = ButtonWidget.Cast( wgt.FindAnyWidget("btn_ppp_est_cancel") );
  18. }
  19. //================================================
  20. // OnOpen
  21. //================================================
  22. override void OnOpen(Param param)
  23. {
  24. m_WgtTglSeleHighlight.SetChecked( m_ModuleSceneManager.GetDrawSelection() );
  25. m_WgtTglSavePlayerPos.SetChecked( m_ModuleSceneManager.GetLoadPlayerPos() );
  26. m_EdxRotationDelta.SetText( m_ModuleSceneManager.GetRotationAngle().ToString() );
  27. }
  28. //================================================
  29. // OnClick
  30. //================================================
  31. override bool OnClick(Widget w, int x, int y, int button)
  32. {
  33. super.OnClick(w, x, y, button);
  34. if ( w == m_WgtTglSeleHighlight )
  35. {
  36. m_ModuleSceneManager.SetDrawSelection(m_WgtTglSeleHighlight.IsChecked());
  37. }
  38. else if ( w == m_WgtTglSavePlayerPos )
  39. {
  40. m_ModuleSceneManager.SetLoadPlayerPos(m_WgtTglSavePlayerPos.IsChecked());
  41. }
  42. else if ( w == m_BtnCancel )
  43. {
  44. PopupBack();
  45. return true;
  46. }
  47. return false;
  48. }
  49. //============================================
  50. // OnChange
  51. //============================================
  52. override bool OnChange(Widget w, int x, int y, bool finished)
  53. {
  54. if ( w == m_EdxRotationDelta )
  55. {
  56. int angle = m_EdxRotationDelta.GetText().ToInt();
  57. if ( angle > 0 )
  58. {
  59. m_ModuleSceneManager.SetRotationAngle( angle );
  60. }
  61. return true;
  62. }
  63. return false;
  64. }
  65. }