public void SetGroupVolume(SetGroupVolume groupVolume) { const string baseUrl = "https://api.ws.sonos.com/control/api/v1/"; var control = new VolumeControl { Volume = groupVolume.Volume }; var json = JsonConvert.SerializeObject(control); try { using (var client = new HttpClient()) { client.ConfigureClient(baseUrl); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Token); var response = client.PostAsync($"groups/{groupVolume.GroupId}/groupVolume", new StringContent(json, Encoding.UTF8, "application/json")).Result; if (response.StatusCode == HttpStatusCode.OK) { var result = response.Content.ReadAsStringAsync().Result; } } } catch (Exception e) { Console.WriteLine(e); throw; } }
private void Window_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (VolumeControl.IsMouseCaptured) { VolumeControl.ReleaseMouseCapture(); } }
private void HookSpotify() { try { _spotify = Process.GetProcessesByName("spotify")[0]; } catch (IndexOutOfRangeException) { // spotify isn't running; hook ObjectCreate and wait for it to launch _objectCreateHook = new WinEventHook(OnObjectCreate, WinEventHook.EventConstant.EVENT_OBJECT_CREATE); return; } // in case Mutify has been launched while Spotify is playing something if (_currentTitle != null) { VolumeControl.SetApplicationMute(_spotify.Id, _blacklist.Contains(_currentTitle)); MuteAdButton.IsEnabled = true; } _spotify.EnableRaisingEvents = true; // register a handler _spotify.Exited += SpotifyExited; // for spotify's exit // hook changes to Spotify's main window title so titles can be checked against the blacklist _windowNameHook = new WinEventHook(OnWindowNameChange, WinEventHook.EventConstant.EVENT_OBJECT_NAMECHANGE, _spotify.Id); }
/// <summary> /// Plays a <see cref="Sound"/> globally at specified volume /// </summary> /// <param name="sound">The sound which should be played</param> /// <param name="volumeControl">Which volume control to adjust sound levels by. How loud sound is.</param> /// <returns>The channel on which the sound was created</returns> public static Channel PlaySound(Sound sound, VolumeControl volumeControl) { float volumeLevel; switch (volumeControl) { case VolumeControl.Master: volumeLevel = SoundSystem.masterVolume; break; case VolumeControl.Music: volumeLevel = SoundSystem.musicVolume; break; case VolumeControl.Voice: volumeLevel = SoundSystem.voiceVolume; break; case VolumeControl.Ambient: volumeLevel = SoundSystem.ambientVolume; break; default: volumeLevel = 1f; break; } RuntimeManager.LowlevelSystem.getMasterChannelGroup(out ChannelGroup channels); var newChannels = channels; newChannels.setVolume(volumeLevel); RuntimeManager.LowlevelSystem.playSound(sound, newChannels, false, out Channel channel); return(channel); }
public void LaunchPlayer() { if (LaunchCooldown > 0) { Debug.Log("Is on Launch Cooldown"); return; } if (SFX) { SFX.volume = VolumeControl.GetVolume(EAudioType.EFFECT); SFX.PlayOneShot(DashSound); } /* * //Launch player in direction of movement //Launch in direction of mouse cursor if not moving * Vector3 launchVelocity = PhysBody.velocity.magnitude > 1 ? PhysBody.velocity.normalized * 500 : transform.forward * 500; * * * PhysBody.AddForce(launchVelocity, ForceMode.Impulse);*/ LaunchCooldown = LaunchCooldownTime; InvokeRepeating("AllowLaunch", launchCooldownRate, launchCooldownRate); PlayerController.GetHealth.EnableInvulnerability(invulnerabilityTime); launchStart = transform.position; GetLaunchPosition(); GetLaunchRate(); InvokeRepeating("Launch", 0, launchRate); isDashing = true; }
private void TrayIcon_VolumeChangedClicked(object sender, EventArgs e) { var _volumeControl = new VolumeControl(ConnectionHandler.UserVolumesInCurrentChannel); _volumeControl.VolumeChanged += Control_VolumeChanged; _volumeControl.Show(); }
public void InitializeComponent() { if (!this._contentLoaded) { this._contentLoaded = true; Application.LoadComponent(this, new Uri("/TWC.OVP;component/Views/Shell/SportsNetworkShellView.xaml", UriKind.Relative)); this.LayoutRoot = (Grid) base.FindName("LayoutRoot"); this.ControllerStates = (VisualStateGroup) base.FindName("ControllerStates"); this.ShowController = (VisualState) base.FindName("ShowController"); this.HideController = (VisualState) base.FindName("HideController"); this.WindowStates = (VisualStateGroup) base.FindName("WindowStates"); this.FullScreen = (VisualState) base.FindName("FullScreen"); this.Embedded = (VisualState) base.FindName("Embedded"); this.CaptionSettingsStates = (VisualStateGroup) base.FindName("CaptionSettingsStates"); this.ShowCaptionSettings = (VisualState) base.FindName("ShowCaptionSettings"); this.HideCaptionSettings = (VisualState) base.FindName("HideCaptionSettings"); this.BackgroundRectangle = (Rectangle) base.FindName("BackgroundRectangle"); this.AssetViewer = (ContentControl) base.FindName("AssetViewer"); this.Controller = (Grid) base.FindName("Controller"); this.volumeControl = (VolumeControl) base.FindName("volumeControl"); this.ClosedCaptioning = (ToggleButton) base.FindName("ClosedCaptioning"); this.FullScreenGrid = (Grid) base.FindName("FullScreenGrid"); this.FullScreenButton = (Button) base.FindName("FullScreenButton"); this.ExitFullScreenGrid = (Grid) base.FindName("ExitFullScreenGrid"); this.ExitFullScreenButton = (Button) base.FindName("ExitFullScreenButton"); this.Interaction = (ContentControl) base.FindName("Interaction"); } }
void Damaged(int Damage, int Health, GameObject Instigator) { //Cam.CameraShake.Shake(); CameraShake.Shake(0.15f, 0.3f); SFX.volume = VolumeControl.GetVolume(EAudioType.EFFECT); SFX.Play(); }
/// <summary> /// 获取系统主音量 /// </summary> static void GetSysVolume() { float a = 0f; volumeControl = VolumeControl.Instance; double volume = volumeControl.MasterVolume; sysVolume = (float)volume; }
void OnTriggerEnter(Collider other) { OnHit(other.gameObject); if (SFX) { SFX.volume = VolumeControl.GetVolume(EAudioType.EFFECT); } }
public override void Load(BaseGame game) { if (!Host.IsPrimaryInstance) { Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error); Environment.Exit(0); } base.Load(game); if (args?.Length > 0) { Schedule(delegate { Beatmaps.Import(args); }); } //attach our bindables to the audio subsystem. Audio.Volume.Weld(Config.GetBindable <double>(OsuConfig.VolumeGlobal)); Audio.VolumeSample.Weld(Config.GetBindable <double>(OsuConfig.VolumeEffect)); Audio.VolumeTrack.Weld(Config.GetBindable <double>(OsuConfig.VolumeMusic)); Add(new Drawable[] { new VolumeControlReceptor { RelativeSizeAxes = Axes.Both, ActivateRequested = delegate { volume.Show(); } }, intro = new Intro(), Toolbar = new Toolbar { OnHome = delegate { MainMenu?.MakeCurrent(); }, OnSettings = Options.ToggleVisibility, OnPlayModeChange = delegate(PlayMode m) { PlayMode.Value = m; }, }, Chat = new ChatConsole(API), volume = new VolumeControl { VolumeGlobal = Audio.Volume, VolumeSample = Audio.VolumeSample, VolumeTrack = Audio.VolumeTrack }, new GlobalHotkeys //exists because UserInputManager is at a level below us. { Handler = globalHotkeyPressed } }); intro.ModePushed += modeAdded; intro.Exited += modeRemoved; PlayMode = Config.GetBindable <PlayMode>(OsuConfig.PlayMode); PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); }; PlayMode.TriggerChange(); Cursor.Alpha = 0; }
private void Awake() { if (vc == null) { vc = this; } else { Destroy(this); } }
public static void PlayLevel() { VolumeControl.saveData(); // Volume slider data save. Peter Kong, 6/7/14 DJ_LevelManager.currentLevel = level; //Application.LoadLevel("level" + DJ_LevelManager.currentLevel); //Debug.Log("Starting to load: level" + DJ_LevelManager.currentLevel); //DJ_LoadingScreen.LoadLevel("level" + DJ_LevelManager.currentLevel); //Debug.Log ("Im in here: " + level); Application.LoadLevel("LoadingScene"); }
// Use this for initialization void Start() { if(tag.Contains("SFX")) { //Debug.Log("Contains Tag" + tag); volume = GameObject.FindGameObjectWithTag("SFXText").GetComponent<VolumeControl>(); } else { volume = GameObject.FindGameObjectWithTag("VolumeText").GetComponent<VolumeControl>(); } }
private void MuteAdButton_Click(object sender, EventArgs e) // was RoutedEventArgs. Consequences? { var ad = _currentTitle; if (!_blacklist.Contains(ad)) { _blacklist.Add(ad); _blacklistChanged = true; } VolumeControl.SetApplicationMute(_spotify.Id, true); }
private IEnumerator ManageLoop(AudioSourceAnimator animator, LoopGroup group, EffectFader fader) { var FadeControl = new VolumeControl(0.0f); animator.AddControl(FadeControl); while (true) { fader.Update(Time.deltaTime); FadeControl.Volume = fader.Value; yield return(null); } }
// Use this for initialization void Start() { vc = vcObj.GetComponent<VolumeControl> (); //solidVolume = VolumeCalculator.getVolume (this.gameObject); solidVolume = VolumeCalculator.newGetVolume (this.gameObject); float max = Mathf.Max (new float[3]{this.transform.localScale.x, this.transform.localScale.y, this.transform.localScale.z}); ratioSub = new Vector3 (this.transform.localScale.x / max, this.transform.localScale.y / max, this.transform.localScale.z / max); shrinkSpeed *= this.transform.localScale.magnitude; }
private static void LoadModules(ModuleContainer moduleContainer) { //Global resource/s. var baseFont = new Font(AssPath + "/Resources/Fonts/SourceSansPro-Regular.otf"); baseFont.GetTexture(14).Smooth = false; //Modules /* Modules shouldn't depend on other modules unless absolutely neccessary. * Draw order is determined by the order they are added to the container. */ var pBar = new ProgressBar(); var songList = new SongList(baseFont); Audio.CurrentSongList = songList; var dragWindow = new DragWindow(); var playButton = new PlayButton(); var border = new Border(); var volumeControl = new VolumeControl(); var shuffle = new ShuffleButton(); var repeat = new RepeatButton(); var add = new AddSource(); var spriteBatch = new SpriteBatchMod(SpriteBatch); var search = new TextSearch(songList, baseFont); var hotkeys = new HotKeys(pBar, songList, volumeControl); moduleContainer.AddModule(pBar); moduleContainer.AddModule(songList); moduleContainer.AddModule(dragWindow); moduleContainer.AddModule(playButton); moduleContainer.AddModule(volumeControl); moduleContainer.AddModule(shuffle); moduleContainer.AddModule(repeat); moduleContainer.AddModule(add); moduleContainer.AddModule(spriteBatch); moduleContainer.AddModule(border); moduleContainer.AddModule(search); moduleContainer.AddModule(hotkeys); //Module specific resources songList.LoadFromMultipleDirectories(Config.musicDirectories); songList.SortByArtist(); //Remove duplicates. var duplicates = songList.GroupBy(x => x.Name).Where(x => x.Count() > 1); foreach (Song song in duplicates .SelectMany(duplicate => duplicate.Take(duplicate.Count() - 1))) { songList.Remove(song); } }
void adjustVolume() { //Debug.Log("Adjust Volume Called"); if (source) { source.volume = VolumeControl.GetVolume(EAudioType.MUSIC); } else { //Debug.Log("SOURCE NOT VALID"); } }
public void CreateMenuVC() { menuVol = Instantiate(Resources.Load("ControlVolumen")) as GameObject; volCont = GameObject.Find("CanvasVolumen").GetComponent<VolumeControl>(); auxvolumen = (float) volCont.ambiente2.volume; /* public void setAmbiente(AudioSource aux, int aaa) { //VolumeControl vc = GetComponent<VolumeControl>(); //xxx = vc.yyy; //ambiente.volume = aux.volume; //xxx = aaa; }*/ }
void Start() { sc = scoreObj.GetComponent<ScoreController> (); vc = volumeControlObj.GetComponent<VolumeControl> (); foreach (Transform child in this.transform) { if (child.name == blockadeName){ blockade = child.gameObject; }else if(child.name == unlockName){ unlock = child.gameObject; } } ub = unlock.GetComponent<UnlockBehaviour> (); blb = blockade.GetComponent<BlockadeBehaviour> (); }
// Use this for initialization void Start() { VFX = GetComponent <ParticleSystem>(); FX = GetComponent <AudioSource>(); FX.volume = FX.volume * VolumeControl.GetVolume(EAudioType.EFFECT); VFX.Play(); FX.pitch = Random.Range(PitchRange.x, PitchRange.y); FX.Play(); Destroy(gameObject, lifeTime); }
void PlayWeaponSound() { if (SFX.enabled == false) { return; } SFX.volume = VolumeControl.GetVolume(EAudioType.EFFECT); float basePitch = SFX.pitch; SFX.pitch = Random.Range(SFX.pitch - .1f, SFX.pitch + .1f); SFX.Play(); SFX.pitch = basePitch; }
public async void VolumeButtonClicked(object sender, EventArgs e) { if (VolumeControl.IsVisible) { VolumeControl.TranslateTo(0, 10, easing: Easing.CubicInOut); await VolumeControl.FadeTo(0, easing : Easing.CubicInOut); VolumeControl.IsVisible = false; } else { VolumeControl.IsVisible = true; VolumeControl.TranslateTo(0, -10, easing: Easing.CubicInOut); await VolumeControl.FadeTo(1, easing : Easing.CubicInOut); } }
public static void ResetDefaultDataValues() { Debug.Log("Resetting values"); for (int i = 0; i < maxLevel; i++) { PlayerPrefs.SetInt("stars" + i.ToString(), 0); PlayerPrefs.SetFloat("starTime" + i.ToString(), starTime[i]); PlayerPrefs.SetInt("maxDeaths" + i.ToString(), maxDeath[i]); } PlayerPrefs.SetBool("TutorialBeaten", false); PlayerPrefs.SetInt("PlayerX", 0); PlayerPrefs.SetInt("PlayerY", 1); PlayerPrefs.SetFloat("GameVolume", .5f); VolumeControl.setVolume(PlayerPrefs.GetFloat("GameVolume")); PlayerPrefs.Flush(); }
public void Run(IBackgroundTaskInstance taskInstance) { //Async : deferral BackgroundTaskDeferral _deferral = taskInstance.GetDeferral(); _ifMusicPlaying = false; _processService = new ProcessService(); //打开黑名单: i = 1 => Delay(10000) / 不打开 : i = 0 => delay(2000) do { var NewProcess = _processService.IfBlackListProcessExist(blackListProgresses, _processService.GetProcessNow()); if (NewProcess == false) { if (_ifMusicPlaying == true) { Messenger.Default.Send<StopListenMessage>(new StopListenMessage()); } Thread.Sleep(10000); } else { //弹出新窗口 PunishWindow(); //设置音量50 VolumeControl.ChangeVolumeTotheLevel(0.5); //播放音乐 if (_ifMusicPlaying == false) { Messenger.Default.Send<BeginListenMessage>(new BeginListenMessage()); } Thread.Sleep(2000); } if (_listenFlag == false) { break; } } while (true); }
public static void SetSpotifyMute(bool mute) { List <int> children = new List <int>(); foreach (Process p in Process.GetProcessesByName("spotify")) { children.Add(p.Id); } foreach (int child in children) { VolumeControl volumeControl = GetVolumeControl(child); if (volumeControl != null) { SetMute(volumeControl.Control, mute); } } }
private void OnWindowNameChange(IntPtr hWinEventHook, uint eventType, IntPtr hWnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime) { if (hWnd != _spotify.MainWindowHandle) { return; } if (_currentTitle == null) // nothing playing { this.MuteAdButton.IsEnabled = false; } else { this.MuteAdButton.IsEnabled = true; VolumeControl.SetApplicationMute(_spotify.Id, _blacklist.Contains(_currentTitle)); } }
void OnClick() { if (!DJ_Input.inScoreScreen()) { isPausedScript pause = pauseContainer.GetComponent <isPausedScript>(); if (pause.isPaused) { // Open Pause UI TweenPosition.Begin(pauseContainer, speed, collapsedPosition); pause.isPaused = false; VolumeControl.saveData(); // Volume slider data save. Peter Kong, 6/7/14 } else { // Close Pause UI TweenPosition.Begin(pauseContainer, speed, expandedPosition); pause.isPaused = true; } } }
public void ResetToFactorySettings() { Volume = new VolumeControl(new Volume(15)); ChannelSwitcher = new Switcher(new UserInteraction()); ChannelSwitcher.TrySwitching(0); TimeManager = new TimeManager(); Software = new Software(new UserInteraction()); Source = new DataSource("VGA"); AllowedRemoteControl = false; AllowedAudioVideoShare = false; Equalizer = new SoundEqualizer("Movie"); DynamicBassOn = false; ZoomLevel = 100; NetworkManager = new NetworkManager(new None()); SelectedLanguage = new UiLanguage("en"); SubtitleSettings = new SubtitleSettingsBuilder().Build(); PictureSettings = new PictureSettings(); }
public MainForm() { InitializeComponent(); InitTimer(); this.TopMost = true; this.CreateHandle(); Diagnostics.Diagnostics.progressBarCallBack += new Diagnostics.Diagnostics.ProgressBarCallBack(Diagnostics_progressBarCallBack); SetControlLocations(); this.ShowInTaskbar = false; Bitmap bmp = new Bitmap("../../Icon.png"); this.Icon = Icon.FromHandle(bmp.GetHicon()); _volumeControl = new VolumeControl(this.Handle); }
private void VolumeControl_OnMouseMove(object sender, MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed && VolumeControl.Value <= 1f && VolumeControl.Value >= 0f) { VolumeControl.CaptureMouse(); double volume = GetVolumeFromMousePosition(e.GetPosition(VolumeControl).X); if (volume <= 1d && volume >= 0d) { VolumeControl.Value = volume; } else if (volume >= 1d) { VolumeControl.Value = 1f; } else if (volume <= 0d) { VolumeControl.Value = 0f; } } }
void Awake() { if (clip == null) { Destroy(gameObject); return; } source = GetComponent <AudioSource>(); float _volume = 1; if (VolumeControl.instance) { _volume = VolumeControl.GetVolume(audioType); } source.volume = _volume; source.PlayOneShot(clip); StartCoroutine(DestroySound()); //Destroy(gameObject, clip.length); }
void Start() { vc = vcObj.GetComponent<VolumeControl> (); rt = this.GetComponent<RectTransform> (); yPos = (-1) * rt.rect.height; }
protected override void LoadComplete() { base.LoadComplete(); // hook up notifications to components. BeatmapManager.PostNotification = n => notificationOverlay?.Post(n); BeatmapManager.GetStableStorage = GetStorageForStableInstall; AddRange(new Drawable[] { new VolumeControlReceptor { RelativeSizeAxes = Axes.Both, ActionRequested = action => volume.Adjust(action) }, mainContent = new Container { RelativeSizeAxes = Axes.Both, }, volume = new VolumeControl(), overlayContent = new Container { RelativeSizeAxes = Axes.Both }, new OnScreenDisplay(), }); LoadComponentAsync(screenStack = new Loader(), d => { screenStack.ModePushed += screenAdded; screenStack.Exited += screenRemoved; mainContent.Add(screenStack); }); //overlay elements LoadComponentAsync(direct = new DirectOverlay { Depth = -1 }, mainContent.Add); LoadComponentAsync(social = new SocialOverlay { Depth = -1 }, mainContent.Add); LoadComponentAsync(chat = new ChatOverlay { Depth = -1 }, mainContent.Add); LoadComponentAsync(settings = new MainSettings { GetToolbarHeight = () => ToolbarOffset, Depth = -1 }, overlayContent.Add); LoadComponentAsync(userProfile = new UserProfileOverlay { Depth = -2 }, mainContent.Add); LoadComponentAsync(beatmapSetOverlay = new BeatmapSetOverlay { Depth = -3 }, mainContent.Add); LoadComponentAsync(musicController = new MusicController { Depth = -4, Position = new Vector2(0, Toolbar.HEIGHT), Anchor = Anchor.TopRight, Origin = Anchor.TopRight, }, overlayContent.Add); LoadComponentAsync(notificationOverlay = new NotificationOverlay { Depth = -4, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, }, overlayContent.Add); LoadComponentAsync(dialogOverlay = new DialogOverlay { Depth = -5, }, overlayContent.Add); Logger.NewEntry += entry => { if (entry.Level < LogLevel.Important) { return; } notificationOverlay.Post(new SimpleNotification { Text = $@"{entry.Level}: {entry.Message}" }); }; dependencies.Cache(settings); dependencies.Cache(social); dependencies.Cache(direct); dependencies.Cache(chat); dependencies.Cache(userProfile); dependencies.Cache(musicController); dependencies.Cache(beatmapSetOverlay); dependencies.Cache(notificationOverlay); dependencies.Cache(dialogOverlay); // ensure only one of these overlays are open at once. var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct }; foreach (var overlay in singleDisplayOverlays) { overlay.StateChanged += state => { if (state == Visibility.Hidden) { return; } foreach (var c in singleDisplayOverlays) { if (c == overlay) { continue; } c.State = Visibility.Hidden; } }; } LoadComponentAsync(Toolbar = new Toolbar { Depth = -4, OnHome = delegate { hideAllOverlays(); intro?.ChildScreen?.MakeCurrent(); }, }, overlayContent.Add); settings.StateChanged += delegate { switch (settings.State) { case Visibility.Hidden: intro.MoveToX(0, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint); break; case Visibility.Visible: intro.MoveToX(SettingsOverlay.SIDEBAR_WIDTH / 2, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint); break; } }; Cursor.State = Visibility.Hidden; }
protected override void LoadComplete() { base.LoadComplete(); AddRange(new Drawable[] { new VolumeControlReceptor { RelativeSizeAxes = Axes.Both, ActionRequested = delegate(InputState state) { volume.Adjust(state); } }, mainContent = new Container { RelativeSizeAxes = Axes.Both, }, volume = new VolumeControl(), overlayContent = new Container { RelativeSizeAxes = Axes.Both }, new OnScreenDisplay(), new GlobalHotkeys //exists because UserInputManager is at a level below us. { Handler = globalHotkeyPressed } }); LoadComponentAsync(screenStack = new Loader(), d => { screenStack.ModePushed += screenAdded; screenStack.Exited += screenRemoved; mainContent.Add(screenStack); }); //overlay elements LoadComponentAsync(direct = new DirectOverlay { Depth = -1 }, mainContent.Add); LoadComponentAsync(social = new SocialOverlay { Depth = -1 }, mainContent.Add); LoadComponentAsync(chat = new ChatOverlay { Depth = -1 }, mainContent.Add); LoadComponentAsync(userProfile = new UserProfileOverlay { Depth = -1 }, mainContent.Add); LoadComponentAsync(settings = new SettingsOverlay { Depth = -1 }, overlayContent.Add); LoadComponentAsync(musicController = new MusicController { Depth = -2, Position = new Vector2(0, Toolbar.HEIGHT), Anchor = Anchor.TopRight, Origin = Anchor.TopRight, }, overlayContent.Add); LoadComponentAsync(notificationManager = new NotificationManager { Depth = -2, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, }, overlayContent.Add); LoadComponentAsync(dialogOverlay = new DialogOverlay { Depth = -4, }, overlayContent.Add); Logger.NewEntry += entry => { if (entry.Level < LogLevel.Important) { return; } notificationManager.Post(new SimpleNotification { Text = $@"{entry.Level}: {entry.Message}" }); }; Dependencies.Cache(settings); Dependencies.Cache(social); Dependencies.Cache(chat); Dependencies.Cache(userProfile); Dependencies.Cache(musicController); Dependencies.Cache(notificationManager); Dependencies.Cache(dialogOverlay); // ensure both overlays aren't presented at the same time chat.StateChanged += (container, state) => social.State = state == Visibility.Visible ? Visibility.Hidden : social.State; social.StateChanged += (container, state) => chat.State = state == Visibility.Visible ? Visibility.Hidden : chat.State; LoadComponentAsync(Toolbar = new Toolbar { Depth = -3, OnHome = delegate { intro?.ChildScreen?.MakeCurrent(); }, }, overlayContent.Add); settings.StateChanged += delegate { switch (settings.State) { case Visibility.Hidden: intro.MoveToX(0, SettingsOverlay.TRANSITION_LENGTH, EasingTypes.OutQuint); break; case Visibility.Visible: intro.MoveToX(SettingsOverlay.SIDEBAR_WIDTH / 2, SettingsOverlay.TRANSITION_LENGTH, EasingTypes.OutQuint); break; } }; Cursor.State = Visibility.Hidden; }
void Start() { t = this.GetComponent<Text> (); vc = vcObj.GetComponent<VolumeControl> (); bc = bcObj.GetComponent<BuildControls> (); }
void Start() { scaleMode = 0; newScaling = Vector3.one; newRotate = new Vector3 (90, 0, 0); vc = volumeController.GetComponent<VolumeControl> (); at = alertObj.GetComponent<AlertText> (); if (blueprints.Length > 0) { mode = 0; setCurrSel (mode); } }
public void ShowGUI() { EditorGUILayout.LabelField ("Save game settings", EditorStyles.boldLabel); if (saveFileName == "") { saveFileName = SaveSystem.SetProjectName (); } maxSaves = EditorGUILayout.IntField ("Max. number of saves:", maxSaves); saveFileName = EditorGUILayout.TextField ("Save filename:", saveFileName); useProfiles = EditorGUILayout.ToggleLeft ("Enable save game profiles?", useProfiles); #if !UNITY_WEBPLAYER && !UNITY_ANDROID && !UNITY_WINRT && !UNITY_WII saveTimeDisplay = (SaveTimeDisplay) EditorGUILayout.EnumPopup ("Time display:", saveTimeDisplay); takeSaveScreenshots = EditorGUILayout.ToggleLeft ("Take screenshot when saving?", takeSaveScreenshots); orderSavesByUpdateTime = EditorGUILayout.ToggleLeft ("Order save lists by update time?", orderSavesByUpdateTime); #else EditorGUILayout.HelpBox ("Save-game screenshots are disabled for WebPlayer, Windows Store and Android platforms.", MessageType.Info); takeSaveScreenshots = false; #endif EditorGUILayout.Space (); EditorGUILayout.LabelField ("Cutscene settings:", EditorStyles.boldLabel); actionListOnStart = ActionListAssetMenu.AssetGUI ("ActionList on start game:", actionListOnStart); blackOutWhenSkipping = EditorGUILayout.Toggle ("Black out when skipping?", blackOutWhenSkipping); EditorGUILayout.Space (); EditorGUILayout.LabelField ("Character settings:", EditorStyles.boldLabel); CreatePlayersGUI (); EditorGUILayout.Space (); EditorGUILayout.LabelField ("Interface settings", EditorStyles.boldLabel); movementMethod = (MovementMethod) EditorGUILayout.EnumPopup ("Movement method:", movementMethod); if (movementMethod == MovementMethod.UltimateFPS && !UltimateFPSIntegration.IsDefinePresent ()) { EditorGUILayout.HelpBox ("The 'UltimateFPSIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning); } inputMethod = (InputMethod) EditorGUILayout.EnumPopup ("Input method:", inputMethod); interactionMethod = (AC_InteractionMethod) EditorGUILayout.EnumPopup ("Interaction method:", interactionMethod); if (inputMethod != InputMethod.TouchScreen) { useOuya = EditorGUILayout.ToggleLeft ("Playing on OUYA platform?", useOuya); if (useOuya && !OuyaIntegration.IsDefinePresent ()) { EditorGUILayout.HelpBox ("The 'OUYAIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning); } if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction) { selectInteractions = (SelectInteractions) EditorGUILayout.EnumPopup ("Select Interactions by:", selectInteractions); if (selectInteractions != SelectInteractions.CyclingCursorAndClickingHotspot) { seeInteractions = (SeeInteractions) EditorGUILayout.EnumPopup ("See Interactions with:", seeInteractions); if (seeInteractions == SeeInteractions.ClickOnHotspot) { stopPlayerOnClickHotspot = EditorGUILayout.ToggleLeft ("Stop player moving when click Hotspot?", stopPlayerOnClickHotspot); } } if (selectInteractions == SelectInteractions.CyclingCursorAndClickingHotspot) { autoCycleWhenInteract = EditorGUILayout.ToggleLeft ("Auto-cycle after an Interaction?", autoCycleWhenInteract); } if (SelectInteractionMethod () == SelectInteractions.ClickingMenu) { clickUpInteractions = EditorGUILayout.ToggleLeft ("Trigger interaction by releasing click?", clickUpInteractions); cancelInteractions = (CancelInteractions) EditorGUILayout.EnumPopup ("Close interactions with:", cancelInteractions); } else { cancelInteractions = CancelInteractions.CursorLeavesMenu; } } } if (interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot) { autoCycleWhenInteract = EditorGUILayout.ToggleLeft ("Reset cursor after an Interaction?", autoCycleWhenInteract); } if (movementMethod == MovementMethod.FirstPerson && inputMethod == InputMethod.TouchScreen) { // First person dragging only works if cursor is unlocked lockCursorOnStart = false; } else { lockCursorOnStart = EditorGUILayout.ToggleLeft ("Lock cursor in screen's centre when game begins?", lockCursorOnStart); hideLockedCursor = EditorGUILayout.ToggleLeft ("Hide cursor when locked in screen's centre?", hideLockedCursor); onlyInteractWhenCursorUnlocked = EditorGUILayout.ToggleLeft ("Disallow Interactions if cursor is locked?", onlyInteractWhenCursorUnlocked); } if (IsInFirstPerson ()) { disableFreeAimWhenDragging = EditorGUILayout.ToggleLeft ("Disable free-aim when dragging?", disableFreeAimWhenDragging); if (movementMethod == MovementMethod.FirstPerson) { useFPCamDuringConversations = EditorGUILayout.ToggleLeft ("Run Conversations in first-person?", useFPCamDuringConversations); } } if (inputMethod != InputMethod.TouchScreen) { runConversationsWithKeys = EditorGUILayout.ToggleLeft ("Dialogue options can be selected with number keys?", runConversationsWithKeys); } EditorGUILayout.Space (); EditorGUILayout.LabelField ("Inventory settings", EditorStyles.boldLabel); if (interactionMethod != AC_InteractionMethod.ContextSensitive) { inventoryInteractions = (InventoryInteractions) EditorGUILayout.EnumPopup ("Inventory interactions:", inventoryInteractions); if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction) { if (selectInteractions == SelectInteractions.CyclingCursorAndClickingHotspot) { cycleInventoryCursors = EditorGUILayout.ToggleLeft ("Include Inventory items in Interaction cycles?", cycleInventoryCursors); } else { cycleInventoryCursors = EditorGUILayout.ToggleLeft ("Include Inventory items in Interaction menus?", cycleInventoryCursors); } } if (inventoryInteractions == InventoryInteractions.Multiple && CanSelectItems (false)) { selectInvWithUnhandled = EditorGUILayout.ToggleLeft ("Select item if Interaction is unhandled?", selectInvWithUnhandled); if (selectInvWithUnhandled) { CursorManager cursorManager = AdvGame.GetReferences ().cursorManager; if (cursorManager != null && cursorManager.cursorIcons != null && cursorManager.cursorIcons.Count > 0) { selectInvWithIconID = GetIconID ("Select with unhandled:", selectInvWithIconID, cursorManager); } else { EditorGUILayout.HelpBox ("No Interaction cursors defined - please do so in the Cursor Manager.", MessageType.Info); } } giveInvWithUnhandled = EditorGUILayout.ToggleLeft ("Give item if Interaction is unhandled?", giveInvWithUnhandled); if (giveInvWithUnhandled) { CursorManager cursorManager = AdvGame.GetReferences ().cursorManager; if (cursorManager != null && cursorManager.cursorIcons != null && cursorManager.cursorIcons.Count > 0) { giveInvWithIconID = GetIconID ("Give with unhandled:", giveInvWithIconID, cursorManager); } else { EditorGUILayout.HelpBox ("No Interaction cursors defined - please do so in the Cursor Manager.", MessageType.Info); } } } } if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction && selectInteractions != SelectInteractions.ClickingMenu && inventoryInteractions == InventoryInteractions.Multiple) {} else { reverseInventoryCombinations = EditorGUILayout.ToggleLeft ("Combine interactions work in reverse?", reverseInventoryCombinations); } //if (interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction || inventoryInteractions == InventoryInteractions.Single) if (CanSelectItems (false)) { inventoryDragDrop = EditorGUILayout.ToggleLeft ("Drag and drop Inventory interface?", inventoryDragDrop); if (!inventoryDragDrop) { if (interactionMethod == AC_InteractionMethod.ContextSensitive || inventoryInteractions == InventoryInteractions.Single) { rightClickInventory = (RightClickInventory) EditorGUILayout.EnumPopup ("Right-click active item:", rightClickInventory); } } else if (inventoryInteractions == AC.InventoryInteractions.Single) { inventoryDropLook = EditorGUILayout.ToggleLeft ("Can drop an Item onto itself to Examine it?", inventoryDropLook); } } if (CanSelectItems (false) && !inventoryDragDrop) { inventoryDisableLeft = EditorGUILayout.ToggleLeft ("Left-click deselects active item?", inventoryDisableLeft); if (movementMethod == MovementMethod.PointAndClick && !inventoryDisableLeft) { canMoveWhenActive = EditorGUILayout.ToggleLeft ("Can move player if an Item is active?", canMoveWhenActive); } } inventoryActiveEffect = (InventoryActiveEffect) EditorGUILayout.EnumPopup ("Active cursor FX:", inventoryActiveEffect); if (inventoryActiveEffect == InventoryActiveEffect.Pulse) { inventoryPulseSpeed = EditorGUILayout.Slider ("Active FX pulse speed:", inventoryPulseSpeed, 0.5f, 2f); } activeWhenUnhandled = EditorGUILayout.ToggleLeft ("Show Active FX when an Interaction is unhandled?", activeWhenUnhandled); canReorderItems = EditorGUILayout.ToggleLeft ("Items can be re-ordered in Menu?", canReorderItems); hideSelectedFromMenu = EditorGUILayout.ToggleLeft ("Hide currently active Item in Menu?", hideSelectedFromMenu); activeWhenHover = EditorGUILayout.ToggleLeft ("Show Active FX when Cursor hovers over Item in Menu?", activeWhenHover); EditorGUILayout.Space (); EditorGUILayout.LabelField ("Required inputs:", EditorStyles.boldLabel); EditorGUILayout.HelpBox ("The following inputs are available for the chosen interface settings:" + GetInputList (), MessageType.Info); EditorGUILayout.Space (); EditorGUILayout.LabelField ("Movement settings", EditorStyles.boldLabel); if ((inputMethod == InputMethod.TouchScreen && movementMethod != MovementMethod.PointAndClick) || movementMethod == MovementMethod.Drag) { dragWalkThreshold = EditorGUILayout.FloatField ("Walk threshold:", dragWalkThreshold); dragRunThreshold = EditorGUILayout.FloatField ("Run threshold:", dragRunThreshold); if (inputMethod == InputMethod.TouchScreen && movementMethod == MovementMethod.FirstPerson) { freeAimTouchSpeed = EditorGUILayout.FloatField ("Freelook speed:", freeAimTouchSpeed); } drawDragLine = EditorGUILayout.Toggle ("Draw drag line?", drawDragLine); if (drawDragLine) { dragLineWidth = EditorGUILayout.FloatField ("Drag line width:", dragLineWidth); dragLineColor = EditorGUILayout.ColorField ("Drag line colour:", dragLineColor); } } else if (movementMethod == MovementMethod.Direct) { magnitudeAffectsDirect = EditorGUILayout.ToggleLeft ("Input magnitude affects speed?", magnitudeAffectsDirect); directMovementType = (DirectMovementType) EditorGUILayout.EnumPopup ("Direct-movement type:", directMovementType); if (directMovementType == DirectMovementType.RelativeToCamera) { limitDirectMovement = (LimitDirectMovement) EditorGUILayout.EnumPopup ("Movement limitation:", limitDirectMovement); if (cameraPerspective == CameraPerspective.ThreeD) { directMovementPerspective = EditorGUILayout.ToggleLeft ("Account for player's position on screen?", directMovementPerspective); } } } else if (movementMethod == MovementMethod.PointAndClick) { clickPrefab = (Transform) EditorGUILayout.ObjectField ("Click marker:", clickPrefab, typeof (Transform), false); walkableClickRange = EditorGUILayout.Slider ("NavMesh search %:", walkableClickRange, 0f, 1f); doubleClickMovement = EditorGUILayout.Toggle ("Double-click to move?", doubleClickMovement); } if (movementMethod == MovementMethod.StraightToCursor) { dragRunThreshold = EditorGUILayout.FloatField ("Run threshold:", dragRunThreshold); singleTapStraight = EditorGUILayout.ToggleLeft ("Single-clicking also moves player?", singleTapStraight); if (singleTapStraight) { singleTapStraightPathfind = EditorGUILayout.ToggleLeft ("Pathfind when single-clicking?", singleTapStraightPathfind); } } if (movementMethod == MovementMethod.FirstPerson && inputMethod == InputMethod.TouchScreen) { dragAffects = (DragAffects) EditorGUILayout.EnumPopup ("Touch-drag affects:", dragAffects); } if ((movementMethod == MovementMethod.Direct || movementMethod == MovementMethod.FirstPerson) && inputMethod != InputMethod.TouchScreen) { jumpSpeed = EditorGUILayout.Slider ("Jump speed:", jumpSpeed, 1f, 10f); } destinationAccuracy = EditorGUILayout.Slider ("Destination accuracy:", destinationAccuracy, 0f, 1f); if (destinationAccuracy == 1f && movementMethod != MovementMethod.StraightToCursor) { experimentalAccuracy = EditorGUILayout.ToggleLeft ("Attempt to be super-accurate? (Experimental)", experimentalAccuracy); } if (inputMethod == InputMethod.TouchScreen) { EditorGUILayout.Space (); EditorGUILayout.LabelField ("Touch Screen settings", EditorStyles.boldLabel); if (movementMethod != MovementMethod.FirstPerson) { offsetTouchCursor = EditorGUILayout.Toggle ("Drag cursor with touch?", offsetTouchCursor); } doubleTapHotspots = EditorGUILayout.Toggle ("Double-tap Hotspots?", doubleTapHotspots); } EditorGUILayout.Space (); EditorGUILayout.LabelField ("Camera settings", EditorStyles.boldLabel); cameraPerspective_int = (int) cameraPerspective; cameraPerspective_int = EditorGUILayout.Popup ("Camera perspective:", cameraPerspective_int, cameraPerspective_list); cameraPerspective = (CameraPerspective) cameraPerspective_int; if (movementMethod == MovementMethod.FirstPerson) { cameraPerspective = CameraPerspective.ThreeD; } if (cameraPerspective == CameraPerspective.TwoD) { movingTurning = (MovingTurning) EditorGUILayout.EnumPopup ("Moving and turning:", movingTurning); if (movingTurning == MovingTurning.TopDown || movingTurning == MovingTurning.Unity2D) { verticalReductionFactor = EditorGUILayout.Slider ("Vertical movement factor:", verticalReductionFactor, 0.1f, 1f); } } forceAspectRatio = EditorGUILayout.Toggle ("Force aspect ratio?", forceAspectRatio); if (forceAspectRatio) { wantedAspectRatio = EditorGUILayout.FloatField ("Aspect ratio:", wantedAspectRatio); #if UNITY_IPHONE landscapeModeOnly = EditorGUILayout.Toggle ("Landscape-mode only?", landscapeModeOnly); #endif } EditorGUILayout.Space (); EditorGUILayout.LabelField ("Hotpot settings", EditorStyles.boldLabel); hotspotDetection = (HotspotDetection) EditorGUILayout.EnumPopup ("Hotspot detection method:", hotspotDetection); if (hotspotDetection == HotspotDetection.PlayerVicinity && (movementMethod == MovementMethod.Direct || IsInFirstPerson ())) { hotspotsInVicinity = (HotspotsInVicinity) EditorGUILayout.EnumPopup ("Hotspots in vicinity:", hotspotsInVicinity); } else if (hotspotDetection == HotspotDetection.MouseOver) { scaleHighlightWithMouseProximity = EditorGUILayout.ToggleLeft ("Highlight Hotspots based on cursor proximity?", scaleHighlightWithMouseProximity); if (scaleHighlightWithMouseProximity) { highlightProximityFactor = EditorGUILayout.FloatField ("Cursor proximity factor:", highlightProximityFactor); } } if (cameraPerspective != CameraPerspective.TwoD) { playerFacesHotspots = EditorGUILayout.ToggleLeft ("Player turns head to active Hotspot?", playerFacesHotspots); } hotspotIconDisplay = (HotspotIconDisplay) EditorGUILayout.EnumPopup ("Display Hotspot icon:", hotspotIconDisplay); if (hotspotIconDisplay != HotspotIconDisplay.Never) { if (cameraPerspective != CameraPerspective.TwoD) { occludeIcons = EditorGUILayout.ToggleLeft ("Don't show behind Colliders?", occludeIcons); } hotspotIcon = (HotspotIcon) EditorGUILayout.EnumPopup ("Hotspot icon type:", hotspotIcon); if (hotspotIcon == HotspotIcon.Texture) { hotspotIconTexture = (Texture2D) EditorGUILayout.ObjectField ("Hotspot icon texture:", hotspotIconTexture, typeof (Texture2D), false); } hotspotIconSize = EditorGUILayout.FloatField ("Hotspot icon size:", hotspotIconSize); if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction && selectInteractions != SelectInteractions.CyclingCursorAndClickingHotspot && hotspotIconDisplay != HotspotIconDisplay.OnlyWhenFlashing) { hideIconUnderInteractionMenu = EditorGUILayout.ToggleLeft ("Hide when Interaction Menus are visible?", hideIconUnderInteractionMenu); } } #if UNITY_5 EditorGUILayout.Space (); EditorGUILayout.LabelField ("Audio settings", EditorStyles.boldLabel); volumeControl = (VolumeControl) EditorGUILayout.EnumPopup ("Volume controlled by:", volumeControl); if (volumeControl == VolumeControl.AudioMixerGroups) { musicMixerGroup = (AudioMixerGroup) EditorGUILayout.ObjectField ("Music mixer:", musicMixerGroup, typeof (AudioMixerGroup), false); sfxMixerGroup = (AudioMixerGroup) EditorGUILayout.ObjectField ("SFX mixer:", sfxMixerGroup, typeof (AudioMixerGroup), false); speechMixerGroup = (AudioMixerGroup) EditorGUILayout.ObjectField ("Speech mixer:", speechMixerGroup, typeof (AudioMixerGroup), false); musicAttentuationParameter = EditorGUILayout.TextField ("Music atten. parameter:", musicAttentuationParameter); sfxAttentuationParameter = EditorGUILayout.TextField ("SFX atten. parameter:", sfxAttentuationParameter); speechAttentuationParameter = EditorGUILayout.TextField ("Speech atten. parameter:", speechAttentuationParameter); } #endif EditorGUILayout.Space (); EditorGUILayout.LabelField ("Raycast settings", EditorStyles.boldLabel); navMeshRaycastLength = EditorGUILayout.FloatField ("NavMesh ray length:", navMeshRaycastLength); hotspotRaycastLength = EditorGUILayout.FloatField ("Hotspot ray length:", hotspotRaycastLength); moveableRaycastLength = EditorGUILayout.FloatField ("Moveable ray length:", moveableRaycastLength); EditorGUILayout.Space (); EditorGUILayout.LabelField ("Layer names", EditorStyles.boldLabel); hotspotLayer = EditorGUILayout.TextField ("Hotspot:", hotspotLayer); navMeshLayer = EditorGUILayout.TextField ("Nav mesh:", navMeshLayer); if (cameraPerspective == CameraPerspective.TwoPointFiveD) { backgroundImageLayer = EditorGUILayout.TextField ("Background image:", backgroundImageLayer); } deactivatedLayer = EditorGUILayout.TextField ("Deactivated:", deactivatedLayer); EditorGUILayout.Space (); EditorGUILayout.LabelField ("Loading scene", EditorStyles.boldLabel); useLoadingScreen = EditorGUILayout.Toggle ("Use loading screen?", useLoadingScreen); if (useLoadingScreen) { loadingSceneIs = (ChooseSceneBy) EditorGUILayout.EnumPopup ("Choose loading scene by:", loadingSceneIs); if (loadingSceneIs == ChooseSceneBy.Name) { loadingSceneName = EditorGUILayout.TextField ("Loading scene name:", loadingSceneName); } else { loadingScene = EditorGUILayout.IntField ("Loading screen scene:", loadingScene); } } EditorGUILayout.Space (); EditorGUILayout.LabelField ("Options data", EditorStyles.boldLabel); optionsData = Options.LoadPrefsFromID (0, false, true); if (optionsData == null) { Debug.Log ("Saved new prefs"); Options.SaveDefaultPrefs (optionsData); } defaultSpeechVolume = optionsData.speechVolume = EditorGUILayout.Slider ("Speech volume:", optionsData.speechVolume, 0f, 1f); defaultMusicVolume = optionsData.musicVolume = EditorGUILayout.Slider ("Music volume:", optionsData.musicVolume, 0f, 1f); defaultSfxVolume = optionsData.sfxVolume = EditorGUILayout.Slider ("SFX volume:", optionsData.sfxVolume, 0f, 1f); defaultShowSubtitles = optionsData.showSubtitles = EditorGUILayout.Toggle ("Show subtitles?", optionsData.showSubtitles); defaultLanguage = optionsData.language = EditorGUILayout.IntField ("Language:", optionsData.language); Options.SaveDefaultPrefs (optionsData); if (GUILayout.Button ("Reset options data")) { optionsData = new OptionsData (); optionsData.language = 0; optionsData.speechVolume = 1f; optionsData.musicVolume = 0.6f; optionsData.sfxVolume = 0.9f; optionsData.showSubtitles = false; Options.SavePrefsToID (0, optionsData, true); } EditorGUILayout.Space (); EditorGUILayout.LabelField ("Debug settings", EditorStyles.boldLabel); showActiveActionLists = EditorGUILayout.ToggleLeft ("List active ActionLists in Game window?", showActiveActionLists); showHierarchyIcons = EditorGUILayout.ToggleLeft ("Show icons in Hierarchy window?", showHierarchyIcons); if (GUI.changed) { EditorUtility.SetDirty (this); } }