void txtOk_ClickText(ClickableText clickableText, MouseState mouseState, GameTime gameTime) { _cell.InitClip(); _cell.Clip.Instrument = new InstrumentEffect(_channelEffect); UI.GameEngine.GamePlay.EvaluateMuscianGrid(); this.Alive = false; }
public EffectPanel(UILogic uiLogic, UIComponent parent, TimeSpan creationTime, ChannelEffect channelEffect, Cell cell) : base(uiLogic, parent, creationTime) { this.Modal = true; this.Alive = true; this.Visible = true; this._channelEffect = new ChannelEffect(channelEffect.Channel, channelEffect.Name); this._cell = cell; this.ListUIChildren = new List<UIComponent>(); //--- Clonage des valeurs du channelEffect en entrée dans le channelEffect courant for (int i = 0; i < channelEffect.ListEffectProperty.Count; i++) { _channelEffect.ListEffectProperty[i].Value = channelEffect.ListEffectProperty[i].Value; } //--- Vector2 sizeWindow = new Vector2(_widthChannelChooser + Math.Min(channelEffect.ListEffectProperty.Count, 3) * (EffectPropertyChanger.WIDTH + Ribbon.MARGE), (int)Math.Round((float)channelEffect.ListEffectProperty.Count / 3f, MidpointRounding.AwayFromZero) * EffectPropertyChanger.HEIGHT); Rec = new Rectangle((int)(Render.ScreenWidth / 2 - sizeWindow.X / 2), Ribbon.HEIGHT + Ribbon.MARGE, (int)sizeWindow.X, (int)(sizeWindow.Y)); Vector2 vec = new Vector2(Rec.X + _widthChannelChooser + Ribbon.MARGE, Rec.Y); int nb = 0; foreach (EffectProperty effectProperty in _channelEffect.ListEffectProperty) { EffectPropertyChanger effectPropertyChanger = new EffectPropertyChanger(UI, this, GetNewTimeSpan(), effectProperty); effectPropertyChanger.Rec = new Rectangle((int)vec.X, (int)vec.Y, EffectPropertyChanger.WIDTH, EffectPropertyChanger.HEIGHT); effectPropertyChanger.Init(); nb++; if (nb % 3 == 0) { vec.X = Rec.X + _widthChannelChooser + Ribbon.MARGE; vec.Y += EffectPropertyChanger.HEIGHT + Ribbon.MARGE; } else vec.X += EffectPropertyChanger.WIDTH + Ribbon.MARGE; this.ListUIChildren.Add(effectPropertyChanger); } //CreateChannelMenu(); //--- Bouton Valider ClickableText txtOk = new ClickableText(UI, this, GetNewTimeSpan(), Render.FontText, "Ok", new Vector2(Rec.X + _widthChannelChooser * 0.3f, Rec.Y + Rec.Height * 0.8f), VisualStyle.ForeColor, VisualStyle.ForeColor, VisualStyle.BackColorLight, VisualStyle.BackForeColorMouseOver, false); txtOk.ClickText += new ClickableText.ClickTextHandler(txtOk_ClickText); ListUIChildren.Add(txtOk); ClickableText txtCancel = new ClickableText(UI, this, GetNewTimeSpan(), Render.FontText, "Cancel", new Vector2(Rec.X + _widthChannelChooser * 0.5f, Rec.Y + Rec.Height * 0.8f), VisualStyle.ForeColor, VisualStyle.ForeColor, VisualStyle.BackColorLight, VisualStyle.BackForeColorMouseOver, false); txtCancel.ClickText += new ClickableText.ClickTextHandler(txtCancel_ClickText); ListUIChildren.Add(txtCancel); //--- //--- Bouton Annuler //--- //--- KeyManager keyClose = AddKey(Keys.Escape); keyClose.KeyReleased += new KeyManager.KeyReleasedHandler(keyClose_KeyReleased); //--- }
void txtLibrary_ClickText(ClickableText clickableText, Microsoft.Xna.Framework.Input.MouseState mouseState, GameTime gameTime) { GamePlay.NewMap(clickableText.Text); this.Alive = false; }
void txtCancel_ClickText(ClickableText clickableText, MouseState mouseState, GameTime gameTime) { this.Alive = false; }
void txtSample_ClickText(ClickableText clickableText, Microsoft.Xna.Framework.Input.MouseState mouseState, GameTime gameTime) { UI.GameEngine.Sound.Stop(((Sample)clickableText.Tag).Name); if (IsCheckable) { bool checkItem = clickableText.IsChecked; foreach (UIComponent component in ListUIChildren) { if (component is ClickableText) ((ClickableText)component).IsChecked = false; } clickableText.IsChecked = checkItem; OnSelectedItemChanged(clickableText.Tag); } if (_cell != null) { _cell.InitClip(); _cell.Clip.Instrument = new InstrumentSample((Sample)clickableText.Tag); UI.GameEngine.GamePlay.EvaluateMuscianGrid(); this.Alive = false; } }
void txtItem_ClickText(ClickableText clickableText, Microsoft.Xna.Framework.Input.MouseState mouseState, GameTime gameTime) { GamePlay.LoadMap(Path.GetFileNameWithoutExtension((string)clickableText.Tag)); this.Alive = false; }
void txtSample_MouseEnter(ClickableText clickableText, MouseState mouseState, GameTime gameTime) { UI.GameEngine.Sound.PlaySample((Sample)clickableText.Tag); }
void txtSample_MouseLeave(ClickableText clickableText, MouseState mouseState, GameTime gameTime) { UI.GameEngine.Sound.Stop(((Sample)clickableText.Tag).Name); }
public ClickableText AddItem(string itemName, object value) { Vector2 vec = new Vector2(Rec.X + Ribbon.MARGE, Rec.Y + sizeText.Y * CountItem + MARGE); ClickableText txtItem = new ClickableText(UI, this, GetNewTimeSpan(), Font, itemName.Substring(0, Math.Min(20, itemName.Length)), vec, VisualStyle.ForeColor, VisualStyle.ForeColor, VisualStyle.BackColorLight, VisualStyle.BackForeColorMouseOver, IsCheckable); txtItem.Rec = new Rectangle((int)vec.X, (int)vec.Y, (int)sizeText.X, (int)sizeText.Y); txtItem.Tag = value; ListUIChildren.Add(txtItem); CountItem++; return txtItem; }
void txtSample_MiddleButtonClickText(ClickableText clickableText, MouseState mouseState, GameTime gameTime) { UI.GameEngine.Sound.PlaySample((Sample)clickableText.Tag); }
void txtSilence_ClickText(ClickableText clickableText, MouseState mouseState, GameTime gameTime) { if (Context.NextCellNote != null) { GoToNextCell(); } }
void txtOpenMidi_ClickText(ClickableText clickableText, MouseState mouseState, GameTime gameTime) { //D:\Log\geff\TheGrid\TheGrid\TheGrid\Files\Sound\Midi\MozartTurque.mid //@"D:\Libraries\Musics\Midi\beethoven-pour-elise.mid" //D:\Log\geff\TheGrid\TheGrid\TheGrid\Files\Sound\Midi\Vivaldi4SeasWint.mid NAudio.Midi.MidiFile midiFile = new MidiFile(@"D:\Geff\Log\geff\TheGrid\TheGrid\TheGrid\Files\Sound\Midi\beethoven-pour-elise.mid"); //NAudio.Midi.MidiFile midiFile = new MidiFile(@"D:\GDD\Log\Geff\TheGrid\TheGrid\TheGrid\Files\Sound\Midi\beethoven-pour-elise.mid"); //if (midiFile != null) //{ // foreach (MidiEvent midiEvent in midiFile.Events[2]) // { // NoteEvent noteEvent = midiEvent as NoteEvent; // if (noteEvent != null && noteEvent.CommandCode== MidiCommandCode.NoteOn) // { // AddNote(noteEvent.NoteNumber - 20, noteEvent.NoteName); // } // } //} NoteOnEvent prevNoteEvent = null; int prevNoteLength = 1; int noteLength = 1; if (midiFile != null) { for (int i = 0; i < midiFile.Tracks; i++) { foreach (MidiEvent midiEvent in midiFile.Events[i]) { NoteOnEvent noteEvent = midiEvent as NoteOnEvent; if (noteEvent != null && noteEvent.CommandCode == MidiCommandCode.NoteOn) { try { noteLength = noteEvent.NoteLength; } catch { } float typeNote = (float)noteLength / (float)midiFile.DeltaTicksPerQuarterNote; //--- Ajout des silences if (prevNoteEvent != null) { float deltaTime = noteEvent.AbsoluteTime - (prevNoteEvent.AbsoluteTime + prevNoteLength); int countQuarterNote = (int)(deltaTime / (float)midiFile.DeltaTicksPerQuarterNote); if (deltaTime > midiFile.DeltaTicksPerQuarterNote) { for (int j = 1; j <= countQuarterNote ; j++) { AddSilence(1f, Sample.Channel); } } if (deltaTime > countQuarterNote*midiFile.DeltaTicksPerQuarterNote) { typeNote = (deltaTime - countQuarterNote * midiFile.DeltaTicksPerQuarterNote) / (float)midiFile.DeltaTicksPerQuarterNote; AddSilence(typeNote, Sample.Channel); } } //--- //--- Ajout de la note AddNote(noteEvent.NoteNumber - 20, typeNote, noteEvent.NoteName); //--- } if (noteEvent != null) { prevNoteEvent = noteEvent; prevNoteLength = noteLength; } } } } }
void txtEntrainement_ClickText(ClickableText clickableText, MouseState mouseState, GameTime gameTime) { Training = clickableText.IsChecked; }
void txtCapture_ClickText(ClickableText clickableText, MouseState mouseState, GameTime gameTime) { AddCapture(Sample); }
public NotePanel(UILogic uiLogic, TimeSpan creationTime) : base(uiLogic, null, creationTime) { Alive = true; Visible = true; Context.NextCellNote = Context.SelectedCell; leftPartWidth = 350f;// 0.3f * UI.GameEngine.Render.ScreenWidth; Rec = new Rectangle(0, (int)(0.6f * UI.GameEngine.Render.ScreenHeight), (int)UI.GameEngine.Render.ScreenWidth, (int)(0.4f * UI.GameEngine.Render.ScreenHeight)); keyboard = new Keyboard(this, UI, GetNewTimeSpan()); ListUIChildren = new List<UIComponent>(); ListUIChildren.Add(keyboard); //--- Boutons Vector2 vec = new Vector2(0, Rec.Top + MARGE); ClickableText txtSilence = new ClickableText(UI, this, GetNewTimeSpan(), Render.FontTextSmall, "Silence", new Vector2(MARGE, vec.Y), VisualStyle.ForeColor, VisualStyle.ForeColor, VisualStyle.BackColorLight, VisualStyle.BackForeColorMouseOver, false); txtSilence.ClickText += new ClickableText.ClickTextHandler(txtSilence_ClickText); ListUIChildren.Add(txtSilence); vec.Y += MARGE + txtSilence.Rec.Height; ClickableText txtCapture = new ClickableText(UI, this, GetNewTimeSpan(), Render.FontTextSmall, "Capture", new Vector2(MARGE, vec.Y), VisualStyle.ForeColor, VisualStyle.ForeColor, VisualStyle.BackColorLight, VisualStyle.BackForeColorMouseOver, false); txtCapture.ClickText += new ClickableText.ClickTextHandler(txtCapture_ClickText); ListUIChildren.Add(txtCapture); vec.Y += MARGE + txtCapture.Rec.Height; ClickableText txtEntrainement = new ClickableText(UI, this, GetNewTimeSpan(), Render.FontTextSmall, "Entraînement", new Vector2(MARGE, vec.Y), VisualStyle.ForeColor, VisualStyle.ForeColor, VisualStyle.BackColorLight, VisualStyle.BackForeColorMouseOver, true); txtEntrainement.ClickText += new ClickableText.ClickTextHandler(txtEntrainement_ClickText); ListUIChildren.Add(txtEntrainement); vec.Y += MARGE + txtEntrainement.Rec.Height; ClickableText txtOpenMidi = new ClickableText(UI, this, GetNewTimeSpan(), Render.FontTextSmall, "Midi", new Vector2(MARGE, vec.Y), VisualStyle.ForeColor, VisualStyle.ForeColor, VisualStyle.BackColorLight, VisualStyle.BackForeColorMouseOver, false); txtOpenMidi.ClickText += new ClickableText.ClickTextHandler(txtOpenMidi_ClickText); ListUIChildren.Add(txtOpenMidi); vec.Y += MARGE + txtOpenMidi.Rec.Height; //--- //--- Note duration CreateNoteDurationMenu(); //--- //--- Channel CreateChannelMenu(); //--- //--- Liste des samples listSample = new ListSample(UI,this, GetNewTimeSpan(), null, Context.Map.Channels[1], new Rectangle(MARGE + (int)leftPartWidth / 2, Rec.Top + Rec.Height / 2 + MARGE, (int)leftPartWidth / 2-MARGE*2, Rec.Height / 2-MARGE*2) , Render.FontTextSmall, true); listSample.SelectedItemChanged += new ListBase.SelectedItemChangedHandler(listSample_SelectedItemChanged); ListUIChildren.Add(listSample); //--- //--- KeyManager keyClose = AddKey(Keys.Escape); keyClose.KeyReleased += new KeyManager.KeyReleasedHandler(keyClose_KeyReleased); //--- //--- MouseManager mouseLeftButton = AddMouse(MouseButtons.LeftButton); mouseLeftButton.MouseFirstPressed += new MouseManager.MouseFirstPressedHandler(mouseIgnoreActionFirstPressed); //mouseLeftButton.MousePressed += new MouseManager.MousePressedHandler(mouseIgnoreAction); mouseLeftButton.MouseReleased += new MouseManager.MouseReleasedHandler(mouseIgnoreAction); MouseManager mouseRightButton = AddMouse(MouseButtons.RightButton); mouseRightButton.MouseFirstPressed += new MouseManager.MouseFirstPressedHandler(mouseIgnoreActionFirstPressed); //mouseRightButton.MousePressed += new MouseManager.MousePressedHandler(mouseIgnoreAction); mouseRightButton.MouseReleased += new MouseManager.MouseReleasedHandler(mouseIgnoreAction); //--- Context.SelectedCellChanged += new Context.SelectedCellChangedHandler(Context_SelectedCellChanged); }