From a312a489a3d637a2ff4bd51c3463ae7a1957bcf1 Mon Sep 17 00:00:00 2001 From: Balex123 Date: Tue, 14 Mar 2023 09:04:31 +0100 Subject: [PATCH] upd buttons done. dadwads --- Assets/Scripts/SaveLoad.cs | 37 +++++++++++++++++++------- UserSettings/EditorUserSettings.asset | 4 +-- UserSettings/Layouts/default-2021.dwlt | 24 ++++++++--------- 3 files changed, 41 insertions(+), 24 deletions(-) diff --git a/Assets/Scripts/SaveLoad.cs b/Assets/Scripts/SaveLoad.cs index bd87aad..031bffc 100644 --- a/Assets/Scripts/SaveLoad.cs +++ b/Assets/Scripts/SaveLoad.cs @@ -1,18 +1,35 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; +using System; +using System.IO; +using System.Runtime.Serialization.Formatters.Binary; -public class SaveLoad : MonoBehaviour +// Example class to save and load +[Serializable] +class PlayerData { - // Start is called before the first frame update - void Start() + public int score; + public string name; +} + +class SaveLoad +{ + // Save method + public void Save(PlayerData data, string fileName) { - + BinaryFormatter formatter = new BinaryFormatter(); + using (FileStream stream = new FileStream(fileName, FileMode.Create)) + { + formatter.Serialize(stream, data); + } } - // Update is called once per frame - void Update() + // Load method + public PlayerData Load(string fileName) { - + BinaryFormatter formatter = new BinaryFormatter(); + using (FileStream stream = new FileStream(fileName, FileMode.Open)) + { + return (PlayerData)formatter.Deserialize(stream); + } } } + diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index 5e8ab6e..4faaff8 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -12,10 +12,10 @@ EditorUserSettings: value: 0508030352075a085a565a7b41200f44431619287e2925342e2f1b6ae3b86439 flags: 0 RecentlyUsedSceneGuid-2: - value: 02095251535050595d5e0f2311735c44124f1c2e7b7077667f7e4560b7b3306b + value: 50545254560458595a5e0e7748215d4442161e7e7b2e22342e2c4866b6b4376a flags: 0 RecentlyUsedSceneGuid-3: - value: 50545254560458595a5e0e7748215d4442161e7e7b2e22342e2c4866b6b4376a + value: 02095251535050595d5e0f2311735c44124f1c2e7b7077667f7e4560b7b3306b flags: 0 vcSharedLogLevel: value: 0d5e400f0650 diff --git a/UserSettings/Layouts/default-2021.dwlt b/UserSettings/Layouts/default-2021.dwlt index 5380f9a..8d181b9 100644 --- a/UserSettings/Layouts/default-2021.dwlt +++ b/UserSettings/Layouts/default-2021.dwlt @@ -19,7 +19,7 @@ MonoBehaviour: width: 1536 height: 780.8 m_ShowMode: 4 - m_Title: Game + m_Title: Hierarchy m_RootView: {fileID: 2} m_MinSize: {x: 875, y: 350} m_MaxSize: {x: 10000, y: 10000} @@ -120,7 +120,7 @@ MonoBehaviour: m_MinSize: {x: 300, y: 200} m_MaxSize: {x: 24288, y: 16192} vertical: 0 - controlID: 97 + controlID: 27 --- !u!114 &6 MonoBehaviour: m_ObjectHideFlags: 52 @@ -171,7 +171,7 @@ MonoBehaviour: m_MinSize: {x: 100, y: 200} m_MaxSize: {x: 8096, y: 16192} vertical: 1 - controlID: 98 + controlID: 55 --- !u!114 &8 MonoBehaviour: m_ObjectHideFlags: 52 @@ -318,7 +318,7 @@ MonoBehaviour: m_HSlider: 0 m_VSlider: 0 m_IgnoreScrollWheelUntilClicked: 0 - m_EnableMouseInput: 0 + m_EnableMouseInput: 1 m_EnableSliderZoomHorizontal: 0 m_EnableSliderZoomVertical: 0 m_UniformScale: 1 @@ -380,9 +380,9 @@ MonoBehaviour: m_SceneHierarchy: m_TreeViewState: scrollPos: {x: 0, y: 0} - m_SelectedIDs: - m_LastClickedID: 0 - m_ExpandedIDs: 28fbffff + m_SelectedIDs: 68860000 + m_LastClickedID: 34408 + m_ExpandedIDs: a6caffffc6cbfffffacbffff9ecdffffa6cdffff1cceffff9cdbffffeedbffff28fbffff6c62000080620000a0620000a4620000b8680000ec68000030690000c26a0000d66a0000f66a0000fa6a0000b8850000cc850000 m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -847,7 +847,7 @@ MonoBehaviour: m_LockTracker: m_IsLocked: 0 m_FolderTreeState: - scrollPos: {x: 0, y: 68.600006} + scrollPos: {x: 0, y: 60} m_SelectedIDs: b2640000 m_LastClickedID: 25778 m_ExpandedIDs: 000000009a6400009c6400009e640000a064000000ca9a3bffffff7f @@ -905,7 +905,7 @@ MonoBehaviour: m_ListAreaState: m_SelectedInstanceIDs: m_LastClickedInstanceID: 0 - m_HadKeyboardFocusLastEvent: 0 + m_HadKeyboardFocusLastEvent: 1 m_ExpandedInstanceIDs: c623000000000000 m_RenameOverlay: m_UserAcceptedRename: 0 @@ -922,7 +922,7 @@ MonoBehaviour: m_IsRenaming: 0 m_OriginalEventType: 11 m_IsRenamingFilename: 1 - m_ClientGUIView: {fileID: 9} + m_ClientGUIView: {fileID: 10} m_CreateAssetUtility: m_EndAction: {fileID: 0} m_InstanceID: 0 @@ -1090,9 +1090,9 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 1153.6 + x: 1177.6 y: 73.6 - width: 381.40002 + width: 357.40002 height: 709.8 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: