diff --git a/Assets/Prefabs/ProfilePrefab.prefab b/Assets/Prefabs/ProfilePrefab.prefab index ab9f94d..9c76d94 100644 --- a/Assets/Prefabs/ProfilePrefab.prefab +++ b/Assets/Prefabs/ProfilePrefab.prefab @@ -567,7 +567,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &8368811176025763002 RectTransform: m_ObjectHideFlags: 0 @@ -1593,9 +1593,9 @@ RectTransform: m_Children: [] m_Father: {fileID: 242819324179435233} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 50.86, y: -50} m_SizeDelta: {x: 48, y: 48} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &3309890639236200787 @@ -1850,6 +1850,174 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &2551384005879945101 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 625596639947847025} + - component: {fileID: 4142346164758905726} + - component: {fileID: 4286304792641013276} + - component: {fileID: 4768973558215590045} + - component: {fileID: 1113129045874585675} + m_Layer: 5 + m_Name: LoadingText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &625596639947847025 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2551384005879945101} + 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: 3287642628814459086} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4142346164758905726 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2551384005879945101} + m_CullTransparentMesh: 1 +--- !u!114 &4286304792641013276 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2551384005879945101} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI + 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: Loading... + 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: 72 + m_fontSizeBase: 72 + 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!114 &4768973558215590045 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2551384005879945101} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.ContentSizeFitter + m_HorizontalFit: 2 + m_VerticalFit: 2 +--- !u!114 &1113129045874585675 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2551384005879945101} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73b30df2b3a7144b99b75ce70168fd50, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::CustomColorObject + type: 4 + invert: 0 + addMore: {r: 0, g: 0, b: 0, a: 0} + reverseAdd: 0 --- !u!1 &2688381678350676326 GameObject: m_ObjectHideFlags: 0 @@ -2277,9 +2445,9 @@ RectTransform: - {fileID: 3698174834060150289} m_Father: {fileID: 5628154363262101591} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 30, y: -25} m_SizeDelta: {x: 60, y: 60} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &4127325867784585966 @@ -2353,9 +2521,9 @@ RectTransform: m_Children: [] m_Father: {fileID: 1925913610293912827} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 50.86, y: -50} m_SizeDelta: {x: 48, y: 48} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &7298268128332644082 @@ -2577,9 +2745,9 @@ RectTransform: m_Children: [] m_Father: {fileID: 5805357487255755339} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 50.86, y: -50} m_SizeDelta: {x: 48, y: 48} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &6027504448186360498 @@ -3179,7 +3347,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 1} m_AnchorMax: {x: 0.5, y: 1} m_AnchoredPosition: {x: 0, y: -50} - m_SizeDelta: {x: 0, y: 50} + m_SizeDelta: {x: 68, y: 50} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1722411672855024719 MonoBehaviour: @@ -3253,9 +3421,9 @@ RectTransform: m_Children: [] m_Father: {fileID: 92044167806702842} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 50.86, y: -50} m_SizeDelta: {x: 48, y: 48} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1442204634544771398 @@ -3344,6 +3512,8 @@ MonoBehaviour: exitButton: {fileID: 8878987061217506106} refreshButton: {fileID: 483407254128624561} postButton: {fileID: 874374191363029283} + contentPanel: {fileID: 555763578866773079} + loadingText: {fileID: 4286304792641013276} voteOverlay: {fileID: 4971733847332329152} postOverlay: {fileID: 4259143302822162687} normalBerryStat: {fileID: 5649262317103166116} @@ -4423,9 +4593,9 @@ RectTransform: m_Children: [] m_Father: {fileID: 5864059313227222951} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 50.86, y: -50} m_SizeDelta: {x: 48, y: 48} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &6876058801604657087 @@ -4564,9 +4734,9 @@ RectTransform: m_Children: [] m_Father: {fileID: 7678266279227986216} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 50.86, y: -50} m_SizeDelta: {x: 48, y: 48} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &2307739976294800139 @@ -6674,9 +6844,9 @@ RectTransform: m_Children: [] m_Father: {fileID: 8682910651610782189} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 50.86, y: -50} m_SizeDelta: {x: 48, y: 48} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &7080480991612920838 @@ -7205,6 +7375,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 8368811176025763002} + - {fileID: 625596639947847025} m_Father: {fileID: 3545702879385459921} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -8312,9 +8483,9 @@ RectTransform: m_Children: [] m_Father: {fileID: 3410158548209222622} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 50.86, y: -50} m_SizeDelta: {x: 48, y: 48} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &4724443559879950747 @@ -8540,9 +8711,9 @@ RectTransform: m_Children: [] m_Father: {fileID: 2697650154544868562} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 50.86, y: -50} m_SizeDelta: {x: 48, y: 48} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &7537753037660673815 diff --git a/Assets/Scripts/ProfileMenu.cs b/Assets/Scripts/ProfileMenu.cs index 76e9bef..1a31ea5 100644 --- a/Assets/Scripts/ProfileMenu.cs +++ b/Assets/Scripts/ProfileMenu.cs @@ -16,6 +16,8 @@ public class ProfileMenu : MonoBehaviour public Button refreshButton; public Button postButton; + public GameObject contentPanel; + public TMP_Text loadingText; public GameObject voteOverlay; public GameObject postOverlay; @@ -109,11 +111,73 @@ public class ProfileMenu : MonoBehaviour postButton.onClick.AddListener(UploadPostPopup); } + contentPanel.SetActive(true); + loadingText.gameObject.SetActive(false); + Tools.RefreshHierarchy(gameObject); refreshButton.onClick.AddListener(async () => await RefreshPosts(playerID, playerName)); await RefreshPosts(playerID, playerName); } + public async Task Init(BigInteger playerID) + { + EncryptedWWWForm dataForm = new(); + dataForm.AddField("uesrId", playerID.ToString()); + using UnityWebRequest request = UnityWebRequest.Post(SensitiveInfo.SERVER_DATABASE_PREFIX + "getAccountProfile.php", dataForm.form); + request.SetRequestHeader("Requester", "BerryDashClient"); + request.SetRequestHeader("ClientVersion", Application.version); + request.SetRequestHeader("ClientPlatform", Application.platform.ToString()); + await request.SendWebRequest(); + if (request.result != UnityWebRequest.Result.Success) + { + return; + } + string response = SensitiveInfo.Decrypt(request.downloadHandler.text, SensitiveInfo.SERVER_RECEIVE_TRANSFER_KEY); + var jsonResponse = JObject.Parse(response); + if ((bool)jsonResponse["success"]) + { + var totalNormalBerries = (string)jsonResponse["totalNormalBerries"]; + var totalPoisonBerries = (string)jsonResponse["totalPoisonBerries"]; + var totalSlowBerries = (string)jsonResponse["totalSlowBerries"]; + var totalUltraBerries = (string)jsonResponse["totalUltraBerries"]; + var totalSpeedyBerries = (string)jsonResponse["totalSpeedyBerries"]; + var totalCoinBerries = (string)jsonResponse["totalCoinBerries"]; + var totalRandomBerries = (string)jsonResponse["totalRandomBerries"]; + var totalAntiBerries = (string)jsonResponse["totalAntiBerries"]; + var coins = (string)jsonResponse["coins"]; + var name = (string)jsonResponse["name"]; + var icon = (int)jsonResponse["icon"]; + var overlay = (int)jsonResponse["overlay"]; + var customIcon = (string)jsonResponse["customIcon"]; + var playerIconColorArray = JArray.Parse(jsonResponse["playerIconColor"].ToString()); + var playerIconColor = new Color((int)playerIconColorArray[0] / 255f, (int)playerIconColorArray[1] / 255f, (int)playerIconColorArray[2] / 255f); + var playerOverlayColorArray = JArray.Parse(jsonResponse["playerOverlayColor"].ToString()); + var playerOverlayColor = new Color((int)playerOverlayColorArray[0] / 255f, (int)playerOverlayColorArray[1] / 255f, (int)playerOverlayColorArray[2] / 255f); + await Init( + totalNormalBerries, + totalPoisonBerries, + totalSlowBerries, + totalUltraBerries, + totalSpeedyBerries, + totalCoinBerries, + totalRandomBerries, + totalAntiBerries, + coins, + name, + playerID, + icon, + overlay, + customIcon, + playerIconColor, + playerOverlayColor + ); + } + else + { + Destroy(gameObject); + } + } + async Task RefreshPosts(BigInteger playerID, string playerName) { exitButton.interactable = false;