Пример #1
0
        static void CreateVideo()
        {
            GameObject gameObject = new GameObject("Video");

            gameObject.transform.position = SceneView.lastActiveSceneView.pivot;


            SpriteRenderer spriteRenderer = gameObject.AddComponent <SpriteRenderer> ();

            spriteRenderer.sprite   = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/Decentraland/Internal/Images/video_panel.png");         //DclEditorSkin.VideoPanel;
            spriteRenderer.drawMode = SpriteDrawMode.Sliced;
            spriteRenderer.size     = new Vector2(1.28f, 0.64f);

            DclCustomNode node = gameObject.AddComponent <DclCustomNode>();

            node.position = node.rotation = node.scale = true;
            node.nodeName = "video";

            node.propertyPairs = new List <XmlPropertyPair> ();

            XmlPropertyPair pair = new XmlPropertyPair();

            pair.name  = "width";
            pair.value = "{1.98}";
            node.propertyPairs.Add(pair);

            pair       = new XmlPropertyPair();
            pair.name  = "height";
            pair.value = "{1.08}";
            node.propertyPairs.Add(pair);

            pair       = new XmlPropertyPair();
            pair.name  = "src";
            pair.value = "";
            node.propertyPairs.Add(pair);

            pair       = new XmlPropertyPair();
            pair.name  = "play";
            pair.value = "{true}";
            node.propertyPairs.Add(pair);

            pair       = new XmlPropertyPair();
            pair.name  = "volume";
            pair.value = "{20}";
            node.propertyPairs.Add(pair);

            gameObject.AddComponent <DclVideo>();
        }
Пример #2
0
        void OnValidate()
        {
            DclCustomNode node = gameObject.GetComponent <DclCustomNode>();

            if (node == null)
            {
                return;
            }
            node.setProperty("width", "{" + width + "}");
            node.setProperty("height", "{" + height + "}");
            node.setProperty("src", "\"" + src + "\"");
            node.setProperty("play", "{" + (play ? "true" : "false") + "}");
            node.setProperty("volume", "{" + volume + "}");

            sizeChange = true;
        }