added firebase and rudimentary leaderboard support

This commit is contained in:
derek
2025-04-09 11:19:02 -05:00
parent ce08df66e6
commit 25eb9e725a
121 changed files with 4987 additions and 4 deletions

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_armv7</string>
<key>LibraryPath</key>
<string>godot_svc-device.release_debug.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>armv7</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>godot_svc-simulator.release_debug.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>

View File

@@ -0,0 +1,17 @@
[config]
name="GodotSVC"
binary="godot_svc.xcframework"
initialization="register_godot_svc_plugin"
deinitialization="unregister_godot_svc_plugin"
[dependencies]
linked=[]
embedded=[]
system=[]
capabilities=[]
files=[]
[plist]

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_armv7</string>
<key>LibraryPath</key>
<string>godot_svc-device.release.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>armv7</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>godot_svc-simulator.release.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>

View File

@@ -0,0 +1,17 @@
[config]
name="GodotSVC"
binary="godot_svc.xcframework"
initialization="register_godot_svc_plugin"
deinitialization="unregister_godot_svc_plugin"
[dependencies]
linked=[]
embedded=[]
system=[]
capabilities=[]
files=[]
[plist]

View File

@@ -0,0 +1,30 @@
/*************************************************************************/
/* godot_svc.h */
/*************************************************************************/
#ifndef GODOTSVC_H
#define GODOTSVC_H
#include "core/version.h"
#if VERSION_MAJOR == 4
#include "core/object/class_db.h"
#else
#include "core/object.h"
#endif
class GodotSvc : public Object {
GDCLASS(GodotSvc, Object);
static GodotSvc *instance;
static void _bind_methods();
public:
static GodotSvc *get_singleton();
void popup(String url);
void close();
GodotSvc();
~GodotSvc();
};
#endif

View File

@@ -0,0 +1,41 @@
/*************************************************************************/
/* godot_svc.mm */
/*************************************************************************/
#include "godot_svc.h"
#import "platform/iphone/app_delegate.h"
#import "platform/iphone/view_controller.h"
#import "godot_svc_delegate.mm"
#import <Foundation/Foundation.h>
GodotSvc *GodotSvc::instance = NULL;
GodotSvcDelegate *godot_svc_delegate = nil;
void GodotSvc::_bind_methods() {
ClassDB::bind_method(D_METHOD("popup"), &GodotSvc::popup);
ClassDB::bind_method(D_METHOD("close"), &GodotSvc::close);
}
GodotSvc::GodotSvc() {
ERR_FAIL_COND(instance != NULL);
instance = this;
godot_svc_delegate = [[GodotSvcDelegate alloc] init];
}
void GodotSvc::popup(String url){
NSString *nsURL = [[NSString alloc] initWithUTF8String:url.utf8().get_data()];
[godot_svc_delegate loadSvc:nsURL];
}
void GodotSvc::close(){
[godot_svc_delegate closeSvc];
}
GodotSvc *GodotSvc::get_singleton() {
return instance;
};
GodotSvc::~GodotSvc() {
if (godot_svc_delegate) {
godot_svc_delegate = nil;
}
}

View File

@@ -0,0 +1,36 @@
/*************************************************************************/
/* godot_svc_delegate.mm */
/*************************************************************************/
#import "platform/iphone/view_controller.h"
#import <UIKit/UIKit.h>
#import "WebKit/WebKit.h"
#import <SafariServices/SafariServices.h>
@interface GodotSvcDelegate : NSObject
- (void)loadSvc:(NSString *)url;
- (void)closeSvc;
@end
@implementation GodotSvcDelegate
- (void)loadSvc:(NSString *)url {
// Parses String Into URL Request
NSURL *nsurl=[NSURL URLWithString:url];
// Gets root controller to present the safari view controller
UIViewController *root_controller = [[UIApplication sharedApplication] delegate].window.rootViewController;
// add svc
SFSafariViewController *svc = [[SFSafariViewController alloc] initWithURL:nsurl];
svc.delegate = (id) self;
[root_controller presentViewController:svc animated:YES completion:nil];
}
- (void)closeSvc {
UIViewController *root_controller = [[UIApplication sharedApplication] delegate].window.rootViewController;
[root_controller dismissViewControllerAnimated:true completion:nil];
}
- (void)safariViewControllerDidFinish:(SFSafariViewController *)controller {
UIViewController *root_controller = [[UIApplication sharedApplication] delegate].window.rootViewController;
[root_controller dismissViewControllerAnimated:true completion:nil];
}
@end

View File

@@ -0,0 +1,23 @@
/*************************************************************************/
/* godot_svc_module.cpp */
/*************************************************************************/
#include "godot_svc_module.h"
#include "core/version.h"
#if VERSION_MAJOR == 4
#include "core/config/engine.h"
#else
#include "core/engine.h"
#endif
#include "godot_svc.h"
GodotSvc *godot_svc;
void register_godot_svc_plugin() {
godot_svc = memnew(GodotSvc);
Engine::get_singleton()->add_singleton(Engine::Singleton("GodotSvc", godot_svc));
}
void unregister_godot_svc_plugin() {
if (godot_svc) {
memdelete(godot_svc);
}
}

View File

@@ -0,0 +1,6 @@
/*************************************************************************/
/* godot_svc_module.h */
/*************************************************************************/
void register_godot_svc_plugin();
void unregister_godot_svc_plugin();