public ActionResult CreateAttribute(string name, string value1, string description1, string value2, string description2) { var attribute = new attributes() { NAME = name }; db.attributes.Add(attribute); db.SaveChanges(); var attributeValue1 = new attributes_values() { ATTRIBUTE_ID = attribute.ID, DESCRIPTION = description1, VALUE = value1 }; db.attributes_values.Add(attributeValue1); db.SaveChanges(); var attributeValue2 = new attributes_values() { ATTRIBUTE_ID = attribute.ID, DESCRIPTION = description2, VALUE = value2 }; db.attributes_values.Add(attributeValue2); db.SaveChanges(); return(RedirectToAction("Attributes", "Board", new { Message = "Atributo criado com sucesso" })); }
// Start is called before the first frame update void Awake() { movementPlayer = GetComponent <movement>(); atb = GetComponent <attributes>(); AddScores(0); canMove = true; }
public static void closepath(GameObject[] p) { int c = p.Length; for (int i = 0; i < c; i++) { GameObject s = p[i]; attributes a = s.GetComponent <attributes>(); a.onGood = false; if (a.topwall.transform.position.y != 2.5f) { a.topwall.transform.position += new Vector3(0, 5, 0); } if (a.bottomwall.transform.position.y != 2.5f) { a.bottomwall.transform.position += new Vector3(0, 5, 0); } if (a.leftwall.transform.position.y != 2.5f) { a.leftwall.transform.position += new Vector3(0, 5, 0); } if (a.rightwall.transform.position.y != 2.5f) { a.rightwall.transform.position += new Vector3(0, 5, 0); } } }
void Awake() { GameMasterGo = GameObject.Find("GameMaster"); myBody = GetComponent <Rigidbody2D>(); GameSettings = GameMasterGo.GetComponent <game_settings>(); myHealth = GetComponent <health>(); myAttributes = GetComponent <attributes>(); }
void Awake() { GameMasterGo = GameObject.Find("GameMaster"); target = GameMasterGo.GetComponent <GameObject_handler>().getPlayer(); bulletGo = GameMasterGo.GetComponent <GameObject_handler>().bulletPrefab; myHealth = GetComponent <health>(); myAttributes = GetComponent <attributes>(); }
public void OnTarget(attributes atb) { if (!atb.CompareTag(tag)) { stateNow = statesIa.chase; atbTarget = atb; } }
// Use this for initialization void Start() { ai_anim = GetComponent <Animator>(); ai_anim.SetBool("walking", true); ai_nav = GetComponent <NavMeshAgent>(); ai_attributes = GetComponent <attributes>(); ai_nav.speed = ai_attributes.movement_speed; fire_Rate = ai_attributes.attack_rate; }
public void AddSignature(int signature) { attributes att = this.GetAttributes(); var theKey = new key(); att.key = ArrayExtensions.ArrayAppend(att.key, theKey); theKey.Items = ArrayExtensions.ArrayAppend(theKey.Items, (signature - 7).ToString()); theKey.ItemsElementName = ArrayExtensions.ArrayAppend(theKey.ItemsElementName, ItemsChoiceType8.fifths); }
public static List <attributes> GetAttributes() { List <attributes> list = new List <attributes>(); attributes cmodnamepc = new attributes { code = "model_name", name = "Модель автомобиля", value = "" }; list.Add(cmodnamepc); attributes xcardrs = new attributes { code = "xcardrs", name = "Кол-во дверей", value = "" }; list.Add(xcardrs); attributes dmodyr = new attributes { code = "dmodyr", name = "Год выпуска", value = "" }; list.Add(dmodyr); attributes xgradefulnam = new attributes { code = "xgradefulnam", name = "Класс", value = "" }; list.Add(xgradefulnam); attributes ctrsmtyp = new attributes { code = "ctrsmtyp", name = "Тип трансмиссии", value = "" }; list.Add(ctrsmtyp); attributes cmftrepc = new attributes { code = "cmftrepc", name = "Страна производитель", value = "" }; list.Add(cmftrepc); attributes carea = new attributes { code = "carea", name = "Страна, рынок", value = "" }; list.Add(carea); attributes nengnpf = new attributes { code = "nengnpf", name = "Класс двигателя", value = "" }; list.Add(nengnpf); // return(list); }
/// <summary> /// Get value of attributes modified by buffs /// </summary> public virtual attributes getSummedAttributes() { attributes newAtt = new attributes(); newAtt.setTo(this.baseAtt); foreach (modifier m in this.buffs) { newAtt.add(m.att); } return(newAtt); }
private void OnTriggerEnter2D(Collider2D collision) { attributes atb = collision.GetComponentInParent <attributes>(); if (atb) { Vector2 force = atb.transform.position; force.x -= transform.position.x; force.y -= transform.position.y; force = force.normalized * forceImpulse; progetile.DamgeAplication(atb, 3f, force); } }
private void OnTriggerEnter2D(Collider2D collision) { if (weaponNow1 == null) { if (collision.CompareTag("Enemie")) { AudioClip clipHit = repository.GetRepository().clipPuchHit; repository.GetAudioSource().PlayOneShot(clipHit); attributes atb = collision.GetComponentInParent <attributes>(); Vector2 force = Quaternion.Euler(Vector3.forward * transform.eulerAngles.z) * Vector2.up * 5f; atb.AddHp(-10, force, playerControll); } } }
protected virtual void OnTriggerEnter2D(Collider2D collision) { attributes atb = collision.GetComponentInParent <attributes>(); if (atb && !atb.CompareTag(ownerAtb.tag)) { DamgeAplication(atb, 1f, Vector2.zero); } //Som de acerto do progetil AudioSource ad = repository.GetAudioSource(); ad.PlayOneShot(weaponInfs.clipHit); gameObject.SetActive(false); }
// Start is called before the first frame update void Start() { anima = GetComponent <Animator>(); playerControll = GetComponent <playerControll>(); atb = GetComponent <attributes>(); weapon wp = null; if (CompareTag("Enemie")) { wp = repository.GetRandomWeapon(); } SetWeapon(wp); }
public virtual void Inocation(weaponInfs infs, Vector3 pos, Vector2 dire, attributes atb) { weaponInfs = infs; //Som de saida do progetil AudioSource ad = repository.GetAudioSource(); ad.PlayOneShot(weaponInfs.clipExit); gameObject.SetActive(true); ownerAtb = atb; timeDelta = infs.GetReach() / velocity; transform.position = pos; VelocityChange(dire * velocity); }
public void add(attributes att) { this.health += att.health; this.maxHealth += att.maxHealth; this.movementPoints += att.movementPoints; this.maxMovementPoints += att.maxMovementPoints; this.mainActionPoints += att.mainActionPoints; this.maxMainActionPoints += att.maxMainActionPoints; this.bonusActionPoints += att.bonusActionPoints; this.maxBonusActionPoints += att.maxBonusActionPoints; this.armor += att.armor; this.heatReduceRate += att.heatReduceRate; this.shieldPoints += att.shieldPoints; this.maxShieldPoints += att.maxShieldPoints; this.shieldRegenRate += att.shieldRegenRate; this.shieldMitigation += att.shieldMitigation; }
///////////////////////////////// ////////EVENT CUES ///////////////////////////////// /// <summary> /// Method is called at the start of each turn. /// </summary> public virtual void onTurnStart() { foreach (Buff b in this.buffs) { b.Duration--; } //recalculate values attributes newVals = this.getSummedAttributes(); //TODO: reassign some values this.dynamicAttributes.movementPoints = this.dynamicAttributes.maxMovementPoints; this.dynamicAttributes.mainActionPoints = this.dynamicAttributes.maxMainActionPoints; this.dynamicAttributes.bonusActionPoints = this.dynamicAttributes.maxBonusActionPoints; SetState(new UnitStateMarkedAsFriendly(this)); }
public void AddClef(int keyForm, int keyLine, int keyOctavation) { attributes att = this.GetAttributes(); att.clef = new clef[1]; att.clef[0] = new clef(); switch (keyForm) { case 0: att.clef[0].sign = clefsign.G; att.clef[0].line = (5 - keyLine).ToString(); break; case 1: att.clef[0].sign = clefsign.C; att.clef[0].line = (5 - keyLine).ToString(); break; case 2: att.clef[0].sign = clefsign.F; att.clef[0].line = (5 - keyLine).ToString(); break; case 3: att.clef[0].sign = clefsign.percussion; break; case 4: att.clef[0].sign = clefsign.none; break; default: throw new InvalidOperationException(); } if (keyOctavation == 0) { att.clef[0].clefoctavechange = "1"; } else if (keyOctavation == 2) { att.clef[0].clefoctavechange = "-1"; } }
private static subscriberBase CreateSubscriber(object messageDto) { var myAttributes = new attributes { attribute = SubcriberTolkenMapper.FlattenPropertiesToNameValueList(messageDto) }; var subscriber = new subscriberBase { division = new subscriberBaseDivision {Value = "Transactional"}, allowResubscribe = true, attributes = myAttributes, subscriptionState = GlobalSubscriptionState.SUBSCRIBED, subscriptionStateSpecified = true }; return subscriber; }
public attributes GetAttributes() { if (this.Items != null) { foreach (object t in this.Items) { if (!(t is attributes)) { continue; } return(t as attributes); } } var att = new attributes(); this.Items = ArrayExtensions.ArrayAppend(this.Items, att); return(att); }
private void BuildPartStaffMeasureAttributes(attributes attributes, List <BeatDurationDirective> beatDurationDirectives, int measureNumber) { if (attributes.divisionsSpecified) { var start = measureNumber; var end = int.MaxValue; if (beatDurationDirectives.Count > 0) { var lastBeatDurationDirective = beatDurationDirectives.Last(); lastBeatDurationDirective.ElementRange = new Range(lastBeatDurationDirective.ElementRange.Start, start); } beatDurationDirectives.Add(new BeatDurationDirective() { Divisions = attributes.divisions, ElementRange = new Range(start, end) }); } }
public List <GameObject> recurspath(GameObject s, List <GameObject> g, GameObject p, GameObject og) { //Find a way to see if the section is in good path easier (done) List <GameObject> path = g; List <GameObject> retpath; attributes secat = s.GetComponent <attributes>(); GameObject[] cons; GameObject nsec = null; int origcount = path.Count; if (secat.onGood) { path.Add(s); return(path); } if (s.name == pr.GetComponent <playersection>().col) { path.Add(s); return(path); } bool change; if (secat.topwall.transform.position.y < 0) { cons = secat.topwall.GetComponent <wall_attributes>().connections; if (cons[0] != null) { for (int i = 0; i < cons.Length; i++) { if (s != cons[i]) { nsec = cons[i]; } } if (nsec != p) { change = false; retpath = recurspath(nsec, path, s, og); //This could be redundant because if they are the same lenght then there should not have been any changes if (retpath.Count != origcount) { change = true; } if (change) { if (og == nsec) { return(path); } path = retpath; path.Add(nsec); origcount = path.Count; } } } } if (secat.bottomwall.transform.position.y < 0) { cons = secat.bottomwall.GetComponent <wall_attributes>().connections; for (int i = 0; i < cons.Length; i++) { if (s != cons[i]) { nsec = cons[i]; } } if (nsec != p) { change = false; retpath = recurspath(nsec, path, s, og); if (retpath.Count != origcount) { change = true; } if (change) { if (og == nsec) { return(path); } path = retpath; path.Add(nsec); origcount = path.Count; } } } if (secat.leftwall.transform.position.y < 0) { cons = secat.leftwall.GetComponent <wall_attributes>().connections; for (int i = 0; i < cons.Length; i++) { if (s != cons[i]) { nsec = cons[i]; } } if (nsec != p) { change = false; retpath = recurspath(nsec, path, s, og); if (retpath.Count != origcount) { change = true; } if (change) { if (og == nsec) { return(path); } path = retpath; path.Add(nsec); origcount = path.Count; } } } if (secat.rightwall.transform.position.y < 0) { cons = secat.rightwall.GetComponent <wall_attributes>().connections; for (int i = 0; i < cons.Length; i++) { if (s != cons[i]) { nsec = cons[i]; } } if (nsec != p) { change = false; retpath = recurspath(nsec, path, s, og); if (retpath.Count != origcount) { change = true; } if (change) { if (og == nsec) { return(path); } path = retpath; path.Add(nsec); origcount = path.Count; } } } return(path); }
// C2FORMAT.TXT line 85ff //LAYOUT (Beschreibung der Partitur-Formatvorlage) // if Dateikennung >= V2.1 // BYTE topDist // CHAR Ersatzzeichen fuer geschuetztes Leerzeichen ('\0' --> '$') // BYTE interDist // CHAR Ersatzzeichen fuer geschuetzten Bindestrich ('\0' --> '#') // else // INT topDist // INT interDist // endif // BYTE beamMode // FONT txtFont // BYTE txtAlign // BOOL allaBreve // UINT tempo // INT staves // if Dateikennung >= V2.1 // BYTE[16] nSound (Klang fuer Kanal 1 bis 16 // im 1. Byte ist hoechstes Bit gesetzt!) // BYTE[16] nVolume (Lautstaerke fuer Kanal 1 bis 16) // else (Version 2.0) // BYTE[9] nSound (Klang fuer Kanal 1 bis 9) // BYTE[9] nVolume (Lautstaerke fuer Kanal 1 bis 9) // endif // STAFF_LAYOUT[staves] //end private void ReadLAYOUT(byte[] buffer, ref uint position) { if (this.version >= FileVersion.V21) { Read(buffer, ref position, out BYTE topDist); Read(buffer, ref position, out CHAR spaceReplacement); Read(buffer, ref position, out BYTE interDist); Read(buffer, ref position, out CHAR dashReplacement); } else { Read(buffer, ref position, out INT topDist); Read(buffer, ref position, out INT interDist); } Read(buffer, ref position, out BYTE beamMode); this.ReadFONT(buffer, ref position); Read(buffer, ref position, out BYTE txtAlign); Read(buffer, ref position, out BOOL allaBreve); Read(buffer, ref position, out UINT tempo); Read(buffer, ref position, out INT staveCount); if (this.version >= FileVersion.V21) { var soundValues = new BYTE[16]; var volumeValues = new BYTE[16]; for (int i = 0; i < 16; i++) { Read(buffer, ref position, out soundValues[i]); } for (int i = 0; i < 16; i++) { Read(buffer, ref position, out volumeValues[i]); } } else { var soundValues = new BYTE[9]; var volumeValues = new BYTE[9]; for (int i = 0; i < 9; i++) { Read(buffer, ref position, out soundValues[i]); } for (int i = 0; i < 9; i++) { Read(buffer, ref position, out volumeValues[i]); } } // TODO hier hatte ich zuerst ein partlist-Array. R# hat eine Co-Varianz-Warnung angezeigt. Daher nun object-Array. this.Document.partlist = new partlist { Items = new object[staveCount] }; this.Document.part = new scorepartwisePart[staveCount]; this.InitStaves(staveCount); for (int i = 0; i < staveCount; i++) { // initialite partDescription structures for current staff var partDescription = new scorepart(); this.Document.partlist.Items[i] = partDescription; partDescription.id = "P" + (i + 1).ToString(CultureInfo.InvariantCulture); var partData = new scorepartwisePart { id = partDescription.id }; this.Document.part[i] = partData; var firstMeasure = new scorepartwisePartMeasure(); this.measures[i].Add(firstMeasure); firstMeasure.number = "1"; attributes att = firstMeasure.GetAttributes(); // 32 corresponds with duration values in readSTAFF() att.divisions = 32; att.divisionsSpecified = true; this.ReadSTAFFLAYOUT(buffer, ref position, i, partDescription); firstMeasure.AddClef( this.currentKeyForm[i], this.currentKeyLine[i], this.currentKeyOctavation[i]); } }
public attributes(attributes att) { this.setTo(att); }
=> With(attributes: Attributes.With(name: name ?? throw new ArgumentNullException(nameof(name))));
InitializeAttributes(ref attributes, symbol);
// Start is called before the first frame update void Start() { atb = GetComponent <attributes>(); renderer = GetComponent <Renderer>(); coll = GetComponent <Collider2D>(); }
IEnumerator IAAtive() { while (true) { if (atb && !atb.IsDead()) { if (stateNow == statesIa.awareness) { if (!moveTarget) { //Dando direção aletoria para patrulhar float walkDist = Random.Range(3f, 9f), angZ = Random.Range(0f, 360f); Vector2 dire = Quaternion.Euler(Vector3.forward * angZ) * Vector2.up; //Debug.Log(dire); targetPosition = transform.position; targetPosition += dire * walkDist; distTarget = 1f; moveTarget = true; //Olhar apara direção do movimento //atb.GetMovement().TurnTo(Vector2.SignedAngle(Vector2.up, dire)); } //Visão da IA //Area da que a camera pega Camera cam = Camera.main; Vector2 size; size.y = 2f * cam.orthographicSize; size.x = size.y * cam.aspect; Vector2 point1 = transform.position, point2 = point1 + size / 2f; point1 -= size / 2f; Collider2D[] colls = Physics2D.OverlapAreaAll(point1, point2, repository.GetLayerMaskChars()); //Todos os personagens na area for (int i = 0; i < colls.Length; i++) { Collider2D c = colls[i]; if (!c.CompareTag(tag)) { //Angulo de visão Vector2 delta = c.transform.position - transform.position; float angZ = Vector2.SignedAngle(transform.up, delta); if (angZ * angZ <= 90 * 90) { //Dizendo que é o alvo attributes atbX = c.GetComponent <attributes>(); if (!atbX.IsDead()) { atbTarget = atbX; stateNow = statesIa.chase; } } } } } else if (stateNow == statesIa.chase) { actions act = atb.GetActions(); act.StopFire(); if (atbTarget.IsDead()) { atbTarget = null; stateNow = statesIa.awareness; } else { Vector2 delta = atbTarget.transform.position - transform.position; if (delta.magnitude < act.ReachNow() && renderer.isVisible) { stateNow = statesIa.shooting; moveTarget = false; } else { targetPosition = atbTarget.transform.position; Vector2 dire = targetPosition; dire.x -= transform.position.x; dire.y -= transform.position.y; //atb.GetMovement().TurnTo(Vector2.SignedAngle(Vector2.up, dire)); distTarget = 2f; moveTarget = true; } } } else if (stateNow == statesIa.shooting) { Vector2 delta = atbTarget.transform.position - transform.position; actions act = atb.GetActions(); if (delta.magnitude < act.ReachNow() && renderer.isVisible && !atbTarget.IsDead()) { /*float angZNeed = Vector2.SignedAngle(Vector2.up, delta), angZNow = transform.eulerAngles.z; * if (angZNeed < 0f) * angZNeed += 360f; * if (angZNow < 0f) * angZNow += 360f; * * float angZDif = angZNeed - angZNow; * * if (angZDif*angZDif > 400) * { * atb.GetMovement().TurnTo(angZNeed); * } * else * { * act.Fire(); * }*/ } else { stateNow = statesIa.chase; } } } yield return(new WaitForSeconds(timeAction)); } }
private void RespawEnemie() { attributes atbEnemie = repository.GetEnemie(); atbEnemie.Respaw(GetRandomPos()); }
private void ProcessAccords( int staffNumber, int measureIndex, int voiceNumber, BYTE[] accords, INT[] accordIndexes, string text) { Console.WriteLine($"Processing staff {staffNumber}, measure {measureIndex}, voice {voiceNumber}"); var lyricsProcessor = new LyricsProcessor(text); // iterate data int index = 0; int accordIndex = 0; int currentMeasureTicks = 0; double tripletRests = 0; while (index < accords.Length) { scorepartwisePartMeasure currentMeasure = this.measures[staffNumber][measureIndex]; if (accordIndexes[accordIndex] != index) { throw new InvalidOperationException( $"The current accord should start at index {accordIndexes[accordIndex]} but is {index}."); } accordIndex++; byte value = accords[index++]; // C2FORMAT.TXT line 252ff //5. Daten der Akkordinformationen //-------------------------------- // // +---+---+---+---+---+---+---+---+ // |5 |4 |3 |2 |1 | // +---+---+---+---+---+---+---+---+ // (1) BIT Extras // (2) BIT fester_Taktstrich_oder_Verschiebung // (3) BIT Moduswechsel // (4) BIT Triole_etc // (5) BIT[4] Anzahl_Noten bool hasExtras = (value & 0x01) > 0; bool hasMovement = (value & 0x02) > 0; bool hasModeChange = (value & 0x04) > 0; bool hasTriplet = (value & 0x08) > 0; int notes = (value & 0xF0) >> 4; if (hasModeChange) { // C2FORMAT.TXT line 264ff // if Moduswechsel // +---+---+---+---+---+---+---+---+ // |3 |2 |1 | // +---+---+---+---+---+---+---+---+ // BIT[3] Schluesselform (0=G, 1=C, 2=F, 3=Schlagz. 4=kein, 5=unveraendert) // BIT[3] keyByte-Linie (0 = oberste Linie, ... , 4 = unterste Linie) // BIT[2] keyByte-Oktavierung (0=nach oben, 1=keine, 2= nach unten) // +---+---+---+---+---+---+---+---+ // |2 |1 | // +---+---+---+---+---+---+---+---+ // (1) BIT[4] Tonart (0=7b ... 7=c-Dur ... 14=7#, 15=unveraendert) // (2) BIT[4] Taktnenner (0=ganze, 1=halbe, ..., 6=1/64, 15=kein Takt) // BYTE Taktzaehler (255=unveraendert) // endif byte mb1 = accords[index++]; int keyForm = mb1 & 0x07; int keyLine = (mb1 & 0x38) >> 3; int keyOctavation = (mb1 & 0xC0) >> 6; if (keyForm != 5) { // key has changed ("5" is unchanged) this.currentKeyForm[staffNumber] = keyForm; this.currentKeyLine[staffNumber] = keyLine; this.currentKeyOctavation[staffNumber] = keyOctavation; // TODO Anzeigen } byte mb2 = accords[index++]; int signature = mb2 & 0x0F; if (signature != 15) { // signature has changed ("15" is unchanged) var currentSignature = this.GetCurrentSignature(staffNumber, voiceNumber); if (currentSignature != signature) { Console.WriteLine($"changing signature from {currentSignature} to {signature}"); //this.currentSignature[staffNumber] = signature; this.SetCurrentSignature(staffNumber, voiceNumber, signature); currentMeasure.AddSignature(signature); } } int nenner = (mb2 & 0xF0) >> 4; byte zaehler = accords[index++]; if (zaehler != 255) { int newBeats = zaehler; int newBeatType; switch (nenner) { case 0: newBeatType = 1; break; case 1: newBeatType = 2; break; case 2: newBeatType = 4; break; case 3: newBeatType = 8; break; case 4: newBeatType = 16; break; case 5: newBeatType = 32; break; case 6: newBeatType = 64; break; default: throw new NotImplementedException(); } // check if beat type is really changed // capella is writing type with every system if (this.currentBeats[staffNumber] != newBeats || this.currentBeatType[staffNumber] != newBeatType) { this.currentBeats[staffNumber] = newBeats; this.currentBeatType[staffNumber] = newBeatType; attributes att = currentMeasure.GetAttributes(); var theTime = new time(); att.time = ArrayExtensions.ArrayAppend(att.time, theTime); theTime.Items = ArrayExtensions.ArrayAppend( theTime.Items, this.currentBeats[staffNumber].ToString(CultureInfo.InvariantCulture)); theTime.ItemsElementName = ArrayExtensions.ArrayAppend( theTime.ItemsElementName, ItemsChoiceType10.beats); theTime.Items = ArrayExtensions.ArrayAppend(theTime.Items, this.currentBeatType[staffNumber].ToString(CultureInfo.InvariantCulture)); theTime.ItemsElementName = ArrayExtensions.ArrayAppend(theTime.ItemsElementName, ItemsChoiceType10.beattype); } } } if (hasMovement) { // C2FORMAT.TXT line 281ff // if fester_Taktstrich_oder_Verschiebung // +---+---+---+---+---+---+---+---+ // |2 |1 | // +---+---+---+---+---+---+---+---+ // BIT[4] fester_Taktstrich (0..6=einfach, doppelt, Schluss Wdh-Ende, // Wdh.Anf., Wdh-Ende/Anf) // BIT[4] Horizontalverschiebung // endif byte move = accords[index++]; } int tripletCounter = 0; bool tripartit; if (hasTriplet) { // C2FORMAT.TXT line 290ff // if Triole_etc (Beispiele: Triole / Duole) // +---+---+---+---+---+---+---+---+ // |3 |2 |1 | // +---+---+---+---+---+---+---+---+ // (1) BIT[4] Zaehler ( 3 / 2 ) // (2) BIT[1] tripartit ( 0 / 1 ) // (3) Bit[3] reserviert (=0) // endif byte triole = accords[index++]; tripletCounter = triole & 0x0F; tripartit = (triole & 0x10) > 0; } if (hasExtras) { // C2FORMAT.TXT line 299ff // if Extras // BYTE[3] reserviert // BYTE Anzahl_GrafikObjekte // GRAFIKOBJEKT[Anzahl_GrafikObjekte] // endif byte r1 = accords[index++]; byte r2 = accords[index++]; byte r3 = accords[index++]; byte graphObjectCount = accords[index++]; for (int i = 0; i < graphObjectCount; i++) { // C2FORMAT.TXT line 342ff //GRAFIKOBJEKT // BYTE Typ // BYTE Laenge_des_Notenbereichs // case Typ // 0: BINDEBOGEN // 1: N_OLENKLAMMER // 2: DE_CRESCENDO // 3: NOTENLINIEN // 4: VOLTENKLAMMER // 5: TRILLERSCHLANGE // 6: TEXTOBJEKT // 7: LINIE // 8: RECHTECK // 9: ELLIPSE // endcase //end byte type = accords[index++]; byte length = accords[index++]; switch (type) { case 0: // BINDEBOGEN index += 16; break; case 1: // N_OLENKLAMMER index += 10; break; case 2: // DE_CRESCENDO index += 8; break; case 3: // NOTENLINIEN index += 6; break; case 4: // VOLTENKLAMMER index += 7; break; case 5: // TRILLERSCHLANGE index += 7; break; case 6: // TEXTOBJEKT int x = (byte)accords[index] + (byte)accords[index + 1] * 256; index += 2; int y = (byte)accords[index] + (byte)accords[index + 1] * 256; index += 2; byte fontInfo = accords[index++]; int fontIndex = fontInfo & 0x07; if (fontIndex == 2) { index += 56; } while (accords[index] != 0) { index++; } // terminator index++; break; case 7: // LINIE index += 10; break; case 8: // RECHTECK index += 10; break; case 9: // ELLIPSE index += 10; break; } } } // C2FORMAT.TXT line 305ff // +---+---+---+---+---+---+---+---+ // |4 |3 |2 |1 | // +---+---+---+---+---+---+---+---+ // (1) BIT[4] Notenwert // (2) BIT[2] Punktierung (0..3 = ohne, einfach doppelt, Zeilenende) // (3) BIT halbe_Groesse // (4) BIT ohne_Wert // +---+---+---+---+---+---+---+---+ // |6 |5 |4 |3 |2 |1 | | // +---+---+---+---+---+---+---+---+ // (1) BIT Balken trennen // (2) BIT Balken verbinden // (3) BIT unsichtbar // (4) BIT Haltebogen // (5) BIT expl_Vorzeichen // (6) BIT[3] Kopfform // +---+---+---+---+---+---+---+---+ // |4 |3 |2 |1 | // +---+---+---+---+---+---+---+---+ // (1) BIT[4] Artikulationszeichen // (2) BIT[2] Hals // (3) BIT[1] Pause auch in zweistimmiger Zeile zentriert (ab V2.1) // (4) BIT[1] Atemzeichen (neu in V2.2) // NOTE[Anzahl_Noten] byte b1 = accords[index++]; int noteDuration = b1 & 0x0F; int notePunctation = (b1 & 0x30) >> 4; bool noteHalfSize = (b1 & 0x40) > 0; bool noteNoValue = (b1 & 0x80) > 0; byte b2 = accords[index++]; bool splitBar = (b2 & 0x01) > 0; bool combineBar = (b2 & 0x02) > 0; bool invisible = (b2 & 0x04) > 0; bool connectNext = (b2 & 0x08) > 0; bool showSign = (b2 & 0x10) > 0; int headFormat = (b2 & 0xE0) >> 5; byte b3 = accords[index++]; if (noteNoValue && invisible) { // current note is just a placeholder // skip and continue for (int i = 0; i < notes; i++) { index++; } continue; } if (notePunctation == 3) { // "3" in notePuncation marks end of line // just leave accords loop if (index != accords.Length) { throw new InvalidOperationException( "Current member identifies end of line, but there are pending elements."); } break; } var noteType = new notetype(); int noteTicks; switch (noteDuration) { case 0: noteType.Value = notetypevalue.whole; noteTicks = 128; if (notes == 0) { // whole rest -> whole measure noteTicks = this.currentBeats[staffNumber] * (128 / this.currentBeatType[staffNumber]); } break; case 1: noteType.Value = notetypevalue.half; noteTicks = 64; break; case 2: noteType.Value = notetypevalue.quarter; noteTicks = 32; break; case 3: noteType.Value = notetypevalue.eighth; noteTicks = 16; break; case 4: noteType.Value = notetypevalue.Item16th; noteTicks = 8; break; case 5: noteType.Value = notetypevalue.Item32nd; noteTicks = 4; break; case 6: noteType.Value = notetypevalue.Item64th; noteTicks = 2; break; case 7: noteType.Value = notetypevalue.Item128th; noteTicks = 1; break; default: throw new NotImplementedException(); } emptyplacement[] dots = null; if (notePunctation == 1) { noteTicks = (noteTicks * 3) / 2; dots = new[] { new emptyplacement() }; } else if (notePunctation == 2) { noteTicks = (noteTicks * 5) / 3; dots = new[] { new emptyplacement(), new emptyplacement() }; } if (notes == 0) { // rest var newNote = new note(); var theRest = newNote.AddRest(); // the rest sign will be painted on step A by default in octave 4 theRest.displaystep = step.B; int octave = 4; if (voiceNumber == 1) { theRest.displaystep = step.F; octave = 5; } else if (voiceNumber == 2) { theRest.displaystep = step.E; } if (this.currentKeyOctavation[staffNumber] == 0) { // in case of upper octavation we have to increase octave number octave++; } else if (this.currentKeyOctavation[staffNumber] == 2) { // in case of lower octavation we have to decrease octave number octave--; } // in case of F clef we use different octave and step for rest sign if (this.currentKeyForm[staffNumber] == 2) { octave--; theRest.displaystep = step.D; if (voiceNumber == 1) { theRest.displaystep = step.A; } else if (voiceNumber == 2) { theRest.displaystep = step.G; octave--; } } theRest.displayoctave = octave.ToString(CultureInfo.InvariantCulture); newNote.AddDuration(noteTicks); if (noteDuration > 0) { newNote.type = noteType; } newNote.dot = dots; if (voiceNumber > 0) { newNote.voice = voiceNumber.ToString(CultureInfo.InvariantCulture); } if (invisible) { // TODO printobject is yet generated from xsd2code // newNote.printobject = no; } currentMeasure.AddNote(newNote); } for (int i = 0; i < notes; i++) { // C2FORMAT.TXT line 334ff //NOTE // +---+---+---+---+---+---+---+---+ // |2 |1 | // +---+---+---+---+---+---+---+---+ // (1) BIT[6] relative diatonische Hoehe + 32 // (2) BIT[2] Alteration + 2 //end byte noteValue = accords[index++]; int relativePitch = (noteValue & 0x3F) - 32; int alteration = ((noteValue & 0xC0) >> 6) - 2; var newNote = new note(); if (i > 0) { newNote.SetChord(); } var p = pitch.CreatePitch( relativePitch, alteration, this.currentKeyForm[staffNumber], this.currentKeyOctavation[staffNumber], this.GetCurrentSignature(staffNumber, voiceNumber)); newNote.AddPitch(p); newNote.type = noteType; newNote.dot = dots; if (voiceNumber > 0) { newNote.voice = voiceNumber.ToString(CultureInfo.InvariantCulture); } // TRIPLETS if (hasTriplet && tripletCounter > 0) { newNote.timemodification = new timemodification { actualnotes = tripletCounter.ToString(CultureInfo.InvariantCulture), normalnotes = "2" }; // TODO How to remove normal-type? // TODO : //newNote.notations = new notations[1] //{ // new notations { Items = new object[1] // { // new tuplet { type = startstop.start } } // } //}; double accurateNoteTicks = noteTicks * 2; accurateNoteTicks /= tripletCounter; noteTicks = (int)accurateNoteTicks; tripletRests += accurateNoteTicks - noteTicks; if (tripletRests > 0.5) { noteTicks += 1; tripletRests -= 1; } } // the duration values corresponds with the divisions value set in readLAYOUT() newNote.AddDuration(noteTicks); if (connectNext && this.notesConnecting[staffNumber] == false) { newNote.AddTieStart(); } else if (connectNext == false && this.notesConnecting[staffNumber]) { newNote.AddTieStop(); } this.notesConnecting[staffNumber] = connectNext; lyricsProcessor.AddLyrics(newNote); currentMeasure.AddNote(newNote); } currentMeasureTicks += noteTicks; if (currentMeasureTicks >= this.currentBeats[staffNumber] * (128 / this.currentBeatType[staffNumber])) { currentMeasure.AddBackup(currentMeasureTicks); measureIndex++; if (measureIndex >= this.measures[staffNumber].Count) { var newMeasure = new scorepartwisePartMeasure(); this.measures[staffNumber].Add(newMeasure); newMeasure.number = (measureIndex + 1).ToString(CultureInfo.InvariantCulture); } currentMeasureTicks = 0; } } }
=> With(attributes: Attributes.With(id: id ?? throw new ArgumentNullException(nameof(id))));
//public string state { get; set; } public TKtree() { text = ""; //state = "closed"; attributes = new attributes(); }