示例#1
0
        void Start()
        {
            Instance = this;
            Log.Info("KeoCacheDriver.Start");
            CreateButton();
            //if (activeKeoCacheCollection == null)
            //    activeKeoCacheCollection = new KeoCacheCollection();

            //
            // Dynamically generate the window IDs based off of the time
            //
            collectionWinID     = (DateTime.Now.Hour * 3600 + DateTime.Now.Minute * 60 + DateTime.Now.Second) * 1000 + DateTime.Now.Millisecond;
            KeocacheWinID       = (DateTime.Now.Hour * 3600 + DateTime.Now.Minute * 60 + DateTime.Now.Second) * 1000 + DateTime.Now.Millisecond + 1;
            menuWinID           = (DateTime.Now.Hour * 3600 + DateTime.Now.Minute * 60 + DateTime.Now.Second) * 1000 + DateTime.Now.Millisecond + 2;
            hintWinID           = (DateTime.Now.Hour * 3600 + DateTime.Now.Minute * 60 + DateTime.Now.Second) * 1000 + DateTime.Now.Millisecond + 3;
            travelbugWinID      = (DateTime.Now.Hour * 3600 + DateTime.Now.Minute * 60 + DateTime.Now.Second) * 1000 + DateTime.Now.Millisecond + 4;
            importWinID         = (DateTime.Now.Hour * 3600 + DateTime.Now.Minute * 60 + DateTime.Now.Second) * 1000 + DateTime.Now.Millisecond + 5;
            activeCollectionsID = (DateTime.Now.Hour * 3600 + DateTime.Now.Minute * 60 + DateTime.Now.Second) * 1000 + DateTime.Now.Millisecond + 6;
            kerbalXWinID        = (DateTime.Now.Hour * 3600 + DateTime.Now.Minute * 60 + DateTime.Now.Second) * 1000 + DateTime.Now.Millisecond + 7;

            GameEvents.onHideUI.Add(this.HideUI);
            GameEvents.onShowUI.Add(this.ShowUI);
            GameEvents.onGamePause.Add(this.HideUIWhenPaused);
            GameEvents.onGameUnpause.Add(this.ShowUIwhenPaused);
            GameEvents.OnVesselRollout.Add(OnVesselRollout);
            GameEvents.onLevelWasLoaded.Add(OnLevelLoaded);

            if (upArrow == null)
            {
                upArrow = new Texture2D(2, 2);
                if (ToolbarControl.LoadImageFromFile(ref upArrow, "GameData/KeoCaching/PluginData/Icons/up"))
                {
                    upContent = new GUIContent("", upArrow, "");
                }
                else
                {
                    Log.Error("Unable to load up arrow");
                }
            }
            if (downArrow == null)
            {
                downArrow = new Texture2D(2, 2);
                if (ToolbarControl.LoadImageFromFile(ref downArrow, "GameData/KeoCaching/PluginData/Icons/down"))
                {
                    downContent = new GUIContent("", downArrow, "");
                }
                else
                {
                    Log.Error("Unable to load down arrow");
                }
            }


            InitiatePlay();
            ReadAllCaches();
        }
示例#2
0
 public void OnDestroy()
 {
     GameEvents.onHideUI.Remove(this.HideUI);
     GameEvents.onShowUI.Remove(this.ShowUI);
     GameEvents.onGamePause.Remove(this.HideUIWhenPaused);
     GameEvents.onGameUnpause.Remove(this.ShowUIwhenPaused);
     GameEvents.OnVesselRollout.Remove(OnVesselRollout);
     toolbarControl.OnDestroy();
     Destroy(toolbarControl);
     Instance = null;
     Log.Info("OnDestroy");
 }