gameMode.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #pragma once
  2. #ifndef GAME_MODE_H
  3. #define GAME_MODE_H
  4. #ifdef TORQUE_TOOLS
  5. #ifndef _GUI_INSPECTOR_TYPES_H_
  6. #include "gui/editor/guiInspectorTypes.h"
  7. #endif
  8. #endif
  9. #ifndef SUB_SCENE_H
  10. #include "SubScene.h"
  11. #endif
  12. #include "T3D/assets/ImageAsset.h"
  13. class GameMode : public SimObject
  14. {
  15. typedef SimObject Parent;
  16. private:
  17. StringTableEntry mGameModeName;
  18. StringTableEntry mGameModeDesc;
  19. DECLARE_IMAGEASSET(GameMode, PreviewImage, GFXStaticTextureSRGBProfile)
  20. bool mIsActive;
  21. bool mIsAlwaysActive;
  22. public:
  23. GameMode();
  24. ~GameMode() = default;
  25. static void initPersistFields();
  26. bool onAdd() override;
  27. void onRemove() override;
  28. bool isActive() { return mIsActive; }
  29. void setActive(const bool& active);
  30. bool isAlwaysActive() { return mIsAlwaysActive; }
  31. void setAlwaysActive(const bool& alwaysActive);
  32. DECLARE_CONOBJECT(GameMode);
  33. static void findGameModes(const char* gameModeList, Vector<GameMode*>* outGameModes);
  34. DECLARE_CALLBACK(void, onActivated, ());
  35. DECLARE_CALLBACK(void, onDeactivated, ());
  36. DECLARE_CALLBACK(void, onSceneLoaded, ());
  37. DECLARE_CALLBACK(void, onSceneUnloaded, ());
  38. DECLARE_CALLBACK(void, onSubsceneLoaded, (SubScene*));
  39. DECLARE_CALLBACK(void, onSubsceneUnloaded, (SubScene*));
  40. };
  41. DefineConsoleType(TypeGameModeList, String)
  42. #ifdef TORQUE_TOOLS
  43. class GuiInspectorTypeGameModeListHelper;
  44. class GuiInspectorTypeGameModeList : public GuiInspectorField
  45. {
  46. typedef GuiInspectorField Parent;
  47. public:
  48. GuiInspectorTypeGameModeListHelper* mHelper;
  49. GuiRolloutCtrl* mRollout;
  50. GuiDynamicCtrlArrayControl* mArrayCtrl;
  51. Vector<GuiInspectorField*> mChildren;
  52. GuiBitmapButtonCtrl* mButton;
  53. RectI mButtonRect;
  54. DECLARE_CONOBJECT(GuiInspectorTypeGameModeList);
  55. GuiInspectorTypeGameModeList();
  56. // ConsoleObject
  57. bool onAdd() override;
  58. static void consoleInit();
  59. // GuiInspectorField
  60. bool resize(const Point2I& newPosition, const Point2I& newExtent) override;
  61. void childResized(GuiControl* child) override;
  62. bool updateRects() override;
  63. void updateData() override;
  64. StringTableEntry getValue() override;
  65. void setValue(StringTableEntry value) override;
  66. };
  67. class GuiInspectorTypeGameModeListHelper : public GuiInspectorField
  68. {
  69. typedef GuiInspectorField Parent;
  70. public:
  71. GuiInspectorTypeGameModeListHelper();
  72. DECLARE_CONOBJECT(GuiInspectorTypeGameModeListHelper);
  73. GuiBitmapButtonCtrl* mButton;
  74. GuiRolloutCtrl* mParentRollout;
  75. GuiInspectorTypeGameModeList* mParentField;
  76. RectI mButtonRect;
  77. //-----------------------------------------------------------------------------
  78. // Override able methods for custom edit fields
  79. //-----------------------------------------------------------------------------
  80. GuiControl* constructEditControl() override;
  81. bool resize(const Point2I& newPosition, const Point2I& newExtent) override;
  82. bool updateRects() override;
  83. void setValue(StringTableEntry value) override;
  84. };
  85. #endif
  86. #endif