예제 #1
0
        protected override void DrawBuildSettingListElement(Rect rect, int index, bool isActive, bool isFocused)
        {
            // Get all the properties
            SerializedProperty element = Property.GetArrayElementAtIndex(index);

            // Calculate position
            rect.height = EditorGUIUtility.singleLineHeight;
            rect.y     += EditorUiUtility.VerticalMargin;

            // Draw a toggle
            Rect fieldRect = rect;

            fieldRect.width = rect.height + EditorUiUtility.VerticalMargin;
            HostArchiveSetting setting = (HostArchiveSetting)element.objectReferenceValue;

            setting.IsEnabled = EditorGUI.Toggle(fieldRect, setting.IsEnabled);

            // Check whether to enable the next set of UI
            bool originalEnabled = GUI.enabled;

            GUI.enabled = false;

            // Draw the object field
            fieldRect.x    += fieldRect.width;
            fieldRect.width = rect.width - fieldRect.width;
            element.objectReferenceValue = EditorGUI.ObjectField(fieldRect, "", element.objectReferenceValue, typeof(IChildBuildSetting), false);
            GUI.enabled = originalEnabled;

            // Calculate position
            rect.y += rect.height;
            rect.y += EditorUiUtility.VerticalMargin;

            // Draw Edit buttons
            DrawButtons(rect, element.objectReferenceValue);
        }
예제 #2
0
        private void DrawArchiveContents()
        {
            EditorUiUtility.DrawBoldFoldout(contentAnimation, "Archive Contents");

            // Draw the rest of the controls
            using (EditorGUILayout.FadeGroupScope fadeScope = new EditorGUILayout.FadeGroupScope(contentAnimation.faded))
            {
                if (fadeScope.visible == true)
                {
                    // Draw the rest of the controls
                    EditorGUILayout.PropertyField(includeIndexHtml);
                    EditorGUILayout.PropertyField(domainEncrypter);
                    domainList.DoLayoutList();

                    // Draw the import stuff
                    EditorGUILayout.Space();
                    UnityEngine.Object testAsset = null;
                    testAsset = EditorGUILayout.ObjectField("Import Domain List", testAsset, typeof(UnityEngine.Object), false);
                    if (testAsset != null)
                    {
                        AssetBundle bundle = null;
                        try
                        {
                            // Load the bundle, and convert it to a domain list
                            bundle = AssetBundle.LoadFromFile(AssetDatabase.GetAssetPath(testAsset));
                            DomainList domainList = Utility.GetDomainList(bundle);

                            // Decrypt the domain list
                            HostArchiveSetting setting = ((HostArchiveSetting)target);
                            setting.AcceptedDomains = DomainList.Decrypt(domainList, setting.DomainEncrypter);
                        }
                        finally
                        {
                            if (bundle != null)
                            {
                                // Clean-up
                                bundle.Unload(true);
                            }
                        }
                    }
                }
            }
        }