private void Awake() { Log.Normal("Customizing DraggableWindow"); DraggableWindow.CloseTexture = ResourceUtil.LocateTexture("ScienceAlert.Resources.btnClose.png"); DraggableWindow.LockTexture = ResourceUtil.LocateTexture("ScienceAlert.Resources.btnLock.png"); DraggableWindow.UnlockTexture = ResourceUtil.LocateTexture("ScienceAlert.Resources.btnUnlock.png"); DraggableWindow.ButtonHoverBackground = ResourceUtil.LocateTexture("ScienceAlert.Resources.btnBackground.png"); DraggableWindow.ButtonSound = "click1"; scienceAlert = GetComponent <ScienceAlert>(); optionsWindow = new GameObject("ScienceAlert.OptionsWindow").AddComponent <DraggableOptionsWindow>(); optionsWindow.scienceAlert = GetComponent <ScienceAlert>(); optionsWindow.manager = GetComponent <ExperimentManager>(); experimentList = new GameObject("ScienceAlert.ExperimentList").AddComponent <DraggableExperimentList>(); experimentList.biomeFilter = GetComponent <BiomeFilter>(); experimentList.manager = GetComponent <ExperimentManager>(); #if false debugWindow = new GameObject("ScienceAlert.DebugWindow").AddComponent <DraggableDebugWindow>(); debugWindow.Visible = false; #endif optionsWindow.Visible = experimentList.Visible = false; }
public event Callback OnExperimentsScanned = delegate { }; // called whenever the observers rescan the ship, typically void Awake() { vesselStorage = gameObject.AddComponent <StorageCache>(); biomeFilter = gameObject.AddComponent <BiomeFilter>(); scienceAlert = gameObject.GetComponent <ScienceAlert>(); audio = GetComponent <AudioPlayer>() ?? AudioPlayer.Audio; scienceAlert.OnScanInterfaceChanged += OnScanInterfaceChanged; scienceAlert.OnToolbarButtonChanged += OnToolbarButtonChanged; GameEvents.onVesselWasModified.Add(OnVesselWasModified); GameEvents.onVesselChange.Add(OnVesselChanged); GameEvents.onVesselDestroy.Add(OnVesselDestroyed); }
/****************************************************************************** * Implementation Details ******************************************************************************/ /// <summary> /// Create the window components we'll be using /// </summary> private void Awake() { Log.Verbose("Customizing DraggableWindow"); DraggableWindow.CloseTexture = ResourceUtil.LocateTexture("ScienceAlert.Resources.btnClose.png"); DraggableWindow.LockTexture = ResourceUtil.LocateTexture("ScienceAlert.Resources.btnLock.png"); DraggableWindow.UnlockTexture = ResourceUtil.LocateTexture("ScienceAlert.Resources.btnUnlock.png"); DraggableWindow.ButtonHoverBackground = ResourceUtil.LocateTexture("ScienceAlert.Resources.btnBackground.png"); DraggableWindow.ButtonSound = "click1"; scienceAlert = GetComponent <ScienceAlert>(); // note to self: these are on separate gameobjects because they use a UIButton to catch // clickthrough, parented to the window's GO. It's simpler to simply disable the window rather than // also disable the UIButton every time Log.Normal("Creating options window"); optionsWindow = new GameObject("ScienceAlert.OptionsWindow").AddComponent <Implementations.DraggableOptionsWindow>(); optionsWindow.scienceAlert = GetComponent <ScienceAlert>(); optionsWindow.manager = GetComponent <Experiments.ExperimentManager>(); Log.Normal("Creating experiment window"); experimentList = new GameObject("ScienceAlert.ExperimentList").AddComponent <Implementations.DraggableExperimentList>(); experimentList.biomeFilter = GetComponent <BiomeFilter>(); experimentList.manager = GetComponent <Experiments.ExperimentManager>(); Log.Normal("Creating debug window"); debugWindow = new GameObject("ScienceAlert.DebugWindow").AddComponent <Implementations.DraggableDebugWindow>(); // initially hide windows optionsWindow.Visible = experimentList.Visible = debugWindow.Visible = false; }