Esempio n. 1
0
        public new virtual void InitializePrefab()
        {
            if (OnPreInitialization != null)
            {
                try
                {
                    OnPreInitialization(base.GetComponent <PropInfo>());
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
            }
            RedirectionHelper.RevertRedirect(_InitializePrefab_original, _InitializePrefab_state);
            try
            {
                base.InitializePrefab();
            }
            finally
            {
                RedirectionHelper.RedirectCalls(_InitializePrefab_original, _InitializePrefab_detour);
            }

            if (OnPostInitialization != null)
            {
                try
                {
                    OnPostInitialization(base.GetComponent <PropInfo>());
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
            }
        }
Esempio n. 2
0
        public static void Revert()
        {
            if (deployed)
            {
                RedirectionHelper.RevertRedirect(_InitializePrefab_original, _InitializePrefab_state);
                _InitializePrefab_original = null;
                _InitializePrefab_detour   = null;

                OnPreInitialization  = null;
                OnPostInitialization = null;

                deployed = false;

                Debug.LogFormat("PrefabHook: {0} Methods restored!", "PropInfo");
            }
        }