mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
@@ -51,6 +51,7 @@ Project::Project()
|
||||
: name(_("Project")),
|
||||
version("1.0.0"),
|
||||
packageName("com.example.gamename"),
|
||||
templateSlug(""),
|
||||
orientation("landscape"),
|
||||
folderProject(false),
|
||||
windowWidth(800),
|
||||
@@ -516,6 +517,7 @@ void Project::UnserializeFrom(const SerializerElement& element) {
|
||||
SetProjectUuid(propElement.GetStringAttribute("projectUuid", ""));
|
||||
SetAuthor(propElement.GetChild("author", 0, "Auteur").GetValue().GetString());
|
||||
SetPackageName(propElement.GetStringAttribute("packageName"));
|
||||
SetTemplateSlug(propElement.GetStringAttribute("templateSlug"));
|
||||
SetOrientation(propElement.GetStringAttribute("orientation", "default"));
|
||||
SetFolderProject(propElement.GetBoolAttribute("folderProject"));
|
||||
SetLastCompilationDirectory(propElement
|
||||
@@ -747,6 +749,7 @@ void Project::SerializeTo(SerializerElement& element) const {
|
||||
propElement.SetAttribute("projectUuid", projectUuid);
|
||||
propElement.SetAttribute("folderProject", folderProject);
|
||||
propElement.SetAttribute("packageName", packageName);
|
||||
propElement.SetAttribute("templateSlug", templateSlug);
|
||||
propElement.SetAttribute("orientation", orientation);
|
||||
platformSpecificAssets.SerializeTo(
|
||||
propElement.AddChild("platformSpecificAssets"));
|
||||
@@ -974,6 +977,7 @@ void Project::Init(const gd::Project& game) {
|
||||
isPlayableWithGamepad = game.isPlayableWithGamepad;
|
||||
isPlayableWithMobile = game.isPlayableWithMobile;
|
||||
packageName = game.packageName;
|
||||
templateSlug = game.templateSlug;
|
||||
orientation = game.orientation;
|
||||
folderProject = game.folderProject;
|
||||
latestCompilationDirectory = game.latestCompilationDirectory;
|
||||
|
@@ -162,6 +162,18 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
*/
|
||||
const gd::String& GetPackageName() const { return packageName; }
|
||||
|
||||
/**
|
||||
* \brief Change the slug of the template from which the project is created.
|
||||
*/
|
||||
void SetTemplateSlug(const gd::String& templateSlug_) {
|
||||
templateSlug = templateSlug_;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Get the slug of the template from which the project is created.
|
||||
*/
|
||||
const gd::String& GetTemplateSlug() const { return templateSlug; }
|
||||
|
||||
/**
|
||||
* \brief Change the project orientation (in particular when exported with
|
||||
* Cordova). This has no effect on desktop and web browsers. \param
|
||||
@@ -983,6 +995,8 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
bool isPlayableWithGamepad; ///< The project is playable with a gamepad.
|
||||
bool isPlayableWithMobile; ///< The project is playable on a mobile.
|
||||
gd::String packageName; ///< Game package name
|
||||
gd::String templateSlug; ///< The slug of the template from which the game is
|
||||
///< created.
|
||||
gd::String orientation; ///< Lock game orientation (on mobile devices).
|
||||
///< "default", "landscape" or "portrait".
|
||||
bool
|
||||
|
@@ -385,6 +385,8 @@ interface Project {
|
||||
void SetPlayableWithMobile(boolean playable);
|
||||
void SetPackageName([Const] DOMString packageName);
|
||||
[Const, Ref] DOMString GetPackageName();
|
||||
void SetTemplateSlug([Const] DOMString templateSlug);
|
||||
[Const, Ref] DOMString GetTemplateSlug();
|
||||
void SetOrientation([Const] DOMString orientation);
|
||||
[Const, Ref] DOMString GetOrientation();
|
||||
void SetProjectUuid([Const] DOMString projectUuid);
|
||||
|
@@ -19,6 +19,8 @@ declare class gdProject extends gdObjectsContainer {
|
||||
setPlayableWithMobile(playable: boolean): void;
|
||||
setPackageName(packageName: string): void;
|
||||
getPackageName(): string;
|
||||
setTemplateSlug(templateSlug: string): void;
|
||||
getTemplateSlug(): string;
|
||||
setOrientation(orientation: string): void;
|
||||
getOrientation(): string;
|
||||
setProjectUuid(projectUuid: string): void;
|
||||
|
@@ -171,11 +171,13 @@ export default class ExportLauncher extends Component<Props, State> {
|
||||
// If the game is not registered, register it before launching the export.
|
||||
const authorName =
|
||||
this.props.project.getAuthor() || 'Unspecified publisher';
|
||||
const templateSlug = this.props.project.getTemplateSlug();
|
||||
const gameName = this.props.project.getName() || 'Untitled game';
|
||||
const game = await registerGame(getAuthorizationHeader, userId, {
|
||||
gameId,
|
||||
authorName,
|
||||
gameName,
|
||||
templateSlug,
|
||||
});
|
||||
// We don't await for the authors update, as it is not required for publishing.
|
||||
this.tryUpdateAuthors();
|
||||
|
@@ -106,6 +106,7 @@ export const GameRegistration = ({
|
||||
gameId: project.getProjectUuid(),
|
||||
authorName: project.getAuthor() || 'Unspecified publisher',
|
||||
gameName: project.getName() || 'Untitled game',
|
||||
templateSlug: project.getTemplateSlug(),
|
||||
});
|
||||
loadGame();
|
||||
if (onGameRegistered) onGameRegistered();
|
||||
|
@@ -276,7 +276,10 @@ export const HomePage = React.memo<Props>(
|
||||
|
||||
setPreCreationDialogOpen(false);
|
||||
setSelectedExample(null);
|
||||
onOpenProjectAfterCreation({ ...projectMetadata });
|
||||
onOpenProjectAfterCreation({
|
||||
...projectMetadata,
|
||||
templateSlug: selectedExample ? selectedExample.slug : undefined,
|
||||
});
|
||||
} finally {
|
||||
setIsOpening(false);
|
||||
}
|
||||
|
@@ -1960,12 +1960,14 @@ const MainFrame = (props: Props) => {
|
||||
storageProvider,
|
||||
fileMetadata,
|
||||
projectName,
|
||||
templateSlug,
|
||||
shouldCloseDialog,
|
||||
}: {|
|
||||
project?: gdProject,
|
||||
storageProvider: ?StorageProvider,
|
||||
fileMetadata: ?FileMetadata,
|
||||
projectName?: string,
|
||||
templateSlug?: string,
|
||||
shouldCloseDialog?: boolean,
|
||||
|}) => {
|
||||
if (shouldCloseDialog)
|
||||
@@ -1983,7 +1985,9 @@ const MainFrame = (props: Props) => {
|
||||
currentProject.setVersion('1.0.0');
|
||||
currentProject.getAuthorIds().clear();
|
||||
currentProject.setAuthor('');
|
||||
if (templateSlug) currentProject.setTemplateSlug(templateSlug);
|
||||
if (projectName) currentProject.setName(projectName);
|
||||
|
||||
openSceneOrProjectManager({
|
||||
currentProject: currentProject,
|
||||
editorTabs: editorTabs,
|
||||
|
@@ -27,6 +27,7 @@ export type OnOpenProjectAfterCreationFunction = ({|
|
||||
storageProvider: ?StorageProvider,
|
||||
fileMetadata: ?FileMetadata,
|
||||
projectName?: string,
|
||||
templateSlug?: string,
|
||||
shouldCloseDialog?: boolean,
|
||||
|}) => Promise<void>;
|
||||
|
||||
|
@@ -179,10 +179,12 @@ export const registerGame = (
|
||||
gameId,
|
||||
gameName,
|
||||
authorName,
|
||||
templateSlug,
|
||||
}: {|
|
||||
gameId: string,
|
||||
gameName: string,
|
||||
authorName: string,
|
||||
templateSlug: string,
|
||||
|}
|
||||
): Promise<Game> => {
|
||||
return getAuthorizationHeader()
|
||||
@@ -192,6 +194,7 @@ export const registerGame = (
|
||||
{
|
||||
gameName,
|
||||
authorName,
|
||||
templateSlug,
|
||||
},
|
||||
{
|
||||
params: {
|
||||
|
Reference in New Issue
Block a user