diff --git a/Assets/Scenes/IconsMenu.unity b/Assets/Scenes/IconsMenu.unity index 1866365..7cbf656 100644 --- a/Assets/Scenes/IconsMenu.unity +++ b/Assets/Scenes/IconsMenu.unity @@ -2512,7 +2512,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &346076456 RectTransform: m_ObjectHideFlags: 0 @@ -6421,7 +6421,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &989561979 RectTransform: m_ObjectHideFlags: 0 @@ -6717,29 +6717,31 @@ MonoBehaviour: selectionText: {fileID: 283532290} previewBird: {fileID: 485555076} previewOverlay: {fileID: 1953625730} - icon1: {fileID: 1374823590} - icon2: {fileID: 1587955963} - icon3: {fileID: 2082761349} - icon4: {fileID: 105058369} - icon5: {fileID: 1275335465} - icon6: {fileID: 1682251926} - icon7: {fileID: 2044046146} - icon8: {fileID: 1433968977} - overlay0: {fileID: 437256206} - overlay1: {fileID: 388694500} - overlay2: {fileID: 606851916} - overlay3: {fileID: 1721135576} - overlay4: {fileID: 1786729680} - overlay5: {fileID: 519880727} - overlay6: {fileID: 2122644443} - overlay7: {fileID: 490807504} - overlay8: {fileID: 1197784014} - overlay9: {fileID: 420083143} - overlay10: {fileID: 367978220} - overlay11: {fileID: 1860444778} - overlay12: {fileID: 1513997428} - overlay13: {fileID: 1736703} - overlay14: {fileID: 1798643177} + icons: + - {fileID: 1374823590} + - {fileID: 1587955963} + - {fileID: 2082761349} + - {fileID: 105058369} + - {fileID: 1275335465} + - {fileID: 1682251926} + - {fileID: 2044046146} + - {fileID: 1433968977} + overlays: + - {fileID: 437256206} + - {fileID: 388694500} + - {fileID: 606851916} + - {fileID: 1721135576} + - {fileID: 1786729680} + - {fileID: 519880727} + - {fileID: 2122644443} + - {fileID: 490807504} + - {fileID: 1197784014} + - {fileID: 420083143} + - {fileID: 367978220} + - {fileID: 1860444778} + - {fileID: 1513997428} + - {fileID: 1736703} + - {fileID: 1798643177} previewBirdObject: {fileID: 2072730781} iconColorPanel: {fileID: 346076460} overlayColorPanel: {fileID: 989561983} diff --git a/Assets/Scripts/ColorPanel.cs b/Assets/Scripts/ColorPanel.cs index 43cfdfb..a46355f 100644 --- a/Assets/Scripts/ColorPanel.cs +++ b/Assets/Scripts/ColorPanel.cs @@ -78,4 +78,20 @@ public class ColorPanel : MonoBehaviour (int)bSlider.value )); } + + public void SetColor(Color col) + { + rSlider.SetValueWithoutNotify(col.r * 255f); + gSlider.SetValueWithoutNotify(col.g * 255f); + bSlider.SetValueWithoutNotify(col.b * 255f); + SyncAll(); + } + + public void SetColor(JArray color) + { + rSlider.SetValueWithoutNotify((int)color[0]); + gSlider.SetValueWithoutNotify((int)color[1]); + bSlider.SetValueWithoutNotify((int)color[2]); + SyncAll(); + } } diff --git a/Assets/Scripts/IconsMenu.cs b/Assets/Scripts/IconsMenu.cs index 3b5fdbd..32af3a6 100644 --- a/Assets/Scripts/IconsMenu.cs +++ b/Assets/Scripts/IconsMenu.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using System.Collections.Generic; using Newtonsoft.Json.Linq; using TMPro; using UnityEngine; @@ -18,66 +18,58 @@ public class Iconsmenu : MonoBehaviour public TMP_Text selectionText; public Image previewBird; public Image previewOverlay; - public Button icon1; - public Button icon2; - public Button icon3; - public Button icon4; - public Button icon5; - public Button icon6; - public Button icon7; - public Button icon8; - public Button overlay0; - public Button overlay1; - public Button overlay2; - public Button overlay3; - public Button overlay4; - public Button overlay5; - public Button overlay6; - public Button overlay7; - public Button overlay8; - public Button overlay9; - public Button overlay10; - public Button overlay11; - public Button overlay12; - public Button overlay13; - public Button overlay14; + public Button[] icons; + public Button[] overlays; + private Dictionary customIcons = new(); public GameObject previewBirdObject; public ColorPanel iconColorPanel; public ColorPanel overlayColorPanel; private void Start() { - foreach (var icon in BazookaManager.Instance.GetCustomBirdIconData().Data) + var customIconData = BazookaManager.Instance.GetCustomBirdIconData(); + foreach (var icon in customIconData.Data) { var iconEntry = Instantiate(marketplaceIconsSample, marketplaceIconsContent.transform); iconEntry.name = "MarketplaceIcon"; - iconEntry.GetComponent