Protected Fields allow you to protect your game against memory manipluation.
Currently protectable field types:
- float
- int16
- int32
- int64
- uint16
- uint32
- uint64
- String
Pro only:
- double
- bool
- decimal
- Vector2
- Vector3
- Vector4
- Quaternion
- DateTime
Access protected fields through replacing a normal fieldtype like Int32 with ProtectedInt32.
Access the field value with calling the property Value.
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
// using OPS.AntiCheat; public class ProtectedFieldsDemo : MonoBehaviour { void Start () { //Add the namespace OPS.AntiCheat //Replace your field type with a protected one. (Most types are supported, so add a Protected in front.) //Now access the protected value of a field, with the property Value. //UInt ProtectedUInt16 a = new ProtectedUInt16(1234); a += 1; Debug.Log(a); ProtectedUInt32 b = new ProtectedUInt32(5678); b += 2; Debug.Log(b); ProtectedUInt64 c = new ProtectedUInt64(91011); c += 3; Debug.Log(c); //Int ProtectedInt16 d = new ProtectedInt16(1234); d += 1; Debug.Log(d); ProtectedInt32 e = new ProtectedInt32(5678); e += 2; Debug.Log(e); ProtectedInt64 f = new ProtectedInt64(91011); f += 3; Debug.Log(f); //Float ProtectedFloat g = new ProtectedFloat(1234.123f); g += 0.11f; Debug.Log(g); //Double ProtectedDouble h = new ProtectedDouble(1234.123d); h += 0.11d; Debug.Log(h); //String ProtectedString i = new ProtectedString("My Protected Text"); i += "!!"; Debug.Log(i); //Vector ProtectedVector2 j = new ProtectedVector2(new Vector2(1,2)); j += new Vector2(1, 0); Debug.Log(j); ProtectedVector3 k = new ProtectedVector3(new Vector3(1, 2, 3)); k += new Vector3(2, 1, 0); Debug.Log(k); ProtectedVector4 l = new ProtectedVector4(new Vector4(1, 2, 3, 4)); l += new Vector4(3, 2, 1, 0); Debug.Log(l); //Quaternion ProtectedQuaternion m = new ProtectedQuaternion(new Quaternion(1, 2, 3, 4)); m *= new Quaternion(3, 2, 1, 0); Debug.Log(m); //Bool ProtectedBool n = new ProtectedBool(false); n = false; Debug.Log(n); //Decimal ProtectedDecimal o = new ProtectedDecimal(12312.534m); o += 0.11m; Debug.Log(o); //DateTime ProtectedDateTime p = new ProtectedDateTime(System.DateTime.Now); p = p.Value.AddDays(5); Debug.Log(p); } } |
Possible Operations with Protected Field Types:
1 2 3 4 5 6 7 8 9 10 |
public static ProtectedInt32 operator +(ProtectedInt32 v1, ProtectedInt32 v2); public static ProtectedInt32 operator -(ProtectedInt32 v1, ProtectedInt32 v2); public static ProtectedInt32 operator *(ProtectedInt32 v1, ProtectedInt32 v2); public static ProtectedInt32 operator /(ProtectedInt32 v1, ProtectedInt32 v2); public static bool operator ==(ProtectedInt32 v1, ProtectedInt32 v2); public static bool operator !=(ProtectedInt32 v1, ProtectedInt32 v2); public static bool operator <(ProtectedInt32 v1, ProtectedInt32 v2); public static bool operator >(ProtectedInt32 v1, ProtectedInt32 v2); public static bool operator <=(ProtectedInt32 v1, ProtectedInt32 v2); public static bool operator >=(ProtectedInt32 v1, ProtectedInt32 v2); |