修改3D默认飞机颜色
修复任务双击快进自动退出的bug 2D/3D切换飞机如果不动就没刷新位置的bug
This commit is contained in:
parent
d525f00222
commit
23c1390758
@ -538,9 +538,11 @@ namespace Plane.FormationCreator.Formation
|
|||||||
public async Task FlyToTasks()
|
public async Task FlyToTasks()
|
||||||
{
|
{
|
||||||
var copters = _copterManager.Copters;
|
var copters = _copterManager.Copters;
|
||||||
if ((TaskState == TasksStatus.Stop))
|
if ((SelectedTaskIndex==-1) ||(TaskState == TasksStatus.Stop))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int vSelectedTaskIndex= SelectedTaskIndex;
|
||||||
|
|
||||||
Pause();
|
Pause();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
//等待暂停或2s超时(80*25ms)
|
//等待暂停或2s超时(80*25ms)
|
||||||
@ -549,6 +551,8 @@ namespace Plane.FormationCreator.Formation
|
|||||||
await Task.Delay(25).ConfigureAwait(false);
|
await Task.Delay(25).ConfigureAwait(false);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
if (SelectedTaskIndex == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
if (TaskState == TasksStatus.Paused)
|
if (TaskState == TasksStatus.Paused)
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,7 @@ using Newtonsoft.Json;
|
|||||||
using Plane.Geography;
|
using Plane.Geography;
|
||||||
using Plane.FormationCreator.Views;
|
using Plane.FormationCreator.Views;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using Plane.Collections;
|
||||||
|
|
||||||
namespace Plane.FormationCreator.ViewModels
|
namespace Plane.FormationCreator.ViewModels
|
||||||
{
|
{
|
||||||
@ -279,6 +280,8 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
b2DMapMode = true;
|
b2DMapMode = true;
|
||||||
_flightTaskManager.TaskRun_2D = b2DMapMode; //2D模式模拟显示
|
_flightTaskManager.TaskRun_2D = b2DMapMode; //2D模式模拟显示
|
||||||
}
|
}
|
||||||
|
//强制刷新飞机位置
|
||||||
|
_copterManager.Copters.ForEach(copter => copter.RefreashLoc());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,17 +67,6 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private ICommand _flyTotaskCommand;
|
|
||||||
public ICommand flyTotaskCommand
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _flyTotaskCommand ?? (_flyTotaskCommand = new RelayCommand(async () =>
|
|
||||||
{
|
|
||||||
await _flightTaskManager.FlyToTasks();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private ICommand _renametaskCommand;
|
private ICommand _renametaskCommand;
|
||||||
|
@ -134,7 +134,7 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
_flightTaskManager.Orientation + 180,
|
_flightTaskManager.Orientation + 180,
|
||||||
midColDistance * 2);
|
midColDistance * 2);
|
||||||
}
|
}
|
||||||
|
//没有这架飞机就加入
|
||||||
if (!planeModel3Ds.ContainsKey(copter))
|
if (!planeModel3Ds.ContainsKey(copter))
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -158,19 +158,23 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
x *= _copterManager.scale3d;
|
x *= _copterManager.scale3d;
|
||||||
y *= _copterManager.scale3d;
|
y *= _copterManager.scale3d;
|
||||||
z *= _copterManager.scale3d;
|
z *= _copterManager.scale3d;
|
||||||
|
Color color ;
|
||||||
|
if (copter.LEDColor != null && copter.LEDColor != "")
|
||||||
|
color = (Color)ColorConverter.ConvertFromString("#" + copter.LEDColor);
|
||||||
|
else
|
||||||
|
color = (Color)ColorConverter.ConvertFromString("#" + CopterManager.CopterDefaultColor);
|
||||||
var model3D = new GeometryModel3D
|
var model3D = new GeometryModel3D
|
||||||
{
|
{
|
||||||
Geometry = meshwaypoint,
|
Geometry = meshwaypoint,
|
||||||
Transform = new TranslateTransform3D(x, y, z),
|
Transform = new TranslateTransform3D(x, y, z),
|
||||||
Material = MaterialHelper.CreateMaterial(Color.FromRgb(238, 210, 238)),
|
Material = MaterialHelper.CreateMaterial(color),
|
||||||
BackMaterial = MaterialHelper.CreateMaterial(Color.FromRgb(238, 210, 238))
|
BackMaterial = MaterialHelper.CreateMaterial(color)
|
||||||
};
|
};
|
||||||
|
|
||||||
planeModel3Ds.Add(copter, model3D);
|
planeModel3Ds.Add(copter, model3D);
|
||||||
planeGroup.Children.Add(model3D);
|
planeGroup.Children.Add(model3D);
|
||||||
}
|
}
|
||||||
|
//有飞机在视图里就移动位置
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -194,19 +198,14 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
panle3D.Transform = new TranslateTransform3D(x, y, z);
|
panle3D.Transform = new TranslateTransform3D(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Color color;
|
||||||
if (copter.LEDColor != null && copter.LEDColor != "")
|
if (copter.LEDColor != null && copter.LEDColor != "")
|
||||||
{
|
color = (Color)ColorConverter.ConvertFromString("#" + copter.LEDColor);
|
||||||
|
else
|
||||||
|
color = (Color)ColorConverter.ConvertFromString("#" + CopterManager.CopterDefaultColor);
|
||||||
|
panle3D.Material = MaterialHelper.CreateMaterial(color);
|
||||||
|
panle3D.BackMaterial = MaterialHelper.CreateMaterial(color);
|
||||||
|
|
||||||
Color color;
|
|
||||||
//3D在地面不能显示黑色,要不看不清楚
|
|
||||||
if (copter.Altitude==0.0f)
|
|
||||||
color = (Color)ColorConverter.ConvertFromString("#FFFFFF");
|
|
||||||
else
|
|
||||||
color = (Color)ColorConverter.ConvertFromString("#" + copter.LEDColor);
|
|
||||||
panle3D.Material = MaterialHelper.CreateMaterial(color);
|
|
||||||
panle3D.BackMaterial = MaterialHelper.CreateMaterial(color);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Message.Show("添加3D飞机:" + copter.Name);
|
//Message.Show("添加3D飞机:" + copter.Name);
|
||||||
|
Loading…
Reference in New Issue
Block a user