diff --git a/Client/Assets/0_Scenes/Title.unity b/Client/Assets/0_Scenes/Title.unity index 3607111a..814c2539 100644 --- a/Client/Assets/0_Scenes/Title.unity +++ b/Client/Assets/0_Scenes/Title.unity @@ -132,6 +132,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 574026086} + - component: {fileID: 574026087} m_Layer: 0 m_Name: GameObject m_TagString: Untagged @@ -155,6 +156,18 @@ Transform: - {fileID: 1137523890} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &574026087 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 574026085} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f71dc23ac80b51f4087e4120eb7f7893, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &753435365 GameObject: m_ObjectHideFlags: 0 diff --git a/Client/Assets/1_Script/System/Crypto.cs b/Client/Assets/1_Script/System/Crypto.cs index d84510cb..b4214a98 100644 --- a/Client/Assets/1_Script/System/Crypto.cs +++ b/Client/Assets/1_Script/System/Crypto.cs @@ -27,10 +27,10 @@ public class Crypto : SingletonMonoBehaviour } //¾ÐÃàÇØÁ¦ - public string Decompress(string t) + public string Decompress(string text) { MemoryStream resultStream = new MemoryStream(); - byte[] buffer = Convert.FromBase64String(t); + byte[] buffer = Convert.FromBase64String(text); using (MemoryStream ms = new MemoryStream(buffer)) { @@ -48,10 +48,6 @@ public class Crypto : SingletonMonoBehaviour //¾Ïȣȭ public string Encrypto(string encrypt) { -//#if UNITY_EDITOR -// return encrypt; -//#endif - //Åë½Å ¾Ïȣȭ #region To Base64 byte[] b = Encoding.UTF8.GetBytes(encrypt); @@ -59,13 +55,6 @@ public class Crypto : SingletonMonoBehaviour #endregion #region Áß°£¿¡ °ª ³Ö±â - //for (int i = 0; i < encrypt.Length; i++) - //{ - // if ((i % 2).Equals(0)) - // { - // encrypt = encrypt.Insert(i, str[UnityEngine.Random.Range(0, str.Length)].ToString()); - // } - //} encrypt = encrypt.Insert(0, str[UnityEngine.Random.Range(0, str.Length)].ToString()); #endregion @@ -87,9 +76,6 @@ public class Crypto : SingletonMonoBehaviour //º¹È£È­ public string Decrypto(string cipherText) { -//#if UNITY_EDITOR -// return cipherText; -//#endif string decrypt = cipherText; decrypt = Decrypt(decrypt); @@ -108,13 +94,6 @@ public class Crypto : SingletonMonoBehaviour #region Áß°£¿¡ °ª ³Ö±â - //StringBuilder sb = new StringBuilder(); - //for (int i = 1; i < length; i += 2) - //{ - // sb.Append(decrypt[i]); - //} - //decrypt = sb.ToString(); - //Debug.Log(decrypt); decrypt = decrypt.Substring(1); #endregion @@ -128,14 +107,6 @@ public class Crypto : SingletonMonoBehaviour private const string vfanjlk32rknjvfsduik = "sldkfghqpwo!)($%+sr=g234"; private const string vbawrnois = "f9v#d9OV*1Unf*%v"; - private const string initVector = "dqu83e2g32;v"; - private const string passPhrase = "vwui3f876^289)^%"; - private const string v = "v3289y3f18793fewq2ljkhn"; - private const string p = "er12h93f2njk!*&#@"; - private const string iv12g34r = "cn932fr$809j@3r2lnk"; - private const string tehtrb231 = "3ft2%uijb3r128^sadljkfsuoi$8y2"; - private const string i567ijuyt = "vqnjk1389y!@#*&(T1d"; - private const string vetrg54 = "abv3123122tsdg3q2r12@#!@%fhe"; // This constant is used to determine the keysize of the encryption algorithm. private const int keysize = 256; @@ -252,9 +223,6 @@ public class Crypto : SingletonMonoBehaviour SHA256 sha = new SHA256Managed(); public string SHA256Hash(string data) { -//#if UNITY_EDITOR -// return data; -//#endif byte[] hash = sha.ComputeHash(Encoding.ASCII.GetBytes(data)); StringBuilder stringBuilder = new StringBuilder(); foreach (byte b in hash) diff --git a/Client/Assets/1_Script/System/Http.meta b/Client/Assets/1_Script/System/Http.meta new file mode 100644 index 00000000..12cbd3ff --- /dev/null +++ b/Client/Assets/1_Script/System/Http.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f8df93d61103e5b4581a1545472f691f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/1_Script/System/Http/Protocol.cs b/Client/Assets/1_Script/System/Http/Protocol.cs new file mode 100644 index 00000000..d1c7d19f --- /dev/null +++ b/Client/Assets/1_Script/System/Http/Protocol.cs @@ -0,0 +1,40 @@ +using BestHTTP; +using Newtonsoft.Json; +using System; + +public enum Protocol +{ + //0~100 Å×½ºÆ®¿ë ÇÁ·ÎÅäÄÝ + Test = 0, + AddUser = 1, + + + + + + Downlode = 100,//±âȹ µ¥ÀÌÅÍ ´Ù¿î·Îµå +} + +#region 100 : Downlode +public class DownlodeReq +{ + public string version { get; set; } + + public DownlodeReq() + { + version = Statics.version; + } +} + +public class DownlodeResp : Request +{ + private Protocol protocol = Protocol.Downlode; + public string data { get; set; } + public string version { get; set; } + + public void Request(Action onRequestFinished) + { + CreateRequest(protocol, onRequestFinished, new DownlodeReq(), HTTPMethods.Post, null); + } +} +#endregion \ No newline at end of file diff --git a/Client/Assets/1_Script/System/Http/Protocol.cs.meta b/Client/Assets/1_Script/System/Http/Protocol.cs.meta new file mode 100644 index 00000000..bbad50aa --- /dev/null +++ b/Client/Assets/1_Script/System/Http/Protocol.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 19f009aca03a5f549a2ee3c5d0fb5c22 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/1_Script/System/Request.cs b/Client/Assets/1_Script/System/Http/Request.cs similarity index 86% rename from Client/Assets/1_Script/System/Request.cs rename to Client/Assets/1_Script/System/Http/Request.cs index fe958ada..be5777c4 100644 --- a/Client/Assets/1_Script/System/Request.cs +++ b/Client/Assets/1_Script/System/Http/Request.cs @@ -5,6 +5,8 @@ using UnityEngine; public class Request { + public int status { get; set; } + private bool is_end = false; public bool get_id_end { get { return is_end; } } @@ -19,9 +21,9 @@ public class Request /// ¾Ïº¹È£È­ ÇÒ °ÍÀÎÁö /// ¿ªÁ÷·ÄÈ­µÈ µ¥ÀÌÅÍ or ±âº»°ª(¹Ýȯ ¹ÞÁö ¸øÇÔ) /// Json¿¡·¯°¡ ¹ß»ýÇÒ°æ¿ì packageManager > + > add package by name > name : com.unity.nuget.newtonsoft-json Ãß°¡ - public HTTPRequest CreateRequest(string API, Action onRequestFinished, object serializeData, HTTPMethods methods = HTTPMethods.Post, Action errorRequestFinished = null) + public HTTPRequest CreateRequest(Protocol protocol, Action onRequestFinished, object serializeData, HTTPMethods methods = HTTPMethods.Post, Action errorRequestFinished = null) { - API = "";//$"{Readonly.url}{API}".Replace("\\p{Z}", String.Empty); + string API = $"{Statics.url}".Replace("\\p{Z}", String.Empty); #if UNITY_EDITOR Debug.Log(API); #endif @@ -55,10 +57,7 @@ public class Request if (serializeData != null) { httpRquest.SetHeader("Content-Type", "application/json"); - //if (Readonly.getIsAuthoriztion()) - //{ - // httpRquest.AddHeader("Authorization", $"Bearer {Readonly.getAuthoriztion()}"); - //} + httpRquest.SetHeader("cmd", ((int)protocol).ToString()); string json = JsonConvert.SerializeObject(serializeData); #if UNITY_EDITOR Debug.Log($"{json.Substring(0, Mathf.Min(json.Length, 15000))}"); diff --git a/Client/Assets/1_Script/System/Request.cs.meta b/Client/Assets/1_Script/System/Http/Request.cs.meta similarity index 100% rename from Client/Assets/1_Script/System/Request.cs.meta rename to Client/Assets/1_Script/System/Http/Request.cs.meta diff --git a/Client/Assets/1_Script/System/Statics.cs b/Client/Assets/1_Script/System/Statics.cs new file mode 100644 index 00000000..a9d4e41b --- /dev/null +++ b/Client/Assets/1_Script/System/Statics.cs @@ -0,0 +1,8 @@ +public class Statics +{ + public static readonly string url = "https://game.pandoli365.com"; + + + public static string version = ""; + +} diff --git a/Client/Assets/1_Script/System/Statics.cs.meta b/Client/Assets/1_Script/System/Statics.cs.meta new file mode 100644 index 00000000..7af7eae1 --- /dev/null +++ b/Client/Assets/1_Script/System/Statics.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7590ac0973bfd604e87b69a1992a0274 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/1_Script/Test.cs b/Client/Assets/1_Script/Test.cs new file mode 100644 index 00000000..393989d4 --- /dev/null +++ b/Client/Assets/1_Script/Test.cs @@ -0,0 +1,31 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Test : MonoBehaviour +{ + [ContextMenu("test")] + public void test() + { + + DownlodeResp request = new DownlodeResp(); + request.Request((data) => + { + Crypto cr = new Crypto(); + Debug.Log(cr.Decompress(data.data)); + Statics.version = data.version; + }); + } + + [ContextMenu("test2")] + public void test2() + { + Crypto cr = new Crypto(); + string testdd = cr.Compress("testdata"); + Debug.Log(testdd); + Debug.Log(cr.Decompress(testdd)); + + } + + +} diff --git a/Client/Assets/1_Script/Test.cs.meta b/Client/Assets/1_Script/Test.cs.meta new file mode 100644 index 00000000..ecb9d2f2 --- /dev/null +++ b/Client/Assets/1_Script/Test.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f71dc23ac80b51f4087e4120eb7f7893 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/3_Prefab/SystemUI.prefab b/Client/Assets/3_Prefab/SystemUI.prefab index d5d6aca5..0c827d2c 100644 --- a/Client/Assets/3_Prefab/SystemUI.prefab +++ b/Client/Assets/3_Prefab/SystemUI.prefab @@ -1391,6 +1391,7 @@ GameObject: - component: {fileID: 3807276985409566799} - component: {fileID: 1795904799042966813} - component: {fileID: 960845345} + - component: {fileID: 2204724754506904848} m_Layer: 0 m_Name: SystemUI m_TagString: Untagged @@ -1550,6 +1551,18 @@ AudioListener: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6231225141918335816} m_Enabled: 1 +--- !u!114 &2204724754506904848 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6231225141918335816} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 25b402012db9b5f438c3219cd7451c2d, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &6231225142097393327 GameObject: m_ObjectHideFlags: 0