Exemple #1
0
        void DrawScene(Scene scene)
        {
            this.scene = scene;
            var fileChooserAdd = new FileChooserButton("Select model", FileChooserAction.Open);

            fileChooserAdd.WidthRequest = 124;
            fileChooserAdd.Name         = "filechooserbutton3";
            fileChooserAdd.FileSet     += (sender, e) =>
            {
                var wait = core.AddNotyfyTask(() =>
                {
                    SceneNode modelNode = ResourcesManager.LoadAsset <ModelPrefab>(fileChooserAdd.Filename).CreateNode();
                    scene.AddNode2Root(modelNode);
                    //Set name
                    var path       = System.IO.Path.GetDirectoryName(fileChooserAdd.Filename);
                    modelNode.Name = path.Substring(path.LastIndexOf('\\') + 1) + "." + System.IO.Path.GetFileNameWithoutExtension(fileChooserAdd.Filename);
                });
                wait.WaitOne();
                ClearChildrens(fixedScene);
                DrawScene(scene);
            };
            fixedScene.Put(fileChooserAdd, 0, 0);
            fileChooserAdd.Show();
            int y = 35;

            foreach (var node in scene.GetNodes())
            {
                Button btn = new Button();
                btn.Label         = node.Name;
                btn.TooltipText   = node.Name;
                btn.Name          = "btn";
                btn.HeightRequest = 20;
                btn.Clicked      += (sender, e) =>
                {
                    DrawComponents(node);
                };
                fixedScene.Put(btn, 0, y);
                btn.Show();
                y += 35;
            }
            var cont = fixedScene.CreatePangoContext();
        }