예제 #1
0
        private void ObscuredFloatExample()
        {
            logBuilder.Length = 0;
            logBuilder.AppendLine(Constants.LOG_PREFIX + "<b>[ ObscuredFloat test ]</b>");

            // example of custom crypto key using
            ObscuredFloat.SetNewCryptoKey(404);

            // just a small self-test here
            float regular = 99.9f;

            logBuilder.AppendLine("Original health bar: " + regular);

            ObscuredFloat obscured = regular;

            logBuilder.AppendLine("How your health bar is stored in memory when obscured: " + obscured.GetEncrypted());

            ObscuredFloat.SetNewCryptoKey(666);             // you can change crypto key at any time!

            // all usual operations are supported, dummy code, just for demo purposes
            obscured += 6f;
            obscured -= 1.5f;
            obscured++;
            obscured--;
            obscured--;
            obscured = regular - obscured + 10.5f;

            logBuilder.AppendLine("Health bar after few usual operations: " + obscured);

            Debug.Log(logBuilder);
        }
예제 #2
0
    private void Start()
    {
        Debug.Log("===== ObscuredFloatTest =====\n");

        // example of custom crypto key using
        // this is not necessary! key is 230887 by default
        ObscuredFloat.SetNewCryptoKey(404);

        // just a small self-test here
        healthBar = 99.9f;
        Debug.Log("Original health bar:\n" + healthBar);

        obscuredHealthBar = healthBar;
        Debug.Log("How your health bar is stored in memory when obscured:\n" + obscuredHealthBar.GetEncrypted());

        float         totalProgress   = 100f;
        ObscuredFloat currentProgress = 60.3f;

        ObscuredFloat.SetNewCryptoKey(666);         // you can change crypto key at any time!

        // all usual operations supported, dummy code, just for demo purposes
        currentProgress++;
        currentProgress -= 2;
        currentProgress--;
        currentProgress = totalProgress - currentProgress;

        obscuredHealthBar = healthBar = currentProgress = 0;
    }
예제 #3
0
    public virtual void Awake()
    {
        DontDestroyOnLoad(this.gameObject);
        if (_instance == null)
        {
            _instance = this as GameShared;
        }
        else
        {
            Destroy(gameObject);
        }

        int rand = UnityEngine.Random.Range(100, 9999);

        ObscuredInt.SetNewCryptoKey(rand);
        ObscuredFloat.SetNewCryptoKey(rand);
    }
    private void Start()
    {
        Debug.Log("===== ObscuredFloatTest =====\n");
        ObscuredFloat.SetNewCryptoKey(404);
        healthBar = 99.9f;
        Debug.Log("Original health bar:\n" + healthBar);
        obscuredHealthBar = healthBar;
        Debug.Log("How your health bar is stored in memory when obscured:\n" + obscuredHealthBar.GetEncrypted());
        float         num   = 100f;
        ObscuredFloat input = 60.3f;

        ObscuredFloat.SetNewCryptoKey(666);
        input             = ++input;
        input             = (float)input - 2f;
        input             = --input;
        input             = num - (float)input;
        obscuredHealthBar = (healthBar = (input = 0f));
        ObscuredFloat.onCheatingDetected = OnCheatingDetected;
    }
예제 #5
0
        private void ObscuredFloatExample()
        {
            this.logBuilder.Length = 0;
            this.logBuilder.AppendLine("[ACTk] <b>[ ObscuredFloat test ]</b>");
            ObscuredFloat.SetNewCryptoKey(404);
            float num = 99.9f;

            this.logBuilder.AppendLine("Original health bar: " + num);
            ObscuredFloat obscuredFloat = num;

            this.logBuilder.AppendLine("How your health bar is stored in memory when obscured: " + obscuredFloat.GetEncrypted());
            ObscuredFloat.SetNewCryptoKey(666);
            obscuredFloat += 6f;
            obscuredFloat -= 1.5f;
            obscuredFloat  = ++obscuredFloat;
            obscuredFloat  = --obscuredFloat;
            obscuredFloat  = --obscuredFloat;
            obscuredFloat  = num - obscuredFloat + 10.5f;
            this.logBuilder.AppendLine("Health bar after few usual operations: " + obscuredFloat);
            Debug.Log(this.logBuilder);
        }