예제 #1
0
    public override void GetContent(IDocumentationBuilder _)
    {
        base.GetContent(_);

        _.CodeSnippet("var player = this.CreatePlayer()");
        _.Title2("Creating a ViewModel with the Extension Method");
        _.Paragraph("In uframe 1.6 there is an extension method for creating any viewmodel that will use the correct controller to create it.");
        _.CodeSnippet("this.CreateViewModel<PlayerViewModel>()");
        _.Paragraph("This method will resolve the controller and invoke the associated controller's 'Create' method.");
        _.Paragraph("It is important that you use this method because the controller will initialize the commands on the viewmodel to point to the correct handlers on itself.");
        _.Break();

        _.Title2("Initialization Inside Controllers");
        _.Paragraph("Typically you will use the relevant Controller's Initialize{ElementName} function to initialize " +
                    "a newly created ViewModel with default values and references.  It's a great place to subscribe to " +
                    "state changes and \"scene property\" changes, or possibly track a list of ViewModel instances when " +
                    "acting similarly to a manager.");



        _.Break();
        _.Title2("Initialization Inside Views");
        _.Paragraph("For convenience, you also have the option of Initializing a ViewModel from a particular View, by checking Initialize ViewModel on the View.  This is particularly useful when setting up a scene before runtime or creating prefabs.");

        _.Break();
        _.AlsoSeePages(typeof(ViewModelManagers));
    }
예제 #2
0
    public override void GetContent(IDocumentationBuilder _)
    {
        base.GetContent(_);
        _.Paragraph("The uFrame Kernel is an essential piece of uFrame, it handles loading scenes, systems and services.  " +
                    "The kernel is nothing more than a prefab with these types of components attached to it in an organized manner.");

        _.ImageByUrl("http://i.imgur.com/5Rg2X25.png");

        _.Paragraph("In the image above you can see the scene 'BasicsProjectKernelScene'.  This scene will always always contain the 'BasicsProjectKernel' " +
                    "prefab and any other things that need to live throughout the entire lifecycle of your application.");
        _.Paragraph("Important Note: All SystemLoaders, Services, and SceneLoaders are MonoBehaviours attached their corresponding child game-objects in the kernel prefab.");

        _.Note(
            "Whenever a scene begins, uFrame will ensure that the kernel is loaded, if it hasen't been loaded it will delay " +
            "its loading mechanism until the kernel has been loaded. This is necessary because you might initialize ViewModels, deserialize them...etc so the view should not bind until that data is ready.");

        _.Break();

        _.Title2("Scaffolding The Kernel");
        _.Paragraph("For convenience uFrame 1.6 makes the process of creating the kernel very easy and straightforward.  " +
                    "By pressing the Scaffold/Update Kernel button it will create a scene, and a prefab with all of the types created by the uFrame designer.  " +
                    "You can freely modify the kernel, and updating it will only add anything that is not there.");
        _.Break();

        _.Title2("Boot Order");
        _.ImageByUrl("http://i.imgur.com/L5CC8q8.png");

        _.Title2("The Game Ready Event");
        _.Paragraph("Once the kernal has loaded, it will publish the event 'GameReadyEvent'.  This event ensures that everything is loaded and bindings have properly taken place on views.");
    }
    public void EnsureCreateScene(IDocumentationBuilder _, SceneTypeNode scene, Action <IDocumentationBuilder> stepContent = null, string sceneName = null)
    {
        _.ShowTutorialStep(new TutorialStep(scene == null ? "Create the scene " + sceneName : string.Format("Create the scene for scene type '{0}'", scene.Name), () =>
        {
            var paths      = scene.Graph.Project.SystemDirectory;
            var scenesPath = System.IO.Path.Combine(paths, "Scenes");
            var scenePath  = System.IO.Path.Combine(scenesPath, scene.Name + ".unity");
            var exists     = File.Exists(scenePath);
            return(exists
                ? null
                : string.Format(
                       "The scene does not exist yet. Right click on the '{0}' node and select 'Create Scene'", scene.Name));
        })
        {
            StepContent = b =>
            {
                b.Paragraph("In this step you need to created an instance of a scene, based on a SceneType. This means, that uFrame will automatically generate a scene with a basic setup.");
                b.Paragraph("To create an instance of a scene, you first have to locate the desired SceneType node. Right-click on the node and select 'Create Scene' ooption.");

                b.Note("There are several things that may happen while you are creating a scene:\n" +
                       "* If your current scene is not saved, uFrame will ask if you want to save it, before doing anything. Make sure you save any important data, as during this step you will be transfered to a different scene.\n" +
                       "* uFrame will first try to save scene with the name {SceneTypeName}.unity. If such scene does not exist, it will be created automatically and no further dialogs will appear. You then will be transfered to this scene.\n" +
                       "* If {SceneTypeName}.unity scene already exists, you will be prompted for the name and location for the new scene. You will then be transfered to the newly created scene." +
                       "");

                b.Note("uFrame automatically adds all the scene you create into the build!");
                if (stepContent != null)
                {
                    stepContent(b);
                }
            }
        });
    }
예제 #4
0
    protected override void Ending(IDocumentationBuilder _, InteractiveTutorial tutorial)
    {
        _.Paragraph("Now run the game, select the PlayerView gameobject, and type 'Hello World' into the Name field, then press the reset button.  You should also see the console log each change to the property 'Name'");
        _.ImageByUrl("http://i.imgur.com/zrg6r7q.png");

        _.AlsoSeePages(typeof(LoadingAndUnloadingScenes), typeof(CreatingServices));
    }
    public uFrameKernel EnsureUpdateKernelWithTypes(IDocumentationBuilder builder, IProjectRepository projectRepository, string[] types_section, Action <IDocumentationBuilder> stepContent = null)
    {
        var project = projectRepository as DefaultProjectRepository;

        var path               = project == null ? string.Empty : AssetDatabase.GetAssetPath(project);
        var prefabName         = project == null ? "Kernel.prefab" : project.Name + "Kernel.prefab";
        var prefabNameWithPath = project == null ? prefabName : path.Replace(project.name + ".asset", prefabName);


        var go        = AssetDatabase.LoadAssetAtPath(prefabNameWithPath, typeof(GameObject)) as GameObject;
        var component = go == null ? null : go.GetComponent <uFrameKernel>();

        builder.ShowTutorialStep(new TutorialStep("Update Kernel", () =>
        {
            if (component == null)
            {
                return("The Kernel Prefab has not been created yet.  Please press 'Scaffold/Update Kernel'.");
            }
            return(null);
        })
        {
            StepContent = stepContent
        });
        return(component);
    }
    protected bool BasicSetup(IDocumentationBuilder _, string systemName = "SystemA", string sceneName = "SystemB")
    {
        TheProject = DoCreateNewProjectStep(_, this.GetType().Name + "Project");
        if (TheProject == null)
        {
            return(false);
        }

        TheGraph = DoGraphStep <MVVMGraph>(_, "MainDiagram");
        if (TheGraph == null)
        {
            return(false);
        }

        EnsureNamespace(_, this.GetType().Name + "Project");

        SystemA = DoNamedNodeStep <SubsystemNode>(_, "SystemA");
        if (SystemA == null)
        {
            return(false);
        }

        SceneA = DoNamedNodeStep <SceneTypeNode>(_, "SceneA");
        if (SceneA == null)
        {
            return(false);
        }
        return(true);
    }
예제 #7
0
    public override void GetContent(IDocumentationBuilder _)
    {
        base.GetContent(_);
        _.Paragraph("The uFrame Kernel is an essential piece of uFrame, it handles loading scenes, systems and services.  " +
                    "The kernel is nothing more than a prefab with these types of components attached to it in an organized manner.");



        _.ImageByUrl("http://i.imgur.com/5Rg2X25.png");

        _.Paragraph("In the image above you can see the scene 'BasicsProjectKernelScene'.  This scene will always always contain the 'BasicsProjectKernel' " +
                    "prefab and any other things that need to live throughout the entire lifecycle of your application.");
        _.Paragraph("Important Note: All SystemLoaders, Services, and SceneLoaders are MonoBehaviours attached their corresponding child game-objects in the kernel prefab.");

        _.Note(
            "Whenever a scene begins, uFrame will ensure that the kernel is loaded, if it hasen't been loaded it will delay " +
            "its loading mechanism until the kernel has been loaded. This is necessary because you might initialize ViewModels, deserialize them...etc so the view should not bind until that data is ready.");

        _.Break();

        _.Title2("Scaffolding The Kernel");
        _.Paragraph("For convenience uFrame 1.6 makes the process of creating the kernel very easy and straightforward.  " +
                    "By pressing the Scaffold/Update Kernel button it will create a scene, and a prefab with all of the types created by the uFrame designer.  " +
                    "You can freely modify the kernel, and updating it will only add anything that is not there.");
        _.Break();

        _.Title2("Boot Order");
        _.ImageByUrl("http://i.imgur.com/L5CC8q8.png");


        _.Title2("The Game Ready Event");
        _.Paragraph("Once the kernal has loaded, it will publish the event 'GameReadyEvent'.  This event ensures that everything is loaded and bindings have properly taken place on views.");
    }
예제 #8
0
    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));
    }
 protected void CreateGameView(IDocumentationBuilder _)
 {
     GameView = DoNamedNodeStep <ViewNode>(_, "GameView", TheGame, b =>
     {
         _.Paragraph("You must enter the 'Game' element context to create its view, you can do this by double-clicking on it.");
     });
     DoCreateConnectionStep(_, TheGame, GameView == null ? null : GameView.ElementInputSlot, "Game output", "GameView element input");
 }
예제 #10
0
 protected bool CreateGameElement(IDocumentationBuilder _)
 {
     TheGame = DoNamedNodeStep <ElementNode>(_, "Game", SystemA, b => { });
     if (TheGame == null)
     {
         return(false);
     }
     return(true);
 }
        public ConnectionData DoCreateConnectionStep(IDocumentationBuilder builder, IDiagramNodeItem output, IDiagramNodeItem input, string outputName = "", string inputName = "", string outputItemName = "", string inputItemName = "", Action <IDocumentationBuilder> stepContent = null)
        {
//            var inputName = input == null ? "A" :input.Name;
//            var outputName = output == null ? "B" : output.Name;
//
//            if (input != null && input != input.Node)
//            {
//                inputName = input.Node.Name + "'s " + input.Name + " input slot";
//            }
//            if (output != null && output != output.Node)
//            {
//                outputName = output.Node.Name + "'s " + output.Name + " output slot";
//            }
            builder.ShowTutorialStep(new TutorialStep(string.Format("Create a connection from {0} to {1}.", outputName, inputName), () =>
            {
                var existing = output == null || input == null ? null :
                               WorkspaceService.Repository.All <ConnectionData>().FirstOrDefault(p => p.OutputIdentifier == output.Identifier && p.InputIdentifier == input.Identifier);
                if (existing == null)
                {
                    var typedItem = output as ITypedItem;
                    if (typedItem != null && input != null)
                    {
                        if (typedItem.RelatedType == input.Identifier)
                        {
                            return(null);
                        }
                    }
                    return("The connection hasen't been created yet.");
                }
                return(null);
            })
            {
                StepContent = _ =>
                {
                    _.Paragraph("In this step you are going to create a connection from {0} to {1}.\n" +
                                "First of all you need to locate {2}. If it is a node, expand it. When you place your mouse pointer over the {2}, input and output connectors will be shown." +
                                "Then you need to locate {3}. If it is a node, expand it. When you place your mouse pointer over the {3}, input and output connectors will be shown." +
                                "Both nodes and items MAY have inputs and outputs", outputName, inputName, outputItemName, inputItemName);

                    _.ImageByUrl("http://i.imgur.com/YTSnk19.png",
                                 "This picture shows input and output connectors of a node");
                    _.ImageByUrl("http://i.imgur.com/1y5mvRb.png",
                                 "This picture shows input and output connectors of a node item");

                    _.Paragraph(
                        "Left-click on the {0}, hold left mouse button and drag it to {1}. Then release left mouse button. This should create a connection between {0} and {1}",
                        outputName, inputName);

                    if (stepContent != null)
                    {
                        stepContent(_);
                    }
                }
            });
            return(null);
        }
        public T DoNamedItemStep <T>(IDocumentationBuilder builder,
                                     string requiredName,
                                     IDiagramNode requiredNode,
                                     string singularItemTypeName,
                                     Action <IDocumentationBuilder> stepContent,
                                     string requiredNodeName = "UNSPECIFIED",
                                     string requiredSection  = "UNSPECIFIED"
                                     ) where T : class, IDiagramNodeItem
        {
            T   existing = requiredNode == null ?  (T)null : requiredNode.PersistedItems.OfType <T>().FirstOrDefault(p => p.Name == requiredName);
            var message  = string.Format("Create {0} with the name '{1}' on '{2}' node", singularItemTypeName,
                                         requiredName, requiredNodeName);

            if (requiredNode != null)
            {
                message += string.Format(" on the '{0}' node", requiredNode.Name);
            }
            builder.ShowTutorialStep(new TutorialStep(message, () =>
            {
                if (existing == null)
                {
                    return("Item not created yet");
                }
                return(null);
            })
            {
                StepContent = _ =>
                {
                    var nodeName = requiredNode == null ? requiredNodeName : requiredNode.Name;
                    var section  = requiredSection;
                    _.Paragraph("In this step you will need to create and item called \"{2}\" in the \"{1}\" section of {0} node. Just like any other item, it will belong to a node. That is why you first need to locate the corresponding node: {0}. " +
                                "The next step is to locate the corresponding section. Most of the time section has a clear name. In this case, section is called \"{1}\"\n" +
                                "Almost every section will have a plus button to the right. By clicking this button, you introduce a new entry in the section. Most of time, clicking this button will instantly" +
                                " add a new entry in the section. However, some of them will show selection window, and you will need to select an item from the list.", nodeName, section, requiredName);

                    _.Paragraph("The final step is specifying name and optional type for the item. This is not always necessary." +
                                "To rename an item, you have to double click it's name. If it is not a reference item, the name will become editable. To finish editing, click anywhere else on the graph.\n" +
                                "Some items may allow you to specify type. To select type, click on the current type of the item. Type selection window will appear. Select desired type from the list.");

                    _.ImageByUrl("http://i.imgur.com/EzVOszn.png", "This image explain the section structure of the node.");

                    _.Note("Not every item has a type. ");
                    _.Note("Some items represent a reference to another item. That is why you cannot modify it's name directly.");

                    _.Break();

                    _.ToggleContentByPage <T>(singularItemTypeName);

                    if (stepContent != null)
                    {
                        stepContent(_);
                    }
                }
            });
            return(existing);
        }
예제 #13
0
 public void EnsureCode(IDocumentationBuilder _, DiagramNode codeFor, string description, string imageUrl, string filenameSearch, string codeSearch)
 {
     _.ShowTutorialStep(new TutorialStep(description,
                                         () => EnsureCodeInEditableFile(codeFor, filenameSearch, codeSearch)),
                        b =>
     {
         _.Paragraph(string.Format("Right-Click on the Node and choose Open->{0}", filenameSearch));
         _.ImageByUrl(imageUrl);
     });
 }
예제 #14
0
    protected bool EnsureKernel(IDocumentationBuilder _)
    {
        Kernel = this.EnsureScaffoldKernel(_, TheProject, ExplainKernel);
        if (Kernel == null)
        {
            return(false);
        }

        return(true);
    }
예제 #15
0
    public override void GetContent(IDocumentationBuilder _)
    {
        base.GetContent(_);
//        foreach (var line in Lines)
//        {
//            _.Paragraph(line);
//        }

        _.Paragraph(ChangeLog.text);
    }
예제 #16
0
 public override void GetContent(IDocumentationBuilder _)
 {
     base.GetContent(_);
     _.Paragraph("By default uFrame keeps up with viewmodels for us.  It maintains a manager for each type of viewmodel you create.");
     _.Paragraph("To access these managers, you can inject them into controllers and services using the following code.");
     _.Break();
     _.CodeSnippet("[Inject] public IViewModelManager<MyViewModel> MyViewModelsManager { get; set; }");
     _.Break();
     _.Note("Important Note: By default every element controller already generates manager properties just like the above example for the associated element's viewmodel.");
 }
예제 #17
0
        private static void ImportantMethods(IDocumentationBuilder _)
        {
            _.Title2("Execution Order");
            _.Paragraph("There are actually several different entry points on generated Views.  The usual order is:");
            _.Title3("For Views instantiated at runtime");
            _.Paragraph("Awake > OnEnable > PreBind > Bind > AfterBind > InitializeViewModel > Start > Update loop begins");
            _.Title3("For Views existing \"SceneFirst\" before runtime");
            _.Paragraph(
                "Awake > OnEnable > CreateModel > InitializeViewModel > Start (before base call) > PreBind > Bind > AfterBind > Start (after base call)");

            _.Title3("When Destroying an object");
            _.Paragraph(
                "OnDisable > OnDestroy (before base.OnDestroy() call) > UnBind > OnDestroy (after base.OnDestroy() call)");
            _.Break();
            _.Break();
            _.Title2("Help, my bindings have stopped working!");
            _.Paragraph(
                "There are a few methods that ALWAYS need their base.Method() calls intact, otherwise uFrame can easily  produce unexpected results.");
            _.Paragraph("These methods include a majority of the overridden standard Unity methods:");
            _.Paragraph(" - Awake(), Start(), OnEnable(), OnDisable(), OnDestroy(), Update(), LateUpdate()");
            _.Paragraph(" - PreBind(), Bind(), AfterBind(), UnBind(), InitializeViewModel()");
            _.Break();
            _.Break();
            _.Title2("Important Methods");
            _.Paragraph(
                "When looking for more clarity on how uFrame builds upon Monobehaviour, it can be fairly useful to look through ViewBase.cs, as this is what all uFrame Views inherit from.");

            _.Title3("PreBind()");
            _.Paragraph("This happens before the View begins creating bindings to its given ViewModel.");
            _.Break();

            _.Title3("Bind()");
            _.Paragraph(
                "This is where the View actually creates property bindings, collection bindings, and command bindings to the given ViewModel.  The base.Bind() call will automatically create the bindings specified in the uFrame diagram for this specific View type.  If you have any further manual bindings you need to do, this can be a good place to implement them.");
            _.Break();

            _.Title3("AfterBind()");
            _.Paragraph("This is called immediately after the View creates bindings to its ViewModel.");
            _.Break();

            _.Title3("CreateModel()");
            _.Paragraph(
                "This is when SceneFirst Views request a proper ViewModel from the scene's Dependency Container.  For the most part, this should be left alone.");
            _.Break();

            _.Title3("InitializeViewModel()");
            _.Paragraph(
                "On a View, when the Initialize ViewModel option is checked in the inspector, this is where the base.InitializeViewModel() call will set the ViewModel's properties to the values of the View's matching properties (which are underscored in code on the View).  This will usually never need to be overridden.");
            _.Break();

            _.Title3("Awake(), Start(), OnEnable(), OnDisable(), OnDestroy(), Update(), LateUpdate()");
            _.Paragraph(
                "These are all the same as their Unity counterparts, and must retain their base calls if you override them, in order for uFrame to function properly.");
            _.Break();
        }
        public TGraphType DoGraphStep <TGraphType>(IDocumentationBuilder builder, string name = null, Action <IDocumentationBuilder> stepContent = null) where TGraphType : class, IGraphData
        {
            var currentGraph =
                (WorkspaceService.CurrentWorkspace == null) ||
                (WorkspaceService.CurrentWorkspace.CurrentGraph == null)
                    ? null : (WorkspaceService.CurrentWorkspace.Graphs.OfType <UnityGraphData>().Select(p => p.Graph).OfType <TGraphType>().FirstOrDefault()) as TGraphType;

            builder.ShowTutorialStep(new TutorialStep(string.Format("Create a new {0} Graph with the name '{1}'", typeof(TGraphType).Name.Replace("Graph", ""), name ?? "ANYTHING"), () =>
            {
                if (currentGraph == null)
                {
                    return("Graph hasn't been created yet.");
                }
                else if (!string.IsNullOrEmpty(name) && currentGraph.RootFilter.Name != name)
                {
                    return(string.Format("Rename it to '{0}'", name));
                }
                return(null);
            })
            {
                StepContent = b =>
                {
                    b.Paragraph("In this step you will learn a little bit about graphs." +
                                "Each graph lives physically as a file inside your project folder. Graphs are combined into a uFrame project, but they can live on their own and can be linked to different projects at once!");

                    b.Paragraph("Each graph can contain nodes of certain types. " +
                                "Graphs can also share nodes between each other as long as they belong to the same project." +
                                "Graphs are used to manage various sections of your project. ");

                    b.Paragraph(
                        "You can create graphs using uFrame Graph Designer Window. In the top left corner you will find graph selection box. Besides displaying all the graphs attached to the current project, it will show options to create new graphs of different types");

                    b.ImageByUrl("http://i.imgur.com/MqXxE6h.png", "This picture shows how to create new graph");

                    b.Note("When you create a graph, pay attention to what project is currently selected! Graph will be created and linked to the selected project automatically. Also, graph file will be created inside of the selected project folder.");

                    b.Paragraph("In this step we need to create a graph of type {0}", typeof(TGraphType).Name);

                    b.Paragraph("After you create a graph, it will contain only one node. This node represents graph itself and is often called Graph node.");

                    b.Paragraph("To rename your graph, you have to rename the corresponding graph node. For this, you have to right-click on the header of the graph node and click rename." +
                                "Node title will become editable. Type in the desired title. Click anywhere else, to finish editing");

                    b.ImageByUrl("http://i.imgur.com/PDUZhsU.png", "This picture shows how to rename a graph");

                    b.Note("When user renames graph node, uFrame automatically updates graph file too!");

                    if (stepContent != null)
                    {
                        stepContent(b);
                    }
                }
            });
            return(currentGraph);
        }
예제 #19
0
        private static void ImportantMethods(IDocumentationBuilder _)
        {
            _.Title2("Execution Order");
            _.Paragraph("There are actually several different entry points on generated Views.  The usual order is:");
            _.Title3("For Views instantiated at runtime");
            _.Paragraph("Awake > OnEnable > PreBind > Bind > AfterBind > InitializeViewModel > Start > Update loop begins");
            _.Title3("For Views existing \"SceneFirst\" before runtime");
            _.Paragraph(
                "Awake > OnEnable > CreateModel > InitializeViewModel > Start (before base call) > PreBind > Bind > AfterBind > Start (after base call)");

            _.Title3("When Destroying an object");
            _.Paragraph(
                "OnDisable > OnDestroy (before base.OnDestroy() call) > UnBind > OnDestroy (after base.OnDestroy() call)");
            _.Break();
            _.Break();
            _.Title2("Help, my bindings have stopped working!");
            _.Paragraph(
                "There are a few methods that ALWAYS need their base.Method() calls intact, otherwise uFrame can easily  produce unexpected results.");
            _.Paragraph("These methods include a majority of the overridden standard Unity methods:");
            _.Paragraph(" - Awake(), Start(), OnEnable(), OnDisable(), OnDestroy(), Update(), LateUpdate()");
            _.Paragraph(" - PreBind(), Bind(), AfterBind(), UnBind(), InitializeViewModel()");
            _.Break();
            _.Break();
            _.Title2("Important Methods");
            _.Paragraph(
                "When looking for more clarity on how uFrame builds upon Monobehaviour, it can be fairly useful to look through ViewBase.cs, as this is what all uFrame Views inherit from.");

            _.Title3("PreBind()");
            _.Paragraph("This happens before the View begins creating bindings to its given ViewModel.");
            _.Break();

            _.Title3("Bind()");
            _.Paragraph(
                "This is where the View actually creates property bindings, collection bindings, and command bindings to the given ViewModel.  The base.Bind() call will automatically create the bindings specified in the uFrame diagram for this specific View type.  If you have any further manual bindings you need to do, this can be a good place to implement them.");
            _.Break();

            _.Title3("AfterBind()");
            _.Paragraph("This is called immediately after the View creates bindings to its ViewModel.");
            _.Break();

            _.Title3("CreateModel()");
            _.Paragraph(
                "This is when SceneFirst Views request a proper ViewModel from the scene's Dependency Container.  For the most part, this should be left alone.");
            _.Break();

            _.Title3("InitializeViewModel()");
            _.Paragraph(
                "On a View, when the Initialize ViewModel option is checked in the inspector, this is where the base.InitializeViewModel() call will set the ViewModel's properties to the values of the View's matching properties (which are underscored in code on the View).  This will usually never need to be overridden.");
            _.Break();

            _.Title3("Awake(), Start(), OnEnable(), OnDisable(), OnDestroy(), Update(), LateUpdate()");
            _.Paragraph(
                "These are all the same as their Unity counterparts, and must retain their base calls if you override them, in order for uFrame to function properly.");
            _.Break();
        }
예제 #20
0
 public void CreateDefaultScene(IDocumentationBuilder builder)
 {
     EnsureComponentInSceneStep <Scene>(builder, null,
                                        "Create an empty scene, create an empty game object and add the 'Scene' component to it.",
                                        b =>
     {
         b.ImageByUrl("http://i.imgur.com/5Pnd9Xf.png");
         b.Paragraph("In this example we are using \"Scene\" component, which is in fact a common SceneType. It does not belong to any project, that is why you have to manually specify the kernel scene." +
                     " Later you will learn how to define scene types for a specific project. Those will get kernel scene name automatically, and you won't have to specify it manually.");
         b.Note("Make sure to set KernelScene to \"" + TheProject.Name + "KernelScene\" and do not forget to add this scene into the build settings!");
     });
 }
예제 #21
0
 public override void GetContent(IDocumentationBuilder _)
 {
     base.GetContent(_);
     _.Paragraph("Although uFrame does its best to support and guide you to the creation of better games, it is extremely important to realize that the implementation is still always left to you.  While uFrame tries to separate things clearly, there are still countless ways you can circumvent and break the patterns put in place.  The most common violation is through mixing core game logic with representation logic, where some poor developer has created a nightmare trying to access fields on Views from Controllers or other Views.  These separations exist for a reason, so one puzzle piece can content itself with handling its own functionality and not worry how other pieces are handling themselves.");
     _.Break();
     _.Paragraph("There are also many situations with multiple valid solutions, and it all depends on how you decide to arrange your implementation.  When prototyping, many things are forgivable and easily redesigned as the project evolves and features are settled on.  It's very easy to bind/subscribe to properties in order to initiate logic, but you should always consider from where you want that logic handled.  For example, imagine something odd happens and your RobotEnemy suddenly stops working correctly.  If all of your modifications are done in RobotEnemyController, then you've only got one place to look for the problem.  If you've allowed any parent, or child, or practically anything with a reference to RobotEnemy, to make modifications to it, then you've got more places to check...");
     _.Break();
     _.Paragraph(" Above all, stick to the separation of Controller <-> ViewModel <- View.");
     _.Paragraph(" - Controllers handle the layer of core game logic,");
     _.Paragraph(" - ViewModels are effectively the data layer,");
     _.Paragraph(" - and Views are the presentation layer, handling how the game is displayed and represented in Unity.");
 }
예제 #22
0
        internal Documentation(IDocumentationBuilder documentationBuilder = null)
        {
            // Need to cache this value since it cannot be access from a thread.
            var persistentDataPath = DocumentationBuilder.PersistentDataPath;

            if (documentationBuilder == null)
            {
                documentationBuilder = new DocumentationBuilder();
            }

            Builder = documentationBuilder;
        }
        public Workspace DoCreateNewProjectStep(IDocumentationBuilder builder, string projectName, Action <IDocumentationBuilder> stepContent = null)
        {
            var currentProject = WorkspaceService.CurrentWorkspace;

            builder.ShowTutorialStep(new TutorialStep("Create a project and open it in Graph Designer", () =>
            {
                if (currentProject == null)
                {
                    return("Project hasn't been created yet.");
                }
                if (currentProject.Name != projectName)
                {
                    return(string.Format("Make sure that \"{0}\" project is created\n" +
                                         "Make sure that Graph Designer window is opened and selected project is \"{0}\"", projectName));
                }
                return(null);
            })
            {
                StepContent = _ =>
                {
                    if (stepContent != null)
                    {
                        stepContent(_);
                    }

                    _.Paragraph("You need to create a new project to begin this journey.");
                    _.Paragraph("Navigate to the project window and create a folder. Pick up the name to correspond your project: ");

                    _.ImageByUrl("http://i.imgur.com/gV6dWD0.png", "This picture shows how to create new folder for uFrame project");

                    _.Paragraph("From here right click on the newly created folder and choose uFrame->New Project");
                    _.Paragraph("This will create a new project repository for you. You will find it inside of the folder." +
                                "The project repository will hold references to all of your graphs.");

                    _.ImageByUrl("http://i.imgur.com/yv6J4Ag.png", "This picture shows how to create new uFrame project.");

                    _.Paragraph("Change your project name by renaming the project repository file. You can pick up the same name, you have chosen for the folder:");


                    _.ImageByUrl("http://i.imgur.com/YTf2p2G.png", "This picture shows how to change uFrame project name.");

                    _.Break();

                    _.Paragraph("If you haven't already, open the graph designer by clicking on Window->uFrame Designer in the Unity menu.");
                    _.ImageByUrl("http://i.imgur.com/80Pou12.png", "This picture shows how to open uFrame Graph Designer");

                    _.Paragraph("Finally you need to select your project in graph designer.");
                    _.ImageByUrl("http://i.imgur.com/K7rf60I.png", "This picture shows how to select uFrame project in uFrame Graph Designer");
                },
            });
            return(currentProject);
        }
예제 #24
0
 protected bool CreatePlayerElement(IDocumentationBuilder _)
 {
     ThePlayer = DoNamedNodeStep <ElementNode>(_, "Player", SystemA, b =>
     {
         b.ImageByUrl("http://i.imgur.com/lEnVVQj.png", "This picture shows how to create Element Node");
         b.ImageByUrl("http://i.imgur.com/SJ0zI8w.png", "This picture shows the final state of a newly created node, renamed to \"Player\"");
     });
     if (ThePlayer == null)
     {
         return(false);
     }
     return(true);
 }
예제 #25
0
    public sealed override void GetContent(IDocumentationBuilder _)
    {
        base.GetContent(_);
        Introduction(_);
        _.BeginTutorial("Creating Services");
        TutorialContent(_);
        var tutorial = _.EndTutorial();

        if (tutorial.LastStepCompleted)
        {
            Ending(_, tutorial);
        }
    }
예제 #26
0
 protected void EnsureInitializeView(IDocumentationBuilder _, ViewBase view, string additionalMessage = null)
 {
     _.ShowTutorialStep(new TutorialStep("Now check 'Initialize View Model' on the view.", () =>
     {
         return(view.OverrideViewModel ? null : "You haven't checked the checkbox yet");
     }), b =>
     {
         b.Paragraph("'Initialize View Model' will allow you to set properties on the view-model before its bound.");
         b.ImageByUrl("http://i.imgur.com/8yCZNLA.png");
         if (additionalMessage != null)
         {
             b.Paragraph(additionalMessage);
         }
     });
 }
예제 #27
0
    protected void CreatePlayerView(IDocumentationBuilder _)
    {
        ThePlayerView = DoNamedNodeStep <ViewNode>(_, "PlayerView", ThePlayer, b =>
        {
            b.ImageByUrl("http://i.imgur.com/H1OzzfC.png");
        });
        DoCreateConnectionStep(_, ThePlayer, ThePlayerView == null ? null : ThePlayerView.ElementInputSlot, "Player node output", "PlayerView node Element input", "Player node", "PlayerView node", b =>
        {
            b.Paragraph("Creating this connection means that the view will visually present the data on the player to the user in the 3d world.");
            b.Paragraph("You can always create multiple views to seperate different presentations of the same data. For instance, you could also create a PlayerUIView, which deals strictly with showing inventory, stats,...etc");

            b.Break();
            b.ImageByUrl("http://i.imgur.com/scVtfd9.png");
        });
    }
예제 #28
0
    public override void GetContent(IDocumentationBuilder _)
    {
        base.GetContent(_);
        _.Section("What is interactive tutorial?");
        _.Paragraph("Interactive tutorial is a new experimental type of learning material. Unlike regular static tutorials, interactive tutorials communicate with the environment to perform the following tasks:\n\n" +
                    "* Step completion analysis\n" +
                    "* Just-In-Time hints and troubleshooting\n" +
                    "* Dynamic content adjustments\n");

        _.Paragraph("Each tutorial exposes several steps to go through. It analyses current state of your project and figures out if current step is complete.");
        _.Note("Interactive tutorial re-evaluates the environment every time you focus documentation window with this tutorial opened. So once you think you finished the step, please, focus the documentation window" +
               " and let interactive tutorial check your progress. If conditions are met, the current step will be considered finished and the next step will be revealed");
        _.Paragraph("While following the tutorial, you may accidently break something, that you have done in the previous step. In this case, tutorial goes back to the broken step and you will have to adjust your  ");
        _.Paragraph("Based on your actions, the content of the step may be adjusted to guide you in the right direction. More over, text of each tutorial tends to adjust to your current task. That is why, learning material of each step may change as you progress.");
    }
    public override void GetContent(IDocumentationBuilder _)
    {
        base.GetContent(_);
        _.Section("What is interactive tutorial?");
        _.Paragraph("Interactive tutorial is a new experimental type of learning material. Unlike regular static tutorials, interactive tutorials communicate with the environment to perform the following tasks:\n\n" +
                    "* Step completion analysis\n" +
                    "* Just-In-Time hints and troubleshooting\n" +
                    "* Dynamic content adjustments\n");

        _.Paragraph("Each tutorial exposes several steps to go through. It analyses current state of your project and figures out if current step is complete.");
        _.Note("Interactive tutorial re-evaluates the environment every time you focus documentation window with this tutorial opened. So once you think you finished the step, please, focus the documentation window" +
               " and let interactive tutorial check your progress. If conditions are met, the current step will be considered finished and the next step will be revealed");
        _.Paragraph("While following the tutorial, you may accidently break something, that you have done in the previous step. In this case, tutorial goes back to the broken step and you will have to adjust your  ");
        _.Paragraph("Based on your actions, the content of the step may be adjusted to guide you in the right direction. More over, text of each tutorial tends to adjust to your current task. That is why, learning material of each step may change as you progress.");
    }
예제 #30
0
    protected void SaveAndCompile(IDocumentationBuilder _, DiagramNode node = null)
    {
        _.ShowTutorialStep(SaveAndCompile(node ?? SceneA), b =>

        {
            b.Paragraph("In this step you need to initiate the process of code generation. This is done using Save and Compile button in the top right corner of the graph designer window. Saving and compiling is the process of taking the information you've created by graphs and putting it into code form.  The generated code consists of both designer files (always regenerated), and editable files (only generated if it doesnt exist so it doesn't destroy your implementations).");

            b.Note(" It does not matter, what graph you are currently in. Save and Compile procedure is Project-specific and is performed for all the graphs in the project at once. So pay attention to what project is currently selected.");

            b.Note(" If you face with compiling issues after you save and compile, first of all, determine where the issue comes from. If it is an editable file: you can fix it manually and uFrame will not erase your fix on next code generation." +
                   " If the issue comes from designer files (which gets regenerated each time), you need to understand if an issue is related to your diagram. Sometimes, type references may have invalid types, or elements may have incorrectly named properties." +
                   " Such diagram issues may result into generated code not compiling.");

            b.ImageByUrl("http://i.imgur.com/QhfMGSq.png", "This picture shows \"Save and Compile\" button");
        });
    }
예제 #31
0
    protected void AddViewToScene(IDocumentationBuilder _, ViewNode view)
    {
        ScenePlayerView = EnsureComponentInSceneStep <ViewBase>(_, view ?? GameView,
                                                                string.Format("Now add the {0} to the scene.", view == null ? "view" : view.Name),
                                                                b =>
        {
            b.Paragraph("Create an empty gameObject underneath the _SceneARoot game object.  ");

            b.Paragraph(
                string.Format("On this empty game object click 'Add Component' in the inspector. Then add the '{0}' component to it.", view == null ? "view" : view.Name));

            b.Note("When creating scene types, everything should be a descendent of this root game object, " +
                   "this allows them to be destroyed by uFrame when needed.");

            b.ImageByUrl("http://i.imgur.com/3pKo4yL.png");
        });
    }
예제 #32
0
    protected override void TutorialContent(IDocumentationBuilder _)
    {
        //Step 1
        TheProject = DoCreateNewProjectStep(_, "TheBasicsProject");

        //Step 2
        EnsureNamespace(_, "TheBasicsProject");

        //Step 3
        SubsystemGraph = DoGraphStep <SubsystemGraph>(_, "BasicsSystem");

        if (SubsystemGraph != null)
        {
            SystemA = SubsystemGraph.RootFilter as SubsystemNode;
        }

        //Step 4
        CreatePlayerElement(_);

        //Step 5
        CreatePlayerView(_);
        NameProperty = DoNamedItemStep <PropertiesChildItem>(_, "Name", ThePlayer, "a property", b =>
        {
            b.Paragraph("After you finish this step, your node should look like this:");
            b.ImageByUrl("http://i.imgur.com/wJi2IZP.png", "This picture shows the state of Player node after you finish current step.");
        }, "Player", "Properties");

        ResetCommand = DoNamedItemStep <CommandsChildItem>(_, "Reset", ThePlayer, "a command", b =>
        {
            b.ImageByUrl("http://i.imgur.com/ZktA9FP.png");
        }, "Player", "Commands");

        NameChangedBinding = DoNamedItemStep <BindingsReference>(_, "Name Changed", ThePlayerView, "a binding", b =>
        {
            b.ImageByUrl("http://i.imgur.com/9K08Woe.png");
        }, "PlayerView", "Bindings");
        SaveAndCompile(_, ThePlayerView);
        EnsureKernel(_);
        CreateDefaultScene(_);
        AddViewToScene(_, ThePlayerView);
        EnsureInitializeView(_, ScenePlayerView);
        EnsureCode(_, ThePlayer, "Open the player controller by right-clicking on the 'Player' node and choosing Open->PlayerController.cs and add the following code.", "http://i.imgur.com/gjFLEeD.png", "PlayerController.cs", ".Name");
        EnsureCode(_, ThePlayerView, "Open the player view and add the following code.", "http://i.imgur.com/rV97qSC.png", "PlayerView.cs", "Debug.Log");
    }
예제 #33
0
    public override void GetContent(IDocumentationBuilder _)
    {
        base.GetContent(_);
        _.Title2("What is it?");
        _.Paragraph("Controllers dictate the rules of your game and, like ViewModels, they do not inherit from Unity's Monobehaviour.  As they only handle logic, there only ever needs to be one Controller for each type of ViewModel.  For example, when a PlayerViewModel performs the PickupItem command, the PlayerController would simply need to know which PlayerViewModel to execute that command logic on, and the logic remains the same whether there are 4 players or one.");

        _.Paragraph(" A controller is designed to implement the data-driven logic and rules behind an element " +
                    "and could be considered just a \"group\" of commands for a view-model. " +
                    "The Designer has enough information about an element to implement most of the controller itself " +
                    "In most instances, you only need to apply the logic and rules to each method.  ");

        _.Break();



        _.Title2("Best Practices");
        _.Paragraph("When implementing controllers, think of the element as its own little section of your world, " +
                    "if you want your element to interact or be visible to the entire world, publish events as " +
                    "necessary in your command controller methods.");
        _.Paragraph("To understand this idea a bit more, take a look at the following diagram.");
        _.ImageByUrl("http://i.imgur.com/KbPL9bw.png");
        _.Paragraph("So in the diagram above, on the EnemyHit command handler, we publish the command as 'global' event.  This means that services can be your general connection layer that make various elements work together.");
        _.Title3("But why should I do this?");
        _.Paragraph("Imagine you create a Player element, if it lives entirely on its own (no dependencies on other controllers, services..etc), you can re-use the element in another game and implement services to connect them together.");
        _.Break();
        _.Break();

        _.Title2("The Setup Method");
        _.Paragraph("The setup method is an implementation of the ISystemService interface, this means that all controllers are ultimately services, they do not derive from monobehaviour.  This means you can easily listen to any kind of event on a controller, as well as publish them.");
        _.Title3("Important Note");
        _.Paragraph("You must be careful when listening to events in controllers that use inheritance. For instance, if you have an elementA controller, and a derived elementB controller, and in the setup method you are listening to event 'C', then beth element A and element B will be listening to the same event.  In some cases this may be wanted behaviour, but its important to understand.");
        _.Break();
        _.Break();
        _.Title2("The Initialize Method");
        _.Paragraph("The initialize Method in a controller can be used to initialize an Element's ViewModel (similar to how it might be initialized in the inspector of a View). It is a great place to subscribe to 'Scene Properties'.");
        _.Title2("Command Handlers");
        _.Paragraph("Every command that is outlined on an element, in the Element Designer, will have a corresponding method in a controller (assuming the diagram is saved).  ");
        _.Paragraph("There are a few things to notice when looking at the code example below:");
        _.Paragraph(" - The \"FPSWeaponController\" is derived from \"FPSWeaponControllerBase\", which is generated by the designer.");
        _.Paragraph(" - All of these methods are overrides, because the base class has implemented an empty \"virtual method\" for each command.");
        _.Paragraph(" - The reload method has an IEnumerator result type, because is it is marked as a yield command (indicated by the yellow marker).  This can be achieved by right-clicking on a command and checking \"Is Yield Command\". It is used for simulating a co-routine.");
        _.Paragraph(" - In each method we are simply processing rules by reading and modifying the FPSWeaponViewModel's instance data .");
        _.ShowGist("7bba5439faf0b46efa61", "FPSWeaponController.cs");
    }
예제 #34
0
    protected override void TutorialContent(IDocumentationBuilder _)
    {
        BasicSetup(_);

        CreateGameElement(_);
        CreateGameView(_);

        // var debugService = DoNamedNodeStep<ServiceNode>(_, "DebugService");
        var graph = DoGraphStep<ServiceGraph>(_,"DebugService", b => { });
        var debugService = graph == null ? null : graph.RootFilter as ServiceNode;
        var logEvent = DoNamedNodeStep<SimpleClassNode>(_, "LogEvent");
        DoNamedItemStep<PropertiesChildItem>(_, "Message", logEvent, "a property", b => { },"LogEvent","Properties");
        DoNamedItemStep<HandlersReference>(_, "LogEvent", debugService, "a handler", b => { },"DebugService","Handlers");
        DoNamedItemStep<CommandsChildItem>(_, "Log", TheGame, "a command", null,"Game","Commands");
        SaveAndCompile(_);
        EnsureKernel(_);
        EnsureCode(_, debugService, "Open DebugService.cs and implement the LogEventHandler method.", "http://i.imgur.com/Vrdqgx4.png", "DebugService", "Debug.Log");
        EnsureCode(_, TheGame, "Open GameController.cs and implement the Log method.", "http://i.imgur.com/t2zwBZv.png", "GameController", "new LogEvent");
    }
    protected virtual void DoTutorial(IDocumentationBuilder _)
    {
        BasicSetup(_);

        //DoNamedNodeStep<SubsystemNode>(_, "SystemB");
        var sceneB = DoNamedNodeStep<SceneTypeNode>(_, "SceneB");

        CreateGameElement(_);

        DoNamedItemStep<CommandsChildItem>(_, "LoadB", TheGame, "a Command",
            b => b.Paragraph("Now we need to add a command to load scene B."));

        DoNamedItemStep<CommandsChildItem>(_, "UnLoadB", TheGame, "a Command",
            b => b.Paragraph("Now we need to add a command to un-load scene B."));

        CreateGameView(_);

        SaveAndCompile(_);

        EnsureKernel(_);

        EnsureCreateScene(_, SceneA, b =>
        {
            b.ImageByUrl("http://i.imgur.com/XPqOhHS.png");
        }, "SceneA");

        EnsureCreateScene(_, sceneB, b =>
        {
            b.ImageByUrl("http://i.imgur.com/XPqOhHS.png");
        }, "SceneA");

        EnsureSceneOpen(_, SceneA, null,"SceneA");

        EnsureCode(_, TheGame,
            "Now add the code to the game controller to load and unload Scene B.",
            "http://i.imgur.com/Yrg3jNI.png",
            "Controller.cs",
            "LoadSceneCommand");

        AddViewToScene(_,GameView);
    }
예제 #36
0
 public override void GetContent(IDocumentationBuilder _)
 {
     base.GetContent(_);
     _.ImageByUrl("http://i.imgur.com/2G5Amgx.png");
     _.Paragraph("ViewComponents can be used for a wide variety of things, and are meant to provide a further level of extensibility to Views.  They are derived from MonoBehaviour, and require a View in order to function.  A ViewComponent will bind to the same ViewModel instance to which its corresponding View is bound.  In essence, they are extremely simplistic, offering these things:");
     _.Paragraph(" - Access to a particular View to which it is bound ");
     _.Paragraph("   - Access to that specific ViewModel instance");
     _.Paragraph(" - Matching execute methods for the corresponding View's commands");
     _.Paragraph(" - Awake, Bind, and Unbind methods ");
     _.Paragraph("   - These can be used to implement manual bindings where desired, among other things");
     _.Break();
     _.Paragraph("While entirely optional, there are a lot of creative uses for ViewComponents, including interchangeable behaviours, toggleable logic, and even extending logical ownership for a View.");
     _.Break();
     _.Paragraph("For example, we'll outline a scenario where you wish to have a system that detects hit damage to specific player body parts in an FPS game, in order to have damage multipliers.  In the example diagram below, we have separated out ViewComponents for each type of body part.");
     _.ImageByUrl("http://i.imgur.com/wNxFcQt.png");
     _.Paragraph("On the Player GameObject, we would attach the PlayerView.  Assuming that we have a rigged character model parented to that Player GameObject, we would want to set up Colliders on the joint references of each of the corresponding body parts, similar to the screenshot below:");
     _.ImageByUrl("http://i.imgur.com/GuwVQzf.png");
     _.Paragraph("We can either add ViewComponents at runtime, or assign them directly to each Collider individually:");
     _.ImageByUrl("http://i.imgur.com/RX8hZeY.png");
     _.Paragraph("Once this is done, we simply need to add a short piece of code to each ViewComponent to detect collisions and execute TakeDamage, something like:");
     _.ShowGist("2c2c6ca621f91280b693","PlayerArmComponent.cs");
     _.Paragraph("So now with similar code on all of our body part GameObjects, they will each provide separate collision checks for individual body parts.  If a body part is hit by a bullet GameObject with a BulletView on it, the damage of that BulletViewModel instance will be passed, along with the type of body part hit, to the TakeDamage command on the PlayerController.");
 }
예제 #37
0
    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));
    }
        public virtual void GetDocumentation(IDocumentationBuilder node)
        {

        }
예제 #39
0
    protected override void Ending(IDocumentationBuilder _, InteractiveTutorial tutorial)
    {
        _.Paragraph("Now run the game, select the PlayerView gameobject, and type 'Hello World' into the Name field, then press the reset button.  You should also see the console log each change to the property 'Name'");
        _.ImageByUrl("http://i.imgur.com/zrg6r7q.png");

        _.AlsoSeePages(typeof(LoadingAndUnloadingScenes), typeof(CreatingServices));
    }
예제 #40
0
    public void CreateDefaultScene(IDocumentationBuilder builder)
    {
        EnsureComponentInSceneStep<Scene>(builder, null,
            "Create an empty scene, create an empty game object and add the 'Scene' component to it.",
            b =>
            {
                b.ImageByUrl("http://i.imgur.com/5Pnd9Xf.png");
                b.Paragraph("In this example we are using \"Scene\" component, which is in fact a common SceneType. It does not belong to any project, that is why you have to manually specify the kernel scene." +
                       " Later you will learn how to define scene types for a specific project. Those will get kernel scene name automatically, and you won't have to specify it manually.");
                b.Note("Make sure to set KernelScene to \""+TheProject.Name+"KernelScene\" and do not forget to add this scene into the build settings!");

            });
    }
 protected override void Ending(IDocumentationBuilder _, InteractiveTutorial tutorial)
 {
     _.ImageByUrl("http://i.imgur.com/iprda4t.png");
     _.Paragraph("Now run the game from SceneA, select the gameobject and hit the LoadB button and UnLoadB button from the GameView's inspector.");
     _.LinkToPage<UsingSceneLoaders>();
 }
 protected override void Introduction(IDocumentationBuilder _)
 {
     _.Paragraph("The purpose of this tutorial is to teach you how to publish events to the scene service for unloading, and loading of scene types.");
     _.Break();
 }
 protected override void TutorialContent(IDocumentationBuilder _)
 {
     DoTutorial(_);
 }
 protected override void DoTutorial(IDocumentationBuilder _)
 {
     base.DoTutorial(_);
     //EnsureCode(_, SceneA, "Now add the following code to SceneALoader.cs", "http://i.imgur.com/dQknvBt.png", "Loader.cs", "CreatePrimitive");
 }
예제 #45
0
 protected override void Introduction(IDocumentationBuilder _)
 {
 }
예제 #46
0
 public void CreateDefaultScene(IDocumentationBuilder builder)
 {
     EnsureComponentInSceneStep<Scene>(builder, null,
         "Create an empty scene, create an empty game object and add the 'Scene' component to it.",
         b =>
         {
             b.ImageByUrl("http://i.imgur.com/5Pnd9Xf.png");
         });
 }
예제 #47
0
파일: MainForm.cs 프로젝트: gone3d/ortelius
        ///<summary>
        /// Make the list of as files
        ///</summary
        private void BuildDocumentationXml()
        {
            DataTypeUtil allDataTypes = DataTypeUtil.Instance;
            XmlDeclaration dec = allDocXml.CreateXmlDeclaration("1.0", null, null);
            allDocXml.AppendChild(dec);

            XmlElement contentNode = allDocXml.CreateElement("docElements");
            allDocXml.AppendChild(contentNode);

            XmlElement pathNode = allDocXml.CreateElement("basePath");
            pathNode.InnerText = "file:/"+xmlPath.Text.Replace("\\","/")+"/";
            contentNode.AppendChild(pathNode);

            XmlElement newNode1 = allDocXml.CreateElement("introHeader");
            newNode1.InnerText = introHeader.Text;
            contentNode.AppendChild(newNode1);

            XmlElement newNode2 = allDocXml.CreateElement("introText");
            contentNode.AppendChild(newNode2);
            XmlCDataSection CData = allDocXml.CreateCDataSection(introText.Text.Replace("\r\n","<br/>\r\n"));
            newNode2.AppendChild(CData);

            XmlElement createdNode = allDocXml.CreateElement("created");
            createdNode.InnerText = String.Format("{0:d/M yyyy}", DateTime.Now);
            contentNode.AppendChild(createdNode);

            XmlElement languageNode = allDocXml.CreateElement("language");
            switch((CodeLanguage) projSettings.Language){
                case CodeLanguage.Actionscript:
                asDocumentation = new DocumentationBuilder();
                languageNode.InnerText = "AS";
                break;
                case CodeLanguage.Javascript:
                asDocumentation = new JSDocumentationBuilder();
                languageNode.InnerText = "JS";
                break;
            }
            contentNode.AppendChild(languageNode);

            //loop trough all files
            int incFiles = 0;
            foreach ( string filNavn in projSettings.AllASFiles ){
                if(File.Exists(filNavn)){
                incFiles++;
                progressBar1.Value = (incFiles/projSettings.AllASFiles.Count)*38+2;
                progressBar1.Refresh();
                DateTime modifiedTime = File.GetLastWriteTime(filNavn);

                XmlNodeList classXml = asDocumentation.AddFile(File.ReadAllLines(filNavn, Encoding.Default),modifiedTime,filNavn);

                try{
                    if(classXml.Count > 0){
                    foreach (XmlNode classNode in classXml){
                        if(classNode.InnerXml != ""){
                            allDataTypes.AddDataType(classNode.SelectSingleNode("name").InnerText,classNode.SelectSingleNode("package").InnerText,null);//,classNode.SelectSingleNode("fid").InnerText

                            contentNode.AppendChild(allDocXml.ImportNode(classNode,true ));
                        }else{
                            systemSvar += "Empty class in: "+filNavn+"\r\n\r\n";
                            asDocumentation.SystemSvar = "";
                        }
                    }
                    }else{
                            systemSvar += "File not added (no content): "+filNavn+"\r\n\r\n";
                            asDocumentation.SystemSvar = "";
                        }
                }
                catch(Exception e){
                    systemSvar +="Exception error in: "+filNavn+"\r\n"+e.ToString()+"\r\n\r\n" ;
                }

                if(asDocumentation.SystemSvar!=""){
                    systemSvar += "Error in "+filNavn+": "+asDocumentation.SystemSvar+"\r\n\r\n";
                    asDocumentation.SystemSvar = "";
                }
            }
            }
        }
예제 #48
0
    protected override void TutorialContent(IDocumentationBuilder _)
    {
        //Step 1
        TheProject = DoCreateNewProjectStep(_, "TheBasicsProject");

        //Step 2
        EnsureNamespace(_,"TheBasicsProject");

        //Step 3
        SubsystemGraph = DoGraphStep<SubsystemGraph>(_, "BasicsSystem");

        if (SubsystemGraph != null)
        {
            SystemA = SubsystemGraph.RootFilter as SubsystemNode;
        }

        //Step 4
        CreatePlayerElement(_);

        //Step 5
        CreatePlayerView(_);
        NameProperty = DoNamedItemStep<PropertiesChildItem>(_, "Name", ThePlayer, "a property", b =>
        {
            b.Paragraph("After you finish this step, your node should look like this:");
            b.ImageByUrl("http://i.imgur.com/wJi2IZP.png","This picture shows the state of Player node after you finish current step.");
        }, "Player","Properties");

        ResetCommand = DoNamedItemStep<CommandsChildItem>(_, "Reset", ThePlayer, "a command", b =>
        {
            b.ImageByUrl("http://i.imgur.com/ZktA9FP.png");
        }, "Player" ,"Commands");

        NameChangedBinding = DoNamedItemStep<BindingsReference>(_, "Name Changed", ThePlayerView, "a binding", b =>
        {
            b.ImageByUrl("http://i.imgur.com/9K08Woe.png");

        },"PlayerView","Bindings");
        SaveAndCompile(_, ThePlayerView);
        EnsureKernel(_);
        CreateDefaultScene(_);
        AddViewToScene(_, ThePlayerView);
        EnsureInitializeView(_,ScenePlayerView);
        EnsureCode(_, ThePlayer, "Open the player controller by right-clicking on the 'Player' node and choosing Open->PlayerController.cs and add the following code.", "http://i.imgur.com/gjFLEeD.png","PlayerController.cs", ".Name");
        EnsureCode(_, ThePlayerView, "Open the player view and add the following code.", "http://i.imgur.com/rV97qSC.png", "PlayerView.cs", "Debug.Log");
    }