public override void GetContent(Invert.Core.GraphDesigner.IDocumentationBuilder _)
        {
            base.GetContent(_);
            _.Paragraph("Commands define a property of type ISignal<TCommandClass> on an element.  These act as a delegate to a pre-initialized handler." +
                        "The handlers are setup in the controllers initialize method to point to a method, this makes a controller a factory for a view-model." +
                        "");

            var ele = new ScaffoldGraph()
                .BeginNode<ElementNode>("Player")
                .AddItem<CommandsChildItem>("Hit")
            .EndNode();
            _.Title2("Executing a command from a viewmodel.");
            _.CodeSnippet("MyViewModel.CommandName.OnNext(new {CommandName}Command() { });");
            _.Break();
            _.Title2("Generated Model Commands");
            _.TemplateExample<ViewModelTemplate, ElementNode>(ele as ElementNode, true, "CommandItems", "Bind");
            _.Break();
            _.Title2("Generated Controller Command Handlers");
            _.TemplateExample<ControllerTemplate, ElementNode>(ele as ElementNode, true, "CommandItems", "CommandMethod");
            _.Break();

            _.Break();
            _.Title3("Also See");
            _.LinkToPage<Controllers>();
            _.LinkToPage<CreationAndInitialization>();
        }
Beispiel #2
0
        public override void GetContent(Invert.Core.GraphDesigner.IDocumentationBuilder _)
        {
            base.GetContent(_);

            _.Paragraph("While services can serve for almost any purpose, they can be used to seperate various features of uFrame, and your application. " +
                        "Examples might include, FacebookService, NetworkingService, AchievementsService...etc");
            _.Break();
            _.Paragraph("As a matter of fact, at the time of this writing, uFrame ships with two default services, The 'ViewService', and the 'SceneManagementService'.");

            _.Break();

            _.Paragraph("There is really only one general rule of thumb when implementing services, " +
                        "they should only be listening to events, processing them, and publishing its own " +
                        "events that might be useful to other services.  While you can inject other services " +
                        "and use them directly, it's highly reommended to use events as the means of communication.");
            _.Break();

            _.Title2("Accesing ViewModels in services.");
            _.Paragraph("To access a running list of a specific viewmodel just add this property to any service, and make sure you specify the viewmodel type you need.");
            _.CodeSnippet("[Inject] IViewModelManager<PlayerViewModel> AllPlayers { get;set; }");
            _.LinkToPage<ViewModelManagers>();

            var service = ServiceNode();
            _.Title2("Designer File Implementation");
            _.TemplateExample<ServiceTemplate, ServiceNode>(service);
            _.Break();
            _.Title2("Editable File Implementation");
            _.TemplateExample<ServiceTemplate, ServiceNode>(service,false);
        }
        public override void GetContent(Invert.Core.GraphDesigner.IDocumentationBuilder _)
        {
            base.GetContent(_);
            var ele = new ScaffoldGraph()
            .BeginNode<ElementNode>("Player")
            .AddItem<PropertiesChildItem>("FirstName")
            .AddItem<PropertiesChildItem>("LastName")
            .EndNode();

            _.Title2("Subscribable Properties");
            _.TemplateExample<ViewModelTemplate, ElementNode>(ele as ElementNode, true, "ViewModelProperty");

            _.Title2("Value Wrapper Properties");
            _.TemplateExample<ViewModelTemplate, ElementNode>(ele as ElementNode, true, "ViewModelValueProperty");

            _.Title2("The Bind Method");
            _.TemplateExample<ViewModelTemplate, ElementNode>(ele as ElementNode, true, "Bind");
        }
        public override void GetContent(Invert.Core.GraphDesigner.IDocumentationBuilder _)
        {
            base.GetContent(_);
            _.Paragraph("Collections are a bindable list on a view model that allow anything to be notified when a change occurs to the collection.");

            var ele = new ScaffoldGraph()
                .BeginNode<ElementNode>("Player")
                .AddItem<CollectionsChildItem>("Children")
            .EndNode();

            _.Title2("Generated Model Collections");
            _.TemplateExample<ViewModelTemplate, ElementNode>(ele as ElementNode, true, "CollectionProperty", "Bind");
        }
        public override void GetContent(Invert.Core.GraphDesigner.IDocumentationBuilder _)
        {
            base.GetContent(_);
            ElementNode elementNode;
            ScaffoldComputed(out elementNode);

            _.ImageByUrl("http://i.imgur.com/qeDjrVR.png");
            _.Paragraph("A Computed Property is an extremely powerful feature added to uFrame's ViewModel layer.  These properties can calculate their value based on other properties, and are recalculated whenever one of those change.  So for example, if you have a boolean IsDead computed property on a PlayerViewModel, dependent on a Player.Health property, uFrame will generate these three things on that PlayerViewModel for you to override:");
            _.Break();
            _.Title2("Under the hood");
            _.TemplateExample<ViewModelTemplate, ElementNode>(elementNode, true, "ComputedDependents", "ResetComputed", "Compute");

            _.Title3("ResetIsDead");
            _.Paragraph("Usually fine without overriding, used to set up the computed observable");

            _.Title3("ComputeIsDead");
            _.Paragraph("A \"getter\" used to compute the property, based on dependents");

            _.Title3("GetIsDeadDepedents");
            _.Paragraph("This where you would override and provide additional dependents, if needed");

            _.Break();
            _.Note("It's important to correctly set all the dependents, because the computed only knows when it needs to be recalculated by observing these dependents for changes.  This is done in the diagram by dragging a link from a ViewModel's property to the computed, or in code by overriding the Get{ComputedName}Dependents() function.");
        }
        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();
        }