internal override sealed void Setup(LiteNetLibBehaviour behaviour, int elementId) { base.Setup(behaviour, elementId); if (Count > 0 && onOperation != null) { onOperation.Invoke(Operation.AddRangeStart, 0); onOperation.Invoke(Operation.AddRangeEnd, Count - 1); } }
public Task <ModalResult> ShowAsync <TComponent>(string title, RenderComponent <TComponent> component, ModalOptions modalOptions = null) where TComponent : IComponent { modalModel = new ModalModel(component.Contents, title, modalOptions); modals.Push(modalModel); OnChanged?.Invoke(); return(modalModel.Task); }
public CustomDecoration Select(int idx) { if (!setupMode) { return(null); } if (currentSelect != null) { return(currentSelect.GetComponent <CustomDecoration>()); } if (idx < 1 || idx > group[CurrentGroup].Length) { return(null); } string poolname = group[CurrentGroup][idx - 1]; GameObject go = ObjectLoader.CloneDecoration(poolname); currentSelect = go; CustomDecoration cd = go?.GetComponent <CustomDecoration>(); go?.SetActive(true); OnChanged?.Invoke(cd); return(cd); }
private void OnGUI() { if (_sObject == null || _property == null) { FieldUtility.CreateSerializedObjectAndProperty(_serializedTargetObject, _propertyPath, out _sObject, out _property); if (_sObject == null || _property == null) { return; } _disposed = false; ArraySize = _property.arraySize; } _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos); EditorGUI.BeginChangeCheck(); _property.isExpanded = true; EditorGUILayout.PropertyField(_property); EditorGUILayout.EndScrollView(); if (EditorGUI.EndChangeCheck()) { ArraySize = _property.arraySize; _property.serializedObject.ApplyModifiedProperties(); _property.Dispose(); _sObject.Dispose(); _property = null; _sObject = null; _disposed = true; OnChanged?.Invoke(); } }
private void fetch_all_fields() { IsValid = true; if ((IsValid) && (!int.TryParse(TB_Min.Text, out Min))) { ErrorText = String.Format("'{0}' n'est pas un nombre !", TB_Min.Text); IsValid = false; } if ((IsValid) && (!int.TryParse(TB_Max.Text, out Max))) { ErrorText = String.Format("'{0}' n'est pas un nombre !", TB_Max.Text); IsValid = false; } if ((IsValid) && (Min >= Max)) { ErrorText = String.Format("min({0}) >= max({1}) !", Min, Max); IsValid = false; } if (IsValid) { ErrorText = "OK"; } if (OnChanged != null) { OnChanged.Invoke(String.Format("UC_RangeEditor '{0}' to '{1}'", TB_Min.Text, TB_Max.Text)); } }
/// <summary> /// Конструктор. /// </summary> public Groups(IHubConfigurator hubConfigurator) : base(hubConfigurator, HubNames.GroupsHub) { Proxy.On <DbChangeStatus, Group>(nameof(IGroupsHubEvents.OnChanged), (status, group) => OnChanged?.Invoke(status, group)); Proxy.On(nameof(IGroupsHubEvents.GroupsImport), () => Imported?.Invoke()); }
private void Changed() { if (!(OnChanged is null)) { OnChanged.Invoke(); } }
public Task <ModalResult> ShowAsync(string title, RenderComponent component, ModalOptions modalOptions = null) { modalModel = new ModalModel(component, title, modalOptions); modals.Push(modalModel); OnChanged?.Invoke(); return(modalModel.Task); }
private void CalculateNextTurn() { if (doingTurn) { return; } ResourcesStorage.Reset(); foreach (ResourceDelta delta in upkeepDeltas) { ResourcesStorage.AddDelta(delta); } var rocket = new Rocket(); // TODO this needs to stick around, really, if only so that the rocket contents can be communicated to the player // Upkeep gets dibs on rocket capacity. EnsureUpkeepIsMet(rocket); // Fill any remaining space with materials for however many projects we can complete this turn. TryCompleteProjects(rocket); // TODO fill the rest of the rocket's capacity with some player-configurable default resource. // TODO or, possibly, include some subset of the resources for the next project, if any. OnChanged?.Invoke(); }
private void Buffer_Changed(object sender, TextContentChangedEventArgs e) { if (!_isDisposed) { OnChanged?.Invoke(this, e); } }
public void Run() { actionHandler.PrepareWindow(content); var stopWatch = Stopwatch.StartNew(); while (currentRowIndex < content.Length) { currentKeyIsValid = false; lastTypedSymbol = inputProvider.GetKey(); if (lastTypedSymbol == content[currentRowIndex][currentLineIndex]) { currentKeyIsValid = true; validSymbolsTyped++; currentLineIndex++; if (content[currentRowIndex].Length <= currentLineIndex) { currentRowIndex++; currentLineIndex = 0; } } else { currentErrorCount++; } var isFinished = currentRowIndex == content.Length; OnChanged?.Invoke(GetTypingState(isFinished, stopWatch.Elapsed.TotalSeconds)); } stopWatch.Stop(); }
private void DragManager_OnDragEnded(DraggableItem dItem, DraggableItem newSpawnedItem, int amount) { MouseState m = Mouse.GetState(); DrawGrid = false; if (GlobalBounds.Contains(m.X, m.Y)) { if (newSpawnedItem != null) { OnItemCreated.Invoke(newSpawnedItem); Items.Add(newSpawnedItem); newSpawnedItem.LocalBounds = new Rectangle(0, 0, GridWidth, GridHeight); newSpawnedItem.OnDragStarted += () => DragManager.StartDrag(newSpawnedItem, 1); newSpawnedItem.OnDragEnded += () => DragManager.Drop(); } } if (Items.Contains(dItem) && dItem.Item.CurrentAmount <= 0) { DragManager.Slots[dItem.Parent] = null; dItem.Parent.RemoveChild(dItem); Items.Remove(dItem); OnItemDestroyed.Invoke(dItem); } OnChanged.Invoke(); }
public static void Change(object sender, ITypeMap newinst) { ITypeMap old = Instance; if (old == newinst) { throw new ArgumentException(); } Instance = newinst ?? throw new ArgumentNullException(nameof(newinst)); TypeMapChangedArgs args = new TypeMapChangedArgs(old, newinst); OnChanged.Invoke(sender, args); if (args.AutoDisposing) { if (old is IDisposable v1) { v1.Dispose(); } else if (old is IRuntimeTypeMapEX v2) { v2.Dispose(); } } }
public void AddXp(decimal xp) { ExpirenceCollected += xp; if (ExpirenceCollected < ExpirenceRequired) { OnChanged?.Invoke(User, this); return; } ExpirenceCollected = 0; ExpirenceRequired = 4M * (decimal)Math.Pow(Level, 3) / 5M; Level += 1; if (Level % 3 == 0) { User.ActiveItemsManager.ActiveLimit += 2; } var available = User.ActiveItemsManager.ActiveLimit - User.ActiveItemsManager.ActiveProportions.Values.Sum(); User.MessageManager.SendMessage(new SentMessage { Text = $"<b>Вы достигли {Level} уровня! Доступно {available} предметов для распределения.</b>" }); OnChanged?.Invoke(User, this); }
private void OnAnchorMinChanged(object value) { var type = value.GetType(); if (type == typeof(Vector2)) { var vec = (Vector2)value; m_Transform.SetPositionAnchorLocal(vec); CuiComponent.AnchorMin = string.Format("{0} {1}", vec.x, vec.y); } else { if (value.ToString().IsVector()) { var vec = Vector2Ex.Parse(value.ToString()); OnAnchorMinChanged(vec); return; } m_Transform.SetPositionAnchorLocal(new Vector2(0.1f, 0.1f)); CuiComponent.AnchorMin = value.ToString(); } if (OnChanged != null) { OnChanged.Invoke(); } }
public T Dequeue() { var t = _queue.Dequeue(); OnChanged?.Invoke(); return(t); }
private void OnAnchorMaxChanged(object value) { var type = value.GetType(); if (type == typeof(Vector2)) { var vec = (Vector2)value; m_Transform.anchorMax = (Vector2)value; CuiComponent.AnchorMax = string.Format("{0} {1}", vec.x, vec.y); } else { if (value.ToString().IsVector()) { var vec = Vector2Ex.Parse(value.ToString()); OnAnchorMaxChanged(vec); return; } m_Transform.SetSizePixel(new Vector2(100f, 100f)); CuiComponent.AnchorMax = value.ToString(); } if (OnChanged != null) { OnChanged.Invoke(); } }
public async Task Changed() { if (OnChanged != null) { await OnChanged.Invoke(); } }
public void ModifyMax(int delta) { Max += delta; OnChanged?.Invoke(new IntValueChangedEvent { MaxDelta = delta }); }
private void OnValueChanged(T?old, T?nnew, bool wasNull, bool isNull) { ValueChanged?.Invoke(columnName, val => { if (val is ValueHolder <T> tVal) { if (wasNull) { tVal.SetNull(); } else { tVal.Value = old; } } }, val => { if (val is ValueHolder <T> tVal) { if (isNull) { tVal.SetNull(); } else { tVal.Value = nnew; } } }); OnChanged?.Invoke(new DatabaseFieldHistoryAction <T>(this, columnName, old, nnew, wasNull, isNull)); OnPropertyChanged(nameof(IsModified)); }
public void Insert(int index, T value) { m_list.Insert(index, value); syncToPrevList(); ItemAdded?.Invoke(value); OnChanged?.Invoke(); }
private void invokeChanged() { if (OnChanged != null) { OnChanged.Invoke(this); } }
public void Add(T item) { m_list.Add(item); syncToPrevList(); ItemAdded?.Invoke(item); OnChanged?.Invoke(); }
private object GetPropertyEditor(object o, PropertyInfo p) { var allRules = Enumerable.Concat(_editorRules, EditableDumpContainer.GlobalEditorRules); foreach (var editor in allRules) { if (editor.Match(o, p)) { return(editor.Editor(o, p, () => p.GetValue(o), (v) => { SetValue(o, p, v); if (!editor.DisableAutomaticRefresh) { SetContent(); } var newVal = p.GetValue(o); if (_changeHandlers.TryGetValue(p, out var handler)) { handler.Invoke((T)o, newVal); } OnPropertyValueChanged?.Invoke((T)o, p, newVal); OnChanged?.Invoke(); })); } } return(p.GetValue(o)); }
public void SetData(T data) { var oldData = Data; Data = data; OnChanged?.Invoke(oldData, data); }
partial void OnClicked(int component) { FloatDistribution distribution = Value; if (DistributionType == PropertyDistributionType.Curve) { CurveEditorWindow.Show(distribution.GetMinCurve(), (success, curve) => { if (!success) { return; } Value = new FloatDistribution(curve); OnChanged?.Invoke(); }); } else if (DistributionType == PropertyDistributionType.RandomCurveRange) { CurveEditorWindow.Show(distribution.GetMinCurve(), distribution.GetMaxCurve(), (success, minCurve, maxCurve) => { if (!success) { return; } Value = new FloatDistribution(minCurve, maxCurve); OnChanged?.Invoke(); }); } }
public bool Load() { if (!File.Exists(FilePath)) { Data = new T(); return(false); } lock (cs) { try { XmlSerializer serializer = new XmlSerializer(typeof(T)); using (TextReader reader = new StreamReader(FilePath)) { Data = (T)serializer.Deserialize(reader); } } catch (Exception) { Data = new T(); return(false); } } OnChanged?.Invoke(); return(true); }
partial void Callback_OnMaxClicked() { ColorDistribution distribution = Value; if (DistributionType == PropertyDistributionType.RandomRange) { ColorPicker.Show(distribution.GetMaxConstant(), (success, value) => { if (!success) { return; } Value = new ColorDistribution(distribution.GetMinConstant(), value); OnChanged?.Invoke(); }); } else if (DistributionType == PropertyDistributionType.RandomCurveRange) { GradientPicker.Show(distribution.GetMaxGradient(), (success, colorGradient) => { if (!success) { return; } Value = new ColorDistribution(distribution.GetMinGradient(), colorGradient); OnChanged?.Invoke(); }); } }
public void Set(DateTime newValue) { value = newValue; if (OnChanged != null) { OnChanged.Invoke(value); } }
private void onChanged(int i, T v) { OnChange(i, v); OnChanged?.Invoke(this, new OnSetEventArgs <T>() { i = i, val = v }); }