public string Remove(int index) { string obj = AbstractObject[index]; AbstractObject.Remove(obj); return(obj); }
/// <summary> /// Make a place new IconScript for AbstractObject. /// If AbstractObject has his own coordinats != 1, the game will use them /// </summary> /// <param name="x"> coordinat of free space </param> /// <param name="y"> coordinat of free space </param> /// <param name="itm"> source </param> /// <returns> new IconScript object </returns> public static GameObject PlaceNewGameobject(float x, float y, AbstractObject itm) { MainScript ms = Camera.main.GetComponent <MainScript>(); GameObject go = Instantiate(ms.m_iconPrefab); go.name = itm.m_name; IconScript isc = go.GetComponent <IconScript>(); isc.m_ms = ms; if (isc != null) { isc.m_thisItem = itm; } isc._tmpPos.z = go.transform.position.z; //if coordinates does not set in excel, it will be random if (itm.m_defaultX == 1 && itm.m_defaultY == 1) { isc._tmpPos.x = x; isc._tmpPos.y = y; } else { isc._tmpPos.x = itm.m_defaultX; isc._tmpPos.y = itm.m_defaultY; } go.transform.position = isc._tmpPos; isc.m_thisItem.m_thisObject = isc; isc.m_thisItem.ChangeProductionType( isc.transform.Find("smallIcon").GetComponent <SpriteRenderer>(), isc); MainScript.m_sAllItems.Add(go); return(go); }
/// <summary> /// loading all effects from excel map /// </summary> /// <param name="filename"> file name with full path </param> public static void Load(string filename) { _sEffects = new Dictionary <string, EffectTypes>(); var itms = AbstractObject.Load <ExcelLoading.effect>(filename); foreach (var rep in itms.repetative) { EffectTypes type; switch (rep.type) { case "speed": type = EffectTypes.speed; break; case "result": type = EffectTypes.result; break; case "storage": type = EffectTypes.storage; break; default: type = EffectTypes.none; break; } _sEffects.Add(rep.name, type); } }
/// <remarks/> public System.IAsyncResult BeginPutData(AbstractObject abstractDataObject, NameValuePair[] options, System.AsyncCallback callback, object asyncState) { return(this.BeginInvoke("PutData", new object[] { abstractDataObject, options }, callback, asyncState)); }
/// <summary> /// Copy from loaded item. /// shouldn't copy non-serialized fields /// </summary> /// <param name="source"> source for copying </param> public override void Copy(AbstractObject itm) { base.Copy(itm); Population pop = (Population)itm; m_starved = pop.m_starved; }
public override void Copy(AbstractObject source) { WildAnimal ani = source as WildAnimal; _currentChance = ani._currentChance; base.Copy(source); }
/// <summary> /// Copy from loaded item. /// shouldn't copy non-serialized fields /// </summary> /// <param name="source"> source for copying </param> public override void Copy(AbstractObject source) { base.Copy(source); GameAbstractItem itm = source as GameAbstractItem; m_workers = itm.m_workers; }
public void PutOnTile(AbstractObject t) { int x = (int)t.X % _width; int y = (int)t.Y % _height; ((Tile)_tiles[x, y]).Object = t; }
/// <summary> /// Copy from loaded item. /// shouldn't copy non-serialized fields /// </summary> /// <param name="source"> source for copying </param> public override void Copy(AbstractObject source) { base.Copy(source); MineralResource rsc = source as MineralResource; m_count = rsc.m_count; }
// Verify the collision with the box and its children ( if previousIntersection is farest than the intersection with the box ) public AbstractObject collision(CubeStaticObject box, AbstractObject obj) { // Intersection to external box Cube bool collideBox = this.getBoundingBox().collision(box); // Calculate internal intersection if the external one if smaller than the previousIntersection if (collideBox) { // If the box has only one child, check its intersection if (this.inside != null) { // This box is the same as inside if (obj != this.inside) { return(this.inside); } } // If the box has boxes as children, check their intersection else { for (int i = 0; i < this.boxes.Count; i++) { AbstractObject collObj = this.boxes[i].collision(box, obj); if (collObj != null) { return(collObj); } } } } return(null); }
public void AddObject(AbstractObject beh) { beh.Belongs = this; beh.Initialize(); lock (ObjectsInTheWorld) ObjectsInTheWorld.Add(beh); BehaviourController.StartUpdateBehaviour(beh); }
/// <summary> /// Copy from loaded item. /// shouldn't copy non-serialized fields /// </summary> /// <param name="source"> source for copying </param> public override void Copy(AbstractObject source) { base.Copy(source); Items itms = (Items)source; m_blocked = itms.m_blocked; m_damagedCount = itms.m_damagedCount; }
public void RemoveObject(AbstractObject @object) { AbstractObject obj = ObjectsInTheWorld.Find(a => a.BehaviourID == @object.BehaviourID); lock (ObjectsInTheWorld) ObjectsInTheWorld.Remove(obj); obj.Dispose(); }
void Update() { if (Input.GetButtonDown("Fire2")) { Collider[] hitColliders = Physics.OverlapSphere(transform.position, radius); foreach (var i in hitColliders) { Vector3 direction = i.transform.position - transform.position; if (Vector3.Dot(transform.forward, direction) > .5f) { i.SendMessage("Operate", SendMessageOptions.DontRequireReceiver); } } } RaycastHit hit; // Посилання,на змінну,якак буде містити інформацію про об'єкт з яким зіткнувся промінь press.text = ""; if (Physics.Raycast(_camera.transform.position, _camera.transform.forward, out hit, 4f)) //Перевірка { if (hit.transform.CompareTag("weapon")) { if (hit.transform.GetComponent <AbstractObject>() != null) { if (hit.transform.GetComponent <AbstractObject>().Equiped) { return; } } press.text = "Press F"; if (Input.GetKeyDown(KeyCode.F)) { AbstractObject a = hit.transform.GetComponent <AbstractObject>(); if (manager.AddGun(a)) { hit.transform.gameObject.active = false; } } } else if (hit.transform.CompareTag("grenade")) { press.text = "Press F"; if (Input.GetKeyDown(KeyCode.F)) { if (grenadeController.AddGrenade()) { Destroy(hit.transform.gameObject); } } } } }
/// <summary> /// Copy from loaded item. /// shouldn't copy non-serialized fields /// </summary> /// <param name="source"> source for copying </param> public override void Copy(AbstractObject itm) { base.Copy(itm); GameMaterial mat = (GameMaterial)itm; m_storageSize = mat.m_storageSize; m_lastCount = mat.m_lastCount; m_productQueue = mat.m_productQueue; }
void OnTriggerEnter(Collider other) { if (numTechnic == (int)Technic.onde_choc) { switch (other.tag) { case Constants._EnnemisTag: Vector3 dir = Vector3.Normalize(other.transform.position - transform.position); AbstractObject enn = other.GetComponentInChildren <AbstractObject>(); if (!enn) { return; } enn.Degat(dir * puissanceOnde, (int)Technic.onde_choc); break; case Constants._ObsPropSafe: GlobalManager.GameCont.MeshDest.SplitMesh(other.gameObject, control.transform, 100, 3); break; //case tag bibli } } else if (canPunc && (other.gameObject.tag == Constants._EnnemisTag || other.gameObject.tag == Constants._ObsPropSafe)) { AbstractObject tryGet = other.GetComponentInChildren <AbstractObject> ( ); if (!tryGet) { return; } Vector3 getProj = projection_basic; switch (numTechnic) { case (int)Technic.basic_punch: if (RightPunch) { getProj.x *= Random.Range(-getProj.x, -getProj.x / 2); } else { getProj.x *= Random.Range(getProj.x / 2, getProj.x); } tryGet.Degat(getProj, numTechnic); break; case (int)Technic.double_punch: tryGet.Degat(projection_double, numTechnic); break; } MadnessMana("Double"); } else if (other.gameObject.tag == Constants._MissileBazoo) { other.gameObject.GetComponent <MissileBazooka>().ActiveTir(-other.gameObject.GetComponent <MissileBazooka>().GetDirection(), facteurVitesseRenvoie, true); MadnessMana("Double"); } }
public PutDataResult[] PutData([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://www.energistics.org/schemas/abstract")] AbstractObject abstractDataObject, [System.Xml.Serialization.XmlElementAttribute("options")] NameValuePair[] options) { object[] results = this.Invoke("PutData", new object[] { abstractDataObject, options }); return((PutDataResult[])(results[0])); }
public override AbstractObject CreateObject() { if (_stackObjet.Count > 0) { AbstractObject obj = (AbstractObject)_stackObjet.Pop(); return(obj); } return(null); }
private IResource ToResource(IEtpAdapter etpAdapter, AbstractObject entity, EtpUri parentUri, int hasChildren = -1) { return(etpAdapter.CreateResource( uuid: entity.Uuid, uri: entity.GetUri(parentUri), resourceType: ResourceTypes.DataObject, name: entity.Citation.Title, count: hasChildren, lastChanged: entity.GetLastChangedMicroseconds())); }
/// <summary> /// Starting new game /// </summary> public void StartGame() { m_isItInitialized = false; GameInitialization(); Loading(); PlaceOpenedItems(AbstractObject.GetOpennedItems()); m_isItInitialized = true; LearningTip.CreateTip("tip1"); }
/// <summary> /// parsing excel data into current format /// </summary> /// <param name="itm">target</param> /// <param name="repItm">source</param> /// <returns> parsed item </returns> public static new AbstractObject Parse(AbstractObject itm, ExcelLoading.AbstractObject repItm) { ExcelLoading.MineralResource repRes = repItm as ExcelLoading.MineralResource; MineralResource res = itm as MineralResource; res.m_maxCount = decimal.ToInt32(repRes.maximum_in_territory); res.m_count = res.m_maxCount; return(AbstractObject.Parse(itm, repItm)); }
private Resource ToResource(AbstractObject entity, int hasChildren = -1) { return(DiscoveryStoreProvider.New( uuid: entity.Uuid, uri: entity.GetUri(), resourceType: ResourceTypes.DataObject, name: entity.Citation.Title, count: hasChildren, lastChanged: GetLastChanged(entity))); }
/// <summary> /// parsing excel data into current format /// </summary> /// <param name="itm">target</param> /// <param name="repItm">source</param> /// <returns> parsed item </returns> public static new AbstractObject Parse(AbstractObject itm, ExcelLoading.AbstractObject repItm) { ExcelLoading.Resource repRes = repItm as ExcelLoading.Resource; Resource res = itm as Resource; res.m_growingPercent = repRes.growing_percent; res.m_currentMax = (int)res.m_maxCount; return(MineralResource.Parse(itm, repItm)); }
/// <remarks/> public void PutDataAsync(AbstractObject abstractDataObject, NameValuePair[] options, object userState) { if ((this.PutDataOperationCompleted == null)) { this.PutDataOperationCompleted = new System.Threading.SendOrPostCallback(this.OnPutDataOperationCompleted); } this.InvokeAsync("PutData", new object[] { abstractDataObject, options }, this.PutDataOperationCompleted, userState); }
public void LoadEnvironment(AbstractFactory factory) { this.AddArea(factory.CreateArea()); for (AbstractCharacter c = factory.CreateCharacter(); c != null; c = factory.CreateCharacter()) { this.AddCharacter(c); } for (AbstractObject o = factory.CreateObject(); o != null; o = factory.CreateObject()) { this.AddObject(o); } }
public static void EX1() { AbstractFactory factory = new ConcreteFactory1(); AbstractObject createdObject = factory.CreateObjet(); factory = new ConcreteFactory2(); AbstractObject createdObject2 = factory.CreateObjet(); createdObject.ViewDetails(); createdObject2.ViewDetails(); }
/// <summary> /// Copy from loaded item. /// shouldn't copy non-serialized fields /// </summary> /// <param name="source"> source for copying </param> public override void Copy(AbstractObject source) { base.Copy(source); Science scs = (Science)source; for (int i = 0; i < m_dependencyCount.Length; i++) { for (int ii = 0; ii < m_dependencyCount[i].m_value.Count; ii++) { m_dependencyCount[i].m_value[ii] = scs.m_dependencyCount[i].m_value[ii]; } } }
/// <summary> /// parsing excel data into current format /// </summary> /// <param name="itm">target</param> /// <param name="repItm">source</param> /// <returns> parsed item </returns> public static new AbstractObject Parse(AbstractObject itm, ExcelLoading.AbstractObject repItm) { Localization loc = Localization.GetLocalization(); ExcelLoading.ScienceItem rep = (ExcelLoading.ScienceItem)repItm; Science scs = (Science)itm; scs.m_repItem = rep; scs.m_tooltipCount = loc.m_ui.m_scienceCount; scs.m_tooltipProductivity = loc.m_ui.m_scienceProductivity; Productions.AddProduction(scs, "science"); return(GameAbstractItem.Parse(itm, repItm)); }
/// <summary> /// Loading all tooltips from xml file /// </summary> public static void Load(string filename) { _sAllTips = new Dictionary <string, LearningTipData>(); var uparsedTips = AbstractObject.Load <ExcelLoading.AllTips>(filename); foreach (var source in uparsedTips.repetative) { var tipData = new LearningTipData(); tipData.m_dependency = source.targetIcon; tipData.m_targetObject = source.targetObject; tipData.m_position = new Vector2(source.defaultX, source.defaultY); tipData.m_name = source.name; tipData.m_text = source.description; tipData.m_next = source.nextTip; tipData.m_isItUI = source.isItUI; string[] positionVecor = source.yellowPositionVector == null ? new string[] { "" } : source.yellowPositionVector.Split(';'); string[] sizeVector = source.yellowSizeVector == null ? new string[] { "" } : source.yellowSizeVector.Split(';'); if (positionVecor.Length > 1 && sizeVector.Length > 1) { tipData.m_yellowBox = new Rect( AbstractObject.FloatParse(positionVecor[0]), AbstractObject.FloatParse(positionVecor[1]), AbstractObject.FloatParse(sizeVector[0]), AbstractObject.FloatParse(sizeVector[1]) ); } _sAllTips.Add(tipData.m_name, tipData); } //making previous link foreach (var tipPair in _sAllTips) { var tip = tipPair.Value; if (tip.m_next != null && tip.m_next.Length > 0) { var nextTip = _sAllTips[tip.m_next]; if (nextTip.m_previous == null || nextTip.m_previous.Length == 0) { _sAllTips[tip.m_next].m_previous = tip.m_name; } else { throw new Exception("tip '" + nextTip + "' has previous tip:" + nextTip.m_previous); } } } }
public override void Browse() { if (Model.PathSegments.Length > 0) { AbstractObject loObject = Model.RootTree[string.Join("/", Model.PathSegments)]; if (loObject is Leaf) { Model.File = loObject as Leaf; } else if (loObject is Tree) { Model.Directory = loObject as Tree; } } }
private void SelectObject(AbstractObject node) { if (node.IsBlob) { var blob = node as Leaf; var text = blob.Data; m_object.Document.Blocks.Clear(); var p = new Paragraph(); p.Inlines.Add(text); m_object.Document.Blocks.Add(p); m_object_title.Content = "Content of " + blob.Path; } else { m_object.Document.Blocks.Clear(); } }
// Use this for initialization void Start() { objScript = gameObject.GetComponent<AbstractObject>(); matFragmentum = GetComponent<Fragmentum>().GetMaterial(); Bounds b = gameObject.collider.bounds; guo = new GraphUpdateObject(b); AstarPath.active.UpdateGraphs (guo); addToPathFinder(); }
private void pictureBox1_Paint(object sender, PaintEventArgs e) { #region dibujar mayas_corner float refPoint_X = 0; float refPoint_Y = 0; float refPoint_Y_1 = 0; double delta_X_H = 0; float delta_Y_H = 0; double delta_X_V = 0; double delta_Y_V = 0; double dist_X_H = 0; float dist_Y_H = 0; double dist_X_V = 0; double dist_Y_V = 0; for (int k = 0; k < mayas_corner.Count ; k++) { Circle lstCirculos = mayas_corner[k];// 46 + 2 (drag & drop circles) = 48 insted (horizontal lines) // 28 (vertical lines) #region horizontal lines of the dynamic grid - Creation and Drawing int numHorizontalLines = (int)lstCirculos.getY(); double distHorizontal1 = lstCirculos.circles[2].y - lstCirculos.circles[0].y; double intervalHorizonatal1 = distHorizontal1 / numHorizontalLines; double distHorizontal2 = lstCirculos.circles[3].y - lstCirculos.circles[1].y; double intervalHorizontal2 = distHorizontal2 / numHorizontalLines; double intervalHorizontalX1 = (lstCirculos.circles[2].x - lstCirculos.circles[0].x) * 1.0 / numHorizontalLines; double intervalHorizontalX2 = (lstCirculos.circles[3].x - lstCirculos.circles[1].x) * 1.0 / numHorizontalLines; for (int i = 0; i <= numHorizontalLines; i++) { //e.Graphics.DrawLine( // new Pen(Color.Red, 1f), // new Point((int)((i * intervalHorizontalX1) + lstCirculos.circles[0].x), (int)((i * intervalHorizonatal1) + lstCirculos.circles[0].y)), // new Point((int)((i * intervalHorizontalX2) + lstCirculos.circles[1].x), (int)((i * intervalHorizontal2) + lstCirculos.circles[1].y))); } #endregion #region Vertical lines of the dynamic grid - Creation and Drawing - Creating lstAbsQuestion and lstAbsOnjects int numVerticalLines = (int)lstCirculos.getX(); double distVertical1 = lstCirculos.circles[1].x - lstCirculos.circles[0].x; double intervalVertical1 = distVertical1 / numVerticalLines; double distVertical2 = lstCirculos.circles[3].x - lstCirculos.circles[2].x; double intervalVertical2 = distVertical2 / numVerticalLines; double intervalVerticalY1 = (lstCirculos.circles[1].y - lstCirculos.circles[0].y) * 1.0 / numVerticalLines; double intervalVerticalY2 = (lstCirculos.circles[3].y - lstCirculos.circles[2].y) * 1.0 / numVerticalLines; int index_x = 1; int aux_count = 0; int aux_indice_columna = 0; //pass throug of all the vertical lines for (int i = 0; i <= numVerticalLines; i++) { #region Vertical lines of the dynamic grid - Drawing //e.Graphics.DrawLine( // new Pen(Color.Red, 1f), // new Point((int)((i * intervalVertical1) + lstCirculos.circles[0].x), (int)((i * intervalVerticalY1) + lstCirculos.circles[0].y)), // new Point((int)((i * intervalVertical2) + lstCirculos.circles[2].x), (int)((i * intervalVerticalY2) + lstCirculos.circles[2].y))); #endregion if (k < 2) //if(false) { #region Validation Areas of abstract DNI and Options Albergue dist_X_V = Math.Abs(((i * intervalVertical1) + lstCirculos.circles[0].x) - ((i * intervalVertical2) + lstCirculos.circles[2].x)); dist_Y_V = Math.Abs(((i * intervalVerticalY1) + lstCirculos.circles[0].y) - ((i * intervalVerticalY2) + lstCirculos.circles[2].y)); delta_X_V = (dist_X_V * 1.0 / numHorizontalLines); delta_Y_V = (dist_Y_V * 1.0 / numHorizontalLines); int sign = 1; if (lstCirculos.circles[2].x < lstCirculos.circles[0].x) //if (lstCirculos.circles[2].x < lstCirculos.circles[0].x || // lstCirculos.circles[1].x < lstCirculos.circles[3].x) sign *= -1; refPoint_X = (float)((i * intervalVertical1) + lstCirculos.circles[0].x); refPoint_Y = (float)((i * intervalVerticalY1) + lstCirculos.circles[0].y); for (int r = 0; r <= numHorizontalLines; r++) { float x = (refPoint_X + (r * (float)delta_X_V * sign)); float y = (refPoint_Y + (r * (float)delta_Y_V)); if (k == 0) { #region This is the DNI abstract area int pos = (r * 8) + i; abs_aux_DNI = lstAbsDNI[pos]; abs_aux_DNI.set_x(x); abs_aux_DNI.set_y(y); lstAbsDNI[pos] = abs_aux_DNI; //my_pen = new Pen(Color.Green, 1f); my_pen = new Pen(Color.LightGray, 1f); #endregion } if (k == 1) { #region This is the Option Albergue abstract area int pos = (r * 2) + i; abs_aux_option = lstAbsOptions[pos]; abs_aux_option.set_x(x); abs_aux_option.set_y(y); lstAbsOptions[pos] = abs_aux_option; //my_pen = new Pen(Color.PaleVioletRed, 1f); my_pen = new Pen(Color.LightGray, 1f); #endregion } e.Graphics.DrawEllipse( my_pen, x - lstCirculos.getRadio() / 2, y - lstCirculos.getRadio() / 2, lstCirculos.getRadio(), lstCirculos.getRadio()); } #endregion } //else if(k==2) { #region Validating areas of abstract questions, Sedes, ciclo y turno if (i != 2 && i != 3 && i != 4 && i != 7 && i != 8 && i != 9 && i != 12 && i != 13 && i != 14 && i != 17 && i != 18 && i != 19 && i != 22 && i != 23 && i != 24) { dist_X_V = Math.Abs(((i * intervalVertical1) + lstCirculos.circles[0].x) - ((i * intervalVertical2) + lstCirculos.circles[2].x)); dist_Y_V = Math.Abs(((i * intervalVerticalY1) + lstCirculos.circles[0].y) - ((i * intervalVerticalY2) + lstCirculos.circles[2].y)); delta_X_V = (dist_X_V * 1.0 / numHorizontalLines); delta_Y_V = (dist_Y_V * 1.0 / numHorizontalLines); int sign = 1; if (lstCirculos.circles[2].x < lstCirculos.circles[0].x) sign *= -1; refPoint_X = (float)((i * intervalVertical1) + lstCirculos.circles[0].x); refPoint_Y = (float)((i * intervalVerticalY1) + lstCirculos.circles[0].y); int index_y = 0; //pass throug of all the validated horizontal lines for (int r = 0; r <= numHorizontalLines; r++) { float x = (refPoint_X + (r * (float)delta_X_V * sign)); float y = (refPoint_Y + (r * (float)delta_Y_V)); //All vertical lines that belong to Sede , ciclo y turno //avoiding not desiered horizontal lines if (r != 5 && r != 26 && r != 6 && r != 27 && r != 7 && r != 28 && r != 18 && r != 29 && r != 19 && r != 30 && r != 20 && r != 31 && r != 22 && r != 32 && r != 23 && r != 33 && r != 24 && r != 34 && (i == 0 || i == 1)) { #region logic to save obstrat object to a lstAbsOjects of Sede , ciclo y turno if (r <= 4) { #region Sedes Abstrac area if (i == 1) { abs_aux_sede = lstAbsSede[r]; abs_aux_sede.set_x(x); abs_aux_sede.set_y(y); lstAbsSede[r] = abs_aux_sede; //my_pen = new Pen(Color.Salmon, 1f); my_pen = new Pen(Color.LightGray, 1f); } #endregion } else { if (r <= 17) { #region Ciclo abstract area int index_pos = (i * 1) + ((r - 8) * 2); abs_aux_ciclo = lstAbsCiclo[index_pos]; // 8 - 17 -> fuera abs_aux_ciclo.set_x(x); abs_aux_ciclo.set_y(y); lstAbsCiclo[index_pos] = abs_aux_ciclo; //my_pen = new Pen(Color.Silver, 1f); my_pen = new Pen(Color.LightGray, 1f); #endregion } else { if (r <= 21) { #region Semestre abstract area int index_pos = (r - 21) + i; abs_aux_semestre = lstAbsSemestre[index_pos]; abs_aux_semestre.set_x(x); abs_aux_semestre.set_y(y); lstAbsSemestre[index_pos] = abs_aux_semestre; //my_pen = new Pen(Color.Purple, 1f); my_pen = new Pen(Color.LightGray, 1f); #endregion } else { if (r <= 25) { #region Turno abstract area int index_pos = (r - 25) + i; abs_aux_turno = lstAbsTurno[index_pos]; abs_aux_turno.set_x(x); abs_aux_turno.set_y(y); lstAbsTurno[index_pos] = abs_aux_turno; //my_pen = new Pen(Color.Orange, 1f); my_pen = new Pen(Color.LightGray, 1f); #endregion } } } } if (!(r < 5 && i == 0)) { e.Graphics.DrawEllipse( my_pen, x - lstCirculos.getRadio() / 2, y - lstCirculos.getRadio() / 2, lstCirculos.getRadio(), lstCirculos.getRadio()); } #endregion } else { //All vertical lines that belong to AbsQuestion if (i > 2) { #region logic to save ordered obstract question to a lstAbsQuestions //my_pen = new Pen(Color.Red, 1f); my_pen = new Pen(Color.LightGray, 1f); e.Graphics.DrawEllipse( my_pen, x - lstCirculos.getRadio() / 2, y - lstCirculos.getRadio() / 2, lstCirculos.getRadio(), lstCirculos.getRadio()); //save abstract position on list if ((index_x % 2) == 1) { //add in the first columna the object to the list abs_question.set_x1(x); abs_question.set_y1(y); abs_question.set_idQuestion(index_y + (35 * aux_indice_columna)); abs_question.set_radio(lstCirculos.getRadio()); lstAbsQuestions[index_y + (35 * aux_indice_columna)] = abs_question; } else { abs_aux_question.set_x1(lstAbsQuestions[index_y + (35 * aux_indice_columna)].get_x1()); abs_aux_question.set_y1(lstAbsQuestions[index_y + (35 * aux_indice_columna)].get_y1()); abs_aux_question.set_idQuestion(lstAbsQuestions[index_y].get_idQuestion()); abs_aux_question.set_radio(lstAbsQuestions[index_y].get_radio()); abs_aux_question.set_x2(x); abs_aux_question.set_y2(y); lstAbsQuestions[index_y + (35 * aux_indice_columna)] = abs_aux_question; } aux_count++; if (r == 34) { //for debug int ri = 0; } index_y++; if (aux_count % 70 == 0 && aux_count != 0) { aux_indice_columna++; } if (aux_count >= 350) {// set all vallues to zero } #endregion } } } //not delete this count index_x++; //---------------------- } #endregion } if (k == 3) { #region Validating areas of abstract questions, Sedes, ciclo y turno if (i != 0 && i != COLUMNAS) { dist_X_V = Math.Abs(((i * intervalVertical1) + lstCirculos.circles[0].x) - ((i * intervalVertical2) + lstCirculos.circles[2].x)); dist_Y_V = Math.Abs(((i * intervalVerticalY1) + lstCirculos.circles[0].y) - ((i * intervalVerticalY2) + lstCirculos.circles[2].y)); delta_X_V = (dist_X_V * 1.0 / numHorizontalLines); delta_Y_V = (dist_Y_V * 1.0 / numHorizontalLines); int sign = 1; if (lstCirculos.circles[2].x < lstCirculos.circles[0].x) sign *= -1; refPoint_X = (float)((i * intervalVertical1) + lstCirculos.circles[0].x); refPoint_Y = (float)((i * intervalVerticalY1) + lstCirculos.circles[0].y); int index_y = 0; //pass throug of all the validated horizontal lines for (int r = 0; r <= numHorizontalLines; r++) { float x = (refPoint_X + (r * (float)delta_X_V * sign)); float y = (refPoint_Y + (r * (float)delta_Y_V)); //All vertical lines that belong to Sede , ciclo y turno //avoiding not desiered horizontal lines if (true) { //All vertical lines that belong to AbsQuestion //if (i > 2) if (r != 0 && r!= FILAS) //if(true) { #region logic to save ordered obstract question to a lstAbsQuestions //my_pen = new Pen(Color.Gray, 1f); //e.Graphics.DrawEllipse( // my_pen, // x - lstCirculos.getRadio() / 2, // y - lstCirculos.getRadio() / 2, // lstCirculos.getRadio(), lstCirculos.getRadio()); abs_big_maya.set_x1(x); abs_big_maya.set_y1(y); abs_big_maya.set_idQuestion(index_x); abs_big_maya.set_radio(lstCirculos.getRadio()); lstAbsBigMaya[index_x] = abs_big_maya; index_x++; #endregion } } } float rr = lstAbsBigMaya[13].get_y1(); } #endregion } } #endregion #region draw the 4 squares that can be drag and drop if (k == 3) { for (int i = 0; i < lstCirculos.circles.Count; i++) { e.Graphics.DrawRectangle( new Pen(Color.Red, 2f), lstCirculos.circles[i].getX() - (lstCirculos.circles[i].getRadio() / 2), lstCirculos.circles[i].getY() - (lstCirculos.circles[i].getRadio() / 2), lstCirculos.circles[i].getRadio(), lstCirculos.circles[i].getRadio()); } } #endregion } #endregion #region test - Drawing numbers of idQuestions int index = 0; for (int i = 0; i < lstAbsBigMaya.Count; i++) { //e.Graphics.DrawString((i + 1).ToString(), this.Font, Brushes.Black, lstAbsQuestions[i].get_x1(), lstAbsQuestions[i].get_y1()); //e.Graphics.DrawString((i + 1).ToString(), this.Font, Brushes.Red, lstAbsQuestions[i].get_x2(), lstAbsQuestions[i].get_y2()); //e.Graphics.DrawString(lstAbsDNI[i].get_idQuestion().ToString(), this.Font, Brushes.Red, lstAbsDNI[i].get_x(), lstAbsDNI[i].get_y()); //e.Graphics.DrawString(lstAbsOptions[i].get_idQuestion().ToString(), this.Font, Brushes.Red, lstAbsOptions[i].get_x(), lstAbsOptions[i].get_y()); //e.Graphics.DrawString(lstCiclo[i].get_idQuestion().ToString(), this.Font, Brushes.Red, lstCiclo[i].get_x(), lstCiclo[i].get_y()); //e.Graphics.DrawString(lstSemestre[i].get_idQuestion().ToString(), this.Font, Brushes.Red, lstSemestre[i].get_x(), lstSemestre[i].get_y()); //e.Graphics.DrawString(lstTurno[i].get_idQuestion().ToString(), this.Font, Brushes.Red, lstTurno[i].get_x(), lstTurno[i].get_y()); //e.Graphics.DrawString(lstTurno[i].get_idQuestion().ToString(), this.Font, Brushes.Red, lstTurno[i].get_x(), lstTurno[i].get_y()); // lstAbsBigMaya[i].set_idQuestion(index); // FontFamily fontFamily = new FontFamily("Arial"); //Font f = new Font( // fontFamily, // 6, // FontStyle.Regular, // GraphicsUnit.Pixel); // e.Graphics.DrawString(lstAbsBigMaya[i].get_idQuestion().ToString(), f, Brushes.Black, lstAbsBigMaya[i].get_x1(), lstAbsBigMaya[i].get_y1()); //e.Graphics.DrawString(lstAbsBigMaya[i].get_idQuestion().ToString(), this.Font, Brushes.Red, lstAbsBigMaya[i].get_x2(), lstAbsBigMaya[i].get_y2()); index++; } #endregion }
private void Form1_Load(object sender, EventArgs e) { #region Image procesing Form_Load //if (PICK_COLOR == 0) { InicializeColorConfigurationpPen_200ppp(); rbColorPen2B.Checked = true; } //if (PICK_COLOR == 0) { InicializeColorConfigurationpPen_200ppp_EDIT(); rbColorPen2B.Checked = true; } if (PICK_COLOR == 0) { InicializeColorConfigurationpPen_200ppp_No_Inverse_First_Iteration(); rbColorPen2B.Checked = true; } if (PICK_COLOR == 1) { InicializeColorConfigurationBlack(); rbColorBlack.Checked = true; } if (PICK_COLOR == 2) { InicializeColorConfigurationRed(); rbColorRed.Checked = true; } if (PICK_COLOR == 3) { inicializeColorConfigurationBlue(); rbColorBlue.Checked = true; } DYNAMIC_VALUE = 0; OPTION = 0; LECTURE_MODE = 0; PAGE = 0; PICK_COLOR = 3; btnOpenFile.Enabled = false; btnPause.Enabled = true; Pause = false; BeginProcess = true; allProcessed = false; timer1.Enabled = false; timer1.Interval = 30; rbVideo.Checked = false; rbFile.Checked = true; btnPreview.Enabled = false; rbAnalizeAll.Checked = true; images = new List<Image<Bgr, byte>>(); imagesNames = new List<string>(); questions = new List<Question>(); applicants = new List<Applicant>(); txtTotalApplicants.Text = "1"; txtTotalScanedPapers.Text = "1"; TOTAL_APPLICANTS = 0; TOTAL_SCANNED_PAPERS = 0; //TestAngle(); //Application.Idle += ProcesseFrameAndUpdateGUI; CreateColumnsAndData(); #endregion #region Mayas inicialization -> 3 in total FILAS = 48; COLUMNAS = 28; txtTotalApplicants.Text = "1000"; LIMITE_AREA_RESPUESTA = 350; numMayas = 4; flag_init = false; opcion_01 = -1; opcion_02 = -1; codigo_sede = -1; num_01 = -1; num_02 = -1; codigo_semestre = -1; codigo_turno = -1; empty = ""; // Dimension of picture box -> 578, 708 #region ORIGINAL Dynamic inicialization of the mayas_corner //int numMayas = 3; //mayas_corner = new List<Circle>(); //int count = 0; //for (int k = 0; k < numMayas; k++) //{ // Circle lstCirculos = new Circle(); // Circle circulo_0 = new Circle(); // Circle circulo_1 = new Circle(); // Circle circulo_2 = new Circle(); // Circle circulo_3 = new Circle(); // int lineasHorizontales = 0; // int lineasVerticales = 0; // lstCirculos.circles.Add(circulo_0); // lstCirculos.circles.Add(circulo_1); // lstCirculos.circles.Add(circulo_2); // lstCirculos.circles.Add(circulo_3); // for (int j = 0; j < 2; j++) // { // for (int i = 0; i < 2; i++) // { // int index = j * 2 + i; // // Mayas ubications in pixels ERG : (i * 93) + 376 // if (k == 0) // DNI // { // lineasHorizontales = 9; // lineasVerticales = 7; // lstCirculos.circles[index].set_X((i * 93) + 376); // lstCirculos.circles[index].set_Y((j * 95) + 121); // } // if (k == 1) // Opcion Albergue // { // lineasHorizontales = 4; // lineasVerticales = 1; // lstCirculos.circles[index].set_X((i * 14) + 308); // lstCirculos.circles[index].set_Y((j * 42) + 163); // 8.4 // } // //if (k == 2) // sede // //{ // // lineasHorizontales = 4; // // lineasVerticales = 1; // // lstCirculos.circles[index].set_X((i * 13) + 116); // // lstCirculos.circles[index].set_Y((j * 43) + 243); // //} // //if (k == 3) //anio // //{ // // lineasHorizontales = 9; // // lineasVerticales = 1; // // lstCirculos.circles[index].set_X((i * 15) + 116); // // lstCirculos.circles[index].set_Y((j * 97) + 328); // //} // //if (k == 4) // ciclo y turno // //{ // // lineasHorizontales = 1; // // lineasVerticales = 1; // // lstCirculos.circles[index].set_X((i * 15) + 116); // // lstCirculos.circles[index].set_Y((j * 42) + 470); // //} // if (k >= 2) //respuestas // { // //lineasHorizontales = 34; // //lineasVerticales = 2; // //lstCirculos.circles[index].set_X((i * 13) + 185 + (spaceColumnsAnswers * count)) ; // //lstCirculos.circles[index].set_Y((j * 368) + 242); // //implented just for answers // //lineasHorizontales = 34; // //lineasVerticales = 21; // //lstCirculos.circles[index].set_X((i * 289) + 185 ); // //lstCirculos.circles[index].set_Y((j * 368) + 242); // // // lineasHorizontales = 34; // lineasVerticales = 26; // lstCirculos.circles[index].set_X((i * 347) + 121); // lstCirculos.circles[index].set_Y((j * 356) + 246); // } // } // } // lstCirculos.set_X(lineasVerticales); // lstCirculos.set_Y(lineasHorizontales); // mayas_corner.Add(lstCirculos); // if (k >= 5) // count++; //} #endregion Inicialization_BigMaya(); // the same nnumber of num of mayas_corner #region Dynamic inicialization of lstAbsDIN lstAbsDNI = new List<AbstractObject>(); abs_aux_DNI = new AbstractObject(); for (int i = 0; i < 10; i++) { for (int j = 0; j < 8; j++) { int pos = j + (i * 8); abs_aux_DNI.set_idQuestion(i); abs_aux_DNI.set_respuesta(-1); abs_aux_DNI.set_radio(8.7f); abs_aux_DNI.set_id(pos); lstAbsDNI.Add(abs_aux_DNI); } } #endregion #region Dynamic inicialization of lstAbsQuestions lstAbsQuestions = new List<AbstractQuestion>(); abs_question = new AbstractQuestion(); abs_aux_question = new AbstractQuestion(); for (int i = 0; i < 175; i++) { AbstractQuestion aq = new AbstractQuestion(); lstAbsQuestions.Add(aq); } #endregion #region Dynamic inicializatin of lstAbsOptions lstAbsOptions = new List<AbstractObject>(); abs_aux_option = new AbstractObject(); for (int i = 0; i < 5; i++) { for (int j = 0; j < 2; j++) { int pos = j + (i * 2); abs_aux_option.set_idQuestion(i); abs_aux_option.set_respuesta(-1); abs_aux_option.set_radio(8.7f); abs_aux_option.set_id(pos); lstAbsOptions.Add(abs_aux_option); } } #endregion #region Dynamic inicialization of lstSede lstAbsSede = new List<AbstractObject>(); abs_aux_sede = new AbstractObject(); for (int i = 0; i < 5; i++) { abs_aux_sede.set_id(i); abs_aux_sede.set_idQuestion(i); abs_aux_sede.set_radio(8.7f); abs_aux_sede.set_respuesta(-1); lstAbsSede.Add(abs_aux_sede); } #endregion #region Dynamic inicialization of lstCiclo lstAbsCiclo = new List<AbstractObject>(); abs_aux_ciclo = new AbstractObject(); for (int i = 0; i < 10; i++) { for (int j = 0; j < 2; j++) { int pos = j + (i * 2); abs_aux_ciclo.set_id(pos); abs_aux_ciclo.set_idQuestion(i); abs_aux_ciclo.set_radio(8.7f); abs_aux_ciclo.set_respuesta(-1); lstAbsCiclo.Add(abs_aux_ciclo); } } #endregion #region Inicialization of lstSemestre lstAbsSemestre = new List<AbstractObject>(); abs_aux_semestre = new AbstractObject(); for (int i = 0; i < 2; i++) { abs_aux_semestre.set_id(i); abs_aux_semestre.set_idQuestion(i); abs_aux_semestre.set_radio(8.7f); abs_aux_semestre.set_respuesta(-1); lstAbsSemestre.Add(abs_aux_semestre); } #endregion #region Inicialization of lstTurno lstAbsTurno = new List<AbstractObject>(); abs_aux_turno = new AbstractObject(); for (int i = 0; i < 2; i++) { abs_aux_turno.set_id(i); abs_aux_turno.set_idQuestion(i); abs_aux_turno.set_radio(8.7f); abs_aux_turno.set_respuesta(-1); lstAbsTurno.Add(abs_aux_turno); } #endregion #region Dynamic inicialization of lstAbsBigMaya lstAbsBigMaya = new List<AbstractQuestion>(); abs_big_maya = new AbstractQuestion(); abs_aux_big_maya = new AbstractQuestion(); for (int i = 0; i < COLUMNAS*FILAS; i++) { AbstractQuestion aq = new AbstractQuestion(); lstAbsBigMaya.Add(aq); } #endregion contoursPositions = new List<CountorsPositions>(); //pictureBox1.Image = new System.Drawing.Bitmap(@"E:\Voluntades\Reclutamiento 2015\Claudia Alarcón.jpg"); //pictureBox1.Image = new System.Drawing.Bitmap(@"C:\Users\kevin\Desktop\MVVM_ppts\2015-08-02_MVVM_242.jpg"); //pictureBox1.Image = new System.Drawing.Bitmap(@"C:\Users\kevin\Downloads\Superior.jpeg"); #endregion }
public void CleanAllList() { //txtCode=-1; opcion_01 = -1; opcion_02 = -1; codigo_sede = -1; num_01 = -1; num_02 = -1; codigo_semestre = -1; codigo_turno = -1; //Question for (int k = 0; k < lstAbsQuestions.Count(); k++) { AbstractQuestion absQuestion = new AbstractQuestion(); absQuestion = lstAbsQuestions[k]; absQuestion.set_respuesta(-1); lstAbsQuestions[k] = absQuestion; } //DNI txtCode.Text = ""; for (int j = 0; j < lstAbsDNI.Count(); j++) { AbstractObject absDNI = new AbstractObject(); absDNI = lstAbsDNI[j]; absDNI.set_respuesta(-1); lstAbsDNI[j] = absDNI; } //Opcion for (int j = 0; j < lstAbsOptions.Count(); j++) { AbstractObject absOpcion = new AbstractObject(); absOpcion = lstAbsOptions[j]; absOpcion.set_respuesta(-1); lstAbsOptions[j] = absOpcion; } //Sede for (int j = 0; j < lstAbsSede.Count(); j++) { AbstractObject absSede = new AbstractObject(); absSede = lstAbsSede[j]; absSede.set_respuesta(-1); lstAbsSede[j] = absSede; } //Ciclo for (int j = 0; j < lstAbsCiclo.Count(); j++) { AbstractObject absCiclo = new AbstractObject(); absCiclo = lstAbsCiclo[j]; absCiclo.set_respuesta(-1); lstAbsCiclo[j] = absCiclo; } //Semestre for (int j = 0; j < lstAbsSemestre.Count(); j++) { AbstractObject absSemestre = new AbstractObject(); absSemestre = lstAbsSemestre[j]; absSemestre.set_respuesta(-1); lstAbsSemestre[j] = absSemestre; } //turno for (int j = 0; j < lstAbsTurno.Count(); j++) { AbstractObject absTurno = new AbstractObject(); absTurno = lstAbsTurno[j]; absTurno.set_respuesta(-1); lstAbsTurno[j] = absTurno; } }
void Start() { objScript = gameObject.GetComponent<AbstractObject>(); }