Ejemplo n.º 1
0
        private TimeCheatingDetector StartDetectionInternal(float checkInterval, TimeCheatingDetectorEventHandler cheatCheckedEventHandler = null)
        {
            if (isRunning)
            {
                Debug.LogWarning(FinalLogPrefix + "already running!", this);
                return(this);
            }

            if (!enabled)
            {
                Debug.LogWarning(FinalLogPrefix + "disabled but StartDetection still called from somewhere (see stack trace for this message)!", this);
                return(this);
            }

            if (cheatCheckedEventHandler != null && detectionEventHasListener)
            {
                Debug.LogWarning(FinalLogPrefix + "has properly configured Detection Event in the inspector, but still get started with TimeCheatingDetectorCallback callback. Both TimeCheatingDetectorCallback and Detection Event will be called on detection. Are you sure you wish to do this?", this);
            }

            timeElapsed  = 0;
            cheatChecked = cheatCheckedEventHandler;
            interval     = checkInterval;

            started   = true;
            isRunning = true;

            return(this);
        }
Ejemplo n.º 2
0
        protected override void StopDetectionInternal()
        {
            base.StopDetectionInternal();

            cheatChecked = null;
            CheatChecked = null;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Starts detection with specified callback.
        /// </summary>
        /// If you have detector in scene make sure it has empty Detection Event.<br/>
        /// Creates a new detector instance if it doesn't exists in scene.
        /// <param name="cheatCheckedEventHandler">Method to call after each cheat check. Pass null if you wish to use event, set in detector inspector.</param>
        public static TimeCheatingDetector StartDetection(TimeCheatingDetectorEventHandler cheatCheckedEventHandler = null)
        {
            if (cheatCheckedEventHandler == null)
            {
                if (Instance != null)
                {
                    return(Instance.StartDetectionInternal(Instance.interval));
                }

                return(StartDetection(GetOrCreateInstance.interval, null));
            }

            return(StartDetection(GetOrCreateInstance.interval, cheatCheckedEventHandler));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Starts detection with specified callback.
 /// </summary>
 /// If you have detector in scene make sure it has empty Detection Event.<br/>
 /// Creates a new detector instance if it doesn't exists in scene.
 /// <param name="cheatCheckedEventHandler">Method to call after each cheat check. Pass null if you wish to use event, set in detector inspector.</param>
 public static void StartDetection(TimeCheatingDetectorEventHandler cheatCheckedEventHandler = null)
 {
     if (cheatCheckedEventHandler == null)
     {
         if (Instance != null)
         {
             Instance.StartDetectionInternal(Instance.interval);
         }
         else
         {
             StartDetection(GetOrCreateInstance.interval, null);
         }
     }
     else
     {
         StartDetection(GetOrCreateInstance.interval, cheatCheckedEventHandler);
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Starts detection with specified callback using passed interval.<br/>
 /// </summary>
 /// If you pass cheatCheckedCallback than make sure you have no filled Detection Event on detector instance in scene to avoid duplicate event calls.<br/>
 /// Creates a new detector instance if it doesn't exists in scene.
 /// <param name="intervalMinutes">Time in minutes between checks. Overrides #interval property.</param>
 /// <param name="cheatCheckedEventHandler">Method to call after each cheat check. Pass null if you wish to use event, set in detector inspector.</param>
 public static TimeCheatingDetector StartDetection(float intervalMinutes, TimeCheatingDetectorEventHandler cheatCheckedEventHandler = null)
 {
     return(GetOrCreateInstance.StartDetectionInternal(intervalMinutes, cheatCheckedEventHandler));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Starts detection with specified callback using passed interval.<br/>
 /// </summary>
 /// If you pass cheatCheckedCallback than make sure you have no filled Detection Event on detector instance in scene to avoid duplicate event calls.<br/>
 /// Creates a new detector instance if it doesn't exists in scene.
 /// <param name="interval">Time in minutes between checks. Overrides #interval property.</param>
 /// <param name="cheatCheckedEventHandler">Method to call after each cheat check. Pass null if you wish to use event, set in detector inspector.</param>
 public static void StartDetection(float interval, TimeCheatingDetectorEventHandler cheatCheckedEventHandler = null)
 {
     GetOrCreateInstance.StartDetectionInternal(interval, cheatCheckedEventHandler);
 }