public Ball(Vector2 startPos) { var radius = 10; Position = startPos; Size = new Vector2(radius * 2); _startPos = startPos; // Colored circle to represent ball var circle = new Circle() { Color = Colors.Black, Radius = radius }; AddChild(circle); // Update method called every frame var update = new Updateable() { UpdateMethod = Update }; AddComponent(update); // Collision component that calls method when collision occurs var collision = new Collision() { OnCollision = HandleCollision }; AddComponent(collision); }
public Updater(Updateable applicationInfo) { this.applicationInfo = applicationInfo; this.bgWorger = new BackgroundWorker(); this.bgWorger.DoWork += new DoWorkEventHandler(BgWorger_DoWork); this.bgWorger.RunWorkerCompleted += new RunWorkerCompletedEventHandler(BgWorger_RunWorkerCompleted); }
public virtual Emitter <T> OnEmit(T eventType) { if (!_active) { return(this); } int taskCount = 0; SortedList <Updateable> list = _emitterTable.Get(eventType); if (null != list) { for (LIterator <Updateable> it = list.ListIterator(); it.HasNext();) { Updateable update = it.Next(); if (update != null) { update.Action(eventType); if (update is ActionUpdate) { ActionUpdate au = (ActionUpdate)update; if (au.Completed()) { list.Remove(au); } } } taskCount++; if (taskCount >= _maxFrameTask) { break; } } } return(this); }
// --- Load start ---// public void AddLoad(Updateable u) { lock (loads) { loads.Add(u); } }
public void UpdateableCanCompareDirectlyToChildItem() { var rawItem = new Uri("http://google.com"); var updateable = new Updateable <Uri>(rawItem); updateable.Equals(rawItem).Should().BeTrue(); }
void Update() { if (backingInfo is Destructable) { Destructable d = backingInfo as Destructable; updateHealthbar(d); float damageFraction = d.health / d.maxHealth; if (d.health <= 0) { map.removeStructure(this); } spriteRenderer.color = new Color(1, damageFraction, damageFraction); } if (backingInfo is Updateable) { Updateable u = backingInfo as Updateable; u.OnUpdate(); } if (backingInfo is ChargableStructure) { updatePowerbar(backingInfo as ChargableStructure); } }
// --- Load end ---// // --- UnLoad start ---// public void AddUnLoad(Updateable u) { lock (unloads) { unloads.Add(u); } }
public void RemoveLoad(Updateable u) { lock (loads) { loads.Remove(u); } }
public void RemoveUnLoad(Updateable u) { lock (unloads) { unloads.Remove(u); } }
public static void Post(Updateable update) { if (global_queue != null) { global_queue.InvokeLater(update); } else { LSystem.Load(update); } }
public static StopwatchTimer Run(Updateable u) { StopwatchTimer sw = Begin(); u.Action(null); sw.Stop(); return(sw); }
public static void Unload(Updateable u) { LProcess process = LSystem.screenProcess; if (process != null) { process.AddUnLoad(u); } }
public void UpdateResetsRequestCount() { var updateable = new Updateable <Uri>(new Uri("http://foo.com"), 100); updateable.Requests.Should().Be(100); updateable.Update(); updateable.Requests.Should().Be(0); }
public void TwoUpdateableObjectsCanCompareToEachOther() { var one = new Updateable <string>("item"); var two = new Updateable <string>("item"); one.Equals(two).Should().BeTrue(); (one == two).Should().BeTrue(); (one != two).Should().BeFalse(); one.GetHashCode().Should().Be(two.GetHashCode()); }
public virtual bool RemoveObserver(T eventType, Updateable handler) { SortedList <Updateable> list = _emitterTable.Get(eventType); if (list != null) { return(list.Remove(handler)); } return(false); }
public void CompareToSelfIsTrue() { var updateable = new Updateable <Uri>(new Uri("https://[::1]")); updateable.Equals(updateable).Should().BeTrue(); (updateable == updateable).Should().BeTrue(); object indirect = updateable; indirect.Equals(indirect).Should().BeTrue(); }
public void CompareToNullIsFalse() { var updateable = new Updateable <string>("fore"); updateable.Equals((string)null).Should().BeFalse(); updateable.Equals((Updateable <string>)null).Should().BeFalse(); (updateable == null).Should().BeFalse(); (updateable != null).Should().BeTrue(); object indirect = updateable; indirect.Equals(null).Should().BeFalse(); }
private void BgWorger_DoWork(object sender, DoWorkEventArgs e) { Updateable application = (Updateable)e.Argument; if (!UpdateXML.ExsistsOnServer(application.UpdateXmlLocation)) { e.Cancel = true; } else { e.Result = UpdateXML.Parse(application.UpdateXmlLocation, application.ApplicationID); } }
public UpdateInfoForm(Updateable applicationInfo, UpdateXML updateInfo) { InitializeComponent(); if (applicationInfo.ApplicationIcon != null) { this.Icon = applicationInfo.ApplicationIcon; } this.Text = applicationInfo.ApplicationName + " - Update Info"; this.lblVersionOld.Text = "Current Version: " + applicationInfo.ApplicationAssembly.GetName().Version.ToString(); this.lblVersionNew.Text = "Current Version: " + updateInfo.Version.ToString(); this.textDescription.Text = updateInfo.Description; }
public virtual Emitter <T> AddObserver(T eventType, Updateable handler) { SortedList <Updateable> list = _emitterTable.Get(eventType); if (list == null) { list = new SortedList <Updateable>(); } if (!list.Contains(handler)) { list.Add(handler); } _emitterTable.Put(eventType, list); return(this); }
internal UpdateAcceptForm(Updateable applicationInfo, UpdateXML updateInfo) { InitializeComponent(); this.applicationInfo = applicationInfo; this.updateInfo = updateInfo; this.Text = this.applicationInfo.ApplicationName + " - Update available"; if (this.applicationInfo.ApplicationIcon != null) { this.Icon = this.applicationInfo.ApplicationIcon; } this.lblNewVersion.Text = string.Format("New Version: {0}", this.updateInfo.Version.ToString()); }
public void Add(Updateable update) { if (_head == null) { _head = new Entry(update); } else { Entry parent = _head; while (parent.next != null) { parent = parent.next; } parent.next = new Entry(update); } _count++; }
private static void CallUpdateable(List <Updateable> list) { List <Updateable> loadCache; lock (list) { loadCache = new List <Updateable>(list); list.Clear(); } for (int i = 0; i < loadCache.Count; i++) { Updateable running = loadCache[i]; lock (running) { running.Action(); } } loadCache = null; }
public Paddle() { Size = new Vector2(30, 120); // Coloured rectangle to represent paddle var paddleRect = new Rect() { Color = Colors.Black, Size = Size }; AddChild(paddleRect); // Update method that will be called every frame var update = new Updateable() { UpdateMethod = Update }; AddComponent(update); // Collision component so the ball can collide with the paddle AddComponent <Collision>(); }
public static void AddParticle(Updateable updateable) { updatePAdd.Add(updateable); }
public void SetFunction(Updateable function) { this._function = function; }
public abstract void InvokeAsync(Updateable action);
public virtual void AddUnLoad(Updateable u) { if (handler != null) { handler.AddUnLoad(u); } }
public Entry(Updateable update) { this.update = update; }
public void InvokeLater(Updateable update) { _queue.Add(update); }
public virtual void RemoveUnLoad(Updateable u) { if (handler != null) { handler.RemoveUnLoad(u); } }
public ActionCounter(int limit, Updateable actListener) : base(limit) { }
public virtual LTimer SetUpdateable(Updateable u) { this._update = u; return(this); }
public virtual ActionCounter SetActionListener(Updateable u) { this.actListener = u; return(this); }