internal override void Awake()
        {
            settings = KSPAlternateResourcePanel.settings;

            TooltipMouseOffset = new Vector2d(-10, 10);

            ddlSettingsTab = new DropDownList(EnumExtensions.ToEnumDescriptions<SettingsTabs>(),this);

            ddlSettingsSkin = new DropDownList(EnumExtensions.ToEnumDescriptions<Settings.DisplaySkin>(), (Int32)settings.SelectedSkin,this);
            ddlSettingsSkin.OnSelectionChanged += ddlSettingsSkin_SelectionChanged;

            ddlSettingsAlarmsWarning = LoadSoundsList(Resources.clipAlarms.Keys.ToArray(),settings.AlarmsWarningSound);
            ddlSettingsAlarmsAlert = LoadSoundsList(Resources.clipAlarms.Keys.ToArray(), settings.AlarmsAlertSound);
            ddlSettingsAlarmsWarning.OnSelectionChanged += ddlSettingsAlarmsWarning_OnSelectionChanged;
            ddlSettingsAlarmsAlert.OnSelectionChanged += ddlSettingsAlarmsAlert_OnSelectionChanged;

            ddlSettingsRateStyle = new DropDownList(EnumExtensions.ToEnumDescriptions<Settings.RateDisplayEnum>(),(Int32)settings.RateDisplayType, this);
            ddlSettingsRateStyle.OnSelectionChanged += ddlSettingsRateStyle_OnSelectionChanged;

            ddlSettingsButtonStyle = new DropDownList(EnumExtensions.ToEnumDescriptions<ButtonStyleEnum>(), (Int32)settings.ButtonStyleChosen, this);
            ddlSettingsButtonStyle.OnSelectionChanged += ddlSettingsButtonStyle_OnSelectionChanged;

            ddlManager.AddDDL(ddlSettingsButtonStyle);
            ddlManager.AddDDL(ddlSettingsAlarmsWarning);
            ddlManager.AddDDL(ddlSettingsAlarmsAlert);
            ddlManager.AddDDL(ddlSettingsRateStyle);
            ddlManager.AddDDL(ddlSettingsTab);
            ddlManager.AddDDL(ddlSettingsSkin);
        }
        internal void Init()
        {
            settings = KSPAlternateResourcePanel.settings;

            if (Resources.clipAlarms.ContainsKey(settings.AlarmsAlertSound))
                mbARP.clipAlarmsAlert = Resources.clipAlarms[settings.AlarmsAlertSound];
            if (Resources.clipAlarms.ContainsKey(settings.AlarmsWarningSound))
                mbARP.clipAlarmsWarning = Resources.clipAlarms[settings.AlarmsWarningSound];

            audiosourceAlarm = mbARP.gameObject.AddComponent<AudioSource>();
            audiosourceAlarm.spatialBlend = 0;
            audiosourceAlarm.playOnAwake = false;
            audiosourceAlarm.loop = false;
            audiosourceAlarm.Stop();
        }
        internal override void Awake()
        {
            settings = KSPAlternateResourcePanel.settings;
            WindowRect = new Rect(300, 0, 410, WindowHeight);

            ddlMonType = new DropDownList(EnumExtensions.ToEnumDescriptions<ResourceSettings.MonitorDirections>(),this);
            ddlMonType.SetListBoxOffset(vectMonTypeOffset-ScrollPosition);
            ddlMonType.OnSelectionChanged += ddlMonType_OnSelectionChanged;

            ddlDisplayValueAs = new DropDownList(EnumExtensions.ToEnumDescriptions<ResourceSettings.DisplayUnitsEnum>(), this);
            ddlDisplayValueAs.SetListBoxOffset(vectMonTypeOffset - ScrollPosition);
            ddlDisplayValueAs.OnSelectionChanged += ddlDisplayValueAs_OnSelectionChanged;

            ddlManager.AddDDL(ddlMonType);
            ddlManager.AddDDL(ddlDisplayValueAs);
        }
 private void SetLocalVariables()
 {
     windowSettings = mbARP.windowSettings;
     settings = KSPAlternateResourcePanel.settings;
     lstResources = mbARP.lstResourcesVessel;
     lstResourcesLastStage = mbARP.lstResourcesLastStage;
     SelectedResources = mbARP.SelectedResources;
 }
 internal static void SetIconOrder(Settings settings)
 {
     dictFirst = GetIconDict(settings.lstIconOrder[0]);
     dictSecond = GetIconDict(settings.lstIconOrder[1]);
     dictThird = GetIconDict(settings.lstIconOrder[2]);
 }
Пример #6
0
        internal override void Awake()
        {
            LogFormatted("Awakening the AlternateResourcePanel (ARP)");

            LogFormatted("Loading Settings");
            settings = new Settings("settings.cfg");
            if (!settings.Load())
                LogFormatted("Settings Load Failed");

            //If the window is in the pre0.24 default then move it down so its not over the app launcher
            if (new Rect(Screen.width - 310, 0, 310, 40).Contains(settings.vectButtonPos))
            {
                settings.vectButtonPos = new Vector3(Screen.width - 405, 0,0 );
                settings.ButtonPosUpdatedv24 = true;
                settings.Save();
            }
            if (!settings.WindowPosUpdatedv24 && settings.WindowPosition == new Rect(new Rect(Screen.width - 298, 19, 299, 20)))
            {
                MonoBehaviourExtended.LogFormatted("Moving window for 0.24");
                settings.WindowPosUpdatedv24 = true;
                settings.Save();
                blnResetWindow = true;
            }

            //Ensure settings.resources contains all the resources in the loaded game
            VerifyResources();

            //get the sounds and set things up
            Resources.LoadSounds();
            InitAudio();

            //Get whether the toolbar is there
            settings.BlizzyToolbarIsAvailable = ToolbarManager.ToolbarAvailable;

            //convert blizzy bool to display enum
            if (settings.UseBlizzyToolbarIfAvailable) {
                settings.UseBlizzyToolbarIfAvailable = false;
                settings.ButtonStyleChosen = ARPWindowSettings.ButtonStyleEnum.Toolbar;
            }

            //setup the Toolbar button if necessary
            if (settings.ButtonStyleToDisplay==ARPWindowSettings.ButtonStyleEnum.Toolbar)
            {
                    btnToolbar = InitToolbarButton();
            }
            ////if requested use that button
            //if (settings.BlizzyToolbarIsAvailable && settings.UseBlizzyToolbarIfAvailable)
            //    btnToolbar = InitToolbarButton();

            //init the global variables
            lstPartWindows = new ARPPartWindowList();
            lstResourcesVessel = new ARPResourceList(ARPResourceList.ResourceUpdate.AddValues, settings.Resources);
            lstResourcesLastStage = new ARPResourceList(ARPResourceList.ResourceUpdate.AddValues, settings.Resources);

            lstResourcesVesselPerStage = new Dictionary<Int32, ARPResourceList>();

            lstPartsLastStageEngines = new ARPPartList();

            lstResourcesToDisplay = new List<Int32>();
            SelectedResources = new PartResourceVisibleList();

            lstTransfers = new ARPTransferList();

            SelectedResources.ResourceRemoved += SelectedResources_ResourceRemoved;

            lstResourcesVessel.OnMonitorStateChanged += lstResourcesVessel_OnMonitorStateChanged;
            lstResourcesVessel.OnAlarmStateChanged += lstResourcesVessel_OnAlarmStateChanged;

            //init the windows
            InitMainWindow();
            InitSettingsWindow();
            InitResourceConfigWindow();
            InitDebugWindow();

            //plug us in to the draw queue and start the worker
            RenderingManager.AddToPostDrawQueue(1, DrawGUI);
            StartRepeatingWorker(10);

            //register for stage separation events - so we can cancel the noise on a sep
            GameEvents.onStageActivate.Add(OnStageActivate);
            GameEvents.onFlightReady.Add(OnFlightReady);

            //Hook the App Launcher
            OnGUIAppLauncherReady();
            //GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
            GameEvents.onGUIApplicationLauncherUnreadifying.Add(OnGUIAppLauncherUnreadifying);

            //do the daily version check if required
            if (settings.DailyVersionCheck)
                settings.VersionCheck(false);

            APIAwake();
        }