protected bool CheckItem(T item, ref int i) { bool changed = false; if (item.IsAlive) { if (!current[i]) { LoadRequested?.Invoke(item); if (item.IsLoaded) { AliveItems.Add(item); current[i] = true; changed = true; } } } else { if (current[i]) { AliveItems.Remove(item); current[i] = false; changed = true; } if (item.RemoveWhenNotAlive) { RemoveAt(i--); Removed?.Invoke(item); } } return(changed); }
public void OnLoadRequested() { if (LoadRequested != null) { LoadRequested.Invoke(); } }
public new int Add(T item) { LoadRequested?.Invoke(item); int i = base.Add(item); current.Insert(i, false); return(i); }
public new int Add(T item) { if (item.IsAlive && !item.IsLoaded) { LoadRequested?.Invoke(item); } int i = base.Add(item); current.Insert(i, false); return(i); }
Task IMultiplayerClient.LoadRequested() { Scheduler.Add(() => { if (Room == null) { return; } LoadRequested?.Invoke(); }, false); return(Task.CompletedTask); }
public override int Add(T item) { LoadRequested?.Invoke(item); int i = base.Add(item); bool isLoaded = item.IsLoaded && item.IsAlive; current.Insert(i, isLoaded); if (isLoaded) { AliveItems.Add(item); } return(i); }
/// <summary> /// Updates the life status of this LifetimeList's children. /// </summary> /// <returns>Whether any alive states were changed.</returns> public bool Update(FrameTimeInfo time) { bool anyAliveChanged = false; for (int i = 0; i < Count; i++) { var item = this[i]; item.UpdateTime(time); if (item.IsAlive) { if (!current[i]) { LoadRequested?.Invoke(item); if (item.IsLoaded) { AliveItems.Add(item); current[i] = true; anyAliveChanged = true; } } } else { if (current[i]) { AliveItems.Remove(item); current[i] = false; anyAliveChanged = true; } if (item.RemoveWhenNotAlive) { RemoveAt(i--); Removed?.Invoke(item); } } } return(anyAliveChanged); }
static void ParseArguments(string[] arguments = null) { if (arguments == null) { arguments = Arguments; } for (int i = 0; i < arguments.Length; i++) { string argument = arguments[i]; switch (arguments[i]) { case DISPLAY_ARGUMENT: DisplayRequested?.Invoke(null, EventArgs.Empty); break; case LOAD_ARGUMENT: if (!(i <= arguments.Length - 1 && File.Exists(arguments[++i]))) { continue; } LoadRequested?.Invoke(null, arguments[i]); break; default: { var ext = Path.GetExtension(argument); if (ext == CONTEST_EXTENSION_FILE && File.Exists(argument)) { LoadRequested?.Invoke(null, argument); } break; } } } }
public void Load(string path) { string appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); var document = new XmlDocument(); document.Load(path); var design = document.SelectSingleNode("/Canvas/Design"); byte[] arr = Convert.FromBase64String(design.InnerText); LoadRequested?.Invoke(Encoding.UTF8.GetString(arr)); foreach (XmlElement element in document.SelectNodes("/Canvas/Code/Blocks")) { var position = Point.Parse(element.GetAttribute("Position")); var block = BlocksFromXML(element); AttachToCanvas(block); block.Position = position; } List <string> references = new List <string>(); foreach (XmlElement element in document.SelectNodes("/Canvas/Extension/Reference")) { references.Add(element.GetAttribute("Path").Replace("%APPDATA%", appData)); } List <string> dependencies = new List <string>(); foreach (XmlElement element in document.SelectNodes("/Canvas/Extension/Dependencies")) { dependencies.Add(element.GetAttribute("Path").Replace("%APPDATA%", appData)); } LoadCompleted?.Invoke(references.ToArray(), dependencies.ToArray()); }
/// <summary> /// Raises the <see cref="LoadRequested"/> event. /// </summary> /// <param name="context">The optional context for the trigger.</param> protected void RaiseLoadRequested(IDataLoaderContext context = null) { LoadRequested?.Invoke(this, context); }
private void LoadButton_Click(object sender, EventArgs e) { LoadRequested?.Invoke(this, Scenario); }
public void RequestToLoadFile() => LoadRequested?.Invoke(this, EventArgs.Empty);
private void OnItemSelected(SaveItem item) { LoadRequested?.Invoke(item.Id); _panel.gameObject.SetActive(false); }