값 변환 테스트 성공
This commit is contained in:
parent
839f7fc9a9
commit
48f3104d57
|
|
@ -132,6 +132,7 @@ GameObject:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 574026086}
|
- component: {fileID: 574026086}
|
||||||
|
- component: {fileID: 574026087}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: GameObject
|
m_Name: GameObject
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
|
@ -155,6 +156,18 @@ Transform:
|
||||||
- {fileID: 1137523890}
|
- {fileID: 1137523890}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 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
|
--- !u!1 &753435365
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ public class Crypto : SingletonMonoBehaviour<Crypto>
|
||||||
}
|
}
|
||||||
|
|
||||||
//압축해제
|
//압축해제
|
||||||
public string Decompress(string t)
|
public string Decompress(string text)
|
||||||
{
|
{
|
||||||
MemoryStream resultStream = new MemoryStream();
|
MemoryStream resultStream = new MemoryStream();
|
||||||
byte[] buffer = Convert.FromBase64String(t);
|
byte[] buffer = Convert.FromBase64String(text);
|
||||||
|
|
||||||
using (MemoryStream ms = new MemoryStream(buffer))
|
using (MemoryStream ms = new MemoryStream(buffer))
|
||||||
{
|
{
|
||||||
|
|
@ -48,10 +48,6 @@ public class Crypto : SingletonMonoBehaviour<Crypto>
|
||||||
//암호화
|
//암호화
|
||||||
public string Encrypto(string encrypt)
|
public string Encrypto(string encrypt)
|
||||||
{
|
{
|
||||||
//#if UNITY_EDITOR
|
|
||||||
// return encrypt;
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
//통신 암호화
|
//통신 암호화
|
||||||
#region To Base64
|
#region To Base64
|
||||||
byte[] b = Encoding.UTF8.GetBytes(encrypt);
|
byte[] b = Encoding.UTF8.GetBytes(encrypt);
|
||||||
|
|
@ -59,13 +55,6 @@ public class Crypto : SingletonMonoBehaviour<Crypto>
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 중간에 값 넣기
|
#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());
|
encrypt = encrypt.Insert(0, str[UnityEngine.Random.Range(0, str.Length)].ToString());
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -87,9 +76,6 @@ public class Crypto : SingletonMonoBehaviour<Crypto>
|
||||||
//복호화
|
//복호화
|
||||||
public string Decrypto(string cipherText)
|
public string Decrypto(string cipherText)
|
||||||
{
|
{
|
||||||
//#if UNITY_EDITOR
|
|
||||||
// return cipherText;
|
|
||||||
//#endif
|
|
||||||
string decrypt = cipherText;
|
string decrypt = cipherText;
|
||||||
|
|
||||||
decrypt = Decrypt(decrypt);
|
decrypt = Decrypt(decrypt);
|
||||||
|
|
@ -108,13 +94,6 @@ public class Crypto : SingletonMonoBehaviour<Crypto>
|
||||||
|
|
||||||
#region 중간에 값 넣기
|
#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);
|
decrypt = decrypt.Substring(1);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -128,14 +107,6 @@ public class Crypto : SingletonMonoBehaviour<Crypto>
|
||||||
|
|
||||||
private const string vfanjlk32rknjvfsduik = "sldkfghqpwo!)($%+sr=g234";
|
private const string vfanjlk32rknjvfsduik = "sldkfghqpwo!)($%+sr=g234";
|
||||||
private const string vbawrnois = "f9v#d9OV*1Unf*%v";
|
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.
|
// This constant is used to determine the keysize of the encryption algorithm.
|
||||||
private const int keysize = 256;
|
private const int keysize = 256;
|
||||||
|
|
@ -252,9 +223,6 @@ public class Crypto : SingletonMonoBehaviour<Crypto>
|
||||||
SHA256 sha = new SHA256Managed();
|
SHA256 sha = new SHA256Managed();
|
||||||
public string SHA256Hash(string data)
|
public string SHA256Hash(string data)
|
||||||
{
|
{
|
||||||
//#if UNITY_EDITOR
|
|
||||||
// return data;
|
|
||||||
//#endif
|
|
||||||
byte[] hash = sha.ComputeHash(Encoding.ASCII.GetBytes(data));
|
byte[] hash = sha.ComputeHash(Encoding.ASCII.GetBytes(data));
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
foreach (byte b in hash)
|
foreach (byte b in hash)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f8df93d61103e5b4581a1545472f691f
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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<DownlodeResp>
|
||||||
|
{
|
||||||
|
private Protocol protocol = Protocol.Downlode;
|
||||||
|
public string data { get; set; }
|
||||||
|
public string version { get; set; }
|
||||||
|
|
||||||
|
public void Request(Action<DownlodeResp> onRequestFinished)
|
||||||
|
{
|
||||||
|
CreateRequest(protocol, onRequestFinished, new DownlodeReq(), HTTPMethods.Post, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 19f009aca03a5f549a2ee3c5d0fb5c22
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -5,6 +5,8 @@ using UnityEngine;
|
||||||
|
|
||||||
public class Request<T>
|
public class Request<T>
|
||||||
{
|
{
|
||||||
|
public int status { get; set; }
|
||||||
|
|
||||||
private bool is_end = false;
|
private bool is_end = false;
|
||||||
public bool get_id_end { get { return is_end; } }
|
public bool get_id_end { get { return is_end; } }
|
||||||
|
|
||||||
|
|
@ -19,9 +21,9 @@ public class Request<T>
|
||||||
/// <param name="codec">암복호화 할 것인지</param>
|
/// <param name="codec">암복호화 할 것인지</param>
|
||||||
/// <returns>역직렬화된 데이터 or 기본값(반환 받지 못함)</returns>
|
/// <returns>역직렬화된 데이터 or 기본값(반환 받지 못함)</returns>
|
||||||
/// Json에러가 발생할경우 packageManager > + > add package by name > name : com.unity.nuget.newtonsoft-json 추가
|
/// Json에러가 발생할경우 packageManager > + > add package by name > name : com.unity.nuget.newtonsoft-json 추가
|
||||||
public HTTPRequest CreateRequest(string API, Action<T> onRequestFinished, object serializeData, HTTPMethods methods = HTTPMethods.Post, Action errorRequestFinished = null)
|
public HTTPRequest CreateRequest(Protocol protocol, Action<T> 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
|
#if UNITY_EDITOR
|
||||||
Debug.Log(API);
|
Debug.Log(API);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -55,10 +57,7 @@ public class Request<T>
|
||||||
if (serializeData != null)
|
if (serializeData != null)
|
||||||
{
|
{
|
||||||
httpRquest.SetHeader("Content-Type", "application/json");
|
httpRquest.SetHeader("Content-Type", "application/json");
|
||||||
//if (Readonly.getIsAuthoriztion())
|
httpRquest.SetHeader("cmd", ((int)protocol).ToString());
|
||||||
//{
|
|
||||||
// httpRquest.AddHeader("Authorization", $"Bearer {Readonly.getAuthoriztion()}");
|
|
||||||
//}
|
|
||||||
string json = JsonConvert.SerializeObject(serializeData);
|
string json = JsonConvert.SerializeObject(serializeData);
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
Debug.Log($"<color=white>{json.Substring(0, Mathf.Min(json.Length, 15000))}</color>");
|
Debug.Log($"<color=white>{json.Substring(0, Mathf.Min(json.Length, 15000))}</color>");
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
public class Statics
|
||||||
|
{
|
||||||
|
public static readonly string url = "https://game.pandoli365.com";
|
||||||
|
|
||||||
|
|
||||||
|
public static string version = "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7590ac0973bfd604e87b69a1992a0274
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -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));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f71dc23ac80b51f4087e4120eb7f7893
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -1391,6 +1391,7 @@ GameObject:
|
||||||
- component: {fileID: 3807276985409566799}
|
- component: {fileID: 3807276985409566799}
|
||||||
- component: {fileID: 1795904799042966813}
|
- component: {fileID: 1795904799042966813}
|
||||||
- component: {fileID: 960845345}
|
- component: {fileID: 960845345}
|
||||||
|
- component: {fileID: 2204724754506904848}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: SystemUI
|
m_Name: SystemUI
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
|
@ -1550,6 +1551,18 @@ AudioListener:
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 6231225141918335816}
|
m_GameObject: {fileID: 6231225141918335816}
|
||||||
m_Enabled: 1
|
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
|
--- !u!1 &6231225142097393327
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue