Inheritance: UnityEngine.GUI.Scope
Exemplo n.º 1
0
    void OnGUI()
    {
        m_ShowExtraFields.target = EditorGUILayout.ToggleLeft("Show extra fields", m_ShowExtraFields.target);

        //Extra block that can be toggled on and off.
        using (var group = new EditorGUILayout.FadeGroupScope (m_ShowExtraFields.faded))
        {
            if (group.visible)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PrefixLabel("Color");
                m_Color = EditorGUILayout.ColorField(m_Color);
                EditorGUILayout.PrefixLabel("Text");
                m_String = EditorGUILayout.TextField(m_String);
                EditorGUILayout.PrefixLabel("Number");
                m_Number = EditorGUILayout.IntSlider(m_Number,0,10);
                EditorGUI.indentLevel--;
            }
        }
    }
        private void DrawAboutCinemaSuiteSection()
        {
            // Draw the About Cinema Suite Section
            Rect aboutRect = EditorGUILayout.GetControlRect(GUILayout.Width(base.position.width - 22));
            GUI.Box(new Rect(aboutRect.x - 4, aboutRect.y, aboutRect.width + 8, aboutRect.height), string.Empty, EditorStyles.toolbar);
            showCinemaSuiteAbout.target = EditorGUI.Foldout(aboutRect, showCinemaSuiteAbout.target, "About Cinema Suite");
            
#if UNITY_5
            using (var group = new EditorGUILayout.FadeGroupScope(showCinemaSuiteAbout.faded))
            {
                if (group.visible)
                {
#else
            {
                if (showCinemaSuiteAbout.target)
                {
#endif
                    
                    // Header
                    EditorGUILayout.BeginHorizontal();
                    //GUILayout.Label("<b><size=30>Cinema Suite</size></b>");
                    GUILayout.Label(cinemaSuiteLogo);

                    // Web and Social Media Links
                    if (GUILayout.Button(websiteIcon, GUILayout.Height(32), GUILayout.Width(32)))
                    {
                        Application.OpenURL("http://www.cinema-suite.com");
                    }
                    if(GUILayout.Button(forumIcon, GUILayout.Height(32), GUILayout.Width(32)))
                    {
                        Application.OpenURL("http://cinema-suite.com/forum");
                    }
                    if(GUILayout.Button(facebookIcon, GUILayout.Height(32), GUILayout.Width(32)))
                    {
                        Application.OpenURL("https://www.facebook.com/CinemaSuiteInc/");
                    }
                    if(GUILayout.Button(twitterIcon, GUILayout.Height(32), GUILayout.Width(32)))
                    {
                        Application.OpenURL("https://twitter.com/CinemaSuiteInc");
                    }
                    if(GUILayout.Button(youtubeIcon, GUILayout.Height(32), GUILayout.Width(32)))
                    {
                        Application.OpenURL("https://www.youtube.com/cinemasuiteinc");
                    }

                    EditorGUILayout.EndHorizontal();

                    GUILayout.Space(8f);

                    // About us
                    GUILayout.Label("We are a small team who are passionate about Video Games and are dedicated to creating useful software extensions for video game developers.");

                    // Special thanks
                    GUILayout.Label("We would like to extend a special thanks to the Canada Media Fund.");
                    GUILayout.Label(cmfLogo);

                    GUILayout.Space(16f);

                    // Legal Stuff
                    legalStuff = EditorGUILayout.Foldout(legalStuff, new GUIContent("Legal Stuff"));
                    if (legalStuff)
                    {
                        legalScrollPosition = GUILayout.BeginScrollView(legalScrollPosition, false, true, GUILayout.Height(200f));
                        GUILayout.TextArea(DISCLAIMER1 + DISCLAIMER2 + DISCLAIMER3 + DISCLAIMER4 + DISCLAIMER5 + DISCLAIMER6);
                
                        GUILayout.EndScrollView();
                    }

                    
                }
            }
        }
        private void drawProduct(ProductInfo product)
        {
            EditorGUILayout.BeginVertical(skin.FindStyle("Header"));
            Rect foldoutRect = EditorGUILayout.GetControlRect();
            product.ShowProductInfo.target = EditorGUI.Foldout(foldoutRect, product.ShowProductInfo.target, product.name, true);
            EditorGUILayout.EndVertical();

#if UNITY_5
            using (var productGroup = new EditorGUILayout.FadeGroupScope(product.ShowProductInfo.faded))
            {
                if (productGroup.visible)
                {
#else
            {
                if(product.ShowProductInfo.target)
                {
#endif
            
                    Rect contentRect = EditorGUILayout.BeginVertical(skin.FindStyle("Content"));
                    product.OnGUI(contentRect);
                    EditorGUILayout.EndVertical();
                }
            }
        }

        private void loadProductInfo()
        {
            List<ProductInfo> baseProducts = new List<ProductInfo>()
             {
                 new CinemaDirectorBaseProductInfo(), new CinemaProCamsBaseProductInfo(), 
                 new CinemaThemesBaseProductInfo(), new CinemaMocapBaseProductInfo()
             };

            availableProducts = new List<ProductInfo>();
            installedProducts = new List<ProductInfo>();

            foreach (var productInfo in baseProducts)
            {
                Type[] installedProductTypes = GetAllSubTypes(productInfo.GetType());
                if (installedProductTypes.Length > 0)
                {
                    foreach (Type productType in installedProductTypes)
                    {
                        ProductInfo installedProduct = Activator.CreateInstance(productType) as ProductInfo;
                        installedProduct.Initialize(Repaint);
                        installedProducts.Add(installedProduct);
                    }
                }
                else
                {
                    ProductInfo product = Activator.CreateInstance(productInfo.GetType()) as ProductInfo;
                    product.Initialize(Repaint);
                    availableProducts.Add(product);
                }
            }
        }