Tell the user why they can't send requests on self-built instance

This commit is contained in:
2025-06-30 14:38:45 -07:00
parent 68e61a9370
commit 0347dac2d8
23 changed files with 338 additions and 36 deletions

View File

@@ -66,5 +66,5 @@
"explorer.fileNesting.patterns": {
"*.sln": "*.csproj"
},
"dotnet.defaultSolution": "BerryDash-source.sln"
"dotnet.defaultSolution": "BerryDash-src.sln"
}

View File

@@ -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}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9c3738bf0236e043c9bdf9972b8a7375

View File

@@ -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;

View File

@@ -1,6 +1,5 @@
using UnityEngine;
using UnityEngine.EventSystems;
using TMPro;
using UnityEngine.UI;
using System.Collections.Generic;

View File

@@ -6,6 +6,7 @@ public class EncryptedWWWForm
public void AddField(string key, string value)
{
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));
}

View File

@@ -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<SpriteRenderer>().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<SpriteRenderer>().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

View File

@@ -53,7 +53,7 @@ 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}");

View File

@@ -53,7 +53,7 @@ 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}");

View File

@@ -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;

View File

@@ -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;
}
}

View File

@@ -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);
}
}

View File

@@ -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);

View File

@@ -53,7 +53,7 @@ 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}");