public void Awake()
 {
     if (_instance)
     {
         Destroy(_instance);
     }
     _instance = this;
 }
Exemple #2
0
        /// <summary>
        /// Callback for object destruction.
        /// </summary>
        public void OnDestroy()
        {
            RenderingManager.RemoveFromPostDrawQueue(0, OnDraw);
            PluginConfiguration config = PluginConfiguration.CreateForType <KartographSettings> ();

            config.load();
            config.SetValue("VesselWindowPos", _windowPos);
            config.SetValue("KrakenWarn", _krakenWarn);
            config.save();

            GameEvents.onVesselDestroy.Remove(VesselDestroyed);

            if (_instance == this)
            {
                _instance = null;
            }
        }
Exemple #3
0
        /// <summary>
        /// Start this instance.
        /// </summary>
        public void Start()
        {
            if (_instance)
            {
                Destroy(_instance);
            }
            _instance = this;
            _winID    = GUIUtility.GetControlID(FocusType.Passive);
            Debug.Log("Vessel Select Start");
            PluginConfiguration config = PluginConfiguration.CreateForType <KartographSettings> ();

            config.load();
            _windowPos = config.GetValue <Rect> ("VesselWindowPos", new Rect());

            _windowPos.width  = 0.0f;
            _windowPos.height = 0.0f;

            _krakenWarn = config.GetValue <bool> ("KrakenWarn", false);

            GameEvents.onVesselDestroy.Add(VesselDestroyed);
        }
        /// <summary>
        /// Callback for object destruction.
        /// </summary>
        public void OnDestroy()
        {
            ControlUnlock();

            PluginConfiguration config = PluginConfiguration.CreateForType <KartographSettings> ();

            config.load();
            config.SetValue("VesselWindowPos", _windowPos);
            config.SetValue("KrakenWarn", _krakenWarn);
            config.save();

            GameEvents.onVesselDestroy.Remove(VesselDestroyed);
            GameEvents.onHideUI.Remove(Hide);
            GameEvents.onShowUI.Remove(UnHide);
            GameEvents.onGamePause.Remove(Hide);
            GameEvents.onGameUnpause.Remove(UnHide);

            if (_instance == this)
            {
                _instance = null;
            }
        }