예제 #1
0
    public static void Build2(BuildTarget bt)
    {
        if (GameObject.Find("Start") == null)
        {
            EditorPopup.ShowPopup("Please Add Start Point");
        }
        else if (GameObject.FindGameObjectWithTag(Tag.CheckPoint) == null)
        {
            EditorPopup.ShowPopup("Please Add CheckPoint");
        }
        else
        {
            var scene = EditorApplication.currentScene;
            if (Path.GetFileName(scene) != Path.GetFileName(scene).ToLower())
            {
                print.Log("Rename");
                File.Move(scene, scene.ToLower());
                scene = scene.ToLower();
                AssetDatabase.Refresh();
            }

            FixMaterials();


            EditorApplication.SaveScene();
            var f = Path.GetFileNameWithoutExtension(scene) + ".unity3d" +
                    (bt == BuildTarget.Android ? "android" : "web");
            File.Delete(f);
            Directory.CreateDirectory("maps");
            BuildPipeline.BuildStreamedSceneAssetBundle(new[] { scene }, "maps/" + f, bt);
        }
    }
        public override bool BeforeGUI(ref Rect position, ref SerializedProperty property, ref GUIContent label, ref bool includeChildren, bool visible)
        {
            if (!IsVisible())
            {
                return(visible);
            }
            if (!visible)
            {
                return(false);
            }
            if (Event.current.type == EventType.Layout)
            {
                return(visible);
            }
            if (property.propertyType != SerializedPropertyType.ObjectReference)
            {
                return(visible);
            }

            var w    = width < 0 ? m_ContentSize.x : width;
            var h    = height < 0 ? m_ContentSize.y : height;
            var rect = position.WidthFromRight(w).Height(h);

            using (new EditorGUI.DisabledScope(property.objectReferenceValue == null))
                if (GUI.Button(rect, m_Content, m_Style))
                {
                    EditorPopup.Show(rect, property.objectReferenceValue, position.width);
                }
            position.width -= w + 4;
            position.height = m_Height.Get(property.propertyPath, 16);
            return(true);
        }
            public static void Show(Rect rect, Object obj, float width)
            {
                var popup = new EditorPopup();

                popup.m_Width  = width;
                popup.m_Editor = Editor.CreateEditor(obj);
                if (popup.m_Editor is MaterialEditor)
                {
                    var prop = typeof(MaterialEditor).GetProperty("forceVisible", BindingFlags.Instance | BindingFlags.NonPublic);
                    prop.SetValue(popup.m_Editor, true, null);
                }
                if (EditorUtility.IsPersistent(obj))
                {
                    var path = AssetDatabase.GetAssetPath(obj);
                    if (AssetDatabase.IsSubAsset(obj))
                    {
                        path += "/" + obj.name;
                    }
                    popup.m_AssetImporter = AssetImporter.GetAtPath(path);
                    var objs = Selection.objects;
                    popup.m_AssetEditor = Editor.CreateEditor(popup.m_AssetImporter);
                    if (popup.m_AssetEditor != null)
                    {
                        PropertyInfo prop;
#if UNITY_2017_1_OR_NEWER
                        if (popup.m_AssetEditor is AssetImporterEditor)
                        {
                            prop = typeof(AssetImporterEditor).GetProperty("assetEditor", BindingFlags.Instance | BindingFlags.NonPublic);
                            prop.SetValue(popup.m_AssetEditor, popup.m_Editor, null);
                            popup.m_ShowImportedObject = (popup.m_AssetEditor as AssetImporterEditor).showImportedObject;
                        }
                        else
                        {
                            popup.m_AssetImporter = null;
                        }
#else
                        var type = typeof(Editor).Assembly.GetType("UnityEditor.AssetImporterInspector");
                        if (type.IsAssignableFrom(popup.m_AssetEditor.GetType()))
                        {
                            prop = type.GetProperty("assetEditor", BindingFlags.Instance | BindingFlags.NonPublic);
                            prop.SetValue(popup.m_AssetEditor, popup.m_Editor, null);
                            prop = type.GetProperty("showImportedObject", BindingFlags.Instance | BindingFlags.NonPublic);
                            popup.m_ShowImportedObject = (bool)prop.GetValue(popup.m_AssetEditor, null);
                        }
                        else
                        {
                            popup.m_AssetImporter = null;
                        }
#endif
                    }
                    else
                    {
                        popup.m_AssetImporter = null;
                    }
                    Selection.objects = objs;
                }
                PopupWindow.Show(rect, popup);
            }
 ///
 /// ------------------------------------------------------------------------------------------------
 /// Name		LblCustomText_Tapped
 ///
 /// <summary>
 ///             Handles on Tap event of Custom Text.
 /// </summary>
 ///
 /// <remarks>
 /// </remarks>
 /// ------------------------------------------------------------------------------------------------
 ///
 private async void LblCustomText_Tapped(object sender, EventArgs e)
 {
     try
     {
         if (_sRiActionParagraph.CellType == CellTypes.Custom)
         {
             // await Task.Delay(250);
             VisitActionDetailsPage.CenterPopup.ShowPopupCenter(CustomTextPopup = new EditorPopup(LblCustomText.Text), 0.5, "Edit Custom Text");
             CustomTextPopup.CustomText = SaveCustomText;
         }
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }