public UIEffect(Vector2 offset, bool rotate, float rotSpeed, Texture2D tex) { scale = 1; Life = START_LIFE; IsDead = false; origin = new Vector2(tex.Width / 2, tex.Height / 2); if (offset.Equals(Vector2.Zero)) { this.doOffset = false; } else { this.doOffset = true; } position = Player.Position + offset; if (rotate) { mode = EffectMode.RotateAround; } else { mode = EffectMode.Follow; } this.rotSpeed = rotSpeed; this.tex = tex; drawColor = Color.White; }
public void SetActiveEffect(int index) { effectMode = (EffectMode)index; selectionMode = SelectionMode.Effect; UpdateToolInfo(effectMode.ToString()); }
/// <summary> /// Create a new <see cref="VolumeRaycastingEffect"/> instance. /// </summary> /// <param name="graphicsDevice">The <see cref="GraphicsDevice"/> instance to render this effect.</param> internal VolumeRaycastingEffect(GraphicsDevice graphicsDevice) : base(graphicsDevice, typeof(VolumeRaycastingEffect)) { this.dirtyFlags |= EffectDirtyFlags.WorldViewProjectionMatrix; this.mode = EffectMode.ColorFromScreenSpacePosition; this.InitializeFullScreenQuad(); }
//多模式按钮效果选择,有需要的新增配套效果,直接在这里面组合就是了 public void Set(GameObject button, EffectMode mode) { m_Button = button; switch (mode) { case EffectMode.A: EventListener.Get(m_Button).onDown = OnButtonDownDoShrink; EventListener.Get(m_Button).onUp = OnButtonUpDoOutBounce; EventListener.Get(m_Button).onClick = OnButtonClick; break; case EffectMode.B: break; case EffectMode.C: break; default: Debug.LogError("---------------- Select button effect mode Error ! ------------------"); break; } }
private void DoEffectIn(double milliseconds = 1000) { if (_currentEffectMode == EffectMode.Foreground || _currentEffectMode == EffectMode.None) { _currentEffectMode = EffectMode.Background; background.Scale(milliseconds, 1.0, 1.1); background.Blur(milliseconds, 6.0, 0.0); foreground.Scale(500, 1.0, 0.95); foreground.Fade(milliseconds, 1.0, 0.75); } }
private void DoEffectOut(double milliseconds = 1000) { if (CurrentEffectMode == EffectMode.Background || CurrentEffectMode == EffectMode.None) { CurrentEffectMode = EffectMode.Foreground; background.Scale(milliseconds, 1.1, 1.0); background.Blur(milliseconds, 0.0, 6.0); foreground.Scale(500, 0.95, 1.0); foreground.Fade(milliseconds, 0.75, 1.0); } }
public UIEffect(Vector2 p, Vector2 v, Texture2D tex) { scale = 1; Life = START_LIFE; IsDead = false; origin = new Vector2(tex.Width / 2, tex.Height / 2); mode = EffectMode.Move; position = p; velocity = v; this.tex = tex; doOffset = false; drawColor = Color.White; }
public UIEffect(Vector2 p, Vector2 v, string message, Color col) { scale = 1; Life = START_LIFE; IsDead = false; origin = Vector2.Zero; mode = EffectMode.Move; position = p; velocity = v; msg = message; doOffset = false; drawColor = col; }
public UIEffect(Vector2 p, Vector2 v, float gravity, string message, Color col, float scale) { this.scale = scale; Life = START_LIFE; IsDead = false; origin = Vector2.Zero; mode = EffectMode.Gravity; position = p; velocity = v; this.gravity = gravity; msg = message; doOffset = false; drawColor = col; }
/// <summary> /// Changes which sound effects are played. /// </summary> /// <param name="mode">The sound effect set to play.</param> /// <param name="path">If Set is Files, path indicates the directory containing the sound files.</param> public void ChangeSource(EffectMode mode, string path) { this.Mode = mode; if (mode == EffectMode.Files) { if (Directory.Exists(path)) { this.SoundFolder = path; } else { this.SoundFolder = String.Empty; this.Mode = EffectMode.None; } } this.CreatePlayers(); }
public void PlaySoundEffect(SoundEffect effect, EffectMode mode) { if (mode == EffectMode.Off || effect == SoundEffect.None || _audio == null) { return; } if (mode == EffectMode.Default) { var enabled = (Forms9Patch.Settings.KeyClicks & KeyClicks.Audio) > 0; if (Forms9Patch.Settings.KeyClicks == KeyClicks.Default) { enabled = Android.Provider.Settings.System.GetInt(Android.App.Application.Context.ContentResolver, Android.Provider.Settings.System.SoundEffectsEnabled) != 0; //vibeEnabled = Android.Provider.Settings.System.GetInt(Android.App.Application.Context.ContentResolver, Android.Provider.Settings.System.HapticFeedbackEnabled) != 0; } if (!enabled) { return; } } if (_audio != null) { Android.Media.SoundEffect droidSound = Android.Media.SoundEffect.KeyClick; switch (effect) { case SoundEffect.None: return; case SoundEffect.KeyClick: break; case SoundEffect.Return: droidSound = Android.Media.SoundEffect.Return; break; case SoundEffect.Delete: droidSound = Android.Media.SoundEffect.Delete; break; } _audio.PlaySoundEffect(droidSound); } }
private void DoEffectIn(double milliseconds = 1000) { try { if (_currentEffectMode == EffectMode.Foreground || _currentEffectMode == EffectMode.None) { _currentEffectMode = EffectMode.Background; background.Scale(milliseconds, 1.0, 1.1); background.Blur(milliseconds, 6.0, 0.0); foreground.Scale(500, 1.0, 0.95); foreground.Fade(milliseconds, 1.0, 0.75); } } catch (Exception e) { Result.Error(e.Message); } finally { Result.Ok(); } }
public void PlaySoundEffect(SoundEffect effect, EffectMode mode) { if (mode == EffectMode.Off || effect == SoundEffect.None) { return; } if (mode == EffectMode.Default && Forms9Patch.Settings.SoundEffectMode != EffectMode.On) { if (Forms9Patch.Settings.SoundEffectMode == EffectMode.Default) { // this no longer works and there doesn't appear to be a way to detect if keyclicks is on //var type = CFPreferences.CurrentApplication; CFPreferences.AppSynchronize("/var/mobile/Library/Preferences/com.apple.preferences.sounds"); if (!CFPreferences.GetAppBooleanValue("keyboard", "/var/mobile/Library/Preferences/com.apple.preferences.sounds")) { return; } } else // Forms9Patch.Settings.SoundEffectMode == EffectMode.Off { return; } } switch (effect) { case SoundEffect.KeyClick: click.PlaySystemSound(); break; case SoundEffect.Return: modifier.PlaySystemSound(); break; case SoundEffect.Delete: delete.PlaySystemSound(); break; } }
/// <summary> /// Changes which sound effects are played. /// </summary> /// <param name="mode">The sound effect set to play.</param> /// <param name="path">If Set is Files, path indicates the directory containing the sound files.</param> public void ChangeSource(EffectMode mode, string path) { this.Mode = mode; if (mode == EffectMode.Files) { if(Directory.Exists(path)) { this.SoundFolder = path; } else { this.SoundFolder = String.Empty; this.Mode = EffectMode.None; } } this.CreatePlayers(); }
//Set the effect mode to Skin or Sphere. //This public method can be called by third party assets such as PlayMaker public void SetEffectMode(EffectMode setEffectMode) { effectMode = setEffectMode; if (EffectIsOn) SetEffectOn(); }
SpeedModifier(EffectMode type, int percentage) { _type = type; _value = percentage; }
SpeedModifier(SpeedModifier template, int id, float timeout) { ID = id; _type = template._type; _value = template._value; Timeout = timeout; ApplicationTime = Time.time; }
public IEffect Instance(Timestep step, Entity entity, EntityPainter painter, EntityUniverseFacade facade, Blob data, EffectDefinition definition, EffectMode mode) { return(new ModOptionsEvent()); }
/// <summary> /// Changes which sound effects are played. /// </summary> /// <param name="mode">The sound effect set to play (must be None or Default).</param> public void ChangeSource(EffectMode mode) { this.ChangeSource(mode, null); }
/// <summary> /// Changes which sound effects are played. /// </summary> /// <param name="mode">The sound effect set to play (must be None or Default).</param> public void ChangeSource(EffectMode mode) { this.ChangeSource(mode, null); }
public void Feedback(HapticEffect effect, EffectMode mode = EffectMode.Default) { if (effect == HapticEffect.None) { return; } var hapticEnabled = mode == EffectMode.On; if (mode == EffectMode.Default) { hapticEnabled = (Forms9Patch.Settings.HapticEffectMode > EffectMode.Off) && Android.Provider.Settings.System.GetInt(Android.App.Application.Context.ContentResolver, Android.Provider.Settings.System.HapticFeedbackEnabled) != 0; } if (hapticEnabled && AppEnabled) { if (effect == HapticEffect.Selection) { Settings.Activity.Window.DecorView.PerformHapticFeedback(Android.Views.FeedbackConstants.KeyboardTap); } else if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.O) { VibrationEffect droidEffect = null; switch (effect) { case HapticEffect.LightImpact: droidEffect = VibrationEffect.CreateOneShot(200, 128); break; case HapticEffect.MediumImpact: droidEffect = VibrationEffect.CreateOneShot(200, 196); break; case HapticEffect.HeavyImpact: droidEffect = VibrationEffect.CreateOneShot(200, 255); break; case HapticEffect.ErrorNotification: droidEffect = VibrationEffect.CreateWaveform(new long[] { 0, 200, 100, 200, 100, 200 }, new int[] { 0, 196, 0, 196, 0, 255 }, -1); break; case HapticEffect.WarningNotification: droidEffect = VibrationEffect.CreateWaveform(new long[] { 0, 200, 100, 200 }, new int[] { 0, 196, 0, 255 }, -1); break; case HapticEffect.SuccessNotification: droidEffect = VibrationEffect.CreateWaveform(new long[] { 0, 200, 100, 200 }, new int[] { 0, 255, 0, 196 }, -1); break; } if (droidEffect != null) { _vibrator.Vibrate(droidEffect); } } else { #pragma warning disable CS0618 // Type or member is obsolete long[] pattern = null; switch (effect) { case HapticEffect.LightImpact: _vibrator.Vibrate(200, Attributes); break; case HapticEffect.MediumImpact: _vibrator.Vibrate(200, Attributes); break; case HapticEffect.HeavyImpact: _vibrator.Vibrate(200, Attributes); break; case HapticEffect.ErrorNotification: pattern = new long[] { 0, 200, 100, 200, 100, 200 }; break; case HapticEffect.WarningNotification: pattern = new long[] { 0, 200, 100, 200 }; break; case HapticEffect.SuccessNotification: pattern = new long[] { 0, 200, 100, 200 }; break; } if (pattern != null) { _vibrator.Vibrate(pattern, -1, Attributes); } #pragma warning restore CS0618 // Type or member is obsolete } } }
public void Feedback(HapticEffect effect, EffectMode mode = EffectMode.Default) { if (mode == EffectMode.Off || effect == HapticEffect.None || !UIDevice.CurrentDevice.CheckSystemVersion(10, 0)) { return; } if (mode == EffectMode.Default && Forms9Patch.Settings.HapticEffectMode == EffectMode.Off) { return; } switch (effect) { case HapticEffect.Selection: { using (var selection = new UISelectionFeedbackGenerator()) { selection.Prepare(); selection.SelectionChanged(); } } break; case HapticEffect.LightImpact: { using (var impact = new UIImpactFeedbackGenerator(UIImpactFeedbackStyle.Light)) { impact.Prepare(); impact.ImpactOccurred(); } } break; case HapticEffect.MediumImpact: { using (var impact = new UIImpactFeedbackGenerator(UIImpactFeedbackStyle.Medium)) { impact.Prepare(); impact.ImpactOccurred(); } } break; case HapticEffect.HeavyImpact: { using (var impact = new UIImpactFeedbackGenerator(UIImpactFeedbackStyle.Heavy)) { impact.Prepare(); impact.ImpactOccurred(); } } break; case HapticEffect.ErrorNotification: { // Initialize feedback using (var notification = new UINotificationFeedbackGenerator()) { notification.Prepare(); notification.NotificationOccurred(UINotificationFeedbackType.Error); } } break; case HapticEffect.WarningNotification: { // Initialize feedback using (var notification = new UINotificationFeedbackGenerator()) { notification.Prepare(); notification.NotificationOccurred(UINotificationFeedbackType.Warning); } } break; case HapticEffect.SuccessNotification: { // Initialize feedback using (var notification = new UINotificationFeedbackGenerator()) { notification.Prepare(); notification.NotificationOccurred(UINotificationFeedbackType.Success); } } break; } }
/// <summary> /// Implement this function to make a custom inspector. /// </summary> public override void OnInspectorGUI() { foreach (var d in targets.Cast <UIEffect> ()) { var mat = d.material; if (d.isTMPro && mat) { var so = new SerializedObject(d); EffectMode eMode = (EffectMode)GetEnum <EffectMode> (mat); ColorMode cMode = (ColorMode)GetEnum <ColorMode> (mat); BlurMode bMode = (BlurMode)GetEnum <BlurMode> (mat); bool aBlur = mat.IsKeywordEnabled("EX"); if (d.effectMode != eMode || d.colorMode != cMode || d.blurMode != bMode || so.FindProperty("m_AdvancedBlur").boolValue != aBlur) { so.FindProperty("m_EffectMode").intValue = (int)eMode; so.FindProperty("m_ColorMode").intValue = (int)cMode; so.FindProperty("m_BlurMode").intValue = (int)bMode; so.FindProperty("m_AdvancedBlur").boolValue = aBlur; so.ApplyModifiedProperties(); } } } serializedObject.Update(); bool isAnyTMPro = targets.Cast <UIEffect>().Any(x => x.isTMPro); var c = target as UIEffect; //================ // Effect material. //================ var spMaterial = serializedObject.FindProperty("m_EffectMaterial"); EditorGUI.BeginDisabledGroup(true); EditorGUILayout.PropertyField(spMaterial); EditorGUI.EndDisabledGroup(); //================ // Effect setting. //================ var spToneMode = serializedObject.FindProperty("m_EffectMode"); using (new EditorGUI.DisabledGroupScope(isAnyTMPro)) EditorGUILayout.PropertyField(spToneMode); // When tone is enable, show parameters. if (spToneMode.intValue != (int)EffectMode.None) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(serializedObject.FindProperty("m_EffectFactor")); EditorGUI.indentLevel--; } //================ // Color setting. //================ var spColorMode = serializedObject.FindProperty("m_ColorMode"); using (new EditorGUI.DisabledGroupScope(isAnyTMPro)) EditorGUILayout.PropertyField(spColorMode); // When color is enable, show parameters. //if (spColorMode.intValue != (int)ColorMode.Multiply) { EditorGUI.indentLevel++; SerializedProperty spColor = serializedObject.FindProperty("m_Color"); if (spColor == null && serializedObject.targetObject is UIEffect) { spColor = new SerializedObject(serializedObject.targetObjects.Select(x => (x as UIEffect).targetGraphic).ToArray()).FindProperty(!isAnyTMPro ? "m_Color" : "m_fontColor"); } EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = spColor.hasMultipleDifferentValues; #if UNITY_2018_1_OR_NEWER spColor.colorValue = EditorGUILayout.ColorField(contentEffectColor, spColor.colorValue, true, false, false); #else spColor.colorValue = EditorGUILayout.ColorField(contentEffectColor, spColor.colorValue, true, false, false, null); #endif if (EditorGUI.EndChangeCheck()) { spColor.serializedObject.ApplyModifiedProperties(); } EditorGUILayout.PropertyField(serializedObject.FindProperty("m_ColorFactor")); EditorGUI.indentLevel--; } //================ // Blur setting. //================ var spBlurMode = serializedObject.FindProperty("m_BlurMode"); using (new EditorGUI.DisabledGroupScope(isAnyTMPro)) EditorGUILayout.PropertyField(spBlurMode); // When blur is enable, show parameters. if (spBlurMode.intValue != (int)BlurMode.None) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(serializedObject.FindProperty("m_BlurFactor")); var spAdvancedBlur = serializedObject.FindProperty("m_AdvancedBlur"); using (new EditorGUI.DisabledGroupScope(isAnyTMPro)) EditorGUILayout.PropertyField(spAdvancedBlur); EditorGUI.indentLevel--; } serializedObject.ApplyModifiedProperties(); c.ShowTMProWarning(_shader, _mobileShader, _spriteShader, mat => {}); ShowCanvasChannelsWarning(); ShowMaterialEditors(c.materials, 1, c.materials.Length - 1); serializedObject.ApplyModifiedProperties(); }