//------------------------------------------------------------ private void m_btnCoutVerrouillé_Click(object sender, EventArgs e) { if (m_donneeConsommable != null && !LockEdition && m_besoin != null) { m_donneeConsommable.IsCoutTarif = !m_donneeConsommable.IsCoutTarif; if (m_donneeConsommable.IsCoutTarif) { m_txtCoutUnitaire.LockEdition = true; m_donneeConsommable.SetTypeConsommable(m_donneeConsommable.GetTypeConsommable(m_besoin.ContexteDonnee)); if (m_donneeConsommable.CoutUnitaire != null) { m_txtCoutUnitaire.DoubleValue = m_donneeConsommable.CoutUnitaire.Valeur; m_uniteCU = CGestionnaireUnites.GetUnite(CUtilUnite.GetUniteInverse(m_donneeConsommable.CoutUnitaire.Unite)); } if (OnCoutChanged != null) { OnCoutChanged(this, null); } } else { m_txtCoutUnitaire.LockEdition = false; } UpdateImageVerrou(); } }
//----------------------------------------------- private void ShowMenuUnites() { CValeurUnite v = m_txtQuantité.UnitValue; if (v != null) { IUnite u = v.IUnite; if (u != null) { List <IUnite> lst = new List <IUnite>(CGestionnaireUnites.GetUnites(u.Classe)); lst.Sort((x, y) => x.FacteurVersBase.CompareTo(y.FacteurVersBase)); m_menuUnites.Items.Clear(); foreach (IUnite unite in lst) { ToolStripMenuItem itemUnite = new ToolStripMenuItem(unite.LibelleCourt); itemUnite.Tag = unite; m_menuUnites.Items.Add(itemUnite); if (unite.LibelleCourt == m_lblUniteCU.Text) { itemUnite.Checked = true; } itemUnite.Click += new EventHandler(itemUnite_Click); } m_menuUnites.Show(m_lblUniteCU, new Point(0, m_lblUniteCU.Height)); } } }
public void Init(IDonneeBesoin calcul, CBesoin besoin, CItemBesoin itemBesoin, IEnumerable <CItemBesoin> items) { m_bIsInitializing = true; m_calculQte = calcul as CDonneeBesoinQuantiteCU; if (m_calculQte != null) { Visible = true; m_txtQuantité.UnitValue = m_calculQte.Quantite; m_lblUniteCU.Text = ""; m_uniteCU = null; if (m_calculQte.CoutUnitaire != null) { m_txtCoutUnitaire.DoubleValue = m_calculQte.CoutUnitaire.Valeur; if (m_calculQte.Quantite != null && m_calculQte.Quantite.IUnite != null) { string strU = CUtilUnite.GetUniteInverse(m_calculQte.CoutUnitaire.Unite); IUnite u = CGestionnaireUnites.GetUnite(strU); if (u != null && u.Classe.GlobalId == m_calculQte.Quantite.IUnite.Classe.GlobalId) { m_uniteCU = u; m_lblUniteCU.Text = u.LibelleCourt; } } } else { m_txtCoutUnitaire.DoubleValue = null; } } m_bIsInitializing = false; }
//-------------------------------------- public static void AddUnite(IUnite unite) { if (Instance.m_unites.FirstOrDefault(u => u.GlobalId == unite.GlobalId) == null) { Instance.m_unites.Add(unite); } }
//---------------------------------------------------------------------------------------------- private void UpdateQuantite() { CTypeConsommable tpCons = m_selectTypeEquipement.ElementSelectionne as CTypeConsommable; if (tpCons != null && CurrentItem != null) { CValorisationElement val = CurrentItem.Tag as CValorisationElement; IUnite unite = tpCons.Unite; if (unite != null) { m_txtQuantite.DefaultFormat = unite.LibelleCourt; } m_txtQuantite.UseValueFormat = true; CValeurUnite v = val.QuantiteEtUnite; if (v != null && unite != null) { if (v.IUnite == null || v.IUnite.Classe.GlobalId != unite.Classe.GlobalId) { v = null; } } m_txtQuantite.UnitValue = v; m_txtQuantite.LockEdition = LockEdition; } else { IUnite unite = CGestionnaireUnites.GetUnite(CClasseUniteUnite.c_idUnite); m_txtQuantite.DefaultFormat = unite.LibelleCourt; m_txtQuantite.UnitValue = new CValeurUnite(1, unite.LibelleCourt); m_txtQuantite.LockEdition = true; } }
//-------------------------------------------- public CEditeurUneOperation() { InitializeComponent(); IUnite unite = CGestionnaireUnites.GetUnite(CClasseUniteTemps.c_idH); m_txtDuree.DefaultFormat = unite.LibelleCourt; m_txtDuree.UseValueFormat = false; }
//----------------------------------------------- private void m_txtCoutUnitaire_Validated(object sender, EventArgs e) { if (!m_bIsInitializing) { if (m_txtCoutUnitaire.DoubleValue != null && m_txtQuantité.UnitValue != null && m_txtQuantité.UnitValue.IUnite != null && m_uniteCU == null) { m_uniteCU = m_txtQuantité.UnitValue.IUnite; } MajChamps(); DeclencheOnCoutChanged(); } }
//------------------------------------ public override string ToString() { if (m_strFormat.Length > 0) { return(ToString(m_strFormat)); } IUnite unite = CGestionnaireUnites.GetUnite(Unite); if (unite != null) { return(Valeur.ToString() + unite.LibelleCourt); } return(Valeur.ToString() + Unite); }
//-------------------------------------- public static IUnite GetUnite(string strId) { if (strId == null) { return(null); } IUnite unite = Instance.m_unites.FirstOrDefault(u => u.GlobalId == strId); if (unite == null) { unite = Instance.m_unites.FirstOrDefault(u => u.LibelleCourt.ToUpper() == strId.ToUpper()); } return(unite); }
//--------------------------------------------------------------------------- void itemUnite_Click(object sender, EventArgs e) { CValeurUnite valeur = UnitValue; ToolStripMenuItem item = sender as ToolStripMenuItem; IUnite unite = item != null ? item.Tag as IUnite : null; if (unite != null) { Text = valeur.ToString(unite.GlobalId); /*valeur = valeur.ConvertTo(unite.GlobalId); * valeur.Format = ""; * UnitValue = valeur;*/ } }
//--------------------------------------------------------------------------- private void m_menu_Opening(object sender, System.ComponentModel.CancelEventArgs e) { m_menuCouper.Enabled = SelectionLength > 0; m_menuCopier.Enabled = SelectionLength > 0; m_menuColler.Enabled = Clipboard.GetData(DataFormats.Text) != null; m_menuSupprimer.Enabled = SelectionLength > 0; m_menuSelectAll.Enabled = Text.Length > 0; foreach (IDisposable dis in new ArrayList(m_menuConvertir.DropDownItems)) { dis.Dispose(); } m_menuConvertir.DropDownItems.Clear(); IClasseUnite classe = null; if (UniteRacine != null) { classe = UniteRacine.Classe; } else { CValeurUnite v = this.UnitValue; if (v != null && v.Unite != null) { IUnite uTmp = CGestionnaireUnites.GetUnite(v.Unite); if (uTmp != null) { classe = uTmp.Classe; } } } m_menuConvertir.Enabled = classe != null; if (classe != null && UnitValue != null) { foreach (IUnite unite in CGestionnaireUnites.GetUnites(classe)) { ToolStripMenuItem itemUnite = new ToolStripMenuItem(unite.LibelleLong); itemUnite.Tag = unite; itemUnite.Click += new EventHandler(itemUnite_Click); m_menuConvertir.DropDownItems.Add(itemUnite); } ToolStripTextBox box = new ToolStripTextBox(); m_menuConvertir.DropDownItems.Add(box); box.KeyDown += new KeyEventHandler(formatBox_KeyDown); } }
//------------------------------------------------------------ private void RefreshLibelleFormule() { IUnite unite = m_objetEdite as IUnite; if (unite != null) { IClasseUnite classe = unite.Classe; if (classe != null) { m_lblConversion.Text = 1 + m_txtLibellCourtUnite.Text + " = " + "A" + classe.Libelle + "+B"; return; } } m_lblConversion.Text = ""; }
private void C2iTextBoxNumeriqueAvecUnite_Validated(object sender, EventArgs e) { if (Text.Trim().Length > 0 && UnitValue == null) { IUnite unite = UniteRacine; StringBuilder blUnites = new StringBuilder(); if (unite != null) { foreach (IUnite u in CGestionnaireUnites.GetUnites(unite.Classe)) { blUnites.Append(u.LibelleCourt); blUnites.Append(" "); } } else { foreach (IClasseUnite classe in CGestionnaireUnites.Classes) { IEnumerable <IUnite> lstUnites = CGestionnaireUnites.GetUnites(classe); if (lstUnites.Count() > 0) { blUnites.Append(Environment.NewLine); blUnites.Append(classe.Libelle + " : "); foreach (IUnite u in lstUnites) { blUnites.Append(u.LibelleCourt); blUnites.Append(','); } blUnites.Remove(blUnites.Length - 1, 1); } } } m_error.SetError(this, I.T("Enter value using units @1|20014", blUnites.ToString())); } else { m_error.SetError(this, ""); CValeurUnite valeur = UnitValue; if (valeur != null) { UnitValue = valeur; } } }
void itemUnite_Click(object sender, EventArgs e) { ToolStripMenuItem item = sender as ToolStripMenuItem; if (item != null) { IUnite u = item.Tag as IUnite; if (u != null) { m_lblUniteCU.Text = u.LibelleCourt; m_uniteCU = u; if (OnDataChanged != null) { OnDataChanged(this, null); } DeclencheOnCoutChanged(); } } }
private void m_arbreUnits_AfterSelect(object sender, TreeViewEventArgs e) { IClasseUnite classe = e.Node.Tag as IClasseUnite; if (classe != null) { DisplayClasse(classe); return; } IUnite unite = e.Node.Tag as IUnite; if (unite != null) { DisplayUnite(unite); return; } m_panelClasse.Visible = false; m_panelUnite.Visible = false; }
public CValeurUnite ConvertTo(string strUnite) { if (strUnite == Unite) { return(this); } string strMyCle = CUtilUnite.GetIdClasseUnite(Unite); string strAutrecle = CUtilUnite.GetIdClasseUnite(strUnite); if (strMyCle == null || strAutrecle == null || strMyCle != strAutrecle) { throw new Exception(I.T("Can not convert from @1 to @2|20017", Unite, strUnite)); } double fValeur = ConvertToBase(); string[] strComposants = CUtilUnite.Developpe(strUnite); foreach (string strComposant in strComposants) { string strIdUnite = strComposant; bool bDiviser = false; if (strComposant[0] == '/') { bDiviser = true; strIdUnite = strComposant.Substring(1); } IUnite unite = CGestionnaireUnites.GetUnite(strIdUnite); if (unite == null) { return(this); } if (bDiviser) { fValeur *= unite.FacteurVersBase; } else { fValeur /= unite.FacteurVersBase; } } return(new CValeurUnite(fValeur, CUtilUnite.Factorise(strComposants))); }
private void DisplayUnite(IUnite unite) { m_panelUnite.Visible = true; m_panelClasse.Visible = false; if (unite.Classe != null) { m_txtClasseDeUnite.Text = unite.Classe.Libelle; } else { m_txtClasseDeUnite.Text = "???"; } m_txtIdUnite.Text = unite.GlobalId; m_txtLibellCourtUnite.Text = unite.LibelleCourt; m_txtLibelleLongUnite.Text = unite.LibelleLong; m_txtFacteurConversion.DoubleValue = unite.FacteurVersBase; m_txtOffsetConversion.DoubleValue = unite.OffsetVersBase; m_objetEdite = unite; RefreshLibelleFormule(); m_panelEditeUnite.Visible = unite is CUniteInDb; }
//------------------------------------ public double ConvertToBase() { double fValeur = Valeur; string[] strComposants = CUtilUnite.Developpe(Unite); foreach (string strComposant in strComposants) { string strIdUnite = strComposant; bool bDiviser = false; if (strComposant[0] == '/') { bDiviser = true; strIdUnite = strComposant.Substring(1); } if (strComposant[0] == '.') { strIdUnite = strComposant.Substring(1); } IUnite unite = CGestionnaireUnites.GetUnite(strIdUnite); if (unite == null) { return(Valeur); } if (bDiviser) { fValeur /= unite.FacteurVersBase; } else { fValeur *= unite.FacteurVersBase; } if (strComposants.Length == 1) { fValeur += unite.OffsetVersBase; } } return(fValeur); }
//------------------------------------------------------- public static string GetIdClasseUnite(string strUnite) { string[] strUnits = Developpe(strUnite); List <string> lstClasses = new List <string>(); StringBuilder bl = new StringBuilder(); foreach (string strCompo in strUnits) { bool bDiviser = false; string strCle = strCompo; if (strCompo[0] == '/') { bDiviser = true; strCle = strCompo.Substring(1); } IUnite unite = CGestionnaireUnites.GetUnite(strCle); if (unite == null || unite.Classe == null) { return(null); } string strClasse = unite.Classe.GlobalId; if (bDiviser) { strClasse = "/" + strClasse; } else { strClasse = "." + strClasse; } lstClasses.Add(strClasse); } lstClasses.Sort(); foreach (string str in lstClasses) { bl.Append(str); } return(bl.ToString()); }
//------------------------------------ public static CValeurUnite GetValeurFromValeurBase(double fValeurDeBase, string strUnite) { double fValeur = fValeurDeBase; string[] strComposants = CUtilUnite.Developpe(strUnite); foreach (string strComposant in strComposants) { string strIdUnite = strComposant; bool bDiviser = false; if (strComposant[0] == '/') { bDiviser = true; strIdUnite = strComposant.Substring(1); } if (strComposant[0] == '.') { strIdUnite = strComposant.Substring(1); } IUnite unite = CGestionnaireUnites.GetUnite(strIdUnite); if (unite == null) { return(null); } if (bDiviser) { fValeur *= unite.FacteurVersBase; } else { fValeur /= unite.FacteurVersBase; } if (strComposant.Length == 1) { fValeur -= unite.OffsetVersBase; } } return(new CValeurUnite(fValeur, strUnite)); }
//----------------------------------------------- private void FillFromDonnee() { if (m_donneeConsommable == null || m_besoin == null) { return; } CTypeConsommable typeConsommable = m_donneeConsommable.GetTypeConsommable(m_besoin.ContexteDonnee); if (typeConsommable != null) { IUnite unite = typeConsommable.Unite; if (unite != null) { m_txtQuantité.DefaultFormat = unite.LibelleCourt; } m_txtQuantité.UseValueFormat = true; } m_txtQuantité.UnitValue = m_donneeConsommable.Quantite; m_lblUniteCU.Text = ""; m_uniteCU = null; if (m_donneeConsommable.CoutUnitaire != null) { m_txtCoutUnitaire.DoubleValue = m_donneeConsommable.CoutUnitaire.Valeur; string strU = CUtilUnite.GetUniteInverse(m_donneeConsommable.CoutUnitaire.Unite); IUnite u = CGestionnaireUnites.GetUnite(strU); m_uniteCU = u; m_lblUniteCU.Text = u.LibelleCourt; } else { m_txtCoutUnitaire.DoubleValue = null; } m_txtCoutUnitaire.LockEdition = LockEdition || m_donneeConsommable.IsCoutTarif; m_lblUniteCU.Enabled = !LockEdition && !m_donneeConsommable.IsCoutTarif; }
//------------------------------------------------------- public CValeurUnite(double fValeur, string strUnite) { m_fValeur = fValeur; m_strUnite = strUnite; m_unite = null; }
//------------------------------------ //Se débrouille pour que chaque classe d'unité ne soit //représentée que par une seule et même unité public static string Harmonise(string strUnite) { string[] strComposants = Developpe(strUnite); List <string> lstComposants = new List <string>(strComposants); HashSet <int> setFaits = new HashSet <int>(); for (int nComposant = 0; nComposant < lstComposants.Count; nComposant++) { if (!setFaits.Contains(nComposant)) { setFaits.Add(nComposant); string strCompo1 = lstComposants[nComposant]; if (strCompo1[0] == '/') { strCompo1 = strCompo1.Substring(1); } IUnite u1 = CGestionnaireUnites.GetUnite(strCompo1); if (u1 == null) { return(strUnite); } //Cherche les autres éléments de la même classe for (int n = nComposant + 1; n < lstComposants.Count; n++) { if (!setFaits.Contains(n)) { string strCompo2 = lstComposants[n]; bool bDiviser = false; if (strCompo2[0] == '/') { bDiviser = true; strCompo2 = strCompo2.Substring(1); } IUnite u2 = CGestionnaireUnites.GetUnite(strCompo2); if (u2 == null) { return(strUnite); } if (u2.Classe.GlobalId == u1.Classe.GlobalId) { setFaits.Add(n); if (strCompo2 != strCompo1) { string strTmp = strCompo1; if (bDiviser) { strTmp = "/" + strTmp; } lstComposants[n] = strTmp; } } } } } } StringBuilder bl = new StringBuilder(); foreach (string strCompo in lstComposants) { if (bl.Length > 0 && strCompo[0] != '/') { bl.Append('.'); } bl.Append(strCompo); } return(bl.ToString()); }
//------------------------------------ /// <summary> /// Décompose une valeur simple dans les unités de l'unité. /// Par exemple, 65 min décomposé en h min donne 1h5min /// </summary> /// <param name="strUnitesAUtiliser"></param> /// <returns></returns> public string GetStringDecomposeeValeurSimple(params string[] strUnitesAUtiliser) { List <string> strUnitesCorrigées = new List <string>(); foreach (string strUnite in strUnitesAUtiliser) { if (strUnite.Length > 0) { strUnitesCorrigées.Add(strUnite.Trim()); } } IUnite unite = CGestionnaireUnites.GetUnite(Unite); if (unite == null) { return(null); } IClasseUnite classe = unite.Classe; if (classe == null) { return(null); } List <double?> lstVals = new List <double?>(); double fValeurRestante = ConvertToBase(); StringBuilder bl = new StringBuilder(); CValeurUnite valeurTmp = new CValeurUnite(Math.Abs(fValeurRestante), classe.UniteBase); for (int nUnite = 0; nUnite < strUnitesCorrigées.Count; nUnite++) { string strUnite = strUnitesCorrigées[nUnite]; string strLib = strUnite; IUnite u = CGestionnaireUnites.GetUnite(strUnite); if (u != null) { strLib = u.LibelleCourt; } valeurTmp = valeurTmp.ConvertTo(strUnite); int nVal = (int)valeurTmp.Valeur; if (nUnite < strUnitesCorrigées.Count - 1) { valeurTmp = valeurTmp - (double)nVal; if (nVal > 0) { bl.Append(nVal + strLib + " "); } if (valeurTmp.Valeur == 0) { break; } } else { if (valeurTmp.Valeur != 0) { bl.Append(Math.Round(valeurTmp.Valeur, 5).ToString() + strLib); } } } if (Valeur < 0) { bl.Insert(0, "-"); } return(bl.ToString()); }
//------------------------------------ //Se débrouille pour que les éléments qui ont la même classe d'unité travaillent dans //la même unité public static string GetUniteHarmonisee(string strUniteReference, string strUniteAHarmoniser) { string[] strComposantsRef = Developpe(strUniteReference); string[] strComposantsAHarmoniser = Developpe(strUniteAHarmoniser); List <string> lstAHarmoniser = new List <string>(strComposantsAHarmoniser); List <string> lstFinale = new List <string>(); HashSet <string> classesFaites = new HashSet <string>(); HashSet <int> setFaits = new HashSet <int>(); foreach (string strCompoRef in strComposantsRef) { string strRef = strCompoRef; if (strRef[0] == '/') { strRef = strRef.Substring(1); } IUnite u1 = CGestionnaireUnites.GetUnite(strRef); if (u1 == null) { return(strUniteAHarmoniser); } IClasseUnite classe = u1.Classe; if (!classesFaites.Contains(classe.GlobalId)) { classesFaites.Add(classe.GlobalId); for (int n = 0; n < lstAHarmoniser.Count; n++) { if (!setFaits.Contains(n)) { string strHar = lstAHarmoniser[n]; bool bDiviser = false; if (strHar[0] == '/') { bDiviser = true; strHar = strHar.Substring(1); } IUnite u2 = CGestionnaireUnites.GetUnite(strHar); if (u2 == null) { return(strUniteAHarmoniser); } if (u2.Classe.GlobalId == u1.Classe.GlobalId) { setFaits.Add(n); if (strHar != strRef) { string strTmp = strRef; if (bDiviser) { strTmp = "/" + strRef; } lstAHarmoniser[n] = strTmp; } } } } } } StringBuilder bl = new StringBuilder(); foreach (string strCompo in lstAHarmoniser) { if (bl.Length > 0 && strCompo[0] != '/') { bl.Append('.'); } bl.Append(strCompo); } return(bl.ToString()); }
/// <summary> /// Attaque une unité, les chances de victoire snt calculé en fonction des points de vie, des points d'attaque/défense. /// </summary> /// <param name="unitDef"></param> public void attaquer(IUnite unitDef) { Random randCombat = new Random(); Random rand = new Random(); int nbToursCombat = 3 + randCombat.Next((Math.Max(this.PointsVie, unitDef.PointsVie)) + 2); int n = 0; while (nbToursCombat - n > 0 && this.estEnVie() && unitDef.estEnVie()) { double ratioVie = (double)this.PointsVie / (double)this.PointsVieMax; double ratioVieDef = (double)unitDef.PointsVie / (double)unitDef.PointsVieMax; double attaUnit = (double)this.PointsAttaque * (double)ratioVie; double defUnitdef = (double)unitDef.PointsDefense * (double)ratioVieDef; double ratioAttDef = (double)(attaUnit / defUnitdef); double ratioChanceDef = 0; if (ratioAttDef > 1) // avantage attaquant { ratioChanceDef = (1 / ratioAttDef) / 2; ratioChanceDef = (0.5 - ratioChanceDef) + 0.5; } else if (ratioAttDef == 1) //égalité, aucun n'a l'avantage { ratioChanceDef = 0.5; // 50% de chnce de gagner } else // avantage défense { ratioChanceDef = ratioAttDef/2; } double ratioCombat = (double)((double)rand.Next(100) / 100); if (ratioCombat <= ratioChanceDef) { unitDef.perdPV(1); } else { this.perdPV(1); } n++; } }
public virtual Boolean Attaquer(IUnite u) { if(u.Defense == 0) { // u meurt imediatement u.PointsDeVie = 0; return true; } // Tirage d'un nombre entre 3 et le nombre de points de vie de l’unite ayant le plus de points de vie + 2 points int maxNbCombats = (Math.Max(this._pointsDeVie, u.PointsDeVie) + 2); Random random = new Random(); int nbCombats = random.Next(3, (maxNbCombats + 1)); // Calcul du rapport de force avec la formule ((((a - d) / max(a, d)) / 2) + 0.5) double rapportDeForce = rapportDeForce = (((this._attaque - u.Defense) / (Math.Max(this._attaque, u.Defense) * 2)) + 0.5); // Le combat s’arrête lorsque ce nombre est atteint ou lorsque l’une ou autre des unités n’a plus de vie for (int i = 0 ; ((u.PointsDeVie == 0) || (this._pointsDeVie == 0) || (i < maxNbCombats)); i++) { if(random.NextDouble() <= rapportDeForce) { // Victoire de l'attaquant u.PointsDeVie--; } else { // Defaite de l'attaquant this._pointsDeVie--; } } if(this._pointsDeVie <= 0) { return false; } return true; }
//------------------------------------------------------------------------ public double GetValuationForDate(DateTime dt, CValeurUnite quantite) { CListeObjetsDonnees lstValEqpt = Valorisations; CListeObjetsDonnees lstLot = lstValEqpt.GetDependances("LotValorisation"); double fQuantite = 1; if (quantite != null && Unite != null) { if (quantite.IUnite == null) { fQuantite = quantite.Valeur; } else { fQuantite = quantite.ConvertTo(Unite.GlobalId).Valeur; } } if (lstValEqpt.Count == 0) { return(0); } lstLot.Tri = CLotValorisation.c_champDateLot; CLotValorisation lot = lstLot[0] as CLotValorisation; if (lot != null && lot.DateLot.Date.AddMinutes(-1) > dt)//Premier plus récent->premier { CValorisationElement val = lot.GetValorisation(this); if (val != null) { return(val.Valeur * fQuantite); } return(0); } lstLot.InterditLectureInDB = true; lstLot.Filtre = new CFiltreData(CLotValorisation.c_champDateLot + "<@1", dt.Date.AddDays(1)); lstLot.Tri = CLotValorisation.c_champDateLot; if (lstLot.Count > 0) { lot = lstLot[lstLot.Count - 1] as CLotValorisation; if (lot != null) { CValorisationElement val = lot.GetValorisation(this); if (val != null) { CValeurUnite v = val.QuantiteEtUnite; IUnite monUnite = Unite; if (v != null && monUnite != null) { v = v.ConvertTo(monUnite.GlobalId); if (v.Valeur != 0) { return(val.Valeur / v.Valeur * fQuantite); } } return(val.Valeur * fQuantite); } } } return(0); }
//-------------------------------------- public static void RemoveUnite(IUnite unite) { Instance.m_unites.Remove(unite); }