public void setValue1(int value) { value1 = value; if (value1 <= value2) { value2 = value1 - 1; } observer.Invoke(this, null); }
public void setValue1(int value) // Установка 1-го значения { value1 = value; if (value1 <= value2) { value2 = value1 - 1; } observer.Invoke(this, null); // Вызов обновления }
public System.EventHandler observers; //Событие //Функция для изменения значения компонента 1-ой группы(четные) public void setValue(int value) { if (value % 2 == 1) { this.value = value + 1; } else { this.value = value; } observers.Invoke(this, null); //Вызов обновления }
public int?Next() { InitializeGeneratedInts(); int num; do { if (generatedInts.Count == int.MaxValue - 1) { NoPossibleNumber?.Invoke(this, System.EventArgs.Empty); return(null); } num = random.Next(); } while (generatedInts.Contains(num)); generatedInts.Add(num); return(num); }
public void setvalue(int value, int place) { if (value > -1 && value <= 101) { this.value = value; this.place = place; observers.Invoke(this, null); } return; }
public void setValue(int value) { if (value > 277) { this.value = 277; } else if (value < 0) { this.value = 0; } else { this.value = value; } observers.Invoke(this, null); }
public virtual void Tick(TickEventArgs e) { if (!Loaded) { throw new LogicException("Control not loaded!"); } _threadSafety.EnforceThreadSafety(); _invoker.PollInvokes(); if (_redrawPreRenderd) { Redraw_PreRenderd(); _redrawPreRenderd = false; } TickEvent?.Invoke(this, EventArgs.Empty); }
void HandleGUIEvents() { // Handle events UnityEngine.Event evt = UnityEngine.Event.current; EventType currentEventType = evt.type; if (currentEventType == EventType.MouseDrag) { if (null != Dragged) { try { DragAndDrop.PrepareStartDrag(); Dragged.Invoke(ParentControl.SelectedItem, new DragEventArgs()); evt.Use(); } catch (Exception e) { Debug.Log(e); } } } }
public void setValue1(int value) // Изменяет значение числа 1 { this.value1 = value; this.lastSide = 1; observers.Invoke(this, null); }
public void setValue(int value, int check) { this.value = value; this.check = check; observers.Invoke(this, null); }
public void DisplayItem(int levels, SiblingOrder siblingOrder) { if (null == ParentControl || IsHidden) { return; } GUILayout.BeginHorizontal(); for (int index = 0; index < levels; ++index) { ParentControl.Button(TextureIcons.GUIDE); } if (!HasChildItems()) { SetIconExpansion(siblingOrder, TextureIcons.MIDDLE_SIBLING_NO_CHILD, TextureIcons.LAST_SIBLING_NO_CHILD); } else if (IsExpanded) { SetIconExpansion(siblingOrder, TextureIcons.MIDDLE_SIBLING_EXPANDED, TextureIcons.LAST_SIBLING_EXPANDED); } else { SetIconExpansion(siblingOrder, TextureIcons.MIDDLE_SIBLING_COLLAPSED, TextureIcons.LAST_SIBLING_COLLAPSED); } bool clicked = false; // display the text for the tree view if (!string.IsNullOrEmpty(Header)) { bool isSelected; if (ParentControl.SelectedItem == this && !ParentControl.m_forceDefaultSkin) { //use selected skin GUI.skin = ParentControl.m_skinSelected; isSelected = true; } else { isSelected = false; } if (IsCheckBox) { if (IsChecked && ParentControl.Button(TextureIcons.NORMAL_CHECKED)) { IsChecked = false; if (ParentControl.SelectedItem != this) { ParentControl.SelectedItem = this; this.IsSelected = true; if (null != Selected) { Selected.Invoke(this, new SelectedEventArgs()); } } if (null != Unchecked) { Unchecked.Invoke(this, new UncheckedEventArgs()); } } else if (!IsChecked && ParentControl.Button(TextureIcons.NORMAL_UNCHECKED)) { IsChecked = true; if (ParentControl.SelectedItem != this) { ParentControl.SelectedItem = this; this.IsSelected = true; if (null != Selected) { Selected.Invoke(this, new SelectedEventArgs()); } } if (null != Checked) { Checked.Invoke(this, new CheckedEventArgs()); } } ParentControl.Button(TextureIcons.BLANK); } // Add a custom icon, if any if (null != CustomIconBuilder) { CustomIconBuilder.Invoke(this, new CustomIconEventArgs()); ParentControl.Button(TextureIcons.BLANK); } if (UnityEngine.Event.current.isMouse) { s_clickCount = UnityEngine.Event.current.clickCount; } if (ParentControl.IsHoverEnabled) { GUISkin oldSkin = GUI.skin; if (isSelected) { GUI.skin = ParentControl.m_skinSelected; } else if (IsHover) { GUI.skin = ParentControl.m_skinHover; } else { GUI.skin = ParentControl.m_skinUnselected; } if (ParentControl.IsHoverAnimationEnabled) { GUI.skin.button.fontSize = (int)Mathf.Lerp(20f, 12f, m_hoverTime); } GUI.SetNextControlName("toggleButton"); //workaround to dirty GUI if (GUILayout.Button(Header)) { GUI.FocusControl("toggleButton"); //workaround to dirty GUI if (ParentControl.SelectedItem != this) { ParentControl.SelectedItem = this; this.IsSelected = true; if (null != Selected) { Selected.Invoke(this, new SelectedEventArgs()); } } if (null != Click && (uint)s_clickCount <= 2) { clicked = true; } } GUI.skin = oldSkin; } else { GUI.SetNextControlName("toggleButton"); //workaround to dirty GUI if (GUILayout.RepeatButton(Header)) { GUI.FocusControl("toggleButton"); //workaround to dirty GUI if (ParentControl.SelectedItem != this) { ParentControl.SelectedItem = this; this.IsSelected = true; if (null != Selected) { Selected.Invoke(this, new SelectedEventArgs()); } } if (null != Click && (uint)s_clickCount <= 2) { clicked = true;; } } } if (isSelected && !ParentControl.m_forceDefaultSkin) { //return to default skin GUI.skin = ParentControl.m_skinUnselected; } } GUILayout.EndHorizontal(); if (ParentControl.IsHoverEnabled) { if (null != UnityEngine.Event.current && UnityEngine.Event.current.type == EventType.Repaint) { Vector2 mousePos = UnityEngine.Event.current.mousePosition; if (ParentControl.HasFocus(mousePos)) { Rect lastRect = GUILayoutUtility.GetLastRect(); if (lastRect.Contains(mousePos)) { IsHover = true; ParentControl.HoverItem = this; } else { IsHover = false; } if (ParentControl.IsHoverEnabled && ParentControl.IsHoverAnimationEnabled) { m_hoverTime = CalculateHoverTime(lastRect, UnityEngine.Event.current.mousePosition); } } } } if (HasChildItems() && IsExpanded) { for (int index = 0; index < Items.Count; ++index) { TreeViewItem child = Items[index]; child.Parent = this; if ((index + 1) == Items.Count) { child.DisplayItem(levels + 1, SiblingOrder.LAST_CHILD); } else if (index == 0) { child.DisplayItem(levels + 1, SiblingOrder.FIRST_CHILD); } else { child.DisplayItem(levels + 1, SiblingOrder.MIDDLE_CHILD); } } } if (clicked) { Click.Invoke(this, new ClickEventArgs((uint)s_clickCount)); } if (IsSelected && ParentControl.SelectedItem != this) { if (null != Unselected) { Unselected.Invoke(this, new UnselectedEventArgs()); } } IsSelected = ParentControl.SelectedItem == this; if (IsDraggable) { HandleGUIEvents(); } }