Skip to content
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
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ jobs:
targetPlatform: ${{ matrix.targetPlatform }}
allowDirtyBuild: true
buildMethod: GUZ.VR.Editor.VRBuilderActions.Perform${{ matrix.targetDevice }}Build
# Android Keystore settings
androidKeystoreBase64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
androidKeystoreName: GUZ.keystore
customParameters: >
-keystoreName "GUZ.keystore"
-keystorePass "${{ secrets.ANDROID_KEYSTORE_PASS }}"
-keyaliasName "${{ secrets.ANDROID_KEYALIAS_NAME }}"
-keyaliasPass "${{ secrets.ANDROID_KEYALIAS_PASS }}"

# Zip into workspace folder (overcoming permission errors)
- name: zip
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/test_and_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ jobs:
targetPlatform: ${{ matrix.targetPlatform }}
allowDirtyBuild: true
buildMethod: GUZ.VR.Editor.VRBuilderActions.Perform${{ matrix.targetDevice }}Build
# Android Keystore settings
androidKeystoreBase64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
androidKeystoreName: GUZ.keystore
customParameters: >
-keystoreName "GUZ.keystore"
-keystorePass "${{ secrets.ANDROID_KEYSTORE_PASS }}"
-keyaliasName "${{ secrets.ANDROID_KEYALIAS_NAME }}"
-keyaliasPass "${{ secrets.ANDROID_KEYALIAS_PASS }}"

- uses: actions/upload-artifact@v4
with:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json
*CullingData.asset
*CullingData.asset.meta

# APK signing
GUZ.keystore
*.keystore

# Ignore paid assets from repository
Assets/HurricaneVR/

Expand Down
4 changes: 2 additions & 2 deletions Assets/UnZENity-Core/Editor/UnityShortcuts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ namespace GUZ.Core.Editor
{
public class UnityShortcuts
{
[MenuItem("UnZENity/Unity/Build Settings", priority = 700)]
[MenuItem("UnZENity/Unity/Build Profiles", priority = 700)]
public static void ShowBuildSettingsWindow()
{
EditorApplication.ExecuteMenuItem("File/Build Settings...");
EditorApplication.ExecuteMenuItem("File/Build Profiles");
}

[MenuItem("UnZENity/Unity/Build And Run", priority = 710)]
Expand Down
6 changes: 6 additions & 0 deletions Assets/UnZENity-Core/Scripts/Const/DaedalusConst.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@ public class DaedalusConst
public static string SoundDrawWood = "DRAWSOUND_WO.WAV";
public static string SoundUndrawMetal = "UNDRAWSOUND_ME.WAV";
public static string SoundUndrawWood = "UNDRAWSOUND_WO.WAV";

// Guilds
public static string GuildValuesInstance = "GIL_Values";
public static string GuildMaxValue = "GIL_MAX";
public static string GuildHumanAttitudesSize = "TAB_ANZAHL";
public static string GuildHumanAttitudesArray = "GIL_ATTITUDES";
}
}
19 changes: 14 additions & 5 deletions Assets/UnZENity-Core/Scripts/Domain/BootstrapDomain.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Globalization;
using System.Linq;
using GUZ.Core.Models.Vm;
using GUZ.Core.Const;
using GUZ.Core.Services;
using GUZ.Core.Services.Caches;
using GUZ.Core.Services.Context;
Expand Down Expand Up @@ -145,22 +145,31 @@ private void LoadFonts()

private void LoadGuildData()
{
var guildMax = _gameStateService.GothicVm.GetSymbolByName("GIL_MAX");
var guildMax = _gameStateService.GothicVm.GetSymbolByName(DaedalusConst.GuildMaxValue);

_gameStateService.GuildCount = guildMax?.GetInt(0) ?? 0;

var tablesize = _gameStateService.GothicVm.GetSymbolByName("TAB_ANZAHL");
_gameStateService.GuildTableSize = (int)(tablesize != null ? Math.Sqrt(tablesize.GetInt(0)) : 0);
var tablesize = _gameStateService.GothicVm.GetSymbolByName(DaedalusConst.GuildHumanAttitudesSize);
_gameStateService.GuildHumanCount = (int)(tablesize != null ? Math.Sqrt(tablesize.GetInt(0)) : 0);

_gameStateService.GuildAttitudes = new int[_gameStateService.GuildCount * _gameStateService.GuildCount];

var id = _gameStateService.GothicVm.GetSymbolByName("GIL_Values");
var id = _gameStateService.GothicVm.GetSymbolByName(DaedalusConst.GuildValuesInstance);
if (id == null)
{
return;
}

_gameStateService.GuildValues = _gameStateService.GothicVm.InitInstance<GuildValuesInstance>(id);

if (_contextGameVersionService.IsGothic2())
{
// In G2, the Daedalus way of setting Human attitudes between each others is commented out with:
// >>> func void B_InitGuildAttitudes ()
// >>> ***NICHT machen!***
// We therefore set these values now.
_vmExternalService.ExchangeGuildAttitudes(DaedalusConst.GuildHumanAttitudesArray);
}

// TODO - Can be removed? -> When Gil_Values is instanciated inside G1 Daedalus, all values are already filled. No need to copy Human values into it.
// for (var i = 0; i < (int)VmGothicEnums.Guild.GIL_PUBLIC; ++i)
Expand Down
20 changes: 15 additions & 5 deletions Assets/UnZENity-Core/Scripts/Domain/Vm/VmExternalDomain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1137,15 +1137,25 @@ public void Wld_InsertItem(int itemInstance, string spawnpoint)

public void Wld_ExchangeGuildAttitudes(string name)
{
var guilds = _gameStateService.GothicVm.GetSymbolByName(name);
var humanGguildAttitudes = _gameStateService.GothicVm.GetSymbolByName(name);

if (guilds == null)
if (humanGguildAttitudes == null)
return;

for (double i = 0, count = _gameStateService.GuildTableSize; i < count; ++i)

// The guild attitudes are in a matrix. Where a row is the first guild and columns are the second one to check against.
// The first part of this matrix is human guilds. e.g. 16x16 based on the full matrix e.g., 42x42
// We therefore need to loop through the humanGuilds but fill the values inside allGuilds matrix first area top-left.
var humanGuildCount = _gameStateService.GuildHumanCount;
var allGuildCount = _gameStateService.GuildCount;
for (var row = 0; row < humanGuildCount; ++row)
{
for (var j = 0; j < count; ++j)
_gameStateService.GuildAttitudes[(int)(i * count + j)] = guilds.GetInt((ushort)(i * count + j));
for (var column = 0; column < humanGuildCount; ++column)
{
var humanAttitudeIndex = row * humanGuildCount + column;
var allGuildAttitudeIndex = row * allGuildCount + column;
_gameStateService.GuildAttitudes[allGuildAttitudeIndex] = humanGguildAttitudes.GetInt((ushort)humanAttitudeIndex);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Assets/UnZENity-Core/Scripts/Services/GameStateService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class GameStateService
// [IInteractiveObject] => VisualScheme (aka vob.Visual.Name.SubString("_");
public readonly Dictionary<string, List<VobContainer>> VobsInteractable = new();

public int GuildTableSize;
public int GuildHumanCount;
public int GuildCount;
public int[] GuildAttitudes;

Expand Down
8 changes: 8 additions & 0 deletions Assets/UnZENity-Core/Scripts/Services/Vm/VmExternalService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,13 @@ public void RegisterExternals()
{
_domain.RegisterExternals();
}

/// <summary>
/// Gothic2 isn't calling this external function in NotR within Daedalus. Therefore, we set it here.
/// </summary>
public void ExchangeGuildAttitudes(string name)
{
_domain.Wld_ExchangeGuildAttitudes(name);
}
}
}
42 changes: 39 additions & 3 deletions Assets/UnZENity-VR/Editor/VRBuilderActions.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using Unity.XR.OpenXR.Features.PICOSupport;
using UnityEditor;
Expand All @@ -23,9 +24,7 @@ private static void PerformWindows64Build()

SetWindows64Settings();

GenericBuild(_scenes, targetPath, BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows64,

BuildOptions.None);
GenericBuild(_scenes, targetPath, BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows64, BuildOptions.None);
}

[MenuItem("UnZENity/Build/Pico", priority = 21)]
Expand Down Expand Up @@ -60,10 +59,47 @@ private static void GenericBuild(string[] scenes, string targetPath, BuildTarget
options = buildOptions
};

if (buildTarget == BuildTarget.Android)
{
SetKeystoreInformation();
}

// Build the project
BuildPipeline.BuildPlayer(options);
}

private static void SetKeystoreInformation()
{
var args = Environment.GetCommandLineArgs();

var keystoreName = GetArg(args, "-keystoreName");
var keystorePass = GetArg(args, "-keystorePass");
var keyaliasName = GetArg(args, "-keyaliasName");
var keyaliasPass = GetArg(args, "-keyaliasPass");

// If nothing's set, it's a local build. Keep everything as it is.
if (keystorePass == null && keyaliasName == null && keyaliasPass == null)
return;

PlayerSettings.Android.useCustomKeystore = true;
PlayerSettings.Android.keystoreName = keystoreName;
PlayerSettings.Android.keystorePass = keystorePass;
PlayerSettings.Android.keyaliasName = keyaliasName;
PlayerSettings.Android.keyaliasPass = keyaliasPass;
}

private static string GetArg(string[] args, string name)
{
for (var i = 0; i < args.Length; i++)
{
if (args[i] == name && i + 1 < args.Length)
{
return args[i + 1];
}
}
return null;
}

private static string[] FindEnabledEditorScenes()
{
var editorScenes = new List<string>();
Expand Down
10 changes: 7 additions & 3 deletions ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ PlayerSettings:
muteOtherAudioSources: 0
Prepare IOS For Recording: 0
Force IOS Speakers When Recording: 0
audioSpatialExperience: 0
deferSystemGesturesMode: 0
hideHomeButton: 0
submitAnalytics: 1
Expand Down Expand Up @@ -270,17 +271,20 @@ PlayerSettings:
AndroidTargetArchitectures: 2
AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0}
AndroidKeystoreName:
AndroidKeyaliasName:
AndroidKeystoreName: '{inproject}: GUZ.keystore'
AndroidKeyaliasName: guz
AndroidEnableArmv9SecurityFeatures: 0
AndroidEnableArm64MTE: 0
AndroidBuildApkPerCpuArchitecture: 0
AndroidTVCompatibility: 0
AndroidIsGame: 1
androidAppCategory: 3
useAndroidAppCategory: 1
androidAppCategoryOther:
AndroidEnableTango: 0
androidEnableBanner: 1
androidUseLowAccuracyLocation: 0
androidUseCustomKeystore: 0
androidUseCustomKeystore: 1
m_AndroidBanners:
- width: 320
height: 180
Expand Down