Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
98b2f17
New scripts for topBar functionality
KimKiva Oct 1, 2025
5c94737
Added new methods to settingscarrier
KimKiva Oct 1, 2025
ed80f22
Changes to prefabs, including layoutelements and HLG
KimKiva Oct 1, 2025
9117dc5
refactor: simplify TopBarOrderBridge to dictionary-based order handling
KimKiva Oct 6, 2025
8587d8e
improvements to previous refactor, wired prefab elemets to scripts
KimKiva Oct 6, 2025
e618641
fix: prefab anchor set to stretch horizontally
KimKiva Oct 6, 2025
33dde62
Refactor: TopbarToggleDrag
KimKiva Oct 8, 2025
54cf5e9
Update SettingsCarrier.cs
KimKiva Oct 8, 2025
1aa5476
Merge branch 'main' into UI/Settings/Feature/Topbarsettings
BillTheBeast Jan 8, 2026
b46f9e7
Saved the topbar settings toggles as a prefab.
BillTheBeast Apr 15, 2026
46ad1f7
Merge branch 'main' into UI/Settings/Feature/Topbarsettings
BillTheBeast Apr 15, 2026
d9f52cf
Readded some of the topbar modifications components back into place.
BillTheBeast Apr 15, 2026
4634b16
Prefab/Toppanel Alt 1; Horizontal Layout Group-component has been add…
JannePaaso71 Apr 20, 2026
37fea4a
Prefab/Toppanel Alt 1; Horizontal Layout Group-component has been rem…
JannePaaso71 Apr 20, 2026
f5f59f1
Prefab/Toppanel Alt 1; BT_AANESTYS; Button child has been removed. To…
JannePaaso71 Apr 20, 2026
d902ef0
Prefab/Toppanel Alt 1; JukeboxButtos; Toggle-child has been added. To…
JannePaaso71 Apr 20, 2026
1228e7e
Prefab/Toppanel Alt 1; ClanPanelRoot; Toggle-child has been added. To…
JannePaaso71 Apr 20, 2026
7ac6793
Prefab/Toppanel Alt 1; ClanPanelRoot settings have been fixed.
JannePaaso71 Apr 20, 2026
d417772
Prefab/TopPanel Alt 1/ ClanPanelRoot has been fixed: Layout element h…
JannePaaso71 Apr 21, 2026
90a916b
10-MenuUI/UIOverlay/Canvas Scaler: Match has been changed 0 to 0.5(ta…
JannePaaso71 Apr 21, 2026
a85d2c1
TopBarModificationPanel is updated.
JannePaaso71 Apr 23, 2026
de958f7
TopBarModificationPanel/TopbarToggleDrag and TopBarToggleHandler has …
JannePaaso71 Apr 23, 2026
249d7fb
TopBarModificationPanel/TopbarToggleDrag have been transferred back f…
JannePaaso71 Apr 23, 2026
e2e9bb5
TopBarToggleDrag.cs/UpdatePlaceholderIndex has been changed from Rayc…
JannePaaso71 Apr 24, 2026
5afd059
TopBarToggles. Each of its child has a TopBarToggleDrag-component/Cla…
JannePaaso71 Apr 24, 2026
f3b896b
TopBarToggleDrag.cs is ready for Niko's comment.
JannePaaso71 Apr 27, 2026
6807727
Jukebox has been added to TopBarDefs/TopBatItem.
JannePaaso71 Apr 27, 2026
06201d0
ClanTextContainer has been added to TopBarDefs/TopBatItem.
JannePaaso71 Apr 27, 2026
99da542
Voting has been added to TopBarDefs/TopBatItem.
JannePaaso71 Apr 27, 2026
3925bd8
Prefab TopPanel Alt 1 has been updated. TopbarTargets.cs and TopBarTo…
JannePaaso71 Apr 27, 2026
33b9895
ApplyOrderFromSettings has been added to the end of TopBarTargets.cs.…
JannePaaso71 Apr 28, 2026
9373c89
Unity hierarcy has been repaired. There were several Top Panel Alt 1 …
JannePaaso71 Apr 29, 2026
d237ca7
TopBarOrderBridge component has been added to TopBarMpdificatioPanel.…
JannePaaso71 Apr 29, 2026
53ecdc7
Backup copy
JannePaaso71 Apr 30, 2026
26ddc5b
Backup copy
JannePaaso71 May 1, 2026
088ba44
Updated
JannePaaso71 May 4, 2026
af3f3ae
New functions have been added to TopBarTargets.cs. ApplyClanPanelMode…
JannePaaso71 May 5, 2026
3e253f1
TopBarTargets/ApplyFromSettings has been updated to call ApplyClanPan…
JannePaaso71 May 5, 2026
1d16942
CoinsToggle has been added to TopBarModificationPanel/ClanTile
JannePaaso71 May 7, 2026
fffa077
Spacers works
JannePaaso71 May 12, 2026
24efae1
Fix TopBar visibility updates to use active target instead of FindObj…
JannePaaso71 May 12, 2026
69f4c41
Corrected the adjustable top panel position in hierarchy.
BillTheBeast May 12, 2026
a7519c6
TopBarOrderBridge cleanup
JannePaaso71 May 15, 2026
3b6c49e
backup
JannePaaso71 May 18, 2026
d54ee24
TopBarToggles-prefab has been updated.
JannePaaso71 May 19, 2026
c6ba56a
Scrollview has beed added to Themepopup.
JannePaaso71 May 19, 2026
c01da27
Scrolview works.
JannePaaso71 May 20, 2026
34ee2bf
Drag&drop works.
JannePaaso71 May 21, 2026
4447188
SettingEditor.cs has been updated. Changing styles works again in the…
JannePaaso71 May 26, 2026
44fb878
TopPanel Alt1 and ThemePopup have been finished.
JannePaaso71 May 27, 2026
87dc088
TopPanel Alt1 and ThemePopup have been updated.
JannePaaso71 May 27, 2026
41c91e8
Updated.
JannePaaso71 May 27, 2026
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
157 changes: 138 additions & 19 deletions Assets/Altzone/Scripts/Settings/SettingsCarrier.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using Altzone.Scripts.Audio;
using Altzone.Scripts.BattleUiShared;
using System.Collections.Generic;
using Altzone.Scripts.Chat;
using Newtonsoft.Json.Linq;
using UnityEditor;
Expand Down Expand Up @@ -92,12 +93,15 @@ public enum SettingsType
public event Action OnButtonLabelVisibilityChange;

public delegate void MuteAllSoundsChange(bool value);

public static event MuteAllSoundsChange OnMuteAllSoundsChange;

public delegate void TopBarChanged(int index);

public static event TopBarChanged OnTopBarChanged;

public delegate void LanguageChanged(LanguageType language);

public static event LanguageChanged OnLanguageChanged;

// Constants
Expand Down Expand Up @@ -138,12 +142,10 @@ public enum SettingsType
public float soundVolume;

private bool _muteAllSounds;

public bool MuteAllSounds
{
get
{
return _muteAllSounds;
}
get { return _muteAllSounds; }

set
{
Expand Down Expand Up @@ -178,15 +180,17 @@ public LanguageType Language
}

private TextSize _textSize;
public TextSize Textsize { get => _textSize; }

public TextSize Textsize
{
get => _textSize;
}

private bool _showButtonLabels;

public bool ShowButtonLabels
{
get
{
return _showButtonLabels;
}
get { return _showButtonLabels; }

set
{
Expand All @@ -196,6 +200,7 @@ public bool ShowButtonLabels
}

private bool _unlimitedStatUpgradeMaterials;

public bool UnlimitedStatUpgradeMaterials
{
get => _unlimitedStatUpgradeMaterials;
Expand All @@ -208,6 +213,7 @@ public bool UnlimitedStatUpgradeMaterials
}

private bool _statDebuggingMode;

public bool StatDebuggingMode
{
get => _statDebuggingMode;
Expand All @@ -220,6 +226,7 @@ public bool StatDebuggingMode
}

private bool _battleShowDebugStatsOverlay;

public bool BattleShowDebugStatsOverlay
{
get => _battleShowDebugStatsOverlay;
Expand All @@ -232,6 +239,7 @@ public bool BattleShowDebugStatsOverlay
}

private int _battleArenaScale;

public int BattleArenaScale
{
get => _battleArenaScale;
Expand All @@ -244,6 +252,7 @@ public int BattleArenaScale
}

private int _battleArenaPosX;

public int BattleArenaPosX
{
get => _battleArenaPosX;
Expand All @@ -256,6 +265,7 @@ public int BattleArenaPosX
}

private int _battleArenaPosY;

public int BattleArenaPosY
{
get => _battleArenaPosY;
Expand All @@ -268,6 +278,7 @@ public int BattleArenaPosY
}

private BattleMovementInputType _battleMovementInput;

public BattleMovementInputType BattleMovementInput
{
get => _battleMovementInput;
Expand All @@ -280,6 +291,7 @@ public BattleMovementInputType BattleMovementInput
}

private BattleRotationInputType _battleRotationInput;

public BattleRotationInputType BattleRotationInput
{
get => _battleRotationInput;
Expand All @@ -292,6 +304,7 @@ public BattleRotationInputType BattleRotationInput
}

private float _battleSwipeMinDistance;

public float BattleSwipeMinDistance
{
get => _battleSwipeMinDistance;
Expand All @@ -304,6 +317,7 @@ public float BattleSwipeMinDistance
}

private float _battleSwipeMaxDistance;

public float BattleSwipeMaxDistance
{
get => _battleSwipeMaxDistance;
Expand All @@ -316,6 +330,7 @@ public float BattleSwipeMaxDistance
}

private float _battleSwipeSensitivity;

public float BattleSwipeSensitivity
{
get => _battleSwipeSensitivity;
Expand All @@ -328,6 +343,7 @@ public float BattleSwipeSensitivity
}

private float _battleGyroMinAngle;

public float BattleGyroMinAngle
{
get => _battleGyroMinAngle;
Expand All @@ -340,20 +356,35 @@ public float BattleGyroMinAngle
}

private TopBarStyle _topBarStyleSetting;

public TopBarStyle TopBarStyleSetting
{
get => _topBarStyleSetting;
set
{
if (_topBarStyleSetting == value) return;
_topBarStyleSetting = value;

PlayerPrefs.SetInt(TopBarStyleSettingKey, (int)value);
OnTopBarChanged?.Invoke((int)value);
}
}


public static bool IsTopBarItemVisibleByKeyStatic(string key, bool defaultOn = true)
=> PlayerPrefs.GetInt(key, defaultOn ? 1 : 0) != 0;


private const string _topBarOrderKeyPrefix = "TopBarOrder_";
private static string GetTopBarOrderKey(TopBarStyle style) => _topBarOrderKeyPrefix + style;


private string _mainMenuMusicName;
public string MainMenuMusicName { get { return _mainMenuMusicName; } }

public string MainMenuMusicName
{
get { return _mainMenuMusicName; }
}

private int? _chatChannel;

Expand All @@ -379,7 +410,8 @@ private void Awake()

private void Start()
{
Application.targetFrameRate = PlayerPrefs.GetInt("TargetFrameRate", (int)Screen.currentResolution.refreshRateRatio.value);
Application.targetFrameRate =
PlayerPrefs.GetInt("TargetFrameRate", (int)Screen.currentResolution.refreshRateRatio.value);
mainMenuWindowIndex = 0;

_language = ParseLanguage(PlayerPrefs.GetString("LanguageType", ""));
Expand All @@ -395,7 +427,7 @@ private void Start()
_muteAllSounds = PlayerPrefs.GetInt("MuteAllSounds", 0) == 1;

jukeboxSoulhome = PlayerPrefs.GetInt("JukeboxSoulHome", 1) != 0;
jukeboxUI = PlayerPrefs.GetInt("JukeboxUI",1) != 0;
jukeboxUI = PlayerPrefs.GetInt("JukeboxUI", 1) != 0;
jukeboxBattle = PlayerPrefs.GetInt("JukeboxBattle", 0) != 0;

_battleShowDebugStatsOverlay = PlayerPrefs.GetInt(BattleShowDebugStatsOverlayKey, 0) == 1;
Expand All @@ -404,8 +436,10 @@ private void Start()
_battleArenaPosX = PlayerPrefs.GetInt(BattleArenaPosXKey, BattleArenaPosXDefault);
_battleArenaPosY = PlayerPrefs.GetInt(BattleArenaPosYKey, BattleArenaPosYDefault);

_battleMovementInput = (BattleMovementInputType)PlayerPrefs.GetInt(BattleMovementInputKey, (int)BattleMovementInputDefault);
_battleRotationInput = (BattleRotationInputType)PlayerPrefs.GetInt(BattleRotationInputKey, (int)BattleRotationInputDefault);
_battleMovementInput =
(BattleMovementInputType)PlayerPrefs.GetInt(BattleMovementInputKey, (int)BattleMovementInputDefault);
_battleRotationInput =
(BattleRotationInputType)PlayerPrefs.GetInt(BattleRotationInputKey, (int)BattleRotationInputDefault);

_battleSwipeMinDistance = PlayerPrefs.GetFloat(BattleSwipeMinDistanceKey, BattleSwipeMinDistanceDefault);
_battleSwipeMaxDistance = PlayerPrefs.GetFloat(BattleSwipeMaxDistanceKey, BattleSwipeMaxDistanceDefault);
Expand All @@ -418,6 +452,8 @@ private void Start()

_topBarStyleSetting = (TopBarStyle)PlayerPrefs.GetInt(TopBarStyleSettingKey, 1);

OnTopBarChanged?.Invoke((int)_topBarStyleSetting);

_mainMenuMusicName = PlayerPrefs.GetString("MainMenuMusic");

ChatListener.OnActiveChannelChanged += SaveChatChannel;
Expand All @@ -432,9 +468,18 @@ public void SetVolume(SoundType type, float value)
{
switch (type)
{
case SoundType.menu: menuVolume = value; PlayerPrefs.SetFloat("MenuVolume", value); break;
case SoundType.music: musicVolume = value; PlayerPrefs.SetFloat("MusicVolume", value); break;
case SoundType.sound: soundVolume = value; PlayerPrefs.SetFloat("SoundVolume", value); break;
case SoundType.menu:
menuVolume = value;
PlayerPrefs.SetFloat("MenuVolume", value);
break;
case SoundType.music:
musicVolume = value;
PlayerPrefs.SetFloat("MusicVolume", value);
break;
case SoundType.sound:
soundVolume = value;
PlayerPrefs.SetFloat("SoundVolume", value);
break;
default: break;
}
}
Expand All @@ -451,6 +496,7 @@ public float SentVolume(SoundType type)
case SoundType.sound: otherVolume = soundVolume; break;
default: break;
}

return 1 * (otherVolume * masterVolume);
}

Expand All @@ -464,6 +510,7 @@ public float GetVolumeValue(SoundType type)
case SoundType.sound: otherVolume = soundVolume; break;
default: break;
}

return otherVolume;
}

Expand Down Expand Up @@ -524,7 +571,11 @@ public BattleUiMovableElementData GetBattleUiMovableElementData(BattleUiElementT
if (string.IsNullOrEmpty(json)) return null;

BattleUiMovableElementData data = JsonUtility.FromJson<BattleUiMovableElementData>(json);
if (data != null) data.UiElementType = data.UiElementType == BattleUiElementType.None ? type : data.UiElementType; // Backwards compatibility with old BattleUiMovableElementData
if (data != null)
data.UiElementType =
data.UiElementType == BattleUiElementType.None
? type
: data.UiElementType; // Backwards compatibility with old BattleUiMovableElementData

return data;
}
Expand Down Expand Up @@ -571,8 +622,76 @@ public void SetDataFromSelectionBox(SelectionBoxType type, string value)
{
switch (type)
{
case SelectionBoxType.MainMenuMusic: _mainMenuMusicName = value; PlayerPrefs.SetString("MainMenuMusic", value); break;
case SelectionBoxType.MainMenuMusic:
_mainMenuMusicName = value;
PlayerPrefs.SetString("MainMenuMusic", value);
break;
}
}

public void SetTopBarItemVisibleByKey(string key, bool visible)
{
int newV = visible ? 1 : 0;
int oldV = PlayerPrefs.HasKey(key) ? PlayerPrefs.GetInt(key) : -1;
if (oldV == newV) return;

PlayerPrefs.SetInt(key, newV);
OnTopBarChanged?.Invoke((int)TopBarStyleSetting);
}

[System.Serializable]
private class TopBarOrderData
{
public List<int> order = new List<int>();
}

public void SaveTopBarOrder(TopBarStyle style, IList<int> order)
{
string key = GetTopBarOrderKey(style);

TopBarOrderData data = new TopBarOrderData { order = new List<int>(order) };
string jsonNew = JsonUtility.ToJson(data);

string jsonOld = PlayerPrefs.GetString(key, "");
if (jsonOld == jsonNew) return;

PlayerPrefs.SetString(key, jsonNew);
OnTopBarChanged?.Invoke((int)style);
}

public static List<int> LoadTopBarOrderStatic(TopBarStyle style, int count)
{
List<int> result = new List<int>(count);
bool[] used = new bool[count];

string raw = PlayerPrefs.GetString(GetTopBarOrderKey(style), "");
if (string.IsNullOrEmpty(raw))
{
for (int i = 0; i < count; i++) result.Add(i);
return result;
}

TopBarOrderData data = JsonUtility.FromJson<TopBarOrderData>(raw);

// JSON-lista l�pi foreachilla
if (data != null && data.order != null)
{
foreach (int idx in data.order)
{
if ((uint)idx < (uint)count && !used[idx])
{
used[idx] = true;
result.Add(idx);
if (result.Count == count) return result;
}
}
}

for (int i = 0; i < count; i++)
if (!used[i])
result.Add(i);

return result;
}

public ChatChannelType FetchChatChannel()
Expand Down
22 changes: 22 additions & 0 deletions Assets/Altzone/Scripts/Settings/TopBarDefs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace Altzone.Scripts.Settings
{
public static class TopBarDefs
{
private const string KeyPrefix = "TopBarItem_";

public enum TopBarItem
{
ClanTile,
Leaderboard,
Coins,
ClanLogo,
ClanTextContainer,
Jukebox,
PlayerProfile,
Voting,
Settings,
}

public static string Key(TopBarItem item) => $"{KeyPrefix}{item}";
}
}
11 changes: 11 additions & 0 deletions Assets/Altzone/Scripts/Settings/TopBarDefs.cs.meta

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

Loading