public bool Intersects(FoundationDateTimeInterval other) { var start = ElementPair.Max(Start, other.Start); var end = ElementPair.Min(End, other.End); var intersects = start < end; return(intersects); }
public bool Intersects(DateOnlyInterval other) { var start = ElementPair.Max(Start, other.Start); var end = ElementPair.Min(End, other.End); var intersects = start <= end; return(intersects); }
public void WhenShowIsFalse_ShouldChangeElements() { ElementPair elements = new ElementPair(true); Handler.SetConfirmSectionVisibility(elements.Button, elements.Section, false); elements.AssertDisplayState(); }
public void WhenSettingToTheSameState_ShouldNotChangeElements() { ElementPair elements = new ElementPair(); Handler.SetConfirmSectionVisibility(elements.Button, elements.Section, false); elements.AssertDisplayState(); }
public void WhenOneElementIsNull_ShouldFailSilentlyAndNotChangeElement() { ElementPair elements = new ElementPair(); Handler.SetConfirmSectionVisibility(elements.Button, null, true); Handler.SetConfirmSectionVisibility(null, elements.Section, true); elements.AssertDisplayState(); }
public DateOnlyInterval?Intersect(DateOnlyInterval other) { var start = ElementPair.Max(Start, other.Start); var end = ElementPair.Min(End, other.End); var intersects = start <= end; return(intersects ? new DateOnlyInterval(start, end) : (DateOnlyInterval?)null); }
// Use this for initialization public void Init(ElementPair s, ElementPair sBottom) { _content = s.element; image = GetComponent <Image>(); frontImage = transform.GetChild(0).GetComponent <Image>(); _baseSprite = sBottom.image; image.sprite = _baseSprite; frontImage.sprite = s.image; }
public FoundationDateTimeInterval?Intersect(FoundationDateTimeInterval other) { var start = ElementPair.Max(Start, other.Start); var end = ElementPair.Min(End, other.End); var intersects = start < end; return(intersects ? new FoundationDateTimeInterval(start, end) : (FoundationDateTimeInterval?)null); }
public void SetCell(ElementPair t, int x, int y, bool topLayer) { if (topLayer) { _cells[x].raw[y] = t; } else { _cellsBackground[x].raw[y] = t; } }
public override bool Equals(object obj) { ElementPair e = (ElementPair)obj; if ((this.Element1 == e.Element1 && this.Element2 == e.Element2) || (this.Element1 == e.Element2 && this.Element2 == e.Element1)) { return(true); } return(false); }
public ExperimentResult DoExperiment(Element element1, Element element2) { // Start by finding all the elements which can be created by this pair List <Element> elements = new List <Element>(); ElementPair reagents = new ElementPair() { Element1 = element1.Id, Element2 = element2.Id }; foreach (KeyValuePair <int, Element> kvp in _Elements) { if (kvp.Value.Sources.Contains(reagents)) { // Possibly filter based on whether we have discovered this element if (!OnlyUndiscovered || !IsElementDiscovered(kvp.Key)) { elements.Add(kvp.Value); _ElementsDiscovered[kvp.Key] = true; } } } // Experiment is a success if we found (new) elements bool success = elements.Count > 0; if (success) { ProgressDirty = true; DoDiscoveredElementsChanged(); } else { // If it wasn't a success, return the original two elements elements.Add(element1); elements.Add(element2); } // Return the result return(new ExperimentResult() { Success = success, ElementsCreated = elements }); }
protected abstract OperatorElement Clone(ElementPair elements);
protected OperatorElement(ElementPair elements) { Elements = elements; }
internal static VisualTreeElement Serialize(XmlNode node, Control root) { ElementPair parse = null; switch (node.Name) { case "Control": parse = Control.ParseNested(node, root); break; case "VerticalPanel": parse = VerticalPanel.Parse(node, root); break; case "HorizontalPanel": parse = HorizontalPanel.Parse(node, root); break; case "Button": parse = Button.Parse(node, root); break; case "Label": parse = Label.Parse(node, root); break; case "Text": parse = Textbox.Parse(node, root); break; case "ListBox": parse = ListBox.Parse(node, root); break; case "Grid": parse = Grid.Parse(node, root); break; case "Calendar": parse = Calendar.Parse(node, root); break; case "Panel": parse = Panel.Parse(node, root); break; case "VerticalSlider": parse = VerticalSlider.Parse(node, root); break; case "HorizontalSlider": parse = HorizontalSlider.Parse(node, root); break; default: break; } if (parse != null) { parse.Element.BindWidgetProperties(node, root); foreach (XmlNode child in node.ChildNodes) { if (child.NodeType == XmlNodeType.Comment) { continue; } var nextElement = Serialize(child, root); if (parse.Element is IAttachable) { ((IAttachable)parse.Element).AttachProperties(nextElement, child); } if (nextElement != null) { parse.AddToElement(nextElement); } } return(parse.Element); } return(null); }
public override void OnInspectorGUI() { int w = 0; int h = 0; EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Size: ", GUILayout.Width(45)); w = Mathf.Clamp(EditorGUILayout.IntField(_template.Cells.Count, GUILayout.Width(45)), 1, 25); EditorGUILayout.LabelField("X", GUILayout.Width(15)); h = Mathf.Clamp(EditorGUILayout.IntField(_template.Cells[0].raw.Count, GUILayout.Width(45)), 1, 25); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); if (w != _template.Cells.Count || h != _template.Cells[0].raw.Count) { _template.Setize(w, h); EditorUtility.SetDirty(_template); } EditorGUILayout.LabelField(_template.SnakesCount + " players"); for (int i = 0; i < _template.Cells.Count; i++) { EditorGUILayout.BeginHorizontal(); for (int j = 0; j < _template.Cells[0].raw.Count; j++) { Texture2D texture = _template.Cells[i].raw[j].image.texture; if (!topLayer || _template.Cells[i].raw[j].element == LogicElement.LogicElementType.None) { texture = _template.CellsBack[i].raw[j].image.texture; } if (GUILayout.Button(texture, GUIStyle.none, GUILayout.Width(16), GUILayout.Height(16))) { _template.SetCell(_brush, i, j, topLayer); EditorUtility.SetDirty(_template); } } EditorGUILayout.EndHorizontal(); } scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition, GUI.skin.horizontalScrollbar, GUIStyle.none, GUILayout.Height(45)); EditorGUILayout.BeginHorizontal(); foreach (ElementPair ep in _template.Tiles) { if (DefaultResources.GetElementByEnum(ep.element) != null) { if (!topLayer) { if (ep.element == LogicElement.LogicElementType.None) { if (GUILayout.Button(ep.image.texture, GUILayout.Width(30), GUILayout.Height(30))) { _brush = ep; } } } else { if (ep.element != LogicElement.LogicElementType.None || ep == _template.Tiles.FirstOrDefault(e => e.element == LogicElement.LogicElementType.None)) { if (GUILayout.Button(ep.image.texture, GUILayout.Width(30), GUILayout.Height(30))) { _brush = ep; } } } } } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndScrollView(); if (_brush != null) { EditorGUILayout.BeginHorizontal(); GUILayout.Label(_brush.image.texture, GUILayout.Width(50), GUILayout.Height(50)); string s = "top"; if (!topLayer) { s = "bottom"; } if (GUILayout.Button(s, GUILayout.Width(100), GUILayout.Height(50))) { topLayer = !topLayer; if (_brush != null && _brush.element != LogicElement.LogicElementType.None && !topLayer) { _brush = null; } } EditorGUILayout.EndHorizontal(); } showTiles = EditorGUILayout.Foldout(showTiles, "Tiles"); if (showTiles) { tilesList.DoLayoutList(); } }