Skip to content

Commit

Permalink
Merge pull request GodotVR#67 from patrickdown/move_app_info
Browse files Browse the repository at this point in the history
Change application/version setting source to remove redundancy
  • Loading branch information
patrickdown authored Dec 18, 2023
2 parents 3a2f56b + 5417502 commit a0207ea
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 15 deletions.
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

0 comments on commit a0207ea

Please sign in to comment.