From 0347dac2d879a429d6df43de21970a8eac3ce24b Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Mon, 30 Jun 2025 14:38:45 -0700 Subject: [PATCH] Tell the user why they can't send requests on self-built instance --- .vscode/settings.json | 2 +- Assets/Scenes/MainMenu.unity | 231 ++++++++++++++++++ .../AccountMenu/AccountChangePassword.cs | 5 +- .../AccountMenu/AccountChangeUsername.cs | 5 +- Assets/Scripts/AccountMenu/AccountLoggedIn.cs | 11 +- .../Scripts/AccountMenu/AccountLoggedOut.cs | 2 +- Assets/Scripts/AccountMenu/AccountLogin.cs | 7 +- .../AccountMenu/AccountRefreshLogin.cs | 7 +- Assets/Scripts/AccountMenu/AccountRegister.cs | 5 +- Assets/Scripts/BouncyPanel.cs | 15 ++ Assets/Scripts/BouncyPanel.cs.meta | 2 + Assets/Scripts/ChatroomMenu.cs | 15 +- Assets/Scripts/DraggableUI.cs | 3 +- Assets/Scripts/EncryptedWWWForm.cs | 5 +- Assets/Scripts/GamePlayer.cs | 18 +- Assets/Scripts/IconsMenuBirdColorPanel.cs | 4 +- Assets/Scripts/IconsMenuOverlayColorPanel.cs | 4 +- Assets/Scripts/IgnoreRaycast.cs | 2 +- Assets/Scripts/LeaderboardsMenu.cs | 17 +- Assets/Scripts/LoadingMenu.cs | 3 +- Assets/Scripts/MainMenu.cs | 2 + Assets/Scripts/SensitiveInfo.cs | 5 + Assets/Scripts/SettingsMenuBgColorPanel.cs | 4 +- 23 files changed, 338 insertions(+), 36 deletions(-) create mode 100644 Assets/Scripts/BouncyPanel.cs create mode 100644 Assets/Scripts/BouncyPanel.cs.meta diff --git a/.vscode/settings.json b/.vscode/settings.json index 3f4a4bb..3902526 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -66,5 +66,5 @@ "explorer.fileNesting.patterns": { "*.sln": "*.csproj" }, - "dotnet.defaultSolution": "BerryDash-source.sln" + "dotnet.defaultSolution": "BerryDash-src.sln" } \ No newline at end of file diff --git a/Assets/Scenes/MainMenu.unity b/Assets/Scenes/MainMenu.unity index 2a24d4f..3a73788 100644 --- a/Assets/Scenes/MainMenu.unity +++ b/Assets/Scenes/MainMenu.unity @@ -119,6 +119,143 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &31289686 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 31289687} + - component: {fileID: 31289689} + - component: {fileID: 31289688} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &31289687 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 31289686} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 603486473} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &31289688 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 31289686} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: You are on a self-built instance of the game. You will not be able to access + any server endpoints as a result. + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 4fd546dd0900395408d2de20f5025882, type: 2} + m_sharedMaterial: {fileID: -1476194838487357290, guid: 4fd546dd0900395408d2de20f5025882, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 24 + m_fontSizeBase: 24 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &31289689 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 31289686} + m_CullTransparentMesh: 1 --- !u!1 &40776219 GameObject: m_ObjectHideFlags: 0 @@ -1163,6 +1300,99 @@ MonoBehaviour: exitButton: {fileID: 1354600018} updateText: {fileID: 673338280} updateButton: {fileID: 1292044491} + selfBuiltPanel: {fileID: 603486472} +--- !u!1 &603486472 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 603486473} + - component: {fileID: 603486475} + - component: {fileID: 603486474} + - component: {fileID: 603486476} + m_Layer: 5 + m_Name: SelfBuiltPanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &603486473 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 603486472} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 31289687} + m_Father: {fileID: 1263503583} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: -170, y: 107.5} + m_SizeDelta: {x: 300, y: 175} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &603486474 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 603486472} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.28235295, g: 0.28235295, b: 0.28235295, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &603486475 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 603486472} + m_CullTransparentMesh: 1 +--- !u!114 &603486476 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 603486472} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9c3738bf0236e043c9bdf9972b8a7375, type: 3} + m_Name: + m_EditorClassIdentifier: + frequency: 8 + minSize: 1 + maxSize: 1.1 --- !u!1 &673338277 GameObject: m_ObjectHideFlags: 0 @@ -2157,6 +2387,7 @@ RectTransform: - {fileID: 1401523578} - {fileID: 673338278} - {fileID: 989689724} + - {fileID: 603486473} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} diff --git a/Assets/Scripts/AccountMenu/AccountChangePassword.cs b/Assets/Scripts/AccountMenu/AccountChangePassword.cs index 38dd412..3d8da7f 100644 --- a/Assets/Scripts/AccountMenu/AccountChangePassword.cs +++ b/Assets/Scripts/AccountMenu/AccountChangePassword.cs @@ -61,6 +61,9 @@ public class AccountChangePassword : MonoBehaviour case "-997": AccountHandler.UpdateStatusText(changePasswordStatusText, "Encryption/decryption issues", Color.red); break; + case "-996": + AccountHandler.UpdateStatusText(changePasswordStatusText, "Can't send requests on self-built instance", Color.red); + break; case "-1": AccountHandler.UpdateStatusText(changePasswordStatusText, "New Password is too short or too long", Color.red); break; @@ -88,4 +91,4 @@ public class AccountChangePassword : MonoBehaviour AccountHandler.UpdateStatusText(changePasswordStatusText, "Unknown server response " + response, Color.red); } } -} +} \ No newline at end of file diff --git a/Assets/Scripts/AccountMenu/AccountChangeUsername.cs b/Assets/Scripts/AccountMenu/AccountChangeUsername.cs index 3ac869b..b548709 100644 --- a/Assets/Scripts/AccountMenu/AccountChangeUsername.cs +++ b/Assets/Scripts/AccountMenu/AccountChangeUsername.cs @@ -53,6 +53,9 @@ public class AccountChangeUsername : MonoBehaviour case "-997": AccountHandler.UpdateStatusText(changeUsernameStatusText, "Encryption/decryption issues", Color.red); break; + case "-996": + AccountHandler.UpdateStatusText(changeUsernameStatusText, "Can't send requests on self-built instance", Color.red); + break; case "1": PlayerPrefs.SetString("userName", changeUsernameNewUsernameInput.text); AccountHandler.instance.SwitchPanel(0); @@ -73,4 +76,4 @@ public class AccountChangeUsername : MonoBehaviour break; } } -} +} \ No newline at end of file diff --git a/Assets/Scripts/AccountMenu/AccountLoggedIn.cs b/Assets/Scripts/AccountMenu/AccountLoggedIn.cs index 897ceb5..342509f 100644 --- a/Assets/Scripts/AccountMenu/AccountLoggedIn.cs +++ b/Assets/Scripts/AccountMenu/AccountLoggedIn.cs @@ -23,7 +23,8 @@ public class AccountLoggedIn : MonoBehaviour loggedInSaveButton.onClick.AddListener(() => SaveAccount()); loggedInLoadButton.onClick.AddListener(() => LoadAccount()); loggedInRefreshLoginButton.onClick.AddListener(() => AccountHandler.instance.SwitchPanel(6)); - loggedInLogoutButton.onClick.AddListener(() => { + loggedInLogoutButton.onClick.AddListener(() => + { accountLoggedOut.clearValues = true; AccountHandler.instance.SwitchPanel(1); }); @@ -81,6 +82,9 @@ public class AccountLoggedIn : MonoBehaviour case "-997": AccountHandler.UpdateStatusText(loggedInText, "Encryption/decryption issues", Color.red); break; + case "-996": + AccountHandler.UpdateStatusText(loggedInText, "Can't send requests on self-built instance", Color.red); + break; case "1": AccountHandler.UpdateStatusText(loggedInText, "Synced account", Color.green); break; @@ -124,6 +128,9 @@ public class AccountLoggedIn : MonoBehaviour case "-997": AccountHandler.UpdateStatusText(loggedInText, "Encryption/decryption issues", Color.red); break; + case "-996": + AccountHandler.UpdateStatusText(loggedInText, "Can't send requests on self-built instance", Color.red); + break; case "-1": AccountHandler.UpdateStatusText(loggedInText, "Failed to find info about your user (refresh login?)", Color.red); break; @@ -153,4 +160,4 @@ public class AccountLoggedIn : MonoBehaviour loggedInLoadButton.interactable = true; loggedInSaveButton.interactable = true; } -} +} \ No newline at end of file diff --git a/Assets/Scripts/AccountMenu/AccountLoggedOut.cs b/Assets/Scripts/AccountMenu/AccountLoggedOut.cs index 6d08ed2..e96e51d 100644 --- a/Assets/Scripts/AccountMenu/AccountLoggedOut.cs +++ b/Assets/Scripts/AccountMenu/AccountLoggedOut.cs @@ -37,4 +37,4 @@ public class AccountLoggedOut : MonoBehaviour clearValues = false; } } -} +} \ No newline at end of file diff --git a/Assets/Scripts/AccountMenu/AccountLogin.cs b/Assets/Scripts/AccountMenu/AccountLogin.cs index c272ee5..b6ac08f 100644 --- a/Assets/Scripts/AccountMenu/AccountLogin.cs +++ b/Assets/Scripts/AccountMenu/AccountLogin.cs @@ -58,6 +58,11 @@ public class AccountLogin : MonoBehaviour AccountHandler.UpdateStatusText(loginPanelStatusText, "Encryption/decryption issues", Color.red); return; } + else if (response == "-996") + { + AccountHandler.UpdateStatusText(loginPanelStatusText, "Can't send requests on self-built instance", Color.red); + return; + } else if (response == "-1") { AccountHandler.UpdateStatusText(loginPanelStatusText, "Incorrect username or password", Color.red); @@ -93,4 +98,4 @@ public class AccountLogin : MonoBehaviour AccountHandler.UpdateStatusText(loginPanelStatusText, "Unknown server response", Color.red); } } -} +} \ No newline at end of file diff --git a/Assets/Scripts/AccountMenu/AccountRefreshLogin.cs b/Assets/Scripts/AccountMenu/AccountRefreshLogin.cs index 70259c0..cda5704 100644 --- a/Assets/Scripts/AccountMenu/AccountRefreshLogin.cs +++ b/Assets/Scripts/AccountMenu/AccountRefreshLogin.cs @@ -55,6 +55,11 @@ public class AccountRefreshLogin : MonoBehaviour AccountHandler.UpdateStatusText(refreshLoginStatusText, "Encryption/decryption issues", Color.red); return; } + else if (response == "-996") + { + AccountHandler.UpdateStatusText(refreshLoginStatusText, "Can't send requests on self-built instance", Color.red); + return; + } else if (response == "-1") { AccountHandler.UpdateStatusText(refreshLoginStatusText, "Incorrect username or password", Color.red); @@ -76,4 +81,4 @@ public class AccountRefreshLogin : MonoBehaviour AccountHandler.UpdateStatusText(refreshLoginStatusText, "Unknown server response", Color.red); } } -} +} \ No newline at end of file diff --git a/Assets/Scripts/AccountMenu/AccountRegister.cs b/Assets/Scripts/AccountMenu/AccountRegister.cs index a442aea..132d953 100644 --- a/Assets/Scripts/AccountMenu/AccountRegister.cs +++ b/Assets/Scripts/AccountMenu/AccountRegister.cs @@ -75,6 +75,9 @@ public class AccountRegister : MonoBehaviour case "-997": AccountHandler.UpdateStatusText(registerPanelStatusText, "Encryption/decryption issues", Color.red); break; + case "-996": + AccountHandler.UpdateStatusText(registerPanelStatusText, "Can't send requests on self-built instance", Color.red); + break; case "1": AccountHandler.instance.SwitchPanel(2); break; @@ -95,4 +98,4 @@ public class AccountRegister : MonoBehaviour break; } } -} +} \ No newline at end of file diff --git a/Assets/Scripts/BouncyPanel.cs b/Assets/Scripts/BouncyPanel.cs new file mode 100644 index 0000000..670718e --- /dev/null +++ b/Assets/Scripts/BouncyPanel.cs @@ -0,0 +1,15 @@ +using UnityEngine; + +public class BouncyPanel : MonoBehaviour +{ + public float frequency = 8f; + public float minSize = 1f; + public float maxSize = 1.1f; + + void Update() + { + float newsize = (Mathf.Sin(Time.time * frequency) + 1f) / 2f; + var size = Mathf.Lerp(minSize, maxSize, newsize); + gameObject.transform.localScale = new(size, size, size); + } +} \ No newline at end of file diff --git a/Assets/Scripts/BouncyPanel.cs.meta b/Assets/Scripts/BouncyPanel.cs.meta new file mode 100644 index 0000000..a3130cc --- /dev/null +++ b/Assets/Scripts/BouncyPanel.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9c3738bf0236e043c9bdf9972b8a7375 \ No newline at end of file diff --git a/Assets/Scripts/ChatroomMenu.cs b/Assets/Scripts/ChatroomMenu.cs index 7ad4a85..64510b3 100644 --- a/Assets/Scripts/ChatroomMenu.cs +++ b/Assets/Scripts/ChatroomMenu.cs @@ -35,8 +35,10 @@ public class ChatroomMenu : MonoBehaviour refreshLoopRoutine = StartCoroutine(Loop()); } - IEnumerator Loop() { - while (true) { + IEnumerator Loop() + { + while (true) + { Refresh(); yield return new WaitForSeconds(3f); } @@ -76,6 +78,9 @@ public class ChatroomMenu : MonoBehaviour case "-997": ShowStatus("Encryption/decryption issues"); break; + case "-996": + ShowStatus("Can't send requests on self-built instance"); + break; case "-1": ShowStatus("Authentication error"); break; @@ -150,6 +155,9 @@ public class ChatroomMenu : MonoBehaviour case "-997": ShowStatus("Encryption/decryption issues"); break; + case "-996": + ShowStatus("Can't send requests on self-built instance"); + break; default: var split = response.Split(':'); if (split[0] == "1") @@ -215,7 +223,8 @@ public class ChatroomMenu : MonoBehaviour { playerIcon.color = new Color32(byte.Parse(birdR), byte.Parse(birdG), byte.Parse(birdB), 255); playerOverlayIcon.color = new Color32(byte.Parse(overlayR), byte.Parse(overlayG), byte.Parse(overlayB), 255); - } catch (Exception) + } + catch (Exception) { playerIcon.color = Color.white; playerOverlayIcon.color = Color.white; diff --git a/Assets/Scripts/DraggableUI.cs b/Assets/Scripts/DraggableUI.cs index cc0de69..d7571ea 100644 --- a/Assets/Scripts/DraggableUI.cs +++ b/Assets/Scripts/DraggableUI.cs @@ -1,6 +1,5 @@ using UnityEngine; using UnityEngine.EventSystems; -using TMPro; using UnityEngine.UI; using System.Collections.Generic; @@ -100,4 +99,4 @@ public class DraggableUI : MonoBehaviour, IDragHandler, IBeginDragHandler result = Vector3.zero; return false; } -} +} \ No newline at end of file diff --git a/Assets/Scripts/EncryptedWWWForm.cs b/Assets/Scripts/EncryptedWWWForm.cs index 331a75c..0540bfb 100644 --- a/Assets/Scripts/EncryptedWWWForm.cs +++ b/Assets/Scripts/EncryptedWWWForm.cs @@ -6,8 +6,9 @@ public class EncryptedWWWForm public void AddField(string key, string value) { - form.AddField(SensitiveInfo.Encrypt(key, SensitiveInfo.SERVER_SEND_TRANSFER_KEY), SensitiveInfo.Encrypt(value, SensitiveInfo.SERVER_SEND_TRANSFER_KEY)); + if (SensitiveInfo.SERVER_RECEIVE_TRANSFER_KEY.Trim() != string.Empty && SensitiveInfo.SERVER_SEND_TRANSFER_KEY.Trim() != string.Empty) + form.AddField(SensitiveInfo.Encrypt(key, SensitiveInfo.SERVER_SEND_TRANSFER_KEY), SensitiveInfo.Encrypt(value, SensitiveInfo.SERVER_SEND_TRANSFER_KEY)); } public WWWForm GetWWWForm() => form; -} +} \ No newline at end of file diff --git a/Assets/Scripts/GamePlayer.cs b/Assets/Scripts/GamePlayer.cs index 58803ca..68c8256 100644 --- a/Assets/Scripts/GamePlayer.cs +++ b/Assets/Scripts/GamePlayer.cs @@ -48,19 +48,19 @@ public class GamePlayer : MonoBehaviour try { Camera.main.backgroundColor = new Color( - int.Parse(backgroundColor[0])/255f, - int.Parse(backgroundColor[1])/255f, - int.Parse(backgroundColor[2])/255f + int.Parse(backgroundColor[0]) / 255f, + int.Parse(backgroundColor[1]) / 255f, + int.Parse(backgroundColor[2]) / 255f ); bird.GetComponent().color = new Color( - int.Parse(birdColor[0])/255f, - int.Parse(birdColor[1])/255f, - int.Parse(birdColor[2])/255f + int.Parse(birdColor[0]) / 255f, + int.Parse(birdColor[1]) / 255f, + int.Parse(birdColor[2]) / 255f ); bird.transform.GetChild(0).GetComponent().color = new Color( - int.Parse(overlayColor[0])/255f, - int.Parse(overlayColor[1])/255f, - int.Parse(overlayColor[2])/255f + int.Parse(overlayColor[0]) / 255f, + int.Parse(overlayColor[1]) / 255f, + int.Parse(overlayColor[2]) / 255f ); } catch diff --git a/Assets/Scripts/IconsMenuBirdColorPanel.cs b/Assets/Scripts/IconsMenuBirdColorPanel.cs index 2089c54..c2cb2c5 100644 --- a/Assets/Scripts/IconsMenuBirdColorPanel.cs +++ b/Assets/Scripts/IconsMenuBirdColorPanel.cs @@ -53,10 +53,10 @@ public class IconsMenuBirdColorPanel : MonoBehaviour void SlidersChanged() { - var col = new Color(rSlider.value/255f, gSlider.value/255f, bSlider.value/255f); + var col = new Color(rSlider.value / 255f, gSlider.value / 255f, bSlider.value / 255f); previewImage.color = col; hexValue.SetTextWithoutNotify($"#{ColorUtility.ToHtmlStringRGB(col)}"); PlayerPrefs.SetString("BirdColor", $"{(int)rSlider.value};{(int)gSlider.value};{(int)bSlider.value}"); PlayerPrefs.Save(); } -} +} \ No newline at end of file diff --git a/Assets/Scripts/IconsMenuOverlayColorPanel.cs b/Assets/Scripts/IconsMenuOverlayColorPanel.cs index 96cb3a4..08df75d 100644 --- a/Assets/Scripts/IconsMenuOverlayColorPanel.cs +++ b/Assets/Scripts/IconsMenuOverlayColorPanel.cs @@ -53,10 +53,10 @@ public class IconsMenuOverlayColorPanel : MonoBehaviour void SlidersChanged() { - var col = new Color(rSlider.value/255f, gSlider.value/255f, bSlider.value/255f); + var col = new Color(rSlider.value / 255f, gSlider.value / 255f, bSlider.value / 255f); previewImage.color = col; hexValue.SetTextWithoutNotify($"#{ColorUtility.ToHtmlStringRGB(col)}"); PlayerPrefs.SetString("OverlayColor", $"{(int)rSlider.value};{(int)gSlider.value};{(int)bSlider.value}"); PlayerPrefs.Save(); } -} +} \ No newline at end of file diff --git a/Assets/Scripts/IgnoreRaycast.cs b/Assets/Scripts/IgnoreRaycast.cs index 816edfc..eb7de47 100644 --- a/Assets/Scripts/IgnoreRaycast.cs +++ b/Assets/Scripts/IgnoreRaycast.cs @@ -3,4 +3,4 @@ using UnityEngine; public class IgnoreRaycast : MonoBehaviour, ICanvasRaycastFilter { public bool IsRaycastLocationValid(Vector2 sp, Camera eventCamera) => false; -} +} \ No newline at end of file diff --git a/Assets/Scripts/LeaderboardsMenu.cs b/Assets/Scripts/LeaderboardsMenu.cs index 56bdbfb..872f1c5 100644 --- a/Assets/Scripts/LeaderboardsMenu.cs +++ b/Assets/Scripts/LeaderboardsMenu.cs @@ -45,7 +45,8 @@ public class LeaderboardsMenu : MonoBehaviour }); } - void SwitchMenu(int menu) { + void SwitchMenu(int menu) + { UpdateStatus(false, ""); foreach (Transform item in scoreContent.transform) { @@ -125,6 +126,10 @@ public class LeaderboardsMenu : MonoBehaviour { UpdateStatus(true, "Encryption/decryption issues"); } + else if (response == "-996") + { + UpdateStatus(true, "Can't send requests on self-built instance"); + } else if (response == "-1") { UpdateStatus(true, "No entries for this leaderboard found!"); @@ -182,7 +187,8 @@ public class LeaderboardsMenu : MonoBehaviour { playerIcon.color = new Color32(byte.Parse(birdR), byte.Parse(birdG), byte.Parse(birdB), 255); playerOverlayIcon.color = new Color32(byte.Parse(overlayR), byte.Parse(overlayG), byte.Parse(overlayB), 255); - } catch (Exception) + } + catch (Exception) { playerIcon.color = Color.white; playerOverlayIcon.color = Color.white; @@ -236,6 +242,10 @@ public class LeaderboardsMenu : MonoBehaviour { UpdateStatus(true, "Encryption/decryption issues"); } + else if (response == "-996") + { + UpdateStatus(true, "Can't send requests on self-built instance"); + } else if (response == "-1") { UpdateStatus(true, "No entries for this leaderboard found!"); @@ -293,7 +303,8 @@ public class LeaderboardsMenu : MonoBehaviour { playerIcon.color = new Color32(byte.Parse(birdR), byte.Parse(birdG), byte.Parse(birdB), 255); playerOverlayIcon.color = new Color32(byte.Parse(overlayR), byte.Parse(overlayG), byte.Parse(overlayB), 255); - } catch (Exception) + } + catch (Exception) { playerIcon.color = Color.white; playerOverlayIcon.color = Color.white; diff --git a/Assets/Scripts/LoadingMenu.cs b/Assets/Scripts/LoadingMenu.cs index 6a9638f..1f7213e 100644 --- a/Assets/Scripts/LoadingMenu.cs +++ b/Assets/Scripts/LoadingMenu.cs @@ -43,7 +43,8 @@ public class LoadingMenu : MonoBehaviour SetIfNone("Setting4", 0); Application.targetFrameRate = 360; QualitySettings.vSyncCount = 0; - if (Application.platform == RuntimePlatform.WebGLPlayer) { + if (Application.platform == RuntimePlatform.WebGLPlayer) + { Screen.fullScreen = false; } } diff --git a/Assets/Scripts/MainMenu.cs b/Assets/Scripts/MainMenu.cs index bcec399..8246635 100644 --- a/Assets/Scripts/MainMenu.cs +++ b/Assets/Scripts/MainMenu.cs @@ -7,6 +7,7 @@ public class MenuScript : MonoBehaviour public Button exitButton; public TMP_Text updateText; public Button updateButton; + public GameObject selfBuiltPanel; void Awake() { @@ -25,5 +26,6 @@ public class MenuScript : MonoBehaviour Application.Quit(); }); } + if (SensitiveInfo.SERVER_RECEIVE_TRANSFER_KEY.Trim() == string.Empty || SensitiveInfo.SERVER_SEND_TRANSFER_KEY.Trim() == string.Empty) selfBuiltPanel.SetActive(true); } } \ No newline at end of file diff --git a/Assets/Scripts/SensitiveInfo.cs b/Assets/Scripts/SensitiveInfo.cs index 2272604..10802a4 100644 --- a/Assets/Scripts/SensitiveInfo.cs +++ b/Assets/Scripts/SensitiveInfo.cs @@ -12,6 +12,7 @@ public class SensitiveInfo public static string Encrypt(string plainText, string key) { + if (SERVER_RECEIVE_TRANSFER_KEY.Trim() == string.Empty || SERVER_SEND_TRANSFER_KEY.Trim() == string.Empty) return null; try { using Aes aes = Aes.Create(); @@ -40,6 +41,10 @@ public class SensitiveInfo public static string Decrypt(string dataB64, string key) { + if (SERVER_RECEIVE_TRANSFER_KEY.Trim() == string.Empty || SERVER_SEND_TRANSFER_KEY.Trim() == string.Empty) + { + return "-996"; + } try { var data = Convert.FromBase64String(dataB64); diff --git a/Assets/Scripts/SettingsMenuBgColorPanel.cs b/Assets/Scripts/SettingsMenuBgColorPanel.cs index dbcb477..3f593c9 100644 --- a/Assets/Scripts/SettingsMenuBgColorPanel.cs +++ b/Assets/Scripts/SettingsMenuBgColorPanel.cs @@ -53,10 +53,10 @@ public class SettingsMenuBgColorPanel : MonoBehaviour void SlidersChanged() { - var col = new Color(rSlider.value/255f, gSlider.value/255f, bSlider.value/255f); + var col = new Color(rSlider.value / 255f, gSlider.value / 255f, bSlider.value / 255f); previewImage.color = col; hexValue.SetTextWithoutNotify($"#{ColorUtility.ToHtmlStringRGB(col)}"); PlayerPrefs.SetString("BackgroundColor", $"{(int)rSlider.value};{(int)gSlider.value};{(int)bSlider.value}"); PlayerPrefs.Save(); } -} +} \ No newline at end of file