예제 #1
0
        public override void OnGUI(Rect rect)
        {
            GUILayout.BeginArea(rect);
            {
                EditorGUILayout.LabelField($"Repeat Address({RepeatAddressDatas[0].assetAddress})", EGUIStyles.MiddleCenterLabel);
                scrollPos = EditorGUILayout.BeginScrollView(scrollPos, EditorStyles.helpBox);
                {
                    for (int i = 0; i < RepeatAddressDatas.Length; i++)
                    {
                        EditorGUILayout.BeginHorizontal();
                        {
                            EditorGUILayout.LabelField("" + i, EGUIStyles.MiddleLeftLabelStyle, GUILayout.Width(20), GUILayout.Height(40));
                            EditorGUILayout.BeginVertical();
                            {
                                EGUI.BeginLabelWidth(60);
                                {
                                    EditorGUILayout.TextField("Path : ", RepeatAddressDatas[i].assetPath);

                                    UnityObject uObj = AssetDatabase.LoadAssetAtPath <UnityObject>(RepeatAddressDatas[i].assetPath);
                                    EditorGUILayout.ObjectField("Target:", uObj, typeof(UnityObject), false);
                                }
                                EGUI.EndLableWidth();
                            }
                            EditorGUILayout.EndVertical();
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                }
                EditorGUILayout.EndScrollView();
            }
            GUILayout.EndArea();
        }
예제 #2
0
        internal void OnGUI(Rect rect)
        {
            Rect titleRect = new Rect(rect.x, rect.y, rect.width, TITLE_HEIGHT);

            EGUI.DrawBoxHeader(titleRect, Contents.titleStr, EGUIStyles.BoxedHeaderCenterStyle);

            Track trackData = EditorData.Data.GetSelectedTrack();

            if (trackData == null)
            {
                return;
            }

            Rect scrollRect = new Rect(rect.x, titleRect.y + titleRect.height, rect.width, rect.height - titleRect.height);

            GUILayout.BeginArea(scrollRect);
            {
                EGUI.BeginLabelWidth(100);
                {
                    trackData.Name = EditorGUILayout.TextField(Contents.nameContent, trackData.Name);
                }
                EGUI.EndLableWidth();
            }
            GUILayout.EndArea();
        }
        public override void OnInspectorGUI()
        {
            EGUILayout.DrawScript(target);

            EditorGUILayout.Space();

            EGUI.BeginGUIColor(Color.grey);
            {
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    EGUILayout.DrawBoxHeader("Native Drawer Setting", GUILayout.ExpandWidth(true));
                    EGUI.BeginIndent();
                    {
                        NativeDrawerSetting.IsShowHelp = EditorGUILayout.Toggle("Is Show Help", NativeDrawerSetting.IsShowHelp);
                    }
                    EGUI.EndIndent();
                }
                EditorGUILayout.EndVertical();
            }
            EGUI.EndGUIColor();

            EditorGUILayout.Space();

            EGUI.BeginLabelWidth(GetLabelWidth());
            {
                drawerObject.OnGUILayout();
            }
            EGUI.EndLableWidth();
        }
예제 #4
0
        public override void OnInspectorGUI()
        {
            EGUILayout.DrawScript(target);
            DrawerSetting.OnDrawSetting();

            EGUI.BeginLabelWidth(GetLabelWidth());
            {
                drawerObject.OnGUILayout();
            }
            EGUI.EndLableWidth();
        }
예제 #5
0
 public void OnGUILayout()
 {
     EditorGUI.BeginDisabledGroup(!Enable);
     {
         EGUI.BeginLabelWidth(LabelWidth);
         {
             OnLayoutDraw();
         }
         EGUI.EndLableWidth();
     }
     EditorGUI.EndDisabledGroup();
 }
        private void DrawAddressData(Rect contentRect, PackerAssetData assetData)
        {
            EGUI.DrawAreaLine(contentRect, Color.black);

            Rect pingBtnRect = new Rect(contentRect.x + contentRect.width - contentRect.height * 2, contentRect.y, contentRect.height * 2, contentRect.height);

            if (GUI.Button(pingBtnRect, "Ping"))
            {
                SelectionUtility.PingObject(assetData.Path);
            }

            Rect ValueRect = new Rect(contentRect.x, contentRect.y, contentRect.width - contentRect.height * 2, contentRect.height);

            Rect drawRect = new Rect(ValueRect.x, ValueRect.y, ValueRect.width * 0.5f, ValueRect.height * 0.5f);

            EGUI.BeginLabelWidth(80);
            {
                EditorGUI.TextField(drawRect, "path", assetData.Path);
            }
            EGUI.EndLableWidth();

            drawRect = new Rect(ValueRect.x, ValueRect.y + drawRect.height, ValueRect.width * 0.5f, ValueRect.height * 0.5f);
            EGUI.BeginLabelWidth(80);
            {
                EditorGUI.TextField(drawRect, "address", assetData.Address);
            }
            EGUI.EndLableWidth();

            drawRect = new Rect(ValueRect.x + ValueRect.width * 0.5f, ValueRect.y, ValueRect.width * 0.5f, ValueRect.height * 0.5f);
            EGUI.BeginLabelWidth(80);
            {
                EditorGUI.TextField(drawRect, "labels", string.Join(",", assetData.Labels));
            }
            EGUI.EndLableWidth();

            drawRect = new Rect(ValueRect.x + ValueRect.width * 0.5f, ValueRect.y + drawRect.height, ValueRect.width * 0.5f, ValueRect.height * 0.5f);
            EGUI.BeginLabelWidth(80);
            {
            }
            EGUI.EndLableWidth();
            //if (Window.IsAddressRepeated(assetData.Address, out List<PackerBundleData> datas))
            //{
            //    if (GUI.Button(drawRect,addressRepeatContent))
            //    {
            //        AssetAddressRepeatPopupContent content = new AssetAddressRepeatPopupContent()
            //        {
            //            RepeatAddressDatas = datas.ToArray(),
            //        };
            //        PopupWindow.Show(drawRect, content);
            //    }
            //}
        }
        private ReorderableList CreateRList(string propertyName)
        {
            SerializedProperty property = serializedObject.FindProperty(propertyName);
            ReorderableList    rList    = new ReorderableList(serializedObject, property, true, true, true, true);

            rList.drawHeaderCallback = (rect) =>
            {
                EditorGUI.LabelField(rect, ObjectNames.NicifyVariableName(propertyName), EGUIStyles.MiddleLeftLabelStyle);
            };
            rList.elementHeight = Styles.LIST_HEIGHT;
            rList.onAddCallback = (list) =>
            {
                property.InsertArrayElementAtIndex(property.arraySize);
            };
            rList.drawElementCallback = (rect, index, isActive, isFocused) =>
            {
                SerializedProperty elementProperty = property.GetArrayElementAtIndex(index);

                SerializedProperty enumProperty      = elementProperty.FindPropertyRelative("Name");
                SerializedProperty smallIconProperty = elementProperty.FindPropertyRelative("SmallIcon");
                SerializedProperty largeIconProperty = elementProperty.FindPropertyRelative("LargeIcon");

                EGUI.BeginLabelWidth(80);
                {
                    Rect drawRect = rect;
                    drawRect.width -= Styles.LARGE_ICON_SIZE;
                    drawRect.height = Styles.LINE_HEIGHT;
                    EditorGUI.PropertyField(drawRect, enumProperty);

                    drawRect.y += drawRect.height;
                    EditorGUI.PropertyField(drawRect, smallIconProperty);

                    drawRect.y += drawRect.height;
                    EditorGUI.PropertyField(drawRect, largeIconProperty);
                }
                EGUI.EndLableWidth();

                Rect previewRect = rect;
                previewRect.x     += previewRect.width - Styles.LARGE_ICON_SIZE;
                previewRect.width  = Styles.LARGE_ICON_SIZE;
                previewRect.height = Styles.LARGE_ICON_SIZE;
                UnityEngine.GUI.DrawTexture(previewRect, (Texture2D)largeIconProperty.objectReferenceValue ?? EGUIResources.DefaultFolderIcon);

                previewRect.y    += previewRect.height - Styles.SMALL_ICON_SIZE;
                previewRect.width = previewRect.height = Styles.SMALL_ICON_SIZE;
                UnityEngine.GUI.DrawTexture(previewRect, (Texture2D)smallIconProperty.objectReferenceValue ?? EGUIResources.DefaultFolderIcon);
            };

            return(rList);
        }
예제 #8
0
        private void DrawPackOperation()
        {
            if (bundleBuildConfig == null)
            {
                bundleBuildConfig = AssetPackerUtil.ReadBuildData();
            }

            EditorGUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
            {
                EditorGUILayout.LabelField(Contents.BuildTitleContent, EGUIStyles.MiddleCenterLabel);
                EditorGUI.BeginChangeCheck();
                {
                    EGUI.BeginLabelWidth(120);
                    {
                        bundleBuildConfig.OutputDir          = EGUILayout.DrawDiskFolderSelection(Contents.BuildOutputDirStr, bundleBuildConfig.OutputDir);
                        bundleBuildConfig.CleanupBeforeBuild = EditorGUILayout.Toggle(Contents.BuildCleanup, bundleBuildConfig.CleanupBeforeBuild);
                        bundleBuildConfig.PathFormat         = (BundlePathFormatType)EditorGUILayout.EnumPopup(Contents.BuildPathFormatContent, bundleBuildConfig.PathFormat);
                        EditorGUILayout.Space();
                        bundleBuildConfig.IsForceRebuild = EditorGUILayout.Toggle(Contents.ForceRebuild, bundleBuildConfig.IsForceRebuild);
                        bundleBuildConfig.Target         = (ValidBuildTarget)EditorGUILayout.EnumPopup(Contents.BuildTargetContent, bundleBuildConfig.Target);
                        bundleBuildConfig.Compression    = (CompressOption)EditorGUILayout.EnumPopup(Contents.BuildCompressionContent, bundleBuildConfig.Compression);
                    }
                    EGUI.EndLableWidth();
                }
                if (EditorGUI.EndChangeCheck())
                {
                    AssetPackerUtil.WriteBuildData(bundleBuildConfig);
                }

                GUILayout.FlexibleSpace();

                EGUI.BeginGUIBackgroundColor(Color.red);
                {
                    if (GUILayout.Button(Contents.OperationAutoBuildContent, GUILayout.Height(80), GUILayout.ExpandWidth(true)))
                    {
                        EditorApplication.delayCall += () =>
                        {
                            AssetPackerUtil.BuildAssetBundles(packerData, bundleBuildConfig);
                        };
                    }
                }
                EGUI.EndGUIBackgroundColor();
            }
            EditorGUILayout.EndVertical();
        }
예제 #9
0
        public override void OnInspectorGUI()
        {
            if (attr != null)
            {
                EGUILayout.DrawScript(target);
                DrawerSetting.OnDrawSetting();

                EGUI.BeginLabelWidth(attr.LabelWidth);
                {
                    drawerObject.OnGUILayout();
                }
                EGUI.EndLableWidth();
            }
            else
            {
                base.OnInspectorGUI();
            }
        }
예제 #10
0
        public override void OnGUI(Rect rect)
        {
            GUILayout.BeginArea(rect);
            {
                scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
                {
                    EGUI.BeginLabelWidth(60);
                    {
                        EditorGUILayout.LabelField(Contents.NewDataContent, EGUIStyles.MiddleCenterLabel);

                        EditorGUILayout.Space();

                        string dataKey = newData.Key;
                        dataKey = EditorGUILayout.TextField(Contents.DataNameContent, dataKey);
                        if (newData.Key != dataKey)
                        {
                            newData.Key = dataKey;
                            if (string.IsNullOrEmpty(dataKey))
                            {
                                errorMessage = Contents.DataNameEmptyStr;
                            }
                            else
                            {
                                if ((group.AsDynamic()).dataDic.ContainsKey(newData.Key))
                                {
                                    errorMessage = Contents.DataNameRepeatStr;
                                }
                                else
                                {
                                    errorMessage = null;
                                }
                            }
                        }

                        if (newData.OptionValues != null && newData.OptionValues.Length > 0)
                        {
                            newData.Value = EGUILayout.StringPopup(Contents.DataValueContent, newData.Value, newData.OptionValues);
                        }
                        else
                        {
                            newData.Value = EditorGUILayout.TextField(Contents.DataValueContent, newData.Value);
                        }

                        newData.Comment = EditorGUILayout.TextField(Contents.DataCommentContent, newData.Comment);
                        optionValuesRList.DoLayoutList();

                        if (!string.IsNullOrEmpty(errorMessage))
                        {
                            EditorGUILayout.HelpBox(errorMessage, MessageType.Error);
                        }
                        else
                        {
                            GUILayout.FlexibleSpace();

                            if (GUILayout.Button(Contents.SaveStr))
                            {
                                newData.OptionValues = optionValues.ToArray();

                                group.AddData(newData.Key, newData.Value, newData.Comment, newData.OptionValues);

                                onCreatedCallback?.Invoke(group.Name, newData.Key);
                                editorWindow.Close();
                            }
                        }
                    }
                    EGUI.EndLableWidth();
                }
                EditorGUILayout.EndScrollView();
            }
            GUILayout.EndArea();
        }