简体   繁体   English

如何结合Scenegraph开发人员扩展(SGDEX)

[英]How to combine Scenegraph Developer Extensions (SGDEX)

The new Roku scenegraph developer extensions seem pretty useful. 新的Roku Scenegraph开发人员扩展似乎非常有用。 I have two SGDEX views that are useful to me. 我有两个SGDEX视图对我有用。 However I need to combine them and I do not see any documentation on how to do it. 但是,我需要将它们组合在一起,并且看不到有关如何执行操作的任何文档。

The Custom+Scene example is what I am working off of. Custom + Scene示例就是我正在研究的内容。 Simply I would add to add the searchView feature to this script. 只需添加一下即可将searchView功能添加到此脚本中。

I have tried adding SearchView as a component. 我尝试将SearchView添加为组件。 However the searchview example is it's own working page, I would like to add it as a node. 但是searchview示例是它自己的工作页面,我想将其添加为节点。 I have tried adding it as an overhang, and also tried adding it as a button on the homepage. 我尝试过将其添加为突出部分,也尝试过将其添加为主页上的按钮。 I have been unsuccessful with both. 我都没有成功。

Please see scenegraph developer extensions. 请参阅Scenegraph开发人员扩展。

I simply need to add the SearchView feature to the Custom+Scene example in SGDEX. 我只需要在SGDEX中的Custom + Scene示例中添加SearchView功能。 Please provide example of how to do this if you are familiar. 如果您熟悉的话,请提供如何执行此操作的示例。 Thanks. 谢谢。

Updated 更新

Looks like what we wanted to achieve is open the searchView from the mainscene of the custom+screen example. 看起来我们想要实现的是从custom + screen示例的主场景中打开searchView。

I updated the feed.json file of the project and add a new object after the "series" object. 我更新了项目的feed.json文件,并在“系列”对象之后添加了一个新对象。

 ...
 ...
 "search": [
        {
            "id": "search",
            "title": "Search",
            "releaseDate": "2015-06-11",
            "shortDescription": "Will open search view.",
            "thumbnail": "http://level2creative.com/wp-content/uploads/2017/08/image-search-ss-1920-800x450.gif",
            "genres": [
                "search"
            ],
            "tags": [
                "search"
            ],
            "content": {
                "dateAdded": "2015-06-11T14:14:54.431Z",
                "captions": [],
                "videos": [
                    {
                        "url": "http://roku.content.video.llnw.net/smedia/59021fabe3b645968e382ac726cd6c7b/Gb/siCt-V7LOSU08W_Ve1ByJY5N9emKZeXZvnrH2Yb9c/117_segment_2_twitch__nw_060515.mp4",
                        "quality": "HD",
                        "videoType": "MP4"
                    }
                ],
                "duration": 53
            }
        }
    ]

On your GridHandler.brs, change the ParseJsonToNodeArray function, lets change the if condition of the line 27, so it will look like this: 在您的GridHandler.brs上,更改ParseJsonToNodeArray函数,让我们更改第27行的if条件,因此它将如下所示:

if fieldInJsonAA = "movies" or fieldInJsonAA = "series" or fieldInJsonAA = "search"

Then, on your mainscene.brs, go to the method "OnGridItemSelected", change it for something like this: 然后,在您的mainscene.brs上,转到方法“ OnGridItemSelected”,将其更改为类似以下内容:

rowContent = grid.content.GetChild(selectedIndex[0])
if rowContent.title = "search"
    searchView = CreateObject("roSGNode", "SearchView")
    searchView.hintText = "Search for something"
    m.top.ComponentController.CallFunc("show", {
        view: searchView
    })
else
    detailsView = ShowDetailsView(rowContent, selectedIndex[1])
    detailsView.ObserveField("wasClosed", "OnDetailsWasClosed")
end if

That should open the searchView and if you press back that should close the searchView and take the user back to the gridView. 那应该打开searchView,如果您按回去,则应该关闭searchView并使用户回到gridView。

Docs 文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM