public static void CellAndSharedCell(string unparsed) { Application app = Utilities.ComApp; app.AttachCellLibrary("sample2.cel", MsdConversionMode.Always); Point3d origin = app.Point3dFromXY(1, -13); double xScale = 0.1 * app.ActiveModelReference.UORsPerMasterUnit / 1000.0; Point3d scale = app.Point3dFromXYZ(xScale, xScale, xScale); Matrix3d rMatrix = app.Matrix3dIdentity(); CellElement oCell = app.CreateCellElement2("DECID", ref origin, ref scale, true, ref rMatrix); oCell.Color = 0; app.ActiveModelReference.AddElement(oCell); SharedCellElement oSC; xScale = 0.02 * app.ActiveModelReference.UORsPerMasterUnit / 1000.0; scale = app.Point3dFromXYZ(xScale, xScale, xScale); for (int x = 4; x <= 8; x += 2) { origin = app.Point3dFromXY(x, -14); oSC = app.CreateSharedCellElement2("NORTH", ref origin, ref scale, true, ref rMatrix); oSC.OverridesComponentColor = true; oSC.Color = 1; app.ActiveModelReference.AddElement(oSC); } }
void UpdateResourceLifetimeColor(int passIndex, StyleColor colorRead, StyleColor colorWrite) { var pass = m_CurrentDebugData.passList[passIndex]; if (pass.culled) { return; } for (int type = 0; type < (int)RenderGraphResourceType.Count; ++type) { foreach (int resourceRead in pass.resourceReadLists[type]) { CellElement resourceLifetime = m_ResourceElementsInfo[type][resourceRead].lifetime as CellElement; if (resourceLifetime != null) { resourceLifetime.SetColor(colorRead); } } foreach (int resourceWrite in pass.resourceWriteLists[type]) { CellElement resourceLifetime = m_ResourceElementsInfo[type][resourceWrite].lifetime as CellElement; if (resourceLifetime != null) { resourceLifetime.SetColor(colorWrite); } } } }
public CellElement EventCellFormatting(CellElement cellElement) { var cell = cellElement; int column = cell.ColumnIndex; var eventsList = ParseEvents(cell.DayEvent.FactoryList); if (eventsList.Count > 0) { var Event = cell.DayEvent; cell.DrawFill = true; cell.BackColor = EventHelper.States[Event.State].NetColor; cell.Text = ""; var Builder = new StringBuilder("Предприятия\n"); foreach (var item in eventsList) { Builder.AppendFormat("{0} - {1}\n", item.Factory, EventHelper.States[item.ActivityKey].Name); } cell.ToolTipText = Builder.ToString(); } // 
 else if (DateTimeUtils.CheckWeekendByColumn(column, _startDate)) { cell.BackColor = Color.LightPink; cell.BackColor2 = Color.HotPink; cell.DrawFill = true; cell.ToolTipText = ""; } else { cell.DrawFill = false; cell.ToolTipText = ""; } return(cell); }
// получить пользователя с событиями в ячейках private EventsUserOfPeriod GetUserEventsInCells(string name, string userId) { EventsUserOfPeriod user = new EventsUserOfPeriod() { UserName = name, UserId = userId }; var list = dataService.GetEventsByDateAndUserId(_startDate.Date, _endDate.Date, userId); for (int i = 0; i <= (_endDate.Day - _startDate.Day); i++) { CellElement cell = new CellElement() { ColumnIndex = i, Date = _startDate.AddDays(i).Date }; var userEv = list.FirstOrDefault(ev => ev.Date.Date == _startDate.AddDays(i).Date); if (userEv != null) { cell.DayEvent = userEv; } else { cell.DayEvent = new events(); } cell = EventCellFormatting(cell); user.Cells.Add(cell); } return(user); }
CellElement GetCell(Cell cell, CellElement reusableView) { var renderer = (Cells.CellRenderer)Registrar.Registered.GetHandlerForObject <IRegisterable> (cell); var realCell = renderer.GetCellElement(cell, reusableView, Control); return(realCell); }
/// <summary> /// Получить дочерние элементы ячейки /// </summary> public static IEnumerable <Element> GetCellSubElements(this CellElement cellElement) { var elementEnumerator = cellElement?.GetSubElements(); while (elementEnumerator?.MoveNext() == true) { yield return((Element)elementEnumerator.Current); } }
public override void DeserializeXML(XmlElement element) { base.DeserializeXML(element); this.InitElements(); //reads num cells this.Cols = uint.Parse(element.GetAttribute(NUM_COLS_TAG), CultureInfo.InvariantCulture); this.Rows = uint.Parse(element.GetAttribute(NUM_ROWS_TAG), CultureInfo.InvariantCulture); var colorElem = (XmlElement)element.SelectSingleNode(COLOR_TAG); if (colorElem != null) { this.Color.DeserializeXML(colorElem); } //reads cell elements foreach (XmlElement childElement in element.SelectNodes(ELEMENTS_TAG + "/" + ELEMENT_TAG)) { var cellElement = new CellElement(); cellElement.DeserializeXML(childElement); //adds cell elements to list if (!cellElement.IdToken.Equals("agent") && !this.CellElements.ContainsKey(cellElement.IdToken)) { this.CellElements.Add(cellElement.IdToken, cellElement); } } //reads environment cells this.Cells = new Cell[this.Cols, this.Rows]; //reads cells foreach (XmlElement childElement in element.SelectNodes(CELLS_TAG + "/" + CELL_TAG)) { var cell = this.CreateCell(0, 0); cell.DeserializeXML(childElement); if (this.Cells[cell.XCoord, cell.YCoord] != null) { continue; } this.Cells[cell.XCoord, cell.YCoord] = cell; foreach (var elementID in cell.ElementIDs) { if (this.CellElements.ContainsKey(elementID)) { //cell.Elements.Add(this.CellElements[elementID]); this.CellElements[elementID].Clone().Cell = cell; } } } }
/// Called by the state machine for each mouse move event. /// point: Current cursor location. /// view: Cursor is in this view. /// drawMode: Draw mode supplied by the drawing engine. public void Dynamics(ref Point3d Point, BCOM.View View, MsdDrawingMode DrawMode) { if (m_nPoints != 1) { return; } string[] txtStr = new string[2]; Point3d[] txtPts = new Point3d[2]; Element[] elems = new Element[3]; m_atPoints[1] = Point; txtStr[0] = (myForm.rbEN.Checked ? "E=" : "X=") + m_atPoints[0].X.ToString("F2"); txtStr[1] = (myForm.rbEN.Checked ? "N=" : "Y=") + m_atPoints[0].Y.ToString("F2"); double txtLen = app.ActiveSettings.TextStyle.Width * Math.Max(txtStr[0].Length, txtStr[1].Length); double txtLineSpacing = app.ActiveSettings.TextStyle.Height; if (myForm.rbHorizontal.Checked) { m_atPoints[2].X = m_atPoints[1].X + (m_atPoints[0].X > m_atPoints[1].X ? -txtLen : txtLen) * 1.2; m_atPoints[2].Y = m_atPoints[1].Y; txtPts[0].X = (m_atPoints[1].X + m_atPoints[2].X) / 2; txtPts[0].Y = m_atPoints[1].Y + txtLineSpacing; txtPts[1].X = txtPts[0].X; txtPts[1].Y = m_atPoints[1].Y - txtLineSpacing; } else { m_atPoints[2].X = m_atPoints[1].X; m_atPoints[2].Y = m_atPoints[1].Y + (m_atPoints[0].Y > m_atPoints[1].Y ? -txtLen : txtLen) * 1.2; txtPts[0].X = m_atPoints[1].X - txtLineSpacing; txtPts[0].Y = (m_atPoints[1].Y + m_atPoints[2].Y) / 2; txtPts[1].X = m_atPoints[1].X + txtLineSpacing; txtPts[1].Y = txtPts[0].Y; } elems[0] = app.CreateLineElement1(null, ref m_atPoints); elems[0].LineStyle = app.ActiveDesignFile.LineStyles.Find("0", null); Matrix3d rMatrix = app.Matrix3dIdentity(); for (int i = 1; i < 3; i++) { elems[i] = app.CreateTextElement1(null, txtStr[i - 1], ref txtPts[i - 1], ref rMatrix); elems[i].AsTextElement().TextStyle.Font = app.ActiveDesignFile.Fonts.Find(MsdFontType.MicroStation, "ENGINEERING", null); elems[i].AsTextElement().TextStyle.Justification = MsdTextJustification.CenterCenter; if (myForm.rbVertical.Checked) { elems[i].RotateAboutZ(ref txtPts[i - 1], Math.PI / 2); } } CellElement elemCell = app.CreateCellElement1("NoteCoordCell", ref elems, ref m_atPoints[0], false); elemCell.Redraw(DrawMode); if (MsdDrawingMode.Normal == DrawMode) { app.ActiveModelReference.AddElement(elemCell); } }
public static Element getCell() { Application app = Utilities.ComApp; app.AttachCellLibrary("sample2.cel", MsdConversionMode.Always); Point3d origin = app.Point3dFromXY(1, -13); double xScale = 0.1 * app.ActiveModelReference.UORsPerMasterUnit / 1000.0; Point3d scale = app.Point3dFromXYZ(xScale, xScale, xScale); Matrix3d rMatrix = app.Matrix3dIdentity(); CellElement oCell = app.CreateCellElement2("DECID", ref origin, ref scale, true, ref rMatrix); return(oCell); }
private void grid_CellSelection(CellElement oldCell, CellElement newCell) { if (newCell == null) { return; } if (newCell.Row == null) { return; } Text = newCell.Column.RepresentValueAsString(newCell.Row, newCell.Column.GetValueFromRow(newCell.Row)); }
protected override void ReloadSettings() { base.ReloadSettings(); var newItem = new CellElement { Text = this["NewViewModel.Title"], ImageModel = "ic_new", Type = CellElementType.SingleCenterLine, Command = new MvxAsyncCommand(() => NavigationService.Navigate <NewViewModel>()) }; Items.Add(newItem); }
public void processOld(ref /* ref - важно */ CellElement cell, ref bool dirty, bool updateImidiatly) { // TODO необходимо полностью обновить старые проходки, // т.к. нужно назначить правильные Level всем элементам проходки // либо поэтапно ... // TODO формализовать список обновлений через Enum int change = 0; bool cellDirty = false; cell.ResetElementEnumeration(); while (cell.MoveToNextElement(true, ref change)) { Element temp = cell.CopyCurrentElement(); if (!temp.IsGraphical || temp.Level == null) { continue; } Level requiredLevel; if (temp.IsLineElement() && temp.AsLineElement().SegmentsCount > 1) { requiredLevel = PenetrTaskBase.LevelSymb; } else if (temp.Type == MsdElementType.Ellipse) /*перфоратор*/ { requiredLevel = PenetrTaskBase.LevelSymb; } else { requiredLevel = PenetrTaskBase.LevelMain; } if (temp.Level?.ID != requiredLevel.ID) { cellDirty = true; temp.Level = requiredLevel; } ElementHelper.setSymbologyByLevel(temp, ref cellDirty); if (updateImidiatly && cellDirty) { temp.Rewrite(); // ! важно cell.ReplaceCurrentElement(temp); } } }
public void DataPoint(ref Point3d Point, View View) { if (!ready) { current_point = Point; app.ShowPrompt("选择终点"); ready = true; } else { if (current_point.X != Point.X) { Point.X = current_point.X; } Element guide_line = create_line(current_point, Point); LineElement line_element = guide_line.AsLineElement(); Element label = create_rebar_label(content); Range3d label_range = label.Range; Point3d down_left = label_range.Low, up_right = label_range.High; double line_length = up_right.Y - down_left.Y; Element line = create_line(line_length); if (current_point.Y < Point.Y) { Point.Y = Point.Y + line_length; } label.Move(ref Point); line.Move(ref Point); List <Element> list = new List <Element>(); list.Add(label); list.Add(line); list.Add(guide_line); //NamedGroupElement groupElement = app.ActiveModelReference.AddNewNamedGroup("标签1"); //groupElement.AddMember(label); //groupElement.AddMember(line); //groupElement.AddMember(guide_line); CellElement cell = app.CreateCellElement1("标签1", list.ToArray(), Point); app.ActiveModelReference.AddElement(cell); //app.ActiveModelReference.AddElement((Element)groupElement); ready = false; } }
public void Dynamics(ref Point3d Point, View View, MsdDrawingMode DrawMode) { if (!ready) { Element label = create_rebar_label(content); Range3d label_range = label.Range; Point3d down_left = label_range.Low, up_right = label_range.High; double line_length = up_right.Y - down_left.Y; Element line = create_line(line_length); label.Move(ref Point); line.Move(ref Point); List <Element> list = new List <Element>(); list.Add(label); list.Add(line); CellElement cell = app.CreateCellElement1("标签", list.ToArray(), Point); cell.Redraw(DrawMode); } else { if (current_point.X != Point.X) { Point.X = current_point.X; } Element guide_line = create_line(current_point, Point); Element label = create_rebar_label(content); Range3d label_range = label.Range; Point3d down_left = label_range.Low, up_right = label_range.High; double line_length = up_right.Y - down_left.Y; Element line = create_line(line_length); if (current_point.Y < Point.Y) { Point.Y = Point.Y + line_length; } label.Move(Point); line.Move(Point); List <Element> list = new List <Element>(); list.Add(label); list.Add(line); list.Add(guide_line); CellElement cell = app.CreateCellElement1("标签1", list.ToArray(), Point); cell.Redraw(DrawMode); } }
public static void GroupedHoleHatched() { Application app = Bentley.MicroStation.InteropServices.Utilities.ComApp; ClosedElement closedOuterShape = createClosedElement(); Element outerShape = closedOuterShape as Element; Point3d p = app.Point3dFromXY(0, 0); CellElement cell = null; Point3d[] pntArray1 = new Point3d[4]; pntArray1[0] = app.Point3dFromXY(22, -4); pntArray1[1] = app.Point3dFromXY(22, -2); pntArray1[2] = app.Point3dFromXY(24, -2); pntArray1[3] = app.Point3dFromXY(24, -4); Element innerShape = app.CreateShapeElement1(null, ref pntArray1, MsdFillMode.NotFilled); Element[] innerShapes = new Element[] { innerShape }; }
public void Accept(Element Element, ref Point3d Point, View View) { app.ShowCommand(""); CellElement cell = Element.AsCellElement(); TextNodeElement ctextnode = null; int nest_level = 0; while (cell.MoveToNextElement(false, ref nest_level)) { Element current = cell.CopyCurrentElement(); if (current.IsTextNodeElement()) { ctextnode = current.AsTextNodeElement(); int line_count = ctextnode.TextLinesCount; string text = ""; for (int i = 1; i <= line_count; i++) { text += ctextnode.get_TextLine(i); text += "\r\n"; } text = text.Substring(0, text.Length - 2); LabelModifyForm lmf = new LabelModifyForm(text); if (lmf.ShowDialog() == System.Windows.Forms.DialogResult.OK) { System.Windows.Forms.TextBox textBox = (System.Windows.Forms.TextBox)lmf.Controls.Find("content_textBox", false)[0]; text = textBox.Text; TextNodeElement new_text_element = app.CreateTextNodeElement1(null, ctextnode.Origin, ctextnode.Rotation); string[] lines = text.Split("\r\n".ToCharArray()); foreach (string line in lines) { new_text_element.AddTextLine(line); } cell.ReplaceCurrentElement(new_text_element); } break; } } cell.Rewrite(); app.ShowPrompt("修改标注"); }
public override void Init() { base.Init(); //creates the lever this.Lever = new CellElement { IdToken = LEVER_ID, Description = LEVER_ID, Reward = 0, Visible = true, Walkable = true, ImagePath = "../../../../bin/resources/lab/switch.png", Color = System.Drawing.Color.FromArgb(0, 0, 0).ToColorInfo(), }; //changes image of food and visibility foreach (var foodResource in this.FoodResources) { foodResource.ImagePath = "../../../../bin/resources/lab/cheese.png"; foodResource.Visible = false; } }
public static IElement ParseElement(string localizedType, string designedId, string designedName, IElement parent) { IElement element = null; switch (localizedType.ToLower()) { case ElementBase.WINDOW: element = new WindowElement(); element.Attributes.ElementType = ElementBase.WINDOW_TYPE; break; case ElementBase.DIALOG: element = new WindowElement(); element.Attributes.ElementType = ElementBase.DIALOG_TYPE; break; case ElementBase.BUTTON: element = new ButtonElement(); element.Attributes.ElementType = ElementBase.BUTTON_TYPE; break; case ElementBase.COMBO_BOX: element = new ComboBoxElement(); element.Attributes.ElementType = ElementBase.COMBOBOX_TYPE; break; case ElementBase.TEXT: element = new TextElement(); element.Attributes.ElementType = ElementBase.TEXT_TYPE; break; case ElementBase.PANE: element = new ContainerElement(); element.Attributes.ElementType = ElementBase.CONTAINER_TYPE; break; case ElementBase.TITLE_BAR: element = new TitleBarElement(); element.Attributes.ElementType = ElementBase.TITLEBAR_TYPE; break; case ElementBase.MENU_BAR: element = new MenuBarElement(); element.Attributes.ElementType = ElementBase.MENUBAR_TYPE; break; case ElementBase.DOCUMENT: element = new EditableTextElement(); element.Attributes.ElementType = ElementBase.EDITABLETEXT_TYPE; break; case ElementBase.TAB: element = new TabPageElement(); element.Attributes.ElementType = ElementBase.TABPAGE_TYPE; break; case ElementBase.TAB_ITEM: element = new TabItemElement(); element.Attributes.ElementType = ElementBase.TABITEM_TYPE; break; case ElementBase.SCROLL_BAR: element = new ScrollBarElement(); element.Attributes.ElementType = ElementBase.SCROLLBAR_TYPE; break; //case THUMB: case ElementBase.TREE: element = new TreeViewElement(); element.Attributes.ElementType = ElementBase.TREEVIEW_TYPE; break; case ElementBase.TREE_VIEW: element = new TreeViewElement(); element.Attributes.ElementType = ElementBase.TREEVIEW_TYPE; break; case ElementBase.TREE_ITEM: element = new TreeItemElement(); element.Attributes.ElementType = ElementBase.TREEITEM_TYPE; break; case ElementBase.TABLE: element = new TableElement(); element.Attributes.ElementType = ElementBase.TABLE_TYPE; break; //? case ElementBase.HEADER: element = new HeaderElement(); element.Attributes.ElementType = ElementBase.HEADER_TYPE; break; case ElementBase.ITEM: if (parent != null && (parent is TableElement || parent is DatagridElement)) { element = new RowElement(); element.Attributes.ElementType = ElementBase.ROW_TYPE; } break; case ElementBase.LIST: //(listview or checkedlistbox) element = new ListElement(); element.Attributes.ElementType = ElementBase.LIST_TYPE; break; case ElementBase.LIST_VIEW: //(listview or checkedlistbox) element = new ListElement(); element.Attributes.ElementType = ElementBase.LIST_TYPE; break; case ElementBase.LIST_ITEM: //(table) element = new ListItemElement(); element.Attributes.ElementType = ElementBase.LISTITEM_TYPE; break; case ElementBase.EDIT: //textbox element = new EditableTextElement(); element.Attributes.ElementType = ElementBase.EDITABLETEXT_TYPE; break; case ElementBase.CHECK_BOX: element = new CheckBoxElement(); element.Attributes.ElementType = ElementBase.CHECKBOX_TYPE; break; case ElementBase.RADIO_BUTTON: element = new RadioButtonElement(); element.Attributes.ElementType = ElementBase.RADIO_BUTTON_TYPE; break; case ElementBase.CALENDAR: element = new CalendarElement(); element.Attributes.ElementType = "Calendar"; break; case ElementBase.CUSTOM: element = new CustomElement(); element.Attributes.ElementType = "Custom"; break; case ElementBase.DATAGRID: element = new DatagridElement(); element.Attributes.ElementType = "DataGrid"; break; case ElementBase.DATAGRID2: element = new DatagridElement(); element.Attributes.ElementType = "DataGrid"; break; case ElementBase.DATAITEM: element = new DataitemElement(); element.Attributes.ElementType = "dataitem"; break; case ElementBase.GROUP: element = new GroupELement(); element.Attributes.ElementType = ElementBase.GROUP_TYPE; break; case ElementBase.HEADER_ITEM: element = new HeaderItemElement(); element.Attributes.ElementType = "HeaderItem"; break; case ElementBase.HYPERLINK: element = new LinkElement(); element.Attributes.ElementType = "Hyperlink"; break; case ElementBase.IMAGE: element = new ImageElement(); element.Attributes.ElementType = "Image"; break; case ElementBase.MENU: element = new MenuElement(); element.Attributes.ElementType = "Menu"; break; case ElementBase.PROGRESS_BAR: element = new ProgressBarElement(); element.Attributes.ElementType = "ProgressBar"; break; case ElementBase.SEPARATOR: element = new SeparatorElement(); element.Attributes.ElementType = "Separator"; break; case ElementBase.SLIDER: element = new SliderElement(); element.Attributes.ElementType = "Slider"; break; case ElementBase.SPINNER: element = new SpinnerElement(); element.Attributes.ElementType = "Spinner"; break; case ElementBase.SPLIT_BUTTON: element = new SplitButtonElement(); element.Attributes.ElementType = "SplitButton"; break; case ElementBase.STATUS_BAR: element = new StatusBarElement(); element.Attributes.ElementType = "StatusBar"; break; case ElementBase.TOOL_BAR: element = new ToolBarElement(); element.Attributes.ElementType = "ToolBar"; break; case ElementBase.TOOL_TIP: element = new ToolTipElement(); element.Attributes.ElementType = "ToolTip"; break; //? case ElementBase.MENU_ITEM: element = new MenuItemElement(); element.Attributes.ElementType = "MenuItem"; break; case ElementBase.LINK: element = new LinkElement(); element.Attributes.ElementType = ElementBase.LINK_TYPE; break; } if (element == null) { if (parent is TableElement || parent is DatagridElement) { element = new RowElement(); element.Attributes.ElementType = ElementBase.ROW_TYPE; } else if (parent is RowElement) { element = new CellElement(); element.Attributes.ElementType = ElementBase.CELL_TYPE; } else { element = new UnknownELement(); element.Attributes.ElementType = ElementBase.UNKNOWN_TYPE; } } element.Attributes.DesignedId = designedId; return(element); }
public CellElementMicrostation(CellElement cellElement, IOwnerMicrostation ownerContainerMicrostation, bool isNeedCompress) : base((Element)cellElement, ownerContainerMicrostation, isNeedCompress) { _cellElement = cellElement ?? throw new ArgumentNullException(nameof(cellElement)); }
public CellElementMicrostation(CellElement cellElement, IOwnerMicrostation ownerContainerMicrostation) : this(cellElement, ownerContainerMicrostation, false) { }
void CellClicked(int x, int y) { var obs = _levelData.CellElements.Find((obst) => obst.Position.X == x && obst.Position.Y == y); if (obs != null) { Destroy(obs.View); _levelData.CellElements.Remove(obs); return; } if (_mode == EditMode.Obstacle) { var newObstacle = new CellElement() { Position = new IntVector(x, y), CellType = CellType.Wall, View = new GameObject("ObsView" + x + "_" + y) }; var image = newObstacle.View.AddComponent <Image>(); image.color = Color.gray; image.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, CellSize); image.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, CellSize); image.rectTransform.SetParent(BG.transform, false); image.rectTransform.anchorMin = Vector2.zero; image.rectTransform.anchorMax = Vector2.zero; image.rectTransform.pivot = Vector2.zero; image.rectTransform.anchoredPosition = new Vector2(x * CellSize, y * CellSize); _levelData.CellElements.Add(newObstacle); } else if (_mode == EditMode.SpawnPoint1 || _mode == EditMode.SpawnPoint2) { var prevSpawn = _levelData.CellElements.Find(cell => cell.CellType == (_mode == EditMode.SpawnPoint1 ? CellType.Spawn1 : CellType.Spawn2)); if (prevSpawn != null) { Destroy(prevSpawn.View); _levelData.CellElements.Remove(prevSpawn); } var newObstacle = new CellElement() { Position = new IntVector(x, y), CellType = _mode == EditMode.SpawnPoint1 ? CellType.Spawn1 : CellType.Spawn2, View = new GameObject("ObsView" + x + "_" + y) }; var image = newObstacle.View.AddComponent <Image>(); image.color = _mode == EditMode.SpawnPoint1 ? Color.blue : Color.red; image.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, CellSize); image.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, CellSize); image.rectTransform.SetParent(BG.transform, false); image.rectTransform.anchorMin = Vector2.zero; image.rectTransform.anchorMax = Vector2.zero; image.rectTransform.pivot = Vector2.zero; image.rectTransform.anchoredPosition = new Vector2(x * CellSize, y * CellSize); _levelData.CellElements.Add(newObstacle); } }
private void scanRecurse(ModelReference model, ElementScanCriteria criteria, bool updateImidiatly) { if (modelsCellsForUpdate_.ContainsKey(model)) { return; } var cellsToUpdateList = new List <CellElement>(); foreach (string cellName in new string[] { PenConfigVariables.CellName.Value, PenConfigVariables.CellNameOld.Value }) { criteria.IncludeOnlyCell(cellName); ElementEnumerator iter = App.ActiveModelReference.Scan(criteria); iter.Reset(); while (iter.MoveNext()) { if (!iter.Current.IsCellElement() && !iter.Current.IsCompundCell()) { continue; } bool dirty = false; CellElement cell = iter.Current.AsCellElement(); if (updateImidiatly && null == checkedCellsForUpdate_.Find( x => x.MdlElementRef() == cell.MdlElementRef())) { continue; } TFFrameListClass frameList = new TFFrameListClass(); try { if (cellName.Equals(PenConfigVariables.CellName.Value)) { //frameList.InitFromElement(cell); //process(frameList, ref dirty, updateImidiatly); } else if (cellName.Equals(PenConfigVariables.CellNameOld.Value)) { processOld(ref cell, ref dirty, updateImidiatly); // CELL frameList.InitFromElement(cell); // FRAME processOld(frameList, ref dirty, updateImidiatly); } } catch (Exception ex) { // TODO log exception continue; } if (dirty) { cellFrames_.Add(cell.MdlElementRef(), frameList); cellsToUpdateList.Add(cell); } } } if (cellsToUpdateList.Count > 0) { modelsCellsForUpdate_.Add(model, cellsToUpdateList); } foreach (Attachment attachment in model.Attachments) { if (!attachment.IsActive || !attachment.IsMissingFile || !attachment.IsMissingModel) { return; } ModelReference modelRef = App.MdlGetModelReferenceFromModelRefP(attachment.MdlModelRefP()); scanRecurse(modelRef, criteria, updateImidiatly); } }