Skip to content
This repository was archived by the owner on Apr 17, 2026. It is now read-only.

Commit 76c68c9

Browse files
authored
Merge pull request #57 from ZehsTeam/main
Fixes to the color picker menu
2 parents 1f72c23 + dd0ccaa commit 76c68c9

6 files changed

Lines changed: 34 additions & 11 deletions

File tree

Assets/LethalConfigManifest.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ MonoBehaviour:
7070
Name: LethalConfig
7171
Description: Provides an in-game config menu for players to edit their configs,
7272
and an API for other mods to use and customize their entries.
73-
Version: 1.4.5
73+
Version: 1.4.6
7474
Dependencies:
7575
- {fileID: 11400000, guid: 93f32f19b4b23484b83d50013fee18e8, type: 2}
7676
--- !u!114 &4587465158208312100

Assets/Prefabs/ConfigMenuColorPicker.prefab

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@ MonoBehaviour:
15901590
m_fontSizeMax: 72
15911591
m_fontStyle: 0
15921592
m_HorizontalAlignment: 1
1593-
m_VerticalAlignment: 512
1593+
m_VerticalAlignment: 256
15941594
m_textAlignment: 65535
15951595
m_characterSpacing: 0
15961596
m_wordSpacing: 0
@@ -1639,7 +1639,7 @@ MonoBehaviour:
16391639
m_IgnoreLayout: 0
16401640
m_MinWidth: -1
16411641
m_MinHeight: -1
1642-
m_PreferredWidth: -1
1642+
m_PreferredWidth: 241
16431643
m_PreferredHeight: -1
16441644
m_FlexibleWidth: -1
16451645
m_FlexibleHeight: 0

Assets/Scripts/LethalConfigPlugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public static class PluginInfo
88
{
99
public const string Guid = "ainavt.lc.lethalconfig";
1010
public const string Name = "LethalConfig";
11-
public const string Version = "1.4.5";
11+
public const string Version = "1.4.6";
1212
}
1313

1414
[BepInPlugin(PluginInfo.Guid, PluginInfo.Name, PluginInfo.Version)]

Assets/Scripts/MonoBehaviours/ColorPicker/ColorPickerControl.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ private void Initialize()
4646

4747
private void CreateHueImage()
4848
{
49-
_hueTexture = new Texture2D(1, 16);
49+
_hueTexture = new Texture2D(1, 16, TextureFormat.RGBA32, false);
5050
_hueTexture.wrapMode = TextureWrapMode.Clamp;
5151
_hueTexture.name = "HueTexture";
5252

5353
for (int i = 0; i < _hueTexture.height; i++)
5454
{
55-
_hueTexture.SetPixel(0, i, Color.HSVToRGB(i / (float)_hueTexture.height, 1, 0.95f));
55+
_hueTexture.SetPixel(0, i, Color.HSVToRGB(i / (float)_hueTexture.height, 1f, 1f));
5656
}
5757

5858
_hueTexture.Apply();
@@ -63,7 +63,7 @@ private void CreateHueImage()
6363

6464
private void CreateSatValImage()
6565
{
66-
_satValTexture = new Texture2D(16, 16);
66+
_satValTexture = new Texture2D(16, 16, TextureFormat.RGBA32, false);
6767
_satValTexture.wrapMode = TextureWrapMode.Clamp;
6868
_satValTexture.name = "SatValTexture";
6969

@@ -84,7 +84,7 @@ private void CreateSatValImage()
8484

8585
private void CreatePreviousOutputImage()
8686
{
87-
_previousOutputTexture = new Texture2D(1, 16);
87+
_previousOutputTexture = new Texture2D(1, 16, TextureFormat.RGBA32, false);
8888
_previousOutputTexture.wrapMode = TextureWrapMode.Clamp;
8989
_previousOutputTexture.name = "PreviousOutputTexture";
9090

@@ -101,7 +101,7 @@ private void CreatePreviousOutputImage()
101101

102102
private void CreateCurrentOutputImage()
103103
{
104-
_currentOutputTexture = new Texture2D(1, 16);
104+
_currentOutputTexture = new Texture2D(1, 16, TextureFormat.RGBA32, false);
105105
_currentOutputTexture.wrapMode = TextureWrapMode.Clamp;
106106
_currentOutputTexture.name = "CurrentOutputTexture";
107107

Assets/Scripts/MonoBehaviours/ColorPicker/SVImageControl.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using LethalConfig.Utils;
2-
using UnityEngine;
1+
using UnityEngine;
32
using UnityEngine.EventSystems;
43
using UnityEngine.UI;
54

@@ -25,6 +24,16 @@ private void Awake()
2524

2625
private void UpdateColor(PointerEventData eventData)
2726
{
27+
if (_rectTransform == null)
28+
{
29+
_rectTransform = GetComponent<RectTransform>();
30+
}
31+
32+
if (_pickerTransform == null)
33+
{
34+
_pickerTransform = _pickerImage.GetComponent<RectTransform>();
35+
}
36+
2837
RectTransformUtility.ScreenPointToLocalPointInRectangle(_rectTransform, eventData.position, eventData.pressEventCamera, out Vector2 localPosition);
2938

3039
Vector2 clampedPosition = new Vector2(
@@ -54,6 +63,16 @@ public void OnPointerClick(PointerEventData eventData)
5463

5564
public void SetPickerLocation(float saturation, float value)
5665
{
66+
if (_rectTransform == null)
67+
{
68+
_rectTransform = GetComponent<RectTransform>();
69+
}
70+
71+
if (_pickerTransform == null)
72+
{
73+
_pickerTransform = _pickerImage.GetComponent<RectTransform>();
74+
}
75+
5776
float x = (saturation * _rectTransform.rect.width) - (_rectTransform.rect.width * 0.5f);
5877
float y = (value * _rectTransform.rect.height) - (_rectTransform.rect.height * 0.5f);
5978

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## Version 1.4.6
2+
- Fixed the color picker menu not working in the lobby. (#57)
3+
- Fixed long config item names stretching the color picker menu. (#57)
4+
15
## Version 1.4.5
26
- Added new `HexColorInputFieldConfigItem` for hex color code strings with previews. (#56)
37
- Fixed the config search bar showing sections that were hidden using the "show/hide" button when updating the search value. (#56)

0 commit comments

Comments
 (0)