public void Add(Item newItem) { if (items.Count < slots) { items.Add(newItem); } if (onChange != null) { onChange.Invoke(); } else { Debug.Log("No hay espacio en el inventario"); } }
public void Add(Item newItem) { if (items.Count < space) { items.Add(newItem); if (onChange != null) { onChange.Invoke(); } } else { Debug.Log("No hay espacio disponible"); } }
public void Add(Item item) { if (items.Count < space) { items.Add(item); if (onChange != null) { onChange.Invoke(); } } else { Debug.LogWarning("Espacio insuficiente!"); } }
//Calls necessary observer methods when the value gets flatly added to public void setValue(float val) { if (val == 0) { return; } if (val > 0) { OnIncrement.Invoke(val); } else if (val < 0) { OnDecrement.Invoke(val); } value = val; OnChange.Invoke(val); if (ValueAsBool()) { OnTrue.Invoke(); } else { OnFalse.Invoke(); } }
protected void fireOnChange(TKey key) { if (OnChange != null) { OnChange.Invoke(key); } }
private void InvokeOnChange() { if (OnChange != null) { OnChange.Invoke(this, EventArgs.Empty); } }
public void MarkAsDirty() { if (OnChange != null) { OnChange.Invoke(this); } }
public void Update() { #if DEBUG var oldIsNight = IsNight; var oldIsBloodMoon = IsBloodMoon; var oldZombieSpeed = ZombieSpeed; #endif var world = GameManager.Instance.World; IsNight = world.IsDark(); IsBloodMoon = SkyManager.BloodMoon(); ZombieSpeed = CalculateZombieSpeed(); #if DEBUG if (oldIsNight != IsNight) { Logger.Debug("isNight, Old: {0}, New: {1}", oldIsNight, IsNight); } if (oldIsBloodMoon != IsBloodMoon) { Logger.Debug("isBloodMoon, Old: {0}, New: {1}", oldIsBloodMoon, IsBloodMoon); } if (oldZombieSpeed != ZombieSpeed) { Logger.Debug("zombieSpeed, Old: {0}, New: {1}", oldZombieSpeed, ZombieSpeed); } #endif if (_invalidated) { if (OnChange != null) { OnChange.Invoke(); } _invalidated = false; } }
/// <summary> /// publish paper /// </summary> public void ChangeData() { if (null != OnChange) { OnChange.Invoke("new data"); } }
public void Dequip(EquipableItem item) { if (helmet == item) { helmet = null; } if (chest == item) { chest = null; } if (gloves == item) { gloves = null; } if (boots == item) { boots = null; } if (weapon == item) { weapon = null; } if (accessory == item) { accessory = null; } if (OnChange != null) { Debug.Log("hero equipment changed"); OnChange.Invoke(this); } }
public void AddItem(string name, int amount = 1) { if (!this.Contains(name)) { elements.Add(new InventoryElement(name, amount)); } else { if (this[name].Amount + amount >= 0) { this[name].Amount += amount; } else { throw new ArgumentException("removing more items then there are"); } } if (this[name].Amount == 0) { elements.Remove(this[name]); } if (OnChange != null) { OnChange.Invoke(); } }
public void Validate() { if (OnChange != null) { OnChange.Invoke(); } }
internal void Changed() { if (OnChange != null) { OnChange.Invoke(Gesture, this); } }
private void Change(object subject) { if (OnChange != null) { OnChange.Invoke(subject, EventArgs.Empty); } }
public void TriggerAll() { if (OnChange == null) { return; } var changes = new List <DataChange>(); foreach (KeyValuePair <int, string> entry in fieldsByIndex) { var field = entry.Value; if (this[field] != null) { changes.Add(new DataChange { Field = field, Value = this[field], PreviousValue = null }); } } OnChange.Invoke(this, new OnChangeEventArgs(changes)); }
private async Task NotifyStateChanged() { if (OnChange != null) { await OnChange.Invoke(); } }
public void InvokeOnChange(object item, object index) { if (OnChange != null) { OnChange.Invoke(this, new KeyValueEventArgs <T, string>((T)item, (string)index)); } }
void OnValidate() { if (OnChange != null) { OnChange.Invoke(this, EventArgs.Empty); } }
public async Task AddToCart(CartItem item) { var cart = await _localStorage.GetItemAsync <List <CartItem> >("cart"); if (cart == null) { cart = new List <CartItem>(); } var sameItem = cart.Find(x => x.ProductId == item.ProductId && x.PurchaseOptionId == item.PurchaseOptionId); if (sameItem == null) { cart.Add(item); } else { sameItem.Quantity += item.Quantity; } await _localStorage.SetItemAsync("cart", cart); var product = await _productService.GetProduct(item.ProductId); _toastService.ShowSuccess(product.Title, "Added to your shopping cart:"); OnChange.Invoke(); }
public async Task Update() { if (OnChange != null) { await OnChange.Invoke(); } }
public void SetValue(float value) { _value = value; if (OnChange != null) { OnChange.Invoke(_value); } }
public void RemoveAt(int index) { T item = list[index]; list.RemoveAt(index); OnRemove.Invoke(item); OnChange.Invoke(default(T)); }
public void TakeDamage(int amount) { _current -= amount; OnChange.Invoke(); if (_current <= 0) { OnEmpty.Invoke(); } }
public bool Add(Item item) { if (OnChange != null && item != null) { items.Add(item); OnChange.Invoke(this); } return(true); }
public void Remove(T item) { if (Value.Contains(item)) { Value.Remove(item); OnChange.Invoke(item); OnRemove.Invoke(item); } }
public bool Remove(Item item) { if (items.Remove(item) && item != null) { OnChange.Invoke(this); return(true); } return(false); }
public void Set(T value) { if (under.Equals(value)) { return; } onChange.Invoke(under, value); under = value; }
public void Add(T item, bool silently = false) { list.Add(item); if (!silently) { OnAdd.Invoke(item); OnChange.Invoke(item); } }
public void Add(T item) { if (!Value.Contains(item)) { Value.Add(item); OnAdd.Invoke(item); OnChange.Invoke(item); } }
public void AddRange(IEnumerable <T> items) { foreach (var item in items) { Add(item, true); OnAdd.Invoke(item); } OnChange.Invoke(default(T)); }