Commit 5ab0a699 by wangonghui

添加MVP板子的数据模板和插件

parent 34889442
......@@ -169,6 +169,120 @@ namespace VIZ.TVP.CBA.Module
}
/// <summary>
/// 设置MVP球员主队和客队球员技术数据统计
/// </summary>
/// <param name="mainViewModel"></param>
/// <param name="selectIndex"></param>
/// <param name="teamLiveH"></param>
/// <param name="teamLiveV"></param>
public static void SetTechStatsInfo(MvpPlayerViewModel mainViewModel, int selectIndex, LivePlayerStatH teamLiveH, LivePlayerStatV teamLiveV)
{
if (selectIndex == 0)
{
//foreach (var teamLive in mainViewModel.onAirDataModel.livePlayerStatH)
//{
Dictionary<string, string> CompareItemToNumber = new Dictionary<string, string>();
CompareItemToNumber.Add("得分", teamLiveH.Points);
CompareItemToNumber.Add("篮板", teamLiveH.Rebounds);
CompareItemToNumber.Add("助攻", teamLiveH.Assists);
CompareItemToNumber.Add("抢断", teamLiveH.Steals);
CompareItemToNumber.Add("盖帽", teamLiveH.Blocked);
CompareItemToNumber.Add("上场时间", teamLiveH.Minutes);
CompareItemToNumber.Add("投篮命中率", (teamLiveH.FieldGoalsPercentage * 100).ToString("F1") + "%");
CompareItemToNumber.Add("两分命中率", (teamLiveH.TwoPointPercentage).ToString("F1") + "%");
CompareItemToNumber.Add("三分命中率", (teamLiveH.ThreePointPercentage * 100).ToString("F1") + "%");
CompareItemToNumber.Add("罚球命中率", (teamLiveH.FreeThrowsPercentage * 100).ToString("F1") + "%");
CompareItemToNumber.Add("篮下投篮命中率", (teamLiveH.FieldGoalsAtRimPercentage * 100).ToString("F1") + "%");
CompareItemToNumber.Add("中距离投篮命中率", (teamLiveH.FieldGoalsMidRangePercentage * 100).ToString("F1") + "%");
CompareItemToNumber.Add("三分", teamLiveH.ThreePointGoals + "/"
+ teamLiveH.ThreePointAttempted);
CompareItemToNumber.Add("两分", teamLiveH.TwoPointGoals + "/"
+ teamLiveH.TwoPointAttempted);
CompareItemToNumber.Add("两分区", teamLiveH.TwoPointGoals + "/"
+ teamLiveH.TwoPointAttempted);
CompareItemToNumber.Add("三分区", teamLiveH.ThreePointGoals + "/"
+ teamLiveH.ThreePointAttempted);
//CompareItemToNumber.Add("ThreeArea",);
CompareItemToNumber.Add("罚球", teamLiveH.FreeThrows + "/"
+ teamLiveH.FreeThrowsAttempted);
CompareItemToNumber.Add("失误.g", teamLiveH.Turnovers);
if (!mainViewModel.MvpHomePlayerCompareNumDictionary.ContainsKey(teamLiveH.CNAlias))
{
mainViewModel.MvpHomePlayerCompareNumDictionary.Add(teamLiveH.CNAlias, CompareItemToNumber);
}
//}
}
else
{
//foreach (var teamLive in mainViewModel.onAirDataModel.livePlayerStatV)
//{
Dictionary<string, string> CompareItemToNumber = new Dictionary<string, string>();
CompareItemToNumber.Add("得分", teamLiveV.Points);
CompareItemToNumber.Add("篮板", teamLiveV.Rebounds);
CompareItemToNumber.Add("助攻", teamLiveV.Assists);
CompareItemToNumber.Add("抢断", teamLiveV.Steals);
CompareItemToNumber.Add("盖帽", teamLiveV.Blocked);
CompareItemToNumber.Add("上场时间", teamLiveV.Minutes);
CompareItemToNumber.Add("投篮命中率", (teamLiveV.FieldGoalsPercentage).ToString("F1") + "%");
CompareItemToNumber.Add("两分命中率", (teamLiveV.TwoPointPercentage).ToString("F1") + "%");
CompareItemToNumber.Add("三分命中率", (teamLiveV.ThreePointPercentage).ToString("F1") + "%");
CompareItemToNumber.Add("罚球命中率", (teamLiveV.FreeThrowsPercentage).ToString("F1") + "%");
CompareItemToNumber.Add("篮下投篮命中率", (teamLiveV.FieldGoalsAtRimPercentage * 100).ToString("F1") + "%");
CompareItemToNumber.Add("中距离投篮命中率", (teamLiveV.FieldGoalsMidRangePercentage * 100).ToString("F1") + "%");
CompareItemToNumber.Add("三分", teamLiveV.ThreePointGoals + "/"
+ teamLiveV.ThreePointAttempted);
CompareItemToNumber.Add("两分", teamLiveV.TwoPointGoals + "/"
+ teamLiveV.TwoPointAttempted);
CompareItemToNumber.Add("两分区", teamLiveV.TwoPointGoals + "/"
+ teamLiveV.TwoPointAttempted);
CompareItemToNumber.Add("三分区", teamLiveV.ThreePointGoals + "/"
+ teamLiveV.ThreePointAttempted);
//CompareItemToNumber.Add("ThreeArea",);
CompareItemToNumber.Add("罚球", teamLiveV.FreeThrows + "/"
+ teamLiveV.FreeThrowsAttempted);
CompareItemToNumber.Add("失误", teamLiveV.Turnovers);
if (!mainViewModel.MvpVisitPlayerCompareNumDictionary.ContainsKey(teamLiveV.CNAlias))
{
mainViewModel.MvpVisitPlayerCompareNumDictionary.Add(teamLiveV.CNAlias, CompareItemToNumber);
}
// }
}
}
/// <summary>
/// 设置新的主队和客队球员技术数据统计
/// </summary>
......
......@@ -356,6 +356,27 @@ namespace VIZ.TVP.CBA.Module
}
#endregion
#region Mvp球员信息
if(MvpPlayerViewModel.MvpPlayerViewModelInstance.Count>0)
{
foreach (var tempSinglePlayerViewModel in MvpPlayerViewModel.MvpPlayerViewModelInstance)
{
tempSinglePlayerViewModel.ScheduleID = selectMatchData.ScheduleID;
tempSinglePlayerViewModel.Matchtypeid = selectMatchData.ScheduleTypeID;
if (tempSinglePlayerViewModel.page != null && ApplicationDomainEx.CurrentPage == tempSinglePlayerViewModel.page)
{
tempSinglePlayerViewModel.SetSingleData();
}
}
}
#endregion
#region 球员对比信息
......@@ -374,7 +395,7 @@ namespace VIZ.TVP.CBA.Module
//}
if(NewPlayerComPareViewModel.PlayerCompareViewModelInstance.Count>0)
if (NewPlayerComPareViewModel.PlayerCompareViewModelInstance.Count>0)
{
foreach (var playerCompareViewModel in NewPlayerComPareViewModel.PlayerCompareViewModelInstance)
{
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
namespace VIZ.TVP.CBA.Module
{
public class MvpPlayerPlugin : IPluginLifeCycle
{
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
/// 插件ID不能包含点号
/// </remarks>
public const string PLUGIN_ID = "MvpPlayerView";
/// <summary>
/// 插件显示名称
/// </summary>
public const string PLUGIN_NAME = "MVP球员";
public void Dispose()
{
}
public void Initialize()
{
}
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PluginConstant.GroupName;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.PluginType = PluginType.Page;
info.ViewType = typeof(MvpPlayerView);
//info.SettingViewType = typeof(DayMatchUI);
return info;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
using VIZ.Package.Module;
namespace VIZ.TVP.CBA.Module
{
/// <summary>
/// Interaction logic for MvpPlayerView.xaml
/// </summary>
public partial class MvpPlayerView :UserControl, IPluginView
{
MvpPlayerViewModel vm = new MvpPlayerViewModel();
public MvpPlayerView()
{
InitializeComponent();
//vm = new SinglePlayerViewModel(); dqyData
MvpPlayerViewModel.MvpPlayerViewModelInstance.Add(vm);
WPFHelper.BindingViewModel(this, vm);
task_Start.Visibility = Visibility.Hidden;
task_Stop.Visibility = Visibility.Hidden;
task_continue.Visibility = Visibility.Hidden;
task_Start.IsEnabled = true;
task_Stop.IsEnabled = false;
task_continue.IsEnabled = false;
this.Loaded += NewSinglePlayerView_Loaded;
this.IsVisibleChanged += MvplePlayerView_IsVisibleChanged;
}
private void MvplePlayerView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (!string.IsNullOrEmpty(vm.ScheduleID) && !string.IsNullOrEmpty(vm.Matchtypeid))
{
vm.SetSingleData();
}
}
private void NewSinglePlayerView_Loaded(object sender, RoutedEventArgs e)
{
var service = ApplicationDomainEx.ServiceManager.GetService<IPluginService>(ViewServiceKeys.PLUGIN_SERVICE);
if (service == null)
return;
vm.page = service.GetPageModelFromView(this);
}
public void Dispose()
{
}
public void PreviewContinue(ConnModel conn)
{
}
public void PreviewIn(ConnModel conn)
{
if (conn.IsConnected)
{
conn.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "mvpData", vm.CombineSingleData()));
}
}
public void PreviewOut(ConnModel conn)
{
//if(conn.IsConnected)
// {
// conn.EndpointManager.Send(VizEngineCommands.STAGE_CONTINUE);
// }
}
public void TakeContinue(ConnModel conns)
{
}
public void TakeOut(ConnModel conns)
{
if (conns.IsConnected)
{
conns.EndpointManager.Send(VizEngineCommands.STAGE_CONTINUE);
}
}
public void TakeUpdate(ConnModel conns)
{
if (conns.IsConnected)
{
conns.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "mvpData", vm.CombineSingleData()));
}
}
public void TakIn(ConnModel conns)
{
if (conns.IsConnected)
{
conns.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "mvpData", vm.CombineSingleData()));
}
}
/// <summary>
/// 注册任务
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SinglePlayerView_Init()
{
if (task != null)
return;
task = new PackageTaskModel(this);
task.PreviewUpdateAction = OnPreviewUpdate;
task.TakeUpdateAction = OnTakeUpdate;
task.IsPreviewEnabled = true;
task.IsTakeEnabled = true;
task.IsRunning = true;
task.Name = "MVP球员数据";
service = ApplicationDomainEx.ServiceManager.GetService<IPackageTaskService>(ViewServiceKeys.PACKAGE_TASK_SERVICE);
if (service == null)
return;
service.Register(task);
}
/// <summary>
/// 任务模型
/// </summary>
public PackageTaskModel task;
IPackageTaskService service;
private void OnPreviewUpdate(ConnModel conn)
{
if (conn.IsConnected)
{
vm.BtnCommand();
if (vm.onAirDataModel != null)
{
conn.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "mvpData", vm.CombineSingleData()));
}
//task.CanExecute = vm.flag;
//SCRIPT_INVOKE
}
}
private void OnTakeUpdate(ConnModel conn)
{
if (conn.IsConnected)
{
vm.BtnCommand();
//SCRIPT_INVOKE
if (vm.onAirDataModel != null)
{
conn.EndpointManager.Send(String.Format(VizEngineCommands.SCRIPT_INVOKE, "mvpData", vm.CombineSingleData()));
}
}
}
private void task_Start_Click(object sender, RoutedEventArgs e)
{
SinglePlayerView_Init();
task_Start.IsEnabled = false;
task_Stop.IsEnabled = true;
task_continue.IsEnabled = true;
}
private void task_continue_Click(object sender, RoutedEventArgs e)
{
if (task.IsRunning)
{
task.IsRunning = false;
task_continue.Content = "任务继续";
}
else
{
task.IsRunning = true;
task_continue.Content = "任务暂停";
}
task_Start.IsEnabled = false;
task_Stop.IsEnabled = true;
}
private void task_Stop_Click(object sender, RoutedEventArgs e)
{
service.Cancel(task);
task = null;
task_Start.IsEnabled = true;
task_continue.Content = "任务暂停";
task_continue.IsEnabled = false;
task_Stop.IsEnabled = false;
}
}
}
......@@ -230,6 +230,13 @@
</moduel:NewSinglePlayerView>
</Grid>
</TabItem>
<TabItem Header="MVP球员" FontSize="20">
<Grid>
<moduel:MvpPlayerView>
</moduel:MvpPlayerView>
</Grid>
</TabItem>
......
......@@ -131,6 +131,11 @@
<DependentUpon>DateHeaderView.xaml</DependentUpon>
</Compile>
<Compile Include="Main\ViewModel\MainViewModel.cs" />
<Compile Include="MVPPlayer\MvpPlayerPlugin.cs" />
<Compile Include="MVPPlayer\ViewModel\MvpPlayerViewModel.cs" />
<Compile Include="MVPPlayer\View\MvpPlayerView.xaml.cs">
<DependentUpon>MvpPlayerView.xaml</DependentUpon>
</Compile>
<Compile Include="OnAirData\Events.cs" />
<Compile Include="OnAirData\LivePlayerStatH.cs" />
<Compile Include="OnAirData\LivePlayerStatV.cs" />
......@@ -309,6 +314,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MVPPlayer\View\MvpPlayerView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="PlayerCompare\View\NewPlayerComPareView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment