Skip to content

Commit

Permalink
Merge pull request #3276 from KBVE/beta
Browse files Browse the repository at this point in the history
Preparing Release Branch
  • Loading branch information
h0lybyte authored Nov 19, 2024
2 parents 55edb36 + 49444f8 commit 4924af0
Show file tree
Hide file tree
Showing 10 changed files with 148 additions and 56 deletions.
45 changes: 45 additions & 0 deletions apps/kbve.com/src/content/journal/11-18.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: 'November: 18th'
category: Daily
date: 2024-11-18 12:00:00
client: Self
unsplash: 1541320779116-ec4a3d4692bc
img: https://images.unsplash.com/photo-1541320779116-ec4a3d4692bc?crop=entropy&cs=srgb&fm=jpg&ixid=MnwzNjM5Nzd8MHwxfHJhbmRvbXx8fHx8fHx8fDE2ODE3NDg2ODY&ixlib=rb-4.0.3&q=85
description: November 18th.
tags:
- daily
---

import { Adsense, Tasks } from '@kbve/astropad';

## 2024

- 01:51AM

**WebGL**

Adjusted the WebGL build, going to push up another commit as well.
We do need to adjust the supabase login, making sure that it works for both Standalone and WebGL.
Performing that test right now at 5pm, the notes are below.

- 12:50PM

**Vuplex**

The `Vuplex` provider provides a way to utilize the webview but we want to focus on making it work through our package.
However it seems that it crashes on the macbook, so I am going to try to make it work on the windows desktop.
I am thinking that it might be a missing assembly reference, but I am starting to get annoyed with trying to debug this problem, never felt so much pain!
However, part of learning a bunch of different languages would have some downsides because they all have their little tricks.

The login screen has some issues with the pixel density that need to be resolved.
Resolution is current 1 px per Unity , ugh you know what, I will make the adjustments from the other end.
Okay, next step will be to grab the username or give them the option to adjust their username.

- 05:05PM

**WebGL**

I am going to test the webgl build and how it goes about handling the vuplex changes!
Hoping, Coping, Copium! errr... that it automatically does its magic without us having to do any major changes.
We want the login screen to be the same for the Standalone64 build and the Webgl build, if both are working without then we can move forward.

23 changes: 23 additions & 0 deletions packages/kilonet/Kbve.Kilonet.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "Kbve.Kilonet",
"rootNamespace": "KBVE.Kilonet",
"references": [
"Vuplex.WebView",
"Supabase.Core",
"Supabase.Functions",
"Supabase.Gotrue",
"Supabase.Postgrest",
"Supabase.Realtime",
"Supabase.Storage",
"Cysharp.Threading.Tasks"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
7 changes: 7 additions & 0 deletions packages/kilonet/Kbve.Kilonet.asmdef.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/kilonet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Packages: MM/TPD, VuPlex (Desktop/WebGL)
Issue tickets can be found via unity tag, still need to link the issues directly to discord.
Adding the itch io release of the webgl build.
Updating the distance for the ally.
Added WebGL build optimizations.
Started the IFrame Interactions but need to fix the cross origin issue.

- [KBVE](https://kbve.com/)
- [RareIcon](https://rareicon.com/)
2 changes: 1 addition & 1 deletion packages/kilonet/README.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion packages/kilonet/kilonet/GameManager.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion packages/kilonet/kilonet/KiloGlobalCore.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion packages/kilonet/kilonet/Utils/JEDI.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 30 additions & 51 deletions packages/kilonet/kilonet/Utils/VuplexHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,23 @@ namespace KBVE.Kilonet.Utils
{
public class VuplexHelper : MonoBehaviour
{
public string CanvasObjectName = "Canvas";
public string CanvasWebViewPrefabName = "CanvasWebViewPrefab";
public string CanvasWebViewPrefabViewName = "CanvasWebViewPrefabView";

private CanvasWebViewPrefab _canvasWebViewPrefab;

public Canvas CanvasObject;
public CanvasWebViewPrefab CanvasWebViewPrefab;
public IWebView CanvasWebViewPrefabView;

private Supabase.Client _supabaseClient;

private const string SUPABASE_URL = "https://supabase.kbve.com";
private const string SUPABASE_ANON_KEY =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJyb2xlIjogImFub24iLAogICJpc3MiOiAic3VwYWJhc2UiLAogICJpYXQiOiAxNzI0NTM2ODAwLAogICJleHAiOiAxODgyMzAzMjAwCn0._fmEmblm0afeLoPXxt8wP2mYpa9gzU-ufx3v8oRTFGg";

private void Start()
private async void Start()
{
try
{
// Use UniTask to manage initialization
InitializeWebView().Forget(); // Use UniTask's Forget to run async without awaiting

InitializeSupabaseClientAsync().Forget(); // Initialize Supabase client asynchronously
await InitializeWebView();
await InitializeSupabaseClientAsync();
}
catch (Exception ex)
{
Expand All @@ -40,63 +37,45 @@ private void Start()
}


private async UniTaskVoid InitializeWebView()
private async UniTask InitializeWebView()
{
GameObject canvasObject = GameObject.Find(CanvasObjectName);
if (canvasObject == null)
try
{
Debug.LogError($"No GameObject found with the name {CanvasObjectName}");
return;
}
if (CanvasObject == null || CanvasWebViewPrefab == null)
{
Debug.LogError("CanvasObject or CanvasWebViewPrefab is not set in the Unity Editor.");
return;
}

Transform canvasWebViewPrefabTransform = canvasObject.transform.Find(CanvasWebViewPrefabName);
if (canvasWebViewPrefabTransform == null)
{
Debug.LogError(
$"No GameObject found with the name {CanvasWebViewPrefabName} under {CanvasObjectName}."
);
return;
}
await CanvasWebViewPrefab.WaitUntilInitialized();

Transform canvasWebViewPrefabViewTransform = canvasWebViewPrefabTransform.Find(
CanvasWebViewPrefabViewName
);
if (canvasWebViewPrefabViewTransform == null)
{
Debug.LogError(
$"No GameObject found with the name {CanvasWebViewPrefabViewName} under {CanvasWebViewPrefabName}."
);
return;
}
if (CanvasWebViewPrefab.WebView != null)
{
CanvasWebViewPrefabView = CanvasWebViewPrefab.WebView;

_canvasWebViewPrefab = canvasWebViewPrefabViewTransform.GetComponent<CanvasWebViewPrefab>();
if (_canvasWebViewPrefab == null)
{
_canvasWebViewPrefab = canvasWebViewPrefabTransform.GetComponent<CanvasWebViewPrefab>();
CanvasWebViewPrefabView.MessageEmitted += OnMessageReceived;

if (_canvasWebViewPrefab == null)
Debug.Log("Vuplex WebView successfully initialized and ready to receive messages.");
}
else
{
Debug.LogError(
"Failed to locate the CanvasWebViewPrefab component after multiple attempts."
);
return;
Debug.LogError("CanvasWebViewPrefab.WebView is null after initialization.");
}
}

await _canvasWebViewPrefab.WaitUntilInitialized();

_canvasWebViewPrefab.WebView.MessageEmitted += OnMessageReceived;
Debug.Log("Vuplex CanvasWebView successfully initialized and ready to receive messages.");
catch (Exception ex)
{
Debug.LogError($"Error during WebView initialization: {ex.Message}\n{ex.StackTrace}");
}
}

private async UniTaskVoid InitializeSupabaseClientAsync()
private async UniTask InitializeSupabaseClientAsync()
{
try
{
var options = new SupabaseOptions { AutoRefreshToken = true, AutoConnectRealtime = false, };

_supabaseClient = new Supabase.Client(SUPABASE_URL, SUPABASE_ANON_KEY, options);
await _supabaseClient.InitializeAsync(); // Await the initialization instead of using .Wait()
await _supabaseClient.InitializeAsync();

Debug.Log("Supabase client initialized successfully.");
}
Expand All @@ -113,7 +92,7 @@ private void OnMessageReceived(object sender, EventArgs<string> eventArgs)
Debug.Log("Raw JSON received: " + eventArgs.Value);

// Parse JSON message
var dict = MiniJSON.Json.Deserialize(eventArgs.Value) as Dictionary<string, object>;
var dict = JEDI.ParseMiniJSON(eventArgs.Value) as Dictionary<string, object>;
if (dict == null)
{
Debug.LogError("Failed to parse JSON into dictionary. Check JSON format.");
Expand Down
11 changes: 10 additions & 1 deletion packages/kilonet/kilonet/Utils/VuplexHelper.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4924af0

Please sign in to comment.