Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change application/version setting source to remove redundancy #67

Merged
merged 2 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions example.csharp/addons/tiltfive/T5ProjectSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ static void DefineProjectSetting(String name, Variant.Type setting_type, Propert

public static void setup_properties() {
if (!isInitialized) {
DefineProjectSetting("xr/tilt_five/application_id", Variant.Type.String, PropertyHint.None, "", "my.game.com");
DefineProjectSetting("xr/tilt_five/application_version", Variant.Type.String, PropertyHint.None, "", "0.1.0");
DefineProjectSetting("xr/tilt_five/default_display_name", Variant.Type.String, PropertyHint.None, "", "Game: Player One");
DefineProjectSetting("xr/tilt_five/default_display_name", Variant.Type.String, PropertyHint.None, "", "");
DefineProjectSetting("xr/tilt_five/trigger_click_threshhold", Variant.Type.Float, PropertyHint.Range, "0,1,0.01", 0.3);
DefineProjectSetting("xr/tilt_five/debug_logging", Variant.Type.Bool, PropertyHint.None, "", false);

Expand All @@ -39,17 +37,33 @@ public static void setup_properties() {

public static String ApplicationID
{
get { setup_properties(); return ProjectSettings.GetSettingWithOverride("xr/tilt_five/application_id").AsString(); }
get {
var app_id = ProjectSettings.GetSettingWithOverride("application/config/name").AsString();
if (app_id == null || app_id == "")
return "tiltfive.godot.game";
return app_id;
}
}

public static String ApplicationVersion
{
get { setup_properties(); return ProjectSettings.GetSettingWithOverride("xr/tilt_five/application_version").AsString(); }
get {
var version = ProjectSettings.GetSettingWithOverride("application/config/version").AsString();
if (version == null || version == "")
return "unknown";
return version;
}
}

public static String DefaultDisplayName
{
get { setup_properties(); return ProjectSettings.GetSettingWithOverride("xr/tilt_five/default_display_name").AsString(); }
get {
setup_properties();
var disp_name = ProjectSettings.GetSettingWithOverride("xr/tilt_five/default_display_name").AsString();
if (disp_name == null || disp_name == "")
return ApplicationID;
return disp_name;
}
}

public static float TriggerClickThreshhold
Expand Down
23 changes: 14 additions & 9 deletions example.gd/addons/tiltfive/T5ProjectSettings.gd
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,32 @@ static func _define_project_setting(

static func setup_properties():
if not _initialized:
_define_project_setting("xr/tilt_five/application_id", TYPE_STRING, PROPERTY_HINT_NONE, "", "my.game.com")
_define_project_setting("xr/tilt_five/application_version", TYPE_STRING, PROPERTY_HINT_NONE, "", "0.1.0")
_define_project_setting("xr/tilt_five/default_display_name", TYPE_STRING, PROPERTY_HINT_NONE, "", "Game: Player One")
_define_project_setting("xr/tilt_five/default_display_name", TYPE_STRING)
_define_project_setting("xr/tilt_five/trigger_click_threshhold", TYPE_FLOAT, PROPERTY_HINT_RANGE, "0,1,0.01", 0.3)
_define_project_setting("xr/tilt_five/debug_logging", TYPE_BOOL, PROPERTY_HINT_NONE, "", false)
_initialized = true

static var application_id : String:
get:
setup_properties()
return ProjectSettings.get_setting_with_override("xr/tilt_five/application_id")
var app_id := ProjectSettings.get_setting_with_override("application/config/name")
if not app_id or app_id == "":
return "tiltfive.godot.game"
return app_id

static var application_version : String:
get:
setup_properties()
return ProjectSettings.get_setting_with_override("xr/tilt_five/application_version")

var version := ProjectSettings.get_setting_with_override("application/config/version")
if not version or version == "":
return "unknown"
return version

static var default_display_name : String:
get:
setup_properties()
return ProjectSettings.get_setting_with_override("xr/tilt_five/default_display_name")
var disp_name := ProjectSettings.get_setting_with_override("xr/tilt_five/default_display_name")
if not disp_name or disp_name == "":
return T5ProjectSettings.application_id
return disp_name

static var trigger_click_threshhold : float:
get:
Expand Down