private void OnCollisionEnter2D(Collision2D collision) { //TagsMan tm = collision.gameObject.GetComponent<> TagsMan tm = collision.gameObject.GetComponent <TagsMan>(); if (tm == null) { return; } TAGS tag = tm.selected_Tags; if (tag == TAGS.LEFT_WALL) { rightRacket.MakeScore(); } else if (tag == TAGS.RIGHT_WALL) { leftRacket.MakeScore(); } else if (tag == TAGS.LEFT_RACKET) { ComputeReturningVec(collision, 1); } else if (tag == TAGS.RIGHT_RACKET) { ComputeReturningVec(collision, -1); } }
public void clear() { COMPARTMENTS.Clear(); TAGS.Clear(); CONTAINER.Clear(); ITEMS.Clear(); }
//Remove collisions positions and flags private void OnCollisionExit2D(Collision2D coll) { TAGS collTag = TAGS.NONE; string tag = coll.gameObject.tag; if (tag == "Ground") { collTag = TAGS.GROUND; } else if (tag == "Wall") { collTag = TAGS.WALL; } else if (tag == "Player") { collTag = TAGS.PLAYER; } else { //not a type we care about so ignore. return; } for (int i = 0; i < collisions.Length; i++) { if (collisions[i] == collTag) { collisions[i] = TAGS.NONE; } } }
/// <summary> /// transfers a global file (for ex-rates, hicp, glo-switches) into EM3 style and creates the EM3 file /// note: this class is only responsible for writing /// EM2->EM3 adaptations are accomplished by a call to the EM23Adapt class (see AdaptX in the concrete functions above) /// also note: the function (respectively the concrete versions, see above) /// is not intended to be used "stand-alone", but by EM3Global.Transform and EM3All.Write /// </summary> /// <param name="content"> content of global file as read by EM2Global.Read </param> /// <param name="fileName"> full path of EM3 global-file (i.e. the file to write) </param> /// <param name="errors"> critical and non-critical erros during the write-process, empty structure for no errors </param> private static bool Write(List <List <MultiProp> > content, string fileName, string tag, out List <string> errors) { errors = new List <string>(); XmlWriter writer; try { using (writer = XmlWriter.Create(fileName, TransformerCommon.GetXmlWriterSettings())) { writer.WriteStartElement(TransformerCommon.ROOT_ELEMENT); writer.WriteStartElement(TAGS.Enclosure(tag)); // e.g. <HICP> foreach (List <MultiProp> item in content) { writer.WriteStartElement(tag); foreach (var prop in item) { TransformerCommon.TranslateAndWriteElement(writer, prop.tag, prop.content, tag); } writer.WriteEndElement(); } writer.WriteEndElement(); // e.g. </HICPs> writer.WriteEndElement(); // ROOT_ELEMENT } return(true); } catch (Exception exception) { errors.Add($"{fileName}: {exception.Message}"); return(false); } }
public ActionResult DeleteConfirmed(int id) { TAGS tAGS = db.TAGS.Find(id); db.TAGS.Remove(tAGS); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID_TAGS,TAGSNAME")] TAGS tAGS) { if (ModelState.IsValid) { db.Entry(tAGS).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tAGS)); }
//Set collisions positions and flags private void OnCollisionEnter2D(Collision2D coll) { TAGS collTag = TAGS.NONE; string tag = coll.gameObject.tag; if (tag == "Ground") { collTag = TAGS.GROUND; } else if (tag == "Wall") { collTag = TAGS.WALL; } else if (tag == "Player") { collTag = TAGS.PLAYER; } else { //not a tag we care about so ignore. Debug.Log("GameObject does not have recognized tag"); return; } if (coll.contactCount <= 0) { return; } Vector2 contactPoint = coll.GetContact(coll.contactCount - 1).point; //get a contact point if (contactPoint.x != coll.GetContact(0).point.x) //if points aren't on the same x-axis { //point is on the top / bottom if (contactPoint.y < transform.position.y) //on the bottom { collisions[(int)CollisionsLoc.botColl] = collTag; } else { collisions[(int)CollisionsLoc.topColl] = collTag; } } else if (contactPoint.y != coll.GetContact(0).point.y) { if (contactPoint.x < transform.position.x) // on the left { collisions[(int)CollisionsLoc.leftColl] = collTag; } else { collisions[(int)CollisionsLoc.rightColl] = collTag; } } else { Debug.Log("Error in collider positioning"); } }
public ActionResult Create([Bind(Include = "ID_TAGS,TAGSNAME")] TAGS tAGS) { if (ModelState.IsValid) { db.TAGS.Add(tAGS); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tAGS)); }
public TAGS Put([FromBody] TAGS tag) { TAGS tg = context.TAG.Where(c => c.ID == tag.ID).SingleOrDefault(); if (tg != null) { tg.NAME = tag.NAME; tg.CREATE_DATE = DateTime.Now.ToString(); context.SaveChanges(); return(tag); } return(new TAGS()); }
public TAGS Create([FromBody] TAGS tag) { if (context.TAG.Where(c => c.NAME == tag.NAME || c.ID == tag.ID).Count() > 0) { return(new TAGS()); } tag.CREATE_DATE = DateTime.Now.ToString(); context.TAG.Add(tag); context.SaveChanges(); return(tag); }
// GET: TAGS/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TAGS tAGS = db.TAGS.Find(id); if (tAGS == null) { return(HttpNotFound()); } return(View(tAGS)); }
/// <summary> /// omg, worst generic ever /// </summary> /// <typeparam name="T"></typeparam> /// <param name="id"></param> /// <returns></returns> public T getEntryById <T>(UInt32 id) { object tmp = null; if (typeof(T) == typeof(Item)) { var it = ITEMS.Where(l => l.ID == id); if (it.Count() == 1) { tmp = (it.ToArray()[0]); } } else if (typeof(T) == typeof(TAG)) { var it = TAGS.Where(l => l.ID == id); if (it.Count() == 1) { tmp = (it.ToArray()[0]); } } else if (typeof(T) == typeof(Container)) { var it = CONTAINER.Where(l => l.ID == id); if (it.Count() == 1) { tmp = (it.ToArray()[0]); } } else if (typeof(T) == typeof(Compartment)) { var it = COMPARTMENTS.Where(l => l.ID == id); if (it.Count() == 1) { tmp = (it.ToArray()[0]); } } else { throw new Exception(); } return((T)tmp); }
/// <summary> /// transfers the EM2 variables file into EM3 style and creates the respective EM3 file /// note: this class is only responsible for writing, EM2->EM3 adaptations are accomplished by a call to the EM23Adapt class /// also note: the function is not intended to be used "stand-alone", but by EM3Variables.Transform and EM3All.Write /// </summary> /// <param name="content"> content of variables-file as read by EM2Variables.Read </param> /// <param name="emPath"> EuromodFiles folder (containing EM2-files in XMLParam and (will contain) EM3-files in EM3Translation\XMLParam) </param> /// <param name="errors"> critical and non-critical erros during the write-process, empty structure for no errors </param> public static bool Write(EM2Variables.Content content, string emPath, out List <string> errors) { errors = new List <string>(); XmlWriter writer; try { (new EM23Adapt()).AdaptVar(content); // adapt from EM2 style to EM3 style using (writer = XmlWriter.Create(new EMPath(emPath).GetVarFilePath(), TransformerCommon.GetXmlWriterSettings())) { writer.WriteStartElement(TransformerCommon.ROOT_ELEMENT); WriteList(TAGS.VAR, content.variables); WriteList(TAGS.ACTYPE, content.acroTypes); WriteList(TAGS.ACLEVEL, content.acroLevels); WriteList(TAGS.ACRO, content.acros); WriteList(TAGS.CAT, content.acroCategories); writer.WriteEndElement(); return(true); } } catch (Exception exception) { errors.Add($"Variables: {exception.Message}"); return(false); } void WriteList(string tag, List <Dictionary <string, string> > items) { writer.WriteStartElement(TAGS.Enclosure(tag)); foreach (var item in items) { writer.WriteStartElement(tag); foreach (var p in item) { TransformerCommon.TranslateAndWriteElement(writer, p.Key, p.Value, tag); } writer.WriteEndElement(); } writer.WriteEndElement(); } }
public override bool Equals(object obj) { LoudHotel other = obj as LoudHotel; if (other == null) { return(false); } return (HOTELID == other.HOTELID && BASERATE == other.BASERATE && DESCRIPTION == other.DESCRIPTION && DESCRIPTIONFRENCH == other.DESCRIPTIONFRENCH && HOTELNAME == other.HOTELNAME && CATEGORY == other.CATEGORY && ((TAGS == null) ? (other.TAGS == null || other.TAGS.Length == 0) : TAGS.SequenceEqual(other.TAGS ?? new string[0])) && PARKINGINCLUDED == other.PARKINGINCLUDED && SMOKINGALLOWED == other.SMOKINGALLOWED && LASTRENOVATIONDATE == other.LASTRENOVATIONDATE && RATING == other.RATING && ((LOCATION == null) ? other.LOCATION == null : LOCATION.Equals(other.LOCATION))); }
public override string ToString() => $"ID: {HOTELID}; BaseRate: {BASERATE}; Description: {DESCRIPTION}; " + $"Description (French): {DESCRIPTIONFRENCH}; Name: {HOTELNAME}; Category: {CATEGORY}; " + $"Tags: {TAGS?.ToCommaSeparatedString() ?? "null"}; Parking: {PARKINGINCLUDED}; " + $"Smoking: {SMOKINGALLOWED}; LastRenovationDate: {LASTRENOVATIONDATE}; Rating: {RATING}; " + $"Location: [{LOCATION?.Longitude ?? 0}, {LOCATION?.Latitude ?? 0}]";
/// <summary> /// transfers a country's EM2 country- and data-config-content into EM3 style and creates the EM3 country-file /// note: this class is only responsible for writing, EM2->EM3 adaptations are accomplished by a call to the EM23Adapt class /// also note: does not create the country folder /// i.e. the function is not intended to be used "stand-alone", but by EM3.Transform/AddOn and EM3All.Write /// </summary> /// <param name="ctryContent"> content of country-XML-file as read by EM2Country.Read </param> /// <param name="dataContent"> content of country-dataconfig-XML-file as read by EM2Data.Read </param> /// <param name="extensionInfo"> content of global extension-XML-file (necessary for EM2->EM3 adaptation) </param> /// <param name="fileName"> full path of EM3 country-XML-file (i.e. the file to write) </param> /// <param name="errors"> critical and non-critical erros during the write-process, empty structure for no errors </param> public static bool Write(EM2Country.Content ctryContent, EM2Data.Content dataContent, List <List <MultiProp> > extensionInfo, string fileName, out List <string> errors) { errors = new List <string>(); XmlWriter writer; // declare here to be able to use it in sub-functions try { // "summarised" EM2->EM3 adaptation process (new EM23Adapt()).AdaptCountry(ctryContent, dataContent, extensionInfo, out errors); using (writer = XmlWriter.Create(fileName, TransformerCommon.GetXmlWriterSettings())) { writer.WriteStartElement(TransformerCommon.ROOT_ELEMENT); // COUNTRY WriteItem(TAGS.COUNTRY, ctryContent.general); // SYSTEMS writer.WriteStartElement(TAGS.Enclosure(TAGS.SYS)); foreach (var sys in ctryContent.systems.Values) { WriteItem(TAGS.SYS, sys); } writer.WriteEndElement(); // POLICIES writer.WriteStartElement(TAGS.Enclosure(TAGS.POL)); foreach (var pol in ctryContent.policies.Values) { WriteItem(TAGS.POL, pol); } writer.WriteEndElement(); // REFERENCE POLICIES writer.WriteStartElement(TAGS.Enclosure(TAGS.REFPOL)); foreach (var refPol in ctryContent.referencePolicies) { writer.WriteStartElement(TAGS.REFPOL); TransformerCommon.TranslateAndWriteElement(writer, TAGS.ID, refPol.Key, TAGS.REFPOL); TransformerCommon.TranslateAndWriteElement(writer, TAGS.REFPOL_ID, refPol.Value, TAGS.REFPOL); writer.WriteEndElement(); } writer.WriteEndElement(); // FUNCTIONS writer.WriteStartElement(TAGS.Enclosure(TAGS.FUN)); foreach (var fun in ctryContent.functions.Values) { WriteItem(TAGS.FUN, fun); } writer.WriteEndElement(); // PARAMETERS writer.WriteStartElement(TAGS.Enclosure(TAGS.PAR)); foreach (var par in ctryContent.parameters.Values) { WriteItem(TAGS.PAR, par); } writer.WriteEndElement(); // SYS-POL-ITEMS writer.WriteStartElement(TAGS.Enclosure(TAGS.SYS_POL)); foreach (var syspol in ctryContent.sysPol) { WriteSysItem(TAGS.SYS_POL, TAGS.POL_ID, TAGS.SWITCH, syspol); } writer.WriteEndElement(); // SYS-FUNC-ITEMS writer.WriteStartElement(TAGS.Enclosure(TAGS.SYS_FUN)); foreach (var sysfun in ctryContent.sysFun) { WriteSysItem(TAGS.SYS_FUN, TAGS.FUN_ID, TAGS.SWITCH, sysfun); } writer.WriteEndElement(); // SYS-PAR-ITEMS writer.WriteStartElement(TAGS.Enclosure(TAGS.SYS_PAR)); foreach (var syspar in ctryContent.sysPar) { WriteSysItem(TAGS.SYS_PAR, TAGS.PAR_ID, TAGS.VALUE, syspar); } writer.WriteEndElement(); // BREAK HERE FOR ADD-ONS !!! the rest only concerns countries if (dataContent == null) { return(true); } // ------------------------------------------------------------------- // UPRATING INDICES - PROPERTIES (name, description, ...) writer.WriteStartElement(TAGS.Enclosure(TAGS.UPIND)); foreach (var upInd in ctryContent.upInd.Values) { WriteItem(TAGS.UPIND, upInd); } writer.WriteEndElement(); // UPRATING INDICES - VALUES PER YEAR writer.WriteStartElement(TAGS.Enclosure(TAGS.UPIND_YEAR)); foreach (var upIndVal in ctryContent.upIndVal) { writer.WriteStartElement(TAGS.UPIND_YEAR); WriteProperties(upIndVal, TAGS.UPIND_YEAR); writer.WriteEndElement(); } writer.WriteEndElement(); // DATASETS writer.WriteStartElement(TAGS.Enclosure(TAGS.DATA)); foreach (var data in dataContent.dataSets.Values) { writer.WriteStartElement(TAGS.DATA); TransformerCommon.TranslateAndWriteElement(writer, TAGS.ID, data.id, TAGS.DATA); TransformerCommon.TranslateAndWriteElement(writer, TAGS.NAME, data.name, TAGS.DATA); WriteProperties(data.properties, TAGS.DATA); writer.WriteEndElement(); } writer.WriteEndElement(); // SYS-DATA-ITEMS writer.WriteStartElement(TAGS.Enclosure(TAGS.SYS_DATA)); foreach (var ds in dataContent.sysData) { writer.WriteStartElement(TAGS.SYS_DATA); TransformerCommon.TranslateAndWriteElement(writer, TAGS.DATA_ID, ds.dataID, TAGS.SYS_DATA); TransformerCommon.TranslateAndWriteElement(writer, TAGS.SYS_ID, ds.sysID, TAGS.SYS_DATA); WriteProperties(ds.properties, TAGS.SYS_DATA); writer.WriteEndElement(); } writer.WriteEndElement(); // EXTENSIONS // extensions themself writer.WriteStartElement(TAGS.Enclosure(TAGS.LOCAL_EXTENSION)); foreach (var ext in dataContent.localExtensions) { WriteItem(TAGS.LOCAL_EXTENSION, ext); } writer.WriteEndElement(); // extensions' policies writer.WriteStartElement(TAGS.Enclosure(TAGS.EXTENSION_POL)); foreach (var ep in ctryContent.extensionPol) { writer.WriteStartElement(TAGS.EXTENSION_POL); TransformerCommon.TranslateAndWriteElement(writer, TAGS.EXTENSION_ID, ep.Item1, TAGS.EXTENSION_POL); TransformerCommon.TranslateAndWriteElement(writer, TAGS.POL_ID, ep.Item2, TAGS.EXTENSION_POL); TransformerCommon.TranslateAndWriteElement(writer, TAGS.EXENTSION_BASEOFF, ep.Item3, TAGS.EXTENSION_POL); writer.WriteEndElement(); } writer.WriteEndElement(); // extensions' functions writer.WriteStartElement(TAGS.Enclosure(TAGS.EXTENSION_FUN)); foreach (var fp in ctryContent.extensionFun) { writer.WriteStartElement(TAGS.EXTENSION_FUN); TransformerCommon.TranslateAndWriteElement(writer, TAGS.EXTENSION_ID, fp.Item1, TAGS.EXTENSION_FUN); TransformerCommon.TranslateAndWriteElement(writer, TAGS.FUN_ID, fp.Item2, TAGS.EXTENSION_FUN); TransformerCommon.TranslateAndWriteElement(writer, TAGS.EXENTSION_BASEOFF, fp.Item3, TAGS.EXTENSION_FUN); writer.WriteEndElement(); } writer.WriteEndElement(); // extensions' parameters writer.WriteStartElement(TAGS.Enclosure(TAGS.EXTENSION_PAR)); foreach (var ep in ctryContent.extensionPar) { writer.WriteStartElement(TAGS.EXTENSION_PAR); TransformerCommon.TranslateAndWriteElement(writer, TAGS.EXTENSION_ID, ep.Item1, TAGS.EXTENSION_PAR); TransformerCommon.TranslateAndWriteElement(writer, TAGS.PAR_ID, ep.Item2, TAGS.EXTENSION_PAR); TransformerCommon.TranslateAndWriteElement(writer, TAGS.EXENTSION_BASEOFF, ep.Item3, TAGS.EXTENSION_PAR); writer.WriteEndElement(); } writer.WriteEndElement(); // extensions' switches writer.WriteStartElement(TAGS.Enclosure(TAGS.EXTENSION_SWITCH)); foreach (var sw in dataContent.policySwitches) { writer.WriteStartElement(TAGS.EXTENSION_SWITCH); TransformerCommon.TranslateAndWriteElement(writer, TAGS.EXTENSION_ID, sw.switchPolID, TAGS.EXTENSION_SWITCH); TransformerCommon.TranslateAndWriteElement(writer, TAGS.SYS_ID, sw.sysID, TAGS.EXTENSION_SWITCH); TransformerCommon.TranslateAndWriteElement(writer, TAGS.DATA_ID, sw.dataID, TAGS.EXTENSION_SWITCH); TransformerCommon.TranslateAndWriteElement(writer, TAGS.VALUE, sw.value, TAGS.EXTENSION_SWITCH); writer.WriteEndElement(); } writer.WriteEndElement(); // LOOKGROUPS // groups themself writer.WriteStartElement(TAGS.Enclosure(TAGS.LOOKGROUP)); foreach (var lg in ctryContent.lookGroup.Values) { WriteItem(TAGS.LOOKGROUP, lg); } writer.WriteEndElement(); // groups' policies writer.WriteStartElement(TAGS.Enclosure(TAGS.LOOKGROUP_POL)); foreach (var lgp in ctryContent.lookGroupPol) { writer.WriteStartElement(TAGS.LOOKGROUP_POL); TransformerCommon.TranslateAndWriteElement(writer, TAGS.LOOKGROUP_ID, lgp.Item1, TAGS.LOOKGROUP_POL); TransformerCommon.TranslateAndWriteElement(writer, TAGS.POL_ID, lgp.Item2, TAGS.LOOKGROUP_POL); writer.WriteEndElement(); } writer.WriteEndElement(); // groups' functions writer.WriteStartElement(TAGS.Enclosure(TAGS.LOOKGROUP_FUN)); foreach (var lgf in ctryContent.lookGroupFun) { writer.WriteStartElement(TAGS.LOOKGROUP_FUN); TransformerCommon.TranslateAndWriteElement(writer, TAGS.LOOKGROUP_ID, lgf.Item1, TAGS.LOOKGROUP_FUN); TransformerCommon.TranslateAndWriteElement(writer, TAGS.FUN_ID, lgf.Item2, TAGS.LOOKGROUP_FUN); writer.WriteEndElement(); } writer.WriteEndElement(); // groups' parameters writer.WriteStartElement(TAGS.Enclosure(TAGS.LOOKGROUP_PAR)); foreach (var lgp in ctryContent.lookGroupPar) { writer.WriteStartElement(TAGS.LOOKGROUP_PAR); TransformerCommon.TranslateAndWriteElement(writer, TAGS.LOOKGROUP_ID, lgp.Item1, TAGS.LOOKGROUP_PAR); TransformerCommon.TranslateAndWriteElement(writer, TAGS.PAR_ID, lgp.Item2, TAGS.LOOKGROUP_PAR); writer.WriteEndElement(); } writer.WriteEndElement(); // INDIRECT TAX - PROPERTIES (name, comment, ...) writer.WriteStartElement(TAGS.Enclosure(TAGS.INDTAX)); foreach (var indTax in ctryContent.indTax.Values) { WriteItem(TAGS.INDTAX, indTax); } writer.WriteEndElement(); // INDIRECT TAX - VALUES PER YEAR writer.WriteStartElement(TAGS.Enclosure(TAGS.INDTAX_YEAR)); foreach (var indTaxVal in ctryContent.indTaxVal) { writer.WriteStartElement(TAGS.INDTAX_YEAR); WriteProperties(indTaxVal, TAGS.INDTAX_YEAR); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteEndElement(); // ROOT_ELEMENT return(true); } } catch (Exception exception) { errors.Add($"{ctryContent.general.name}: {exception.Message}"); return(false); } void WriteItem(string tag, EM2Item item) { writer.WriteStartElement(tag); if (item.id != null) { TransformerCommon.TranslateAndWriteElement(writer, TAGS.ID, item.id, tag); } if (item.name != null) { TransformerCommon.TranslateAndWriteElement(writer, TAGS.NAME, item.name, tag); } WriteProperties(item.properties, tag); writer.WriteEndElement(); } void WriteProperties(Dictionary <string, string> properties, string tag) { foreach (var p in properties) { if (!string.IsNullOrEmpty(p.Value)) { TransformerCommon.TranslateAndWriteElement(writer, p.Key, p.Value, tag); } } } void WriteSysItem(string mainTag, string itemTag, string valTag, EM2Country.SysItem sysItem) { writer.WriteStartElement(mainTag); TransformerCommon.TranslateAndWriteElement(writer, TAGS.SYS_ID, sysItem.sysID, mainTag); TransformerCommon.TranslateAndWriteElement(writer, itemTag, sysItem.itemID, mainTag); TransformerCommon.TranslateAndWriteElement(writer, TAGS.ORDER, sysItem.order, mainTag); TransformerCommon.TranslateAndWriteElement(writer, valTag, sysItem.value, mainTag); writer.WriteEndElement(); } }