Commit 88c5bb42 by liulongfei

切换场景支持

parent 8751edaf
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
using VIZ.Package.Service;
using VIZ.Package.Storage;
namespace VIZ.Package.Module
{
/// <summary>
/// 播出控制控制器
/// </summary>
public class ControlController
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(ControlController));
/// <summary>
/// Viz命令服务
/// </summary>
private VizCommandService vizCommandService = new VizCommandService();
/// <summary>
/// Viz控制对象命令服务
/// </summary>
private VizCommandControlObjectService vizCommandControlObjectService = new VizCommandControlObjectService();
// ---------------------------------------------------------------------------
// 上版
/// <summary>
/// 上版 -- 正常板子
/// </summary>
/// <param name="obj">控制对象</param>
/// <param name="view">插件视图</param>
/// <param name="conn">连接</param>
public void TakeNormal(ControlObjectModel obj, IPluginView view, ConnModel conn)
{
this.vizCommandService.SetEnabledUpdate(conn, false);
try
{
this.vizCommandService.SetObject(conn, ApplicationDomainEx.CurrentPage.ScenePath, ApplicationDomainEx.CurrentPage.Layer);
if (obj != null)
{
this.vizCommandControlObjectService.SetControlObject(conn, obj);
this.vizCommandControlObjectService.SetCustomControlFieldValue(conn, obj.AllFiledNodes);
}
if (view != null)
{
view.TakIn(conn);
}
}
catch (Exception ex)
{
log.Error(ex);
}
this.vizCommandService.SetEnabledUpdate(conn, true);
this.vizCommandService.Start(conn, ApplicationDomainEx.CurrentPage.Layer);
}
/// <summary>
/// 上版 -- 切换逻辑
/// </summary>
/// <param name="obj">控制对象</param>
/// <param name="view">插件视图</param>
/// <param name="conn">连接</param>
public void TakeTransitionLogic(ControlObjectModel obj, IPluginView view, ConnModel conn)
{
string scenePathDir = ApplicationDomainEx.CurrentPage.ScenePath.Substring(0, ApplicationDomainEx.CurrentPage.ScenePath.LastIndexOf('/'));
string bgScenePath = $"{scenePathDir}/{ApplicationDomainEx.CurrentPage.BackgroundScene}";
this.vizCommandService.SetEnabledUpdate(conn, true);
this.vizCommandService.SetObject(conn, bgScenePath, VizLayer.MAIN_LAYER);
this.vizCommandService.ToggleResetWithTransitionLogic(conn, ApplicationDomainEx.CurrentPage);
this.vizCommandService.ToggleSetGeomWithTransitionLogic(conn, ApplicationDomainEx.CurrentPage);
if (obj != null)
{
this.vizCommandControlObjectService.SetControlObjectOtherWithTransitionLogic(conn, obj, ApplicationDomainEx.CurrentPage);
this.vizCommandControlObjectService.SetCustomControlObjectWithTransitionLogic(conn, obj, ApplicationDomainEx.CurrentPage);
}
if (view != null)
{
view.TakIn(conn);
}
this.vizCommandService.DirectorShowWithTransitionLogic(conn, ApplicationDomainEx.CurrentPage);
this.vizCommandService.DirectorGotoTrioWithTransitionLogic(conn, ApplicationDomainEx.CurrentPage, "O", ApplicationDomainEx.CurrentPage.StateIdentifier);
}
// ---------------------------------------------------------------------------
// 继续
/// <summary>
/// 继续 -- 正常板子
/// </summary>
/// <param name="obj">控制对象</param>
/// <param name="view">插件视图</param>
/// <param name="conn">连接</param>
public void ContinueNormal(ControlObjectModel obj, IPluginView view, ConnModel conn)
{
this.vizCommandService.TakeContinue(conn, ApplicationDomainEx.CurrentPage.Layer);
view?.TakeContinue(conn);
}
/// <summary>
/// 继续 -- 切换逻辑
/// </summary>
/// <param name="obj">控制对象</param>
/// <param name="view">插件视图</param>
/// <param name="conn">连接</param>
public void ContinueTransitionLogic(ControlObjectModel obj, IPluginView view, ConnModel conn)
{
this.vizCommandService.SetEnabledUpdate(conn, true);
this.vizCommandService.ToggleContinueWithTransitionLogic(conn, ApplicationDomainEx.CurrentPage);
if (view != null)
{
view.TakeContinue(conn);
}
}
// ---------------------------------------------------------------------------
// 下板
/// <summary>
/// 下板 -- 正常板子
/// </summary>
/// <param name="obj">控制对象</param>
/// <param name="view">插件视图</param>
/// <param name="conn">连接</param>
public void TakeOutNormal(ControlObjectModel obj, IPluginView view, ConnModel conn)
{
this.vizCommandService.TakeOut(conn, ApplicationDomainEx.CurrentPage.Layer);
view?.TakeOut(conn);
}
/// <summary>
/// 下板 -- 切换逻辑
/// </summary>
/// <param name="obj">控制对象</param>
/// <param name="view">插件视图</param>
/// <param name="conn">连接</param>
public void TakeOutTransitionLogic(ControlObjectModel obj, IPluginView view, ConnModel conn)
{
string scenePathDir = ApplicationDomainEx.CurrentPage.ScenePath.Substring(0, ApplicationDomainEx.CurrentPage.ScenePath.LastIndexOf('/'));
string bgScenePath = $"{scenePathDir}/{ApplicationDomainEx.CurrentPage.BackgroundScene}";
this.vizCommandService.SetEnabledUpdate(conn, true);
this.vizCommandService.SetObject(conn, bgScenePath, VizLayer.MAIN_LAYER);
this.vizCommandService.ToggleSetWithTransitionLogic(conn, ApplicationDomainEx.CurrentPage);
this.vizCommandService.DirectorGotoTrioWithTransitionLogic(conn, ApplicationDomainEx.CurrentPage, ApplicationDomainEx.CurrentPage.StateIdentifier, "O");
view?.TakeOut(conn);
}
// ---------------------------------------------------------------------------
// 更新
/// <summary>
/// 更新 -- 正常板子
/// </summary>
/// <param name="obj">控制对象</param>
/// <param name="view">插件视图</param>
/// <param name="conn">连接</param>
public void UpdateNormal(ControlObjectModel obj, IPluginView view, ConnModel conn)
{
this.vizCommandService.SetEnabledUpdate(conn, false);
try
{
if (obj != null)
{
this.vizCommandControlObjectService.SetControlObject(conn, obj);
this.vizCommandControlObjectService.SetCustomControlFieldValue(conn, obj.AllFiledNodes);
}
view?.TakeUpdate(conn);
}
catch (Exception ex)
{
log.Error(ex);
}
this.vizCommandService.SetEnabledUpdate(conn, true);
}
/// <summary>
/// 更新 -- 切换逻辑
/// </summary>
/// <param name="obj">控制对象</param>
/// <param name="view">插件视图</param>
/// <param name="conn">连接</param>
public void UpdateTransitionLogic(ControlObjectModel obj, IPluginView view, ConnModel conn)
{
string scenePathDir = ApplicationDomainEx.CurrentPage.ScenePath.Substring(0, ApplicationDomainEx.CurrentPage.ScenePath.LastIndexOf('/'));
string bgScenePath = $"{scenePathDir}/{ApplicationDomainEx.CurrentPage.BackgroundScene}";
this.vizCommandService.SetEnabledUpdate(conn, true);
this.vizCommandService.SetObject(conn, bgScenePath, VizLayer.MAIN_LAYER);
if (obj != null)
{
this.vizCommandControlObjectService.SetControlObjectCurrentWithTransitionLogic(conn, obj, ApplicationDomainEx.CurrentPage);
this.vizCommandControlObjectService.SetCustomControlObjectWithTransitionLogic(conn, obj, ApplicationDomainEx.CurrentPage);
}
if (view != null)
{
view.TakeUpdate(conn);
}
}
}
}
......@@ -73,6 +73,11 @@ namespace VIZ.Package.Module
/// </summary>
private RecordLogService recordLogService = new RecordLogService();
/// <summary>
/// 播出控制器
/// </summary>
private ControlController controlController = new ControlController();
// ==============================================================
// Property
// ==============================================================
......@@ -108,26 +113,14 @@ namespace VIZ.Package.Module
this.Execute(
action: (obj, view, conn) =>
{
this.vizCommandService.SetEnabledUpdate(conn, false);
try
if (obj.TransitionLogic)
{
this.vizCommandService.SetObject(conn, ApplicationDomainEx.CurrentPage.ScenePath, ApplicationDomainEx.CurrentPage.Layer);
if (obj != null)
{
this.vizCommandControlObjectService.SetControlObject(conn, obj);
this.vizCommandControlObjectService.SetCustomControlFieldValue(conn, obj.AllFiledNodes);
}
if (view != null)
{
view.TakIn(conn);
}
this.controlController.TakeTransitionLogic(obj, view, conn);
}
catch (Exception ex)
else
{
log.Error(ex);
this.controlController.TakeNormal(obj, view, conn);
}
this.vizCommandService.SetEnabledUpdate(conn, true);
this.vizCommandService.Start(conn, ApplicationDomainEx.CurrentPage.Layer);
},
over: () =>
{
......@@ -169,8 +162,14 @@ namespace VIZ.Package.Module
this.Execute(
action: (obj, view, conn) =>
{
this.vizCommandService.TakeContinue(conn, ApplicationDomainEx.CurrentPage.Layer);
view?.TakeContinue(conn);
if (obj.TransitionLogic)
{
this.controlController.ContinueTransitionLogic(obj, view, conn);
}
else
{
this.controlController.ContinueNormal(obj, view, conn);
}
},
over: null);
}
......@@ -195,8 +194,14 @@ namespace VIZ.Package.Module
this.Execute(
action: (obj, view, conn) =>
{
this.vizCommandService.TakeOut(conn, ApplicationDomainEx.CurrentPage.Layer);
view?.TakeOut(conn);
if (obj.TransitionLogic)
{
this.controlController.TakeOutTransitionLogic(obj, view, conn);
}
else
{
this.controlController.TakeOutNormal(obj, view, conn);
}
},
over: () =>
{
......@@ -241,21 +246,14 @@ namespace VIZ.Package.Module
this.Execute(
action: (obj, view, conn) =>
{
this.vizCommandService.SetEnabledUpdate(conn, false);
try
if (obj.TransitionLogic)
{
if (obj != null)
{
this.vizCommandControlObjectService.SetControlObject(conn, obj);
this.vizCommandControlObjectService.SetCustomControlFieldValue(conn, obj.AllFiledNodes);
}
view?.TakeUpdate(conn);
this.controlController.UpdateTransitionLogic(obj, view, conn);
}
catch (Exception ex)
else
{
log.Error(ex);
this.controlController.UpdateNormal(obj, view, conn);
}
this.vizCommandService.SetEnabledUpdate(conn, true);
},
over: null);
}
......
......@@ -74,6 +74,10 @@ namespace VIZ.Package.Module
page.PluginID = vm.SelectedTemplatePlugin?.ID;
page.PluginName = vm.SelectedTemplatePlugin?.Name;
page.PageNum = pageGroup.Pages.Count == 0 ? 1 : (pageGroup.Pages.MaxOrDefault(p => p.PageNum) + 1);
page.TransitionLogic = template.TransitionLogic;
page.LayerIdentifier = template.LayerIdentifier;
page.StateIdentifier = template.StateIdentifier;
page.BackgroundScene = template.BackgroundScene;
// 关联连接分组
ConnGroupModel conn = ApplicationDomainEx.ConnGroups?.FirstOrDefault(p => p.IsDefault);
......
......@@ -22,7 +22,27 @@
<fcore:Bool2ControlTemplateConverter x:Key="Bool2ControlTemplateConverter_Layer">
<fcore:Bool2ControlTemplateConverter.TrueResult>
<ControlTemplate>
<dxe:TextEdit EditValue="{Binding Path=LayerIdentifier}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="2,0,2,0" IsReadOnly="True"></dxe:TextEdit>
<dxe:TextEdit EditValue="{Binding Path=LayerIdentifier}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="2,0,2,0" IsReadOnly="True">
<dxe:TextEdit.ToolTip>
<Grid Height="75" MinWidth="220">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="110"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Layer identifier:" Foreground="#88ffffff" HorizontalAlignment="Right"></TextBlock>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=Row.LayerIdentifier,Mode=OneWay}" Margin="10,0,10,0"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="0" Text="State identifier:" Foreground="#88ffffff" HorizontalAlignment="Right"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=Row.StateIdentifier,Mode=OneWay}" Margin="10,0,10,0"></TextBlock>
<TextBlock Grid.Row="2" Grid.Column="0" Text="Background scene:" Foreground="#88ffffff" HorizontalAlignment="Right"></TextBlock>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Path=Row.BackgroundScene,Mode=OneWay}" Margin="10,0,10,0"></TextBlock>
</Grid>
</dxe:TextEdit.ToolTip>
</dxe:TextEdit>
</ControlTemplate>
</fcore:Bool2ControlTemplateConverter.TrueResult>
<fcore:Bool2ControlTemplateConverter.FalseResult>
......
......@@ -42,10 +42,32 @@
<fcore:Bool2BoolConverter x:Key="Bool2BoolConverter"></fcore:Bool2BoolConverter>
<!-- 层模板 -->
<!-- 层模板 -->
<fcore:Bool2ControlTemplateConverter x:Key="Bool2ControlTemplateConverter_LayerColumnCellTemplate">
<fcore:Bool2ControlTemplateConverter.TrueResult>
<ControlTemplate>
<TextBlock Text="{Binding Path=Row.LayerIdentifier}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,0,4,0"></TextBlock>
<Border Background="Transparent">
<TextBlock Text="{Binding Path=Row.LayerIdentifier}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,0,4,0"></TextBlock>
<Border.ToolTip>
<Grid Height="75" MinWidth="220">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="110"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Layer identifier:" Foreground="#88ffffff" HorizontalAlignment="Right"></TextBlock>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=Row.LayerIdentifier,Mode=OneWay}" Margin="10,0,10,0"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="0" Text="State identifier:" Foreground="#88ffffff" HorizontalAlignment="Right"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=Row.StateIdentifier,Mode=OneWay}" Margin="10,0,10,0"></TextBlock>
<TextBlock Grid.Row="2" Grid.Column="0" Text="Background scene:" Foreground="#88ffffff" HorizontalAlignment="Right"></TextBlock>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Path=Row.BackgroundScene,Mode=OneWay}" Margin="10,0,10,0"></TextBlock>
</Grid>
</Border.ToolTip>
</Border>
</ControlTemplate>
</fcore:Bool2ControlTemplateConverter.TrueResult>
<fcore:Bool2ControlTemplateConverter.FalseResult>
......@@ -58,7 +80,28 @@
<fcore:Bool2ControlTemplateConverter x:Key="Bool2ControlTemplateConverter_LayerColumnCellEditTemplate">
<fcore:Bool2ControlTemplateConverter.TrueResult>
<ControlTemplate>
<TextBlock Text="{Binding Path=Row.LayerIdentifier}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,0,4,0"></TextBlock>
<Border Background="Transparent">
<TextBlock Text="{Binding Path=Row.LayerIdentifier}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,0,4,0"></TextBlock>
<Border.ToolTip>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Layer identifier:" Foreground="#aaffffff"></TextBlock>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=Row.LayerIdentifier,Mode=OneWay}"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="0" Text="State identifier:" Foreground="#aaffffff"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=Row.StateIdentifier,Mode=OneWay}"></TextBlock>
<TextBlock Grid.Row="2" Grid.Column="0" Text="Background scene:" Foreground="#aaffffff"></TextBlock>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Path=Row.BackgroundScene,Mode=OneWay}"></TextBlock>
</Grid>
</Border.ToolTip>
</Border>
</ControlTemplate>
</fcore:Bool2ControlTemplateConverter.TrueResult>
<fcore:Bool2ControlTemplateConverter.FalseResult>
......
......@@ -1002,6 +1002,7 @@ namespace VIZ.Package.Module
// 根据模板拷贝页
PageModel destPage = this.pageModelCopyController.CopyPage(template, vm, this.SelectedPageGroupModel);
// 页码
destPage.PageNum = this.SelectedPageGroupModel.Pages.MaxOrDefault(p => p.PageNum) + 1;
......
......@@ -39,7 +39,28 @@
<fcore:Bool2ControlTemplateConverter x:Key="Bool2ControlTemplateConverter_LayerColumnCellTemplate">
<fcore:Bool2ControlTemplateConverter.TrueResult>
<ControlTemplate>
<TextBlock Text="{Binding Path=Row.LayerIdentifier}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,0,4,0"></TextBlock>
<Border Background="Transparent">
<TextBlock Text="{Binding Path=Row.LayerIdentifier}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,0,4,0"></TextBlock>
<Border.ToolTip>
<Grid Height="75" MinWidth="220">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="110"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Layer identifier:" Foreground="#88ffffff" HorizontalAlignment="Right"></TextBlock>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=Row.LayerIdentifier,Mode=OneWay}" Margin="10,0,10,0"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="0" Text="State identifier:" Foreground="#88ffffff" HorizontalAlignment="Right"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=Row.StateIdentifier,Mode=OneWay}" Margin="10,0,10,0"></TextBlock>
<TextBlock Grid.Row="2" Grid.Column="0" Text="Background scene:" Foreground="#88ffffff" HorizontalAlignment="Right"></TextBlock>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Path=Row.BackgroundScene,Mode=OneWay}" Margin="10,0,10,0"></TextBlock>
</Grid>
</Border.ToolTip>
</Border>
</ControlTemplate>
</fcore:Bool2ControlTemplateConverter.TrueResult>
<fcore:Bool2ControlTemplateConverter.FalseResult>
......@@ -52,7 +73,28 @@
<fcore:Bool2ControlTemplateConverter x:Key="Bool2ControlTemplateConverter_LayerColumnCellEditTemplate">
<fcore:Bool2ControlTemplateConverter.TrueResult>
<ControlTemplate>
<TextBlock Text="{Binding Path=Row.LayerIdentifier}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,0,4,0"></TextBlock>
<Border Background="Transparent">
<TextBlock Text="{Binding Path=Row.LayerIdentifier}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,0,4,0"></TextBlock>
<Border.ToolTip>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Layer identifier:" Foreground="#aaffffff"></TextBlock>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=Row.LayerIdentifier,Mode=OneWay}"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="0" Text="State identifier:" Foreground="#aaffffff"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=Row.StateIdentifier,Mode=OneWay}"></TextBlock>
<TextBlock Grid.Row="2" Grid.Column="0" Text="Background scene:" Foreground="#aaffffff"></TextBlock>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Path=Row.BackgroundScene,Mode=OneWay}"></TextBlock>
</Grid>
</Border.ToolTip>
</Border>
</ControlTemplate>
</fcore:Bool2ControlTemplateConverter.TrueResult>
<fcore:Bool2ControlTemplateConverter.FalseResult>
......
......@@ -111,6 +111,7 @@
<Compile Include="ControlObject\FieldEdit\Edit\ListEdit\CellEdit\FontListCellEdit.xaml.cs">
<DependentUpon>FontListCellEdit.xaml</DependentUpon>
</Compile>
<Compile Include="Control\Controller\ControlController.cs" />
<Compile Include="Control\Service\IControlService.cs" />
<Compile Include="Help\About\ViewModel\AboutCustomControlFieldWindowModel.cs" />
<Compile Include="Help\About\View\AboutCustomControlFieldWindow.xaml.cs">
......
......@@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
using System.Xml.Linq;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
using VIZ.Package.Storage;
......@@ -407,6 +408,83 @@ namespace VIZ.Package.Service
}
}
// --------------------------------------------------------------------------------------------------
// 切换场景
/// <summary>
/// 设置切换逻辑的控制对象值
/// </summary>
/// <param name="conn">连接</param>
/// <param name="obj">控制对象</param>
/// <param name="pageBase">页</param>
public void SetControlObjectOtherWithTransitionLogic(ConnModel conn, ControlObjectModel obj, PageModelBase pageBase)
{
string scenePathDir = pageBase.ScenePath.Substring(0, pageBase.ScenePath.LastIndexOf('/'));
string bgScenePath = $"{scenePathDir}/{pageBase.BackgroundScene}";
StringBuilder sb = new StringBuilder();
sb.Append($"SCENE*{bgScenePath}*TREE*${pageBase.LayerIdentifier}$other$object*FUNCTION*ControlObject*in SET ON ");
foreach (ControlFieldNodeModel field in obj.AllFiledNodes)
{
// 自定义字段不通过该方法上板
if (field.IsCustom)
continue;
sb.Append($"{field.FieldIdentifier} SET {field.Value}\\0");
}
conn.EndpointManager.Send(sb.ToString());
}
/// <summary>
/// 设置切换逻辑的控制对象值
/// </summary>
/// <param name="conn">连接</param>
/// <param name="obj">控制对象</param>
/// <param name="pageBase">页</param>
public void SetControlObjectCurrentWithTransitionLogic(ConnModel conn, ControlObjectModel obj, PageModelBase pageBase)
{
string scenePathDir = pageBase.ScenePath.Substring(0, pageBase.ScenePath.LastIndexOf('/'));
string bgScenePath = $"{scenePathDir}/{pageBase.BackgroundScene}";
StringBuilder sb = new StringBuilder();
sb.Append($"SCENE*{bgScenePath}*TREE*${pageBase.LayerIdentifier}$current$object*FUNCTION*ControlObject*in SET ON ");
foreach (ControlFieldNodeModel field in obj.AllFiledNodes)
{
// 自定义字段不通过该方法上板
if (field.IsCustom)
continue;
sb.Append($"{field.FieldIdentifier} SET {field.Value}\\0");
}
conn.EndpointManager.Send(sb.ToString());
}
/// <summary>
/// 设置切换逻辑的控制对象值
/// </summary>
/// <param name="conn">连接</param>
/// <param name="obj">控制对象</param>
/// <param name="pageBase">页</param>
public void SetCustomControlObjectWithTransitionLogic(ConnModel conn, ControlObjectModel obj, PageModelBase pageBase)
{
if (obj.AllFiledNodes == null || obj.AllFiledNodes.Count == 0)
return;
List<ControlFieldNodeModel> list = obj.AllFiledNodes.Where(p => p.IsCustom).ToList();
if (list.Count == 0)
return;
// FieldIdentifier|Value*FieldIdentifier|Value
List<string> field_infos = list.Select(p => string.Format("{0}|{1}", p.FieldIdentifier, p.Value)).ToList();
string command = string.Join("*", field_infos);
conn.EndpointManager.Send(string.Format(VizEngineCommands.SCRIPT_INVOKE, ApplicationConstants.VIZ_COMMAND_CUSTOM_CONTROL_FIELD_SET, command));
}
/// <summary>
/// 获取控制字段类型
/// </summary>
......
......@@ -24,7 +24,9 @@ namespace VIZ.Package.Service
if (conn == null)
throw new ArgumentNullException(nameof(conn));
// 需要等待结果
if (string.IsNullOrWhiteSpace(scene))
throw new ArgumentNullException(nameof(scene));
conn.EndpointManager.Request($"RENDERER*{layer} SET_OBJECT SCENE*{scene}");
}
......@@ -35,6 +37,9 @@ namespace VIZ.Package.Service
/// <param name="scene">场景</param>
public void Reload(ConnModel conn, string scene)
{
if (conn == null)
throw new ArgumentNullException(nameof(conn));
conn.EndpointManager.Send($"SCENE**{scene} RELOAD");
}
......@@ -304,6 +309,7 @@ namespace VIZ.Package.Service
return sceneName;
}
/// <summary>
/// 清理页
/// </summary>
......@@ -331,5 +337,128 @@ namespace VIZ.Package.Service
{
return conn.EndpointManager.Request($"SCENE*{scene} LOAD");
}
// --------------------------------------------------------------------------------------------------
// 切换场景
/// <summary>
/// 动画显示
/// </summary>
/// <param name="conn">连接</param>
/// <param name="pageBase">页</param>
public void DirectorShowWithTransitionLogic(ConnModel conn, PageModelBase pageBase)
{
if (conn == null)
throw new ArgumentNullException(nameof(conn));
if (pageBase == null)
throw new ArgumentNullException(nameof(pageBase));
conn.EndpointManager.Send($"RENDERER*MAIN_LAYER*STAGE*DIRECTOR*{pageBase.LayerIdentifier} SHOW ${pageBase.StateIdentifier}");
}
/// <summary>
/// 动画切换
/// </summary>
/// <param name="conn">连接</param>
/// <param name="pageBase">页</param>
/// <param name="from">开始</param>
/// <param name="to">结束</param>
public void DirectorGotoTrioWithTransitionLogic(ConnModel conn, PageModelBase pageBase, string from, string to)
{
if (conn == null)
throw new ArgumentNullException(nameof(conn));
if (pageBase == null)
throw new ArgumentNullException(nameof(pageBase));
conn.EndpointManager.Send($"RENDERER*MAIN_LAYER*STAGE*DIRECTOR*{pageBase.LayerIdentifier} GOTO_TRIO ${from} ${to}");
}
/// <summary>
/// 设置切换逻辑层的GEOM
/// </summary>
/// <param name="conn">连接</param>
/// <param name="pageBase">页</param>
public void ToggleSetGeomWithTransitionLogic(ConnModel conn, PageModelBase pageBase)
{
if (conn == null)
throw new ArgumentNullException(nameof(conn));
if (pageBase == null)
throw new ArgumentNullException(nameof(pageBase));
string scenePathDir = pageBase.ScenePath.Substring(0, pageBase.ScenePath.LastIndexOf('/'));
string bgScenePath = $"{scenePathDir}/{pageBase.BackgroundScene}";
conn.EndpointManager.Send($"SCENE*{bgScenePath}*TREE*${pageBase.LayerIdentifier}*FUNCTION*Toggle*object SET GEOM*{pageBase.ScenePath}");
}
/// <summary>
/// 设置切换逻辑层的对象
/// </summary>
/// <param name="conn">连接</param>
/// <param name="pageBase">页</param>
public void ToggleSetWithTransitionLogic(ConnModel conn, PageModelBase pageBase)
{
if (conn == null)
throw new ArgumentNullException(nameof(conn));
if (pageBase == null)
throw new ArgumentNullException(nameof(pageBase));
string scenePathDir = pageBase.ScenePath.Substring(0, pageBase.ScenePath.LastIndexOf('/'));
string bgScenePath = $"{scenePathDir}/{pageBase.BackgroundScene}";
conn.EndpointManager.Send($"SCENE*{bgScenePath}*TREE*${pageBase.LayerIdentifier}*FUNCTION*Toggle*object SET");
}
/// <summary>
/// 触发切换
/// </summary>
/// <param name="conn">连接</param>
/// <param name="pageBase">页</param>
public void ToggleSwitchWithTransitionLogic(ConnModel conn, PageModelBase pageBase)
{
if (conn == null)
throw new ArgumentNullException(nameof(conn));
if (pageBase == null)
throw new ArgumentNullException(nameof(pageBase));
conn.EndpointManager.Send($"RENDERER*MAIN_LAYER*TREE*${pageBase.LayerIdentifier}*FUNCTION*Toggle*switch INVOKE");
}
/// <summary>
/// 触发重置
/// </summary>
/// <param name="conn">连接</param>
/// <param name="pageBase">页</param>
public void ToggleResetWithTransitionLogic(ConnModel conn, PageModelBase pageBase)
{
if (conn == null)
throw new ArgumentNullException(nameof(conn));
if (pageBase == null)
throw new ArgumentNullException(nameof(pageBase));
conn.EndpointManager.Send($"RENDERER*MAIN_LAYER*TREE*${pageBase.LayerIdentifier}*FUNCTION*Toggle*reset_current INVOKE");
}
/// <summary>
/// 触发继续
/// </summary>
/// <param name="conn">连接</param>
/// <param name="pageBase">页</param>
public void ToggleContinueWithTransitionLogic(ConnModel conn, PageModelBase pageBase)
{
if (conn == null)
throw new ArgumentNullException(nameof(conn));
if (pageBase == null)
throw new ArgumentNullException(nameof(pageBase));
conn.EndpointManager.Send($"RENDERER*MAIN_LAYER*TREE*${pageBase.LayerIdentifier}*FUNCTION*Toggle*continue INVOKE");
}
}
}
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