private void Awake() { m_CharacterMaster = this.GetComponentOrFail <CharacterMaster>(); m_Health = this.GetComponentOrFail <Health>(); m_Health.maxValue = healthParameters.maxHealth; m_Brighten = this.GetComponentOrFail <Brighten>(); Debug.AssertFormat(healthAestheticParameters, this, "No Health Aesthetic Parameters found on {0}", this); }
public void Update(ColumnViewModel columnViewModel) { ColumnViewModel = columnViewModel; TableViewModel tvm = (this.DataContext as TableViewModel); Canvas.SetTop(LowerColumnHeaderWrapperElement, tvm.Height - Const.ColumnHeaderHeight); if (columnViewModel != null) { Int32 columnIndex = columnViewModel.Index; Int32 index = 0; foreach (RowViewModel rowViewModel in tvm.ActivatedRowViewModels) { TextBlock cell; if (index < TableCanvas.Children.Count) { cell = TableCanvas.Children[index] as TextBlock; cell.Visibility = Visibility.Visible; } else { cell = new TextBlock() { Style = Const.CellStyle }; TableCanvas.Children.Add(cell); } String text = rowViewModel.Cells[columnIndex].Content.ToString(); cell.Text = text; cell.Width = columnViewModel.Width; Canvas.SetTop(cell, rowViewModel.Y); index++; } for (Int32 i = index; i < TableCanvas.Children.Count; ++i) { TableCanvas.Children[i].Visibility = Visibility.Collapsed; } Double left = columnViewModel.X - tvm.ScrollLeft; if (left - columnViewModel.Width / 2 <= 0) { UpperColumn.RenderTransformOrigin = new Point(0, 0); LowerColumnHeaderWrapperElement.RenderTransformOrigin = new Point(0, 1); Canvas.SetLeft(UpperPopupElement, 60); Canvas.SetLeft(LowerPopupElement, 60); } else if (left + columnViewModel.Width * 3 / 2 >= tvm.SheetViewWidth) { UpperColumn.RenderTransformOrigin = new Point(1, 0); LowerColumnHeaderWrapperElement.RenderTransformOrigin = new Point(1, 1); Canvas.SetLeft(UpperPopupElement, columnViewModel.Width - 60); Canvas.SetLeft(LowerPopupElement, columnViewModel.Width - 60); } else { UpperColumn.RenderTransformOrigin = new Point(0.5, 0); LowerColumnHeaderWrapperElement.RenderTransformOrigin = new Point(0.5, 1); Canvas.SetLeft(UpperPopupElement, columnViewModel.Width / 2); Canvas.SetLeft(LowerPopupElement, columnViewModel.Width / 2); } Canvas.SetLeft(MagnifiedColumn, left); UpperColumnHeaderWrapperElement.Width = LowerColumnHeaderWrapperElement.Width = MagnifiedColumn.Width = columnViewModel.Width; UpperColumnHeaderWrapperElement.DataContext = LowerColumnHeaderWrapperElement.DataContext = columnViewModel; Canvas.SetTop(UpperPopupElement, Const.ColumnHeaderHeight * 0.2); Canvas.SetTop(LowerPopupElement, columnViewModel.MainPageViewModel.Bounds.Height - Const.ColumnHeaderHeight * 1.7); Wrapper.Visibility = Visibility.Visible; TableScrollViewer.Height = tvm.SheetViewHeight; TableScrollViewer.ChangeView(null, tvm.ScrollTop, null, true); if (Const.PopupMenuEnabled) { if (columnViewModel.IsHidden) { UpperRightMenuElement.Visibility = Visibility.Collapsed; UpperLeftMenuElement.Visibility = Visibility.Visible; LowerRightMenuElement.Visibility = Visibility.Collapsed; LowerLeftMenuElement.Visibility = Visibility.Visible; } else { UpperRightMenuElement.Visibility = Visibility.Visible; UpperLeftMenuElement.Visibility = Visibility.Collapsed; LowerRightMenuElement.Visibility = Visibility.Visible; LowerLeftMenuElement.Visibility = Visibility.Collapsed; } } Brighten.Stop(); if (Darken.GetCurrentState() != ClockState.Active) { Darken.Begin(); } } else { TableScrollViewer.Height = tvm.SheetViewHeight; if (Brighten.GetCurrentState() != ClockState.Active) { Brighten.Begin(); } Darken.Stop(); if (Const.PopupMenuEnabled) { UpperDownMenuElement.Hide(); UpperLeftMenuElement.Hide(); UpperRightMenuElement.Hide(); LowerUpMenuElement.Hide(); LowerLeftMenuElement.Hide(); LowerRightMenuElement.Hide(); } } }