public void RandomizeCryptoKey() { Vector2 value = this.InternalDecrypt(); this.currentCryptoKey = UnityEngine.Random.Range(-2147483648, 2147483647); this.hiddenValue = ObscuredVector2.Encrypt(value, this.currentCryptoKey); }
private ObscuredVector2(ObscuredVector2.RawEncryptedVector2 value) { this.currentCryptoKey = ObscuredVector2.cryptoKey; this.hiddenValue = value; this.fakeValue = ObscuredVector2.initialFakeValue; this.inited = true; }
public void RandomizeCryptoKey() { Vector2 vector2 = this.InternalDecrypt(); this.currentCryptoKey = Random.get_seed(); this.hiddenValue = ObscuredVector2.Encrypt(vector2, this.currentCryptoKey); }
public void ApplyNewCryptoKey() { if (this.currentCryptoKey != ObscuredVector2.cryptoKey) { this.hiddenValue = ObscuredVector2.Encrypt(this.InternalDecrypt(), ObscuredVector2.cryptoKey); this.currentCryptoKey = ObscuredVector2.cryptoKey; } }
public void SetEncrypted(ObscuredVector2.RawEncryptedVector2 encrypted) { this.inited = true; this.hiddenValue = encrypted; if (ObscuredCheatingDetector.IsRunning) { this.fakeValue = this.InternalDecrypt(); } }
public static Vector2 Decrypt(ObscuredVector2.RawEncryptedVector2 value, int key) { if (key == 0) { key = ObscuredVector2.cryptoKey; } Vector2 result; result.x = ObscuredFloat.Decrypt(value.x, key); result.y = ObscuredFloat.Decrypt(value.y, key); return(result); }
public static Vector2 Decrypt(ObscuredVector2.RawEncryptedVector2 value, int key) { if (key == 0) { key = ObscuredVector2.cryptoKey; } Vector2 vector2; vector2.x = (__Null)(double)ObscuredFloat.Decrypt(value.x, key); vector2.y = (__Null)(double)ObscuredFloat.Decrypt(value.y, key); return(vector2); }
public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label) { SerializedProperty hiddenValue = prop.FindPropertyRelative("hiddenValue"); SerializedProperty hiddenValueX = hiddenValue.FindPropertyRelative("x"); SerializedProperty hiddenValueY = hiddenValue.FindPropertyRelative("y"); SetBoldIfValueOverridePrefab(prop, hiddenValue); SerializedProperty cryptoKey = prop.FindPropertyRelative("currentCryptoKey"); SerializedProperty fakeValue = prop.FindPropertyRelative("fakeValue"); SerializedProperty inited = prop.FindPropertyRelative("inited"); int currentCryptoKey = cryptoKey.intValue; Vector2 val = Vector2.zero; if (!inited.boolValue) { if (currentCryptoKey == 0) { currentCryptoKey = cryptoKey.intValue = ObscuredVector2.cryptoKeyEditor; } ObscuredVector2.RawEncryptedVector2 ev = ObscuredVector2.Encrypt(Vector2.zero, currentCryptoKey); hiddenValueX.intValue = ev.x; hiddenValueY.intValue = ev.y; inited.boolValue = true; } else { ObscuredVector2.RawEncryptedVector2 ev = new ObscuredVector2.RawEncryptedVector2(); ev.x = hiddenValueX.intValue; ev.y = hiddenValueY.intValue; val = ObscuredVector2.Decrypt(ev, currentCryptoKey); } EditorGUI.BeginChangeCheck(); val = EditorGUI.Vector2Field(position, label, val); if (EditorGUI.EndChangeCheck()) { ObscuredVector2.RawEncryptedVector2 ev = ObscuredVector2.Encrypt(val, currentCryptoKey); hiddenValueX.intValue = ev.x; hiddenValueY.intValue = ev.y; } fakeValue.vector2Value = val; ResetBoldFont(); }
private Vector2 InternalDecrypt() { if (!this.inited) { this.currentCryptoKey = ObscuredVector2.cryptoKey; this.hiddenValue = ObscuredVector2.Encrypt(ObscuredVector2.initialFakeValue); this.fakeValue = ObscuredVector2.initialFakeValue; this.inited = true; } Vector2 vector; vector.x = ObscuredFloat.Decrypt(this.hiddenValue.x, this.currentCryptoKey); vector.y = ObscuredFloat.Decrypt(this.hiddenValue.y, this.currentCryptoKey); if (ObscuredCheatingDetector.IsRunning && !this.fakeValue.Equals(ObscuredVector2.initialFakeValue) && !this.CompareVectorsWithTolerance(vector, this.fakeValue)) { ObscuredCheatingDetector.Instance.OnCheatingDetected(); } return(vector); }
private Vector2 InternalDecrypt() { if (!this.inited) { this.currentCryptoKey = ObscuredVector2.cryptoKey; this.hiddenValue = ObscuredVector2.Encrypt(ObscuredVector2.initialFakeValue); this.fakeValue = ObscuredVector2.initialFakeValue; this.inited = true; } Vector2 vector1; vector1.x = (__Null)(double)ObscuredFloat.Decrypt(this.hiddenValue.x, this.currentCryptoKey); vector1.y = (__Null)(double)ObscuredFloat.Decrypt(this.hiddenValue.y, this.currentCryptoKey); // ISSUE: explicit reference operation if (ObscuredCheatingDetector.IsRunning && !((Vector2)@this.fakeValue).Equals((object)ObscuredVector2.initialFakeValue) && !this.CompareVectorsWithTolerance(vector1, this.fakeValue)) { ObscuredCheatingDetector.Instance.OnCheatingDetected(); } return(vector1); }
public static Vector2 Decrypt(ObscuredVector2.RawEncryptedVector2 value) { return(ObscuredVector2.Decrypt(value, 0)); }