Пример #1
0
        private void MoveAnimation()
        {
            if (m_AnimationStep >= m_RouteList.Count - 1)
            {
                GameLogic.Default.MoveOver();
                return;
            }
            LocationControl locCtrl1 = m_LocationControls.First(p => p.LocationIndex == m_RouteList[m_AnimationStep]);
            LocationControl locCtrl2 = m_LocationControls.First(p => p.LocationIndex == m_RouteList[m_AnimationStep + 1]);

            m_AnimationStep++;

            DoubleAnimation da1 = new DoubleAnimation((double)locCtrl1.GetValue(Canvas.LeftProperty), (double)locCtrl2.GetValue(Canvas.LeftProperty), new Duration(new TimeSpan(0, 0, 0, 0, 300)));
            DoubleAnimation da2 = new DoubleAnimation((double)locCtrl1.GetValue(Canvas.TopProperty), (double)locCtrl2.GetValue(Canvas.TopProperty), new Duration(new TimeSpan(0, 0, 0, 0, 300)));

            Storyboard.SetTargetProperty(da1, new PropertyPath(Canvas.LeftProperty));
            Storyboard.SetTargetProperty(da2, new PropertyPath(Canvas.TopProperty));

            Storyboard sb = new Storyboard();

            sb.Completed += Sb_Completed;
            sb.Children.Add(da1);
            sb.Children.Add(da2);
            sb.Begin(m_PlayerUIDic[GameLogic.Default.CurrentPlayer]);
        }
Пример #2
0
        private void InitPlayerLocaton()
        {
            m_PlayerUIDic = new Dictionary <Player, Label>();
            foreach (var player in GameLogic.Default.Players)
            {
                Label label = new Label();
                label.Padding    = new Thickness(3);
                label.FontSize   = 24;
                label.Content    = player.Role.Name;
                label.Background = player.Role.Color;

                Location        loc     = GameLogic.Default.Map.LocationCollection.First(p => p.Index == player.Location.Index);
                LocationControl locCtrl = m_LocationControls.First(p => p.Location == player.Location);
                label.SetValue(Canvas.LeftProperty, locCtrl.GetValue(Canvas.LeftProperty));
                label.SetValue(Canvas.TopProperty, locCtrl.GetValue(Canvas.TopProperty));
                m_MapCanvas.Children.Add(label);

                m_PlayerUIDic.Add(player, label);
            }
        }