This commit is contained in:
parent
408c002c47
commit
ea2847a520
5 changed files with 120 additions and 23 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<Properties>
|
||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
|
||||
<MonoDevelop.Ide.Workbench ActiveDocument="DMX-2.0/SequenceurLineaire.cs">
|
||||
<MonoDevelop.Ide.Workbench ActiveDocument="DMX-2.0/IDriverDMX.cs">
|
||||
<Files>
|
||||
<File FileName="DMX-2.0/Main.cs" Line="4" Column="15" />
|
||||
<File FileName="DMX-2.0/MainWindow.cs" Line="17" Column="1" />
|
||||
|
|
@ -8,7 +8,8 @@
|
|||
<File FileName="DMX-2.0/AssemblyInfo.cs" Line="1" Column="1" />
|
||||
<File FileName="DMX-2.0/UniversDMX.cs" Line="48" Column="12" />
|
||||
<File FileName="DMX-2.0/Sequenceur.cs" Line="31" Column="1" />
|
||||
<File FileName="DMX-2.0/SequenceurLineaire.cs" Line="28" Column="7" />
|
||||
<File FileName="DMX-2.0/SequenceurLineaire.cs" Line="6" Column="22" />
|
||||
<File FileName="DMX-2.0/IDriverDMX.cs" Line="13" Column="1" />
|
||||
</Files>
|
||||
</MonoDevelop.Ide.Workbench>
|
||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@
|
|||
<Package>gtk-sharp-2.0</Package>
|
||||
</Reference>
|
||||
<Reference Include="Mono.Posix" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="gtk-gui\gui.stetic">
|
||||
|
|
@ -73,6 +74,7 @@
|
|||
<Compile Include="UniversDMX.cs" />
|
||||
<Compile Include="Sequenceur.cs" />
|
||||
<Compile Include="SequenceurLineaire.cs" />
|
||||
<Compile Include="IDriverDMX.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
|
|
@ -1,12 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
|
||||
namespace DMX2
|
||||
{
|
||||
public abstract class Sequenceur
|
||||
{
|
||||
|
||||
static int idmax;
|
||||
|
||||
public Sequenceur (int id)
|
||||
{
|
||||
this.id = id;
|
||||
idmax = Math.Max(id,idmax);
|
||||
}
|
||||
|
||||
public Sequenceur ()
|
||||
{
|
||||
id = idmax++;
|
||||
}
|
||||
|
||||
int id;
|
||||
|
|
@ -20,11 +31,12 @@ namespace DMX2
|
|||
|
||||
public abstract int EtatCircuit(Circuit c);
|
||||
public abstract void Tick(TimeSpan time);
|
||||
public static Sequenceur Load()
|
||||
public static Sequenceur Load(XmlElement el)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return null;
|
||||
}
|
||||
public abstract void Save();
|
||||
|
||||
public abstract XmlElement Save();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace DMX2
|
||||
{
|
||||
public class SequenceurLineaire : Sequenceur
|
||||
{
|
||||
|
||||
TimeSpan timeStamp;
|
||||
TimeSpan timeStamp = TimeSpan.Zero;
|
||||
|
||||
public TimeSpan TimeStamp {
|
||||
get {
|
||||
|
|
@ -15,37 +16,69 @@ namespace DMX2
|
|||
}
|
||||
|
||||
public class Effet {
|
||||
public string Nom;
|
||||
Dictionary<Circuit,int> valeurs = new Dictionary<Circuit, int>();
|
||||
|
||||
string _nom;
|
||||
public Effet(string nom, Dictionary<Circuit,int> valeurs, TimeSpan duree, TimeSpan transition)
|
||||
{
|
||||
_nom=nom;
|
||||
_valeurs = new Dictionary<Circuit, int>(valeurs);
|
||||
_duree=duree;
|
||||
_transition=transition;
|
||||
}
|
||||
public string Nom {
|
||||
get {
|
||||
return _nom;
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<Circuit,int> _valeurs;
|
||||
public int this [Circuit index] {
|
||||
get {
|
||||
if(!valeurs.ContainsKey(index))
|
||||
valeurs.Add(index,0);
|
||||
return valeurs[index];
|
||||
}
|
||||
set {
|
||||
if(valeurs.ContainsKey (index))
|
||||
valeurs[index] = value;
|
||||
else
|
||||
valeurs.Add(index,value);
|
||||
if(!_valeurs.ContainsKey(index))
|
||||
_valeurs.Add(index,0);
|
||||
return _valeurs[index];
|
||||
}
|
||||
}
|
||||
public void RetireCircuit(Circuit c){
|
||||
valeurs.Remove(c);
|
||||
_valeurs.Remove(c);
|
||||
}
|
||||
public TimeSpan Duree;
|
||||
public TimeSpan Transition;
|
||||
TimeSpan _duree =TimeSpan.Zero ;
|
||||
TimeSpan _transition = TimeSpan.Zero;
|
||||
public TimeSpan Duree {
|
||||
get {
|
||||
return _duree;
|
||||
}
|
||||
}
|
||||
public TimeSpan Transition {
|
||||
get {
|
||||
return _transition;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
List<Circuit> circuitsSeq = new List<Circuit>();
|
||||
List<Effet> effets;
|
||||
List<Effet> effets = new List<Effet>();
|
||||
|
||||
public ReadOnlyCollection<Effet> Effets {
|
||||
get {
|
||||
return effets.AsReadOnly() ;
|
||||
}
|
||||
}
|
||||
Effet effetcourrant=null;
|
||||
|
||||
bool enTransition=false;
|
||||
|
||||
|
||||
Dictionary<Circuit,int> valeurscourantes = new Dictionary<Circuit, int>();
|
||||
Dictionary<Circuit,int> valeursinitiales = new Dictionary<Circuit, int>();
|
||||
|
||||
public SequenceurLineaire ()
|
||||
{
|
||||
}
|
||||
|
||||
public SequenceurLineaire (int id) :base (id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -53,11 +86,53 @@ namespace DMX2
|
|||
{
|
||||
if (!circuitsSeq.Contains (c))
|
||||
return 0;
|
||||
return valeurscourantes[c];
|
||||
}
|
||||
|
||||
public override void Tick (TimeSpan time)
|
||||
{
|
||||
timeStamp += time;
|
||||
if (enTransition) {
|
||||
if(timeStamp<effetcourrant.Duree){
|
||||
foreach( Circuit c in circuitsSeq)
|
||||
{
|
||||
if(valeurscourantes[c] != effetcourrant[c])
|
||||
{
|
||||
valeurscourantes[c] = (effetcourrant[c]-valeursinitiales[c]) * effetcourrant.Duree.Milliseconds / time.Milliseconds + valeursinitiales[c];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FinDeTransition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FinDeTransition ()
|
||||
{
|
||||
enTransition = false;
|
||||
foreach( Circuit c in circuitsSeq)
|
||||
valeurscourantes[c]=effetcourrant[c];
|
||||
}
|
||||
|
||||
|
||||
public void ChangeEffet(Effet effet)
|
||||
{
|
||||
effetcourrant = effet;
|
||||
valeursinitiales = new Dictionary<Circuit, int>(valeurscourantes);
|
||||
enTransition = true;
|
||||
timeStamp = TimeSpan.Zero;
|
||||
}
|
||||
|
||||
public void SauveEffet (string nom, TimeSpan duree, TimeSpan transition)
|
||||
{
|
||||
effets.Add(new Effet(nom, valeurscourantes,duree,transition));
|
||||
}
|
||||
|
||||
public override System.Xml.XmlElement Save ()
|
||||
{
|
||||
throw new System.NotImplementedException ();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,15 @@ namespace DMX2
|
|||
public class UniversDMX
|
||||
{
|
||||
|
||||
Grada[] _gradas = new Grada[512];
|
||||
static int nb=1;
|
||||
|
||||
public UniversDMX()
|
||||
{
|
||||
Nom = "Univers DMX n°"+ nb++.ToString();
|
||||
}
|
||||
|
||||
Grada[] _gradas = new Grada[512];
|
||||
public string Nom;
|
||||
public enum FTransfer {
|
||||
lineaire,
|
||||
log,
|
||||
|
|
|
|||
Loading…
Reference in a new issue