private void Grid_Loaded(object sender, RoutedEventArgs e) { DoomsdayClock.Content = Time; Grid g = (Grid)this.Parent; Grid gg = (Grid)g.Parent; try{ game = (GameGrid)gg.Parent; } catch (Exception error) {} RoomName.Content = roomname; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 6 "..\..\MainWindow.xaml" ((LapinLeap.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.bgGrid = ((System.Windows.Controls.Grid)(target)); return; case 3: this.game = ((LapinLeap.GameGrid)(target)); return; case 4: this.inventory = ((LapinLeap.Inventory)(target)); return; case 5: this.avatar = ((LapinLeap.avatar)(target)); return; case 6: this.DoomsdayClock = ((System.Windows.Controls.Label)(target)); return; case 7: this.MapCanvas = ((System.Windows.Controls.Canvas)(target)); #line 19 "..\..\MainWindow.xaml" this.MapCanvas.PreviewMouseDown += new System.Windows.Input.MouseButtonEventHandler(this.MapCanvas_PreviewMouseDown); #line default #line hidden return; case 8: this.pulser = ((System.Windows.Controls.Label)(target)); return; case 9: this.PhoneCanvas = ((System.Windows.Controls.Canvas)(target)); #line 24 "..\..\MainWindow.xaml" this.PhoneCanvas.PreviewMouseDown += new System.Windows.Input.MouseButtonEventHandler(this.PhoneCanvas_PreviewMouseDown); #line default #line hidden return; case 10: this.cell = ((LapinLeap.phone)(target)); return; } this._contentLoaded = true; }
//move private void Grid_PreviewMouseDown(object sender, MouseButtonEventArgs e) { //BGgrid.Background = Brushes.Blue; DoomsdayClock.Content = Time; Grid g = (Grid)this.Parent; Grid roomgrid = (Grid)g.Parent; GameGrid game = (GameGrid)roomgrid.Parent; ThicknessAnimation animation = new ThicknessAnimation(); Thickness oldCenter = game.currentRoom.Margin; Thickness newCenter = this.Margin; Thickness oldMargin = roomgrid.Margin; //roomgrid.Margin = Thickness newMargin = new Thickness(oldMargin.Left + (oldCenter.Left - newCenter.Left), oldMargin.Top + (oldCenter.Top - newCenter.Top), oldMargin.Right + (oldCenter.Right - newCenter.Right), oldMargin.Bottom + (oldCenter.Bottom - newCenter.Bottom)); animation.From = oldMargin; animation.To = newMargin; PowerEase pe = new PowerEase(); pe.EasingMode = EasingMode.EaseInOut; pe.Power = 3; animation.EasingFunction = pe; animation.Duration = new Duration(TimeSpan.FromSeconds(.5)); roomgrid.BeginAnimation(Grid.MarginProperty, animation); List <Room> desc = game.currentRoom.getalldescendents(); game.currentRoom.BGgrid.Background = new SolidColorBrush(Color.FromArgb(190, 255, 152, 152)); // game.StartRoom.BGgrid.Background = new SolidColorBrush(Color.FromArgb(255, 255, 152, 152)); foreach (Room r in desc) { r.BGgrid.Background = new SolidColorBrush(Color.FromArgb(190, 255, 152, 152)); } game.currentRoom = this; desc = game.currentRoom.getalldescendents(); foreach (Room r in desc) { r.BGgrid.Background = new SolidColorBrush(Color.FromArgb(255, 255, 152, 152)); } game.window.DoomsdayClock.Content = Time; game.adjustBG(Time); BGgrid.Background = Brushes.Blue; //CHANGE CHARA LOC if (oldCenter.Left == newCenter.Left) { game.window.avatar.standstill(); } else if (oldCenter.Left < newCenter.Left)//traveling forward { game.window.avatar.fwd(); } else { game.window.avatar.bwd(); } }
private void optionsList_SelectionChanged(object sender, SelectionChangedEventArgs e) { String s = (string)((ListBox)sender).SelectedItem; if (s == null) { return; } Room selectedroom = (Room)actions[s]; (selectedroom).Visibility = Visibility.Visible; ((ListBox)sender).SelectedItem = null; //v sloppy, revist later DoomsdayClock.Content = Time; Grid g = (Grid)this.Parent; Grid roomgrid = (Grid)g.Parent; GameGrid game = (GameGrid)roomgrid.Parent; ThicknessAnimation animation = new ThicknessAnimation(); Thickness oldCenter = game.currentRoom.Margin; Thickness newCenter = selectedroom.Margin; Thickness oldMargin = roomgrid.Margin; //roomgrid.Margin = Thickness newMargin = new Thickness(oldMargin.Left + (oldCenter.Left - newCenter.Left), oldMargin.Top + (oldCenter.Top - newCenter.Top), oldMargin.Right + (oldCenter.Right - newCenter.Right), oldMargin.Bottom + (oldCenter.Bottom - newCenter.Bottom)); animation.From = oldMargin; animation.To = newMargin; PowerEase pe = new PowerEase(); pe.EasingMode = EasingMode.EaseInOut; pe.Power = 3; animation.EasingFunction = pe; animation.Duration = new Duration(TimeSpan.FromSeconds(.5)); roomgrid.BeginAnimation(Grid.MarginProperty, animation); List <Room> desc = game.currentRoom.getalldescendents(); game.currentRoom.BGgrid.Background = new SolidColorBrush(Color.FromArgb(190, 255, 152, 152)); // game.StartRoom.BGgrid.Background = new SolidColorBrush(Color.FromArgb(255, 255, 152, 152)); foreach (Room r in desc) { r.BGgrid.Background = new SolidColorBrush(Color.FromArgb(190, 255, 152, 152)); } game.currentRoom = selectedroom; desc = game.currentRoom.getalldescendents(); foreach (Room r in desc) { r.BGgrid.Background = new SolidColorBrush(Color.FromArgb(255, 255, 152, 152)); } game.window.DoomsdayClock.Content = Time; game.adjustBG(Time); selectedroom.BGgrid.Background = Brushes.Blue; //CHANGE CHARA LOC if (oldCenter.Left == newCenter.Left) { game.window.avatar.standstill(); } else if (oldCenter.Left < newCenter.Left)//traveling forward { game.window.avatar.fwd(); } else { game.window.avatar.bwd(); } }