本文整理汇总了C#中Scene.AddManager方法的典型用法代码示例。如果您正苦于以下问题:C# Scene.AddManager方法的具体用法?C# Scene.AddManager怎么用?C# Scene.AddManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scene
的用法示例。
在下文中一共展示了Scene.AddManager方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateScene
private Scene CreateScene(ParseTreeNode node)
{
Scene scene = new Scene(grammar.GetName(node));
foreach (Tuple<string, object> attribute in GetProperties(node))
{
ParseTreeNode attributeNode = (ParseTreeNode)attribute.Item2;
scene.AddAttribute(new Attribute(attribute.Item1) { Value = new Value(getStrVal(attributeNode)) });
}
foreach (ParseTreeNode managerNode in grammar.GetOfType(node, grammar.Manager))
{
Manager manager = CreateManager(managerNode);
scene.AddManager(manager);
}
foreach (ParseTreeNode entityNode in grammar.GetOfType(node, grammar.Entity))
{
Entity entity = CreateEntity(entityNode, scene, false);
scene.AddEntity(entity);
}
return scene;
}
示例2: Workspace
private Workspace()
{
Plugins = new ObservableCollection<Plugin>();
Services = new FilteredObservableCollection<Plugin>(Plugins, p => p.Type == PluginType.Service);
Managers = new FilteredObservableCollection<Plugin>(Plugins, p => p.Type == PluginType.Manager);
Components = new FilteredObservableCollection<Plugin>(Plugins, p => p.Type == PluginType.Component);
Events = new ObservableCollection<StatementFactory>();
Actions = new ObservableCollection<StatementFactory>();
Statements = new ObservableCollection<StatementFactory>();
NewProjectCommand = new DelegateCommand(null, p =>
{
var create = true;
if (null != Project && CommandHistory.HasUnsavedChanges)
{
DialogService.Warn(Messages.NewProject, Messages.UnsavedMessage, MessageBoxButton.YesNoCancel, r =>
{
if (r == MessageBoxResult.Yes)
{
SaveProject();
}
else if (r == MessageBoxResult.Cancel)
{
create = false;
}
});
}
if (create)
{
Game game = new Game("Untitled Game");
KglGameStorage.AddDefaultUsings(game);
var service = new Service(GetPlugin(typeof(RenderService)));
service.SetProperty("Width", new Value(800, true));
service.SetProperty("Height", new Value(600, true));
game.AddService(service);
var scene = new Scene("Scene1");
var manager = new Manager(GetPlugin(typeof(RenderManager)));
scene.AddManager(manager);
game.AddScene(scene);
game.FirstScene = scene;
Project project = new Project();
project.Game = game;
DialogService.ShowDialog<ProjectDialog>(project, (result) =>
{
if (result == true)
{
ProjectStorage.CreateProject(project);
Project = project;
}
});
}
});
LoadProjectCommand = new DelegateCommand(null, p =>
{
var load = true;
if (null != Project && CommandHistory.HasUnsavedChanges)
{
DialogService.Warn(Messages.LoadProject, Messages.UnsavedMessage, MessageBoxButton.YesNoCancel, r =>
{
if (r == MessageBoxResult.Yes)
{
SaveProject();
}
else if (r == MessageBoxResult.Cancel)
{
load = false;
}
});
}
if (load)
{
DialogService.ShowLoadDialog((result, fileName) =>
{
if (result == true)
{
try
{
LoadProject(fileName);
}
catch (EditorException e)
{
DialogService.Warn(Messages.FailedToLoad, e.Message, MessageBoxButton.OK);
}
}
});
}
});
//.........这里部分代码省略.........