private static ServiceNode ServiceNode() { var graph = new ScaffoldGraph(); var typeRef = graph.BeginNode<TypeReferenceNode>("ViewCreatedEvent").EndNode(); graph.BeginNode<ServiceNode>("MyService"); HandlersReference handler; graph.AddItem<HandlersReference>("ViewCreatedEvent", out handler); handler.SourceIdentifier = typeRef.Identifier; var service = graph.EndNode() as ServiceNode; return service; }
private static ServiceNode ServiceNode() { var graph = new ScaffoldGraph(); var typeRef = graph.BeginNode <TypeReferenceNode>("ViewCreatedEvent").EndNode(); graph.BeginNode <ServiceNode>("MyService"); HandlersReference handler; graph.AddItem <HandlersReference>("ViewCreatedEvent", out handler); handler.SourceIdentifier = typeRef.Identifier; var service = graph.EndNode() as ServiceNode; return(service); }
private static ScaffoldGraph ScaffoldComputed(out ElementNode ele) { var scaffoldComputed = new ScaffoldGraph() {Name = "Computed Property Scaffold"}; PropertiesChildItem healthProperty; var element = scaffoldComputed .BeginNode<ElementNode>("Player") .AddItem("Health", out healthProperty, "float") .EndNode(); var computed = scaffoldComputed .BeginNode<ComputedPropertyNode>("IsDead") .EndNode(); scaffoldComputed.AddConnection(healthProperty, computed); ele = element as ElementNode; return scaffoldComputed; }
public override void GetContent(IDocumentationBuilder _) { base.GetContent(_); var graph = new ScaffoldGraph(); var node = graph.BeginNode <SceneTypeNode>("UIScene").EndNode() as SceneTypeNode; _.Paragraph("Scene Types exist on the root game object of a scene. These components need to live on the root game-object of the scene. This allows uFrame to know what scene has been loaded and to keep a reference for removing this scene when needed."); _.Title2("Generated Scene Types"); _.Paragraph("The scene type is a mono behaviour that will go on your root scene object. This allows uFrame to associate a game object so it can easily be destroyed when you want to unload a scene. This also allows uFrame to listen for when the scene has actually been loaded."); _.Break(); _.TemplateExample <SceneTemplate, SceneTypeNode>(node, true); _.Break(); _.Title2("Generated Scene Loaders"); _.Paragraph("A scene loader is generated for every scene type that exists in the graph."); _.Paragraph("The scene loader lives as a gameobject on the uFrame Kernel, when the same corresponding 'Scene Type' has been loaded," + " the scene loader will get a reference to the scene type and allow you to load it accordingly. This gives very fine grained " + "control on how scenes are loaded and unloaded."); _.Break(); _.TemplateExample <SceneLoaderTemplate, SceneTypeNode>(node, true); _.AlsoSeePages(typeof(UsingSceneLoaders)); }
private static ScaffoldGraph ScaffoldComputed(out ElementNode ele) { var scaffoldComputed = new ScaffoldGraph() { Name = "Computed Property Scaffold" }; PropertiesChildItem healthProperty; var element = scaffoldComputed .BeginNode <ElementNode>("Player") .AddItem("Health", out healthProperty, "float") .EndNode(); var computed = scaffoldComputed .BeginNode <ComputedPropertyNode>("IsDead") .EndNode(); scaffoldComputed.AddConnection(healthProperty, computed); ele = element as ElementNode; return(scaffoldComputed); }
public override void GetContent(IDocumentationBuilder _) { base.GetContent(_); _.Paragraph("System loaders are used to setup the uFrame Runtime with any dependencies it might need before the game begins."); _.Break(); _.Title2("Custom System Loaders"); _.Paragraph("In some cases creating a custom system loader can be very useful for different environments. e.g. Dev Environment, Production Environment..etc"); _.Paragraph("To create a custom system loader, derive from SystemLoader, override the load method, and add it to the kernel."); _.Break(); _.Break(); _.Title2("Generated System Loaders From Subsystems"); _.Paragraph("All subsystem nodes inside a project will generate a 'SystemLoader'. These register an instance of every element " + "controller that lives inside of it, as well as any 'Instances' defined on it."); _.Break(); var graph = new ScaffoldGraph(); InstancesReference instance; graph.BeginNode <SubsystemNode>(Name) .AddItem <InstancesReference>("MyInstance", out instance); var subsystem = graph.EndNode(); graph.BeginNode <ElementNode>("Player"); var playerNode = graph.EndNode(); graph.PushFilter(subsystem); graph.SetItemLocation(playerNode, new Vector2(10f, 10f)); instance.SourceIdentifier = playerNode.Identifier; _.TemplateExample <SystemLoaderTemplate, SubsystemNode>(subsystem as SubsystemNode, true, "Load"); }
public override void GetContent(Invert.Core.GraphDesigner.IDocumentationBuilder _) { base.GetContent(_); _.Paragraph("Usually a property binding is a one-way stream of information, where a View is simply receiving information about a property's changing values. In a game environment however, there are times where it makes sense to allow Views to actually determine these values as well, for things like a GameObject's position, rotation, etc. This is where two-way bindings are needed."); _.Paragraph("Scene Properties are two-way bindings, and allows for a View to calculate and set a property on its ViewModel. This is done in an observable way, and when adding a scene property to a view, 3 specific methods are made available. For example, adding a Position scene property on a PlayerView will result in these underlying base methods:"); var graph = new ScaffoldGraph(); PropertiesChildItem positionProperty; var player = graph.BeginNode <ElementNode>("Player") .AddItem("Position", out positionProperty, "Vector3") .EndNode(); var view = (ViewNode)graph .BeginNode <ViewNode>("PlayerView") .EndNode() ; graph.AddConnection(player, view.ElementInputSlot); graph.AddConnection(positionProperty, view.ScenePropertiesInputSlot); _.Break(); _.Title2("Under the hood. Generated Scene Properties"); _.TemplateExample <ViewTemplate, ViewNode>(view, true, new [] { "ResetProperty", "CalculateProperty", "GetPropertyObservable", "Bind" }); _.Break(); _.Title3("ResetPosition"); _.Paragraph("ResetPosition() is mostly used to initialize the binding, is called in the View's base Bind() method, and typically doesn't need to be overridden and altered."); _.Break(); _.Title3("CalculatePosition"); _.Paragraph("CalculatePosition() is the main method you would override on your generated PlayerView, where you would return a Vector3 to give the player's position."); _.ShowGist("2e5c9b6d07b76bcaedb1", "CalculatePosition.cs"); _.Break(); _.Title3("GetPositionObservable"); _.Paragraph("GetPositionObservable() should only be overridden in cases where you have a more convenient or performant method of observing the scene property change, because as you see, this calculation is happening every Update by default. In this case, we know that ViewBase is already monitoring a TransformChangedObservable (and specifically a PositionChangedObservable as well), so on our PlayerView we would override the GetPositionObservable like this:"); _.ShowGist("3d0e2f8bd65a044e82d6", "GetPositionObservable.cs"); _.Break(); }
public override void GetContent(Invert.Core.GraphDesigner.IDocumentationBuilder _) { base.GetContent(_); _.Paragraph("Usually a property binding is a one-way stream of information, where a View is simply receiving information about a property's changing values. In a game environment however, there are times where it makes sense to allow Views to actually determine these values as well, for things like a GameObject's position, rotation, etc. This is where two-way bindings are needed."); _.Paragraph("Scene Properties are two-way bindings, and allows for a View to calculate and set a property on its ViewModel. This is done in an observable way, and when adding a scene property to a view, 3 specific methods are made available. For example, adding a Position scene property on a PlayerView will result in these underlying base methods:"); var graph = new ScaffoldGraph(); PropertiesChildItem positionProperty; var player = graph.BeginNode<ElementNode>("Player") .AddItem("Position", out positionProperty, "Vector3") .EndNode(); var view = (ViewNode) graph .BeginNode<ViewNode>("PlayerView") .EndNode() ; graph.AddConnection(player, view.ElementInputSlot); graph.AddConnection(positionProperty,view.ScenePropertiesInputSlot); _.Break(); _.Title2("Under the hood. Generated Scene Properties"); _.TemplateExample<ViewTemplate, ViewNode>(view, true,new [] {"ResetProperty", "CalculateProperty", "GetPropertyObservable", "Bind"}); _.Break(); _.Title3("ResetPosition"); _.Paragraph("ResetPosition() is mostly used to initialize the binding, is called in the View's base Bind() method, and typically doesn't need to be overridden and altered."); _.Break(); _.Title3("CalculatePosition"); _.Paragraph("CalculatePosition() is the main method you would override on your generated PlayerView, where you would return a Vector3 to give the player's position."); _.ShowGist("2e5c9b6d07b76bcaedb1","CalculatePosition.cs"); _.Break(); _.Title3("GetPositionObservable"); _.Paragraph("GetPositionObservable() should only be overridden in cases where you have a more convenient or performant method of observing the scene property change, because as you see, this calculation is happening every Update by default. In this case, we know that ViewBase is already monitoring a TransformChangedObservable (and specifically a PositionChangedObservable as well), so on our PlayerView we would override the GetPositionObservable like this:"); _.ShowGist("3d0e2f8bd65a044e82d6","GetPositionObservable.cs"); _.Break(); }
public override void GetContent(IDocumentationBuilder _) { base.GetContent(_); var graph = new ScaffoldGraph(); var node = graph.BeginNode<SceneTypeNode>("UIScene").EndNode() as SceneTypeNode; _.Paragraph("Scene Types exist on the root game object of a scene. These components need to live on the root game-object of the scene. This allows uFrame to know what scene has been loaded and to keep a reference for removing this scene when needed."); _.Title2("Generated Scene Types"); _.Paragraph("The scene type is a mono behaviour that will go on your root scene object. This allows uFrame to associate a game object so it can easily be destroyed when you want to unload a scene. This also allows uFrame to listen for when the scene has actually been loaded."); _.Break(); _.TemplateExample<SceneTemplate, SceneTypeNode>(node, true); _.Break(); _.Title2("Generated Scene Loaders"); _.Paragraph("A scene loader is generated for every scene type that exists in the graph."); _.Paragraph("The scene loader lives as a gameobject on the uFrame Kernel, when the same corresponding 'Scene Type' has been loaded," + " the scene loader will get a reference to the scene type and allow you to load it accordingly. This gives very fine grained " + "control on how scenes are loaded and unloaded."); _.Break(); _.TemplateExample<SceneLoaderTemplate, SceneTypeNode>(node, true); _.AlsoSeePages(typeof(UsingSceneLoaders)); }