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); //--- }
public void OpenPannelEffect(GameTime gameTime, ChannelEffect channelEffect, Cell cell) { EffectPanel effectPanel = new EffectPanel(this, null, gameTime.TotalGameTime, channelEffect, cell); this.ListUIComponent.Add(effectPanel); }
public void Update(ChannelEffect channelEffect, float[] values, GameTime gameTime) { foreach (Sample sample in channelEffect.Channel.ListSample) { for (int i = 0; i < CountInstancePerSample; i++) { if (!PlayingNote[dicSample[sample.Name][i]]) { Effect effect = dicEffect[sample.Name][i].Find(e => e.Name == channelEffect.Name); if (values[0] == float.MinValue) { effect.Enabled = false; } else { effect.Enabled = true; for (int j = 0; j < values.Length; j++) { effect.Sliders[j].Value = values[j]; } effect.Slider(); } } } } }
public InstrumentEffect(ChannelEffect channelEffect) { this.ChannelEffect = channelEffect; }