public void AddGrowButton(PvZGrowButton grButton) { this.ArrageButton(grButton, this.growButtons.Count); grButton.OnTouchLeave += this.OnGrowButtonTouchLeaved; this.growButtons.Add(grButton); }
public void AddGrowButton(PvZGrowButton grButton) { this.ArrageButton(grButton, this.growButtons.Count); grButton.OnTouchLeave += this.OnGrowButtonTouchLeaved; this.growButtons.Add(grButton); this.uiManager.AddTarget<FreeTap>(grButton); }
private void OnGrowButtonTouchLeaved(PvZGrowButton button, SCSEngine.GestureHandling.Implements.Events.FreeTap leaveGesture) { CRectangleF contentInBound = new CRectangleF(this.Canvas.Content); contentInBound.Position += this.Canvas.Bound.Position; if (!contentInBound.Contains(leaveGesture.Current)) { //create plant-shadow var shadow = button.ShadowFactory.CreatePlantShadow(); shadow.CreatorButton = button; shadow.Canvas.Bound.Position = leaveGesture.Current; shadow.Canvas.Bound.Size = new Vector2(shadow.PlanShadowImage.CurrentFrame.Width, shadow.PlanShadowImage.CurrentFrame.Height); shadow.OnGrowNewPlant += this.OnGrowPlant; // add p-s to ui manager (g-dispatcher) this.uiManager.Add(shadow); this.uiManager.SetHandleTarget<FreeTap>(leaveGesture, shadow); } }
private void ArrageButton(PvZGrowButton grButton, int i) { grButton.Canvas.Bound.Position.X = this.Canvas.Bound.Position.X + this.Canvas.Content.Position.X + (this.elemWidth + this.ElemPad) * i; grButton.Canvas.Bound.Position.Y = this.Canvas.Bound.Position.Y + this.Canvas.Content.Position.Y; grButton.Canvas.Bound.Size.X = this.elemWidth; grButton.Canvas.Bound.Size.Y = this.Canvas.Content.Size.Y; }
private void OnGrowButtonTouchLeaved(PvZGrowButton button, SCSEngine.GestureHandling.Implements.Events.FreeTap leaveGesture) { if (!this.Canvas.Bound.Contains(leaveGesture.Current)) { //create plant-shadow // add p-s to ui manager (g-dispatcher) } }