diff --git a/.idea/.idea.Dontback/.idea/vcs.xml b/.idea/.idea.Dontback/.idea/vcs.xml index d843f34..94a25f7 100644 --- a/.idea/.idea.Dontback/.idea/vcs.xml +++ b/.idea/.idea.Dontback/.idea/vcs.xml @@ -1,4 +1,6 @@ - + + + \ No newline at end of file diff --git a/Assets/Scripts/Data.meta b/Assets/Scripts/Data.meta new file mode 100644 index 0000000..3b1fc3c --- /dev/null +++ b/Assets/Scripts/Data.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3157b26b247048edabb8d3813d750ae5 +timeCreated: 1726032247 \ No newline at end of file diff --git a/Assets/Scripts/Data/DialogData.cs b/Assets/Scripts/Data/DialogData.cs new file mode 100644 index 0000000..4a0a303 --- /dev/null +++ b/Assets/Scripts/Data/DialogData.cs @@ -0,0 +1,5 @@ +public struct DialogData +{ + public int index; + public string content; +} \ No newline at end of file diff --git a/Assets/Scripts/Data/DialogData.cs.meta b/Assets/Scripts/Data/DialogData.cs.meta new file mode 100644 index 0000000..13082e5 --- /dev/null +++ b/Assets/Scripts/Data/DialogData.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7db3fb11d36041c5adeba19179fb8f80 +timeCreated: 1726032238 \ No newline at end of file diff --git a/Assets/Scripts/Event/EventArgs/DialogPopArgs.cs b/Assets/Scripts/Event/EventArgs/DialogPopArgs.cs new file mode 100644 index 0000000..44bd664 --- /dev/null +++ b/Assets/Scripts/Event/EventArgs/DialogPopArgs.cs @@ -0,0 +1,12 @@ +namespace Event.EventArgs +{ + public class DialogPopArgs : System.EventArgs + { + public int Index { get; private set; } + + public DialogPopArgs(int index) + { + Index = index; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Event/EventArgs/DialogPopArgs.cs.meta b/Assets/Scripts/Event/EventArgs/DialogPopArgs.cs.meta new file mode 100644 index 0000000..ad073b5 --- /dev/null +++ b/Assets/Scripts/Event/EventArgs/DialogPopArgs.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 29958321a8bd415ab793cc37deb6a859 +timeCreated: 1726033413 \ No newline at end of file diff --git a/Assets/Scripts/Event/EventHandler/DialogPopHandler.cs b/Assets/Scripts/Event/EventHandler/DialogPopHandler.cs new file mode 100644 index 0000000..5c91d02 --- /dev/null +++ b/Assets/Scripts/Event/EventHandler/DialogPopHandler.cs @@ -0,0 +1,6 @@ +using Event.EventArgs; + +namespace Event.EventHandler +{ + public delegate void DialogPopHandler(DialogPopArgs e); +} \ No newline at end of file diff --git a/Assets/Scripts/Event/EventHandler/DialogPopHandler.cs.meta b/Assets/Scripts/Event/EventHandler/DialogPopHandler.cs.meta new file mode 100644 index 0000000..8ee501f --- /dev/null +++ b/Assets/Scripts/Event/EventHandler/DialogPopHandler.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4803bc41d6fa4ae884b015a21124459e +timeCreated: 1726033554 \ No newline at end of file diff --git a/Assets/Scripts/Event/EventManager.cs b/Assets/Scripts/Event/EventManager.cs index f17a899..cced184 100644 --- a/Assets/Scripts/Event/EventManager.cs +++ b/Assets/Scripts/Event/EventManager.cs @@ -33,10 +33,16 @@ namespace Event } public event CameraInterActHandler CameraInterAct; + public event DialogPopHandler DialogPop; public void OnCameraInterAct(GameObject item) { CameraInterAct?.Invoke(new CameraInterActArgs(item)); } + + public void OnDialogPop(int index) + { + DialogPop?.Invoke(new DialogPopArgs(index)); + } } } \ No newline at end of file diff --git a/Assets/Scripts/UI/Dialog.cs b/Assets/Scripts/UI/Dialog.cs new file mode 100644 index 0000000..7306e5e --- /dev/null +++ b/Assets/Scripts/UI/Dialog.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; +using System.IO; +using Event; +using Event.EventArgs; +using Newtonsoft.Json; +using UnityEngine; + +namespace UI +{ + public class Dialog : MonoBehaviour + { + [SerializeField] private string dialogsPath; + [SerializeField] private string dialogJson; + private Dictionary _dialogsMap = new(); + private void Awake() + { + dialogsPath = Application.persistentDataPath + "/" + "Dialogs.json"; + + if (File.Exists(dialogsPath)) + { + dialogJson = File.ReadAllText(dialogsPath); + _dialogsMap = JsonConvert.DeserializeObject>(dialogJson); + } + else + { + _dialogsMap.Add(0, "New Dialog"); + dialogJson = JsonConvert.SerializeObject(_dialogsMap, Formatting.Indented); + File.WriteAllText(dialogsPath, dialogJson); + } + } + + private void Start() + { + EventManager.Instance.DialogPop += OpenDialog; + } + + public void OpenDialog(DialogPopArgs e) + { + Debug.Log(_dialogsMap[e.Index]); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Dialog.cs.meta b/Assets/Scripts/UI/Dialog.cs.meta new file mode 100644 index 0000000..c163be5 --- /dev/null +++ b/Assets/Scripts/UI/Dialog.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 166525e51f1d41a2addfb1df626096fc +timeCreated: 1726032143 \ No newline at end of file diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index e3385cf..e9b3b32 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -12,7 +12,7 @@ PlayerSettings: targetDevice: 2 useOnDemandResources: 0 accelerometerFrequency: 60 - companyName: DefaultCompany + companyName: CrashWork productName: Dontback defaultCursor: {fileID: 0} cursorHotspot: {x: 0, y: 0} @@ -160,7 +160,8 @@ PlayerSettings: resetResolutionOnWindowResize: 0 androidSupportedAspectRatio: 1 androidMaxAspectRatio: 2.1 - applicationIdentifier: {} + applicationIdentifier: + Standalone: com.DefaultCompany.Dontback buildNumber: Standalone: 0 VisionOS: 0 @@ -647,7 +648,8 @@ PlayerSettings: scriptingDefineSymbols: {} additionalCompilerArguments: {} platformArchitecture: {} - scriptingBackend: {} + scriptingBackend: + Standalone: 1 il2cppCompilerConfiguration: {} il2cppCodeGeneration: {} managedStrippingLevel: