GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
EventsBasedBehavior.h
1 /*
2  * GDevelop Core
3  * Copyright 2008-2016 Florian Rival ([email protected]). All rights
4  * reserved. This project is released under the MIT License.
5  */
6 #pragma once
7 
8 #include <vector>
9 #include "GDCore/Project/AbstractEventsBasedEntity.h"
10 #include "GDCore/Project/NamedPropertyDescriptor.h"
11 #include "GDCore/Project/PropertiesContainer.h"
12 #include "GDCore/Project/EventsFunctionsContainer.h"
13 #include "GDCore/Project/QuickCustomization.h"
14 #include "GDCore/String.h"
15 namespace gd {
16 class SerializerElement;
17 class Project;
18 } // namespace gd
19 
20 namespace gd {
21 
32  public:
34  virtual ~EventsBasedBehavior(){};
35 
40  EventsBasedBehavior* Clone() const { return new EventsBasedBehavior(*this); };
41 
42  EventsBasedBehavior& SetDescription(const gd::String& description_) override {
44  return *this;
45  }
46 
50  EventsBasedBehavior& SetName(const gd::String& name_) override {
52  return *this;
53  }
54 
58  EventsBasedBehavior& SetFullName(const gd::String& fullName_) override {
60  return *this;
61  }
62 
64  SetPreviewIconUrl(const gd::String &previewIconUrl_) override {
65  AbstractEventsBasedEntity::SetPreviewIconUrl(previewIconUrl_);
66  return *this;
67  }
68 
69  EventsBasedBehavior &SetIconUrl(const gd::String &iconUrl_) override {
70  AbstractEventsBasedEntity::SetIconUrl(iconUrl_);
71  return *this;
72  }
73 
78  EventsBasedBehavior &SetHelpPath(const gd::String &helpPath_) override {
80  return *this;
81  }
82 
86  const gd::String& GetObjectType() const { return objectType; };
87 
92  objectType = objectType_;
93  return *this;
94  }
95 
100  EventsBasedBehavior& SetPrivate(bool isPrivate) {
102  return *this;
103  }
104 
105  QuickCustomization::Visibility GetQuickCustomizationVisibility() const {
106  return quickCustomizationVisibility;
107  }
108 
109  EventsBasedBehavior& SetQuickCustomizationVisibility(QuickCustomization::Visibility visibility) {
110  quickCustomizationVisibility = visibility;
111  return *this;
112  }
113 
118  return sharedPropertyDescriptors;
119  }
120 
125  const {
126  return sharedPropertyDescriptors;
127  }
128 
132  static gd::String GetSharedPropertyActionName(const gd::String &propertyName) {
133  return "SetSharedProperty" + propertyName;
134  };
135 
140  return "SharedProperty" + propertyName;
141  };
142 
146  static gd::String
148  return "SharedProperty" + propertyName;
149  };
150 
155  return "ToggleSharedProperty" + propertyName;
156  };
157 
158  void SerializeTo(SerializerElement& element) const override;
159 
160  void UnserializeFrom(gd::Project& project,
161  const SerializerElement& element) override;
162 
163  private:
164  gd::String objectType;
165  gd::PropertiesContainer sharedPropertyDescriptors;
166  QuickCustomization::Visibility quickCustomizationVisibility;
167 };
168 
169 } // namespace gd
Represents a behavior or an object that is implemented with events.
Definition: AbstractEventsBasedEntity.h:29
AbstractEventsBasedEntity & SetPrivate(bool isPrivate_)
Set that the behavior or object is private - it can't be used outside of its extension.
Definition: AbstractEventsBasedEntity.h:52
virtual AbstractEventsBasedEntity & SetDescription(const gd::String &description_)
Set the description of the behavior or object, to be displayed in the editor.
Definition: AbstractEventsBasedEntity.h:66
virtual AbstractEventsBasedEntity & SetName(const gd::String &name_)
Set the internal name of the behavior or object.
Definition: AbstractEventsBasedEntity.h:79
virtual AbstractEventsBasedEntity & SetFullName(const gd::String &fullName_)
Set the name of the behavior or object, to be displayed in the editor.
Definition: AbstractEventsBasedEntity.h:92
virtual AbstractEventsBasedEntity & SetHelpPath(const gd::String &helpPath_)
Set the help path relative to the GDevelop documentation root.
Definition: AbstractEventsBasedEntity.h:120
Represents a behavior that is implemented with events.
Definition: EventsBasedBehavior.h:31
EventsBasedBehavior * Clone() const
Return a pointer to a new EventsBasedBehavior constructed from this one.
Definition: EventsBasedBehavior.h:40
static gd::String GetSharedPropertyConditionName(const gd::String &propertyName)
Get the name of the condition to compare a shared property.
Definition: EventsBasedBehavior.h:139
const gd::String & GetObjectType() const
Get the object type the behavior should be used with.
Definition: EventsBasedBehavior.h:86
EventsBasedBehavior & SetFullName(const gd::String &fullName_) override
Set the name of the behavior, to be displayed in the editor.
Definition: EventsBasedBehavior.h:58
static gd::String GetSharedPropertyExpressionName(const gd::String &propertyName)
Get the name of the expression to get a shared property.
Definition: EventsBasedBehavior.h:147
static gd::String GetSharedPropertyActionName(const gd::String &propertyName)
Get the name of the action to change a shared property.
Definition: EventsBasedBehavior.h:132
EventsBasedBehavior & SetName(const gd::String &name_) override
Set the internal name of the behavior.
Definition: EventsBasedBehavior.h:50
const gd::PropertiesContainer & GetSharedPropertyDescriptors() const
Return a const reference to the list of shared properties.
Definition: EventsBasedBehavior.h:124
EventsBasedBehavior & SetHelpPath(const gd::String &helpPath_) override
Set the help path relative to the GDevelop documentation root.
Definition: EventsBasedBehavior.h:78
EventsBasedBehavior & SetPrivate(bool isPrivate)
Set that the behavior or object is private - it can't be used outside of its extension.
Definition: EventsBasedBehavior.h:100
EventsBasedBehavior & SetDescription(const gd::String &description_) override
Set the description of the behavior or object, to be displayed in the editor.
Definition: EventsBasedBehavior.h:42
EventsBasedBehavior & SetObjectType(const gd::String &objectType_)
Set the object type the behavior should be used with.
Definition: EventsBasedBehavior.h:91
static gd::String GetSharedPropertyToggleActionName(const gd::String &propertyName)
Get the name of the action to toggle a boolean shared property.
Definition: EventsBasedBehavior.h:154
gd::PropertiesContainer & GetSharedPropertyDescriptors()
Return a reference to the list of shared properties.
Definition: EventsBasedBehavior.h:117
Base class representing a project (game), including all resources, scenes, objects,...
Definition: Project.h:51
A container of properties, used for custom behaviors, custom objects, extensions.....
Definition: PropertiesContainer.h:17
Visibility
Definition: QuickCustomization.h:8
A generic container that can represent a value ( containing a string, double, bool or int),...
Definition: SerializerElement.h:37
String represents an UTF8 encoded string.
Definition: String.h:33
Definition: CommonTools.h:24