예제 #1
0
        public static void RefreshObjectMeshPairs(GameObject forObject)
        {
            //PolyFew Doesn't show up for multiple objects so don't do anything
            if (UtilityServices.dataContainer == null)
            {
                return;
            }
            //if (Selection.gameObjects != null && Selection.gameObjects.Length > 1) { return; }
            //forObject = Selection.activeGameObject;

            if (forObject == null)
            {
                return;
            }

            UtilityServices.dataContainer.objectMeshPairs = UtilityServices.GetObjectMeshPairs(forObject, true, true);
            UtilityServices.dataContainer.triangleCount   = UtilityServices.CountTriangles(UtilityServices.dataContainer.reduceDeep, UtilityServices.dataContainer.objectMeshPairs, forObject);

            DataContainer.UndoRedoOps ops;
            bool found = UtilityServices.dataContainer.objectsHistory.TryGetValue(forObject, out ops);

            // Delete the Undo Redo history as they contain older meshes and have become invalid
            if (found)
            {
                UtilityServices.dataContainer.objectsHistory.Remove(forObject);
            }
        }
예제 #2
0
        async Task Save()
        {
            //! Id == null ==> Post sonst put
            var result = await AuthenticationApiService.EditUserAsync(FormUser);

            if (result.IsSuccessful)
            {
                NavigationManager.NavigateTo("/", false);
            }
            else
            {
                UtilityServices.ShowNotification(NotificationSeverity.Error, "Save Userdata failed", result.Errors.ToArray());
            }
        }
예제 #3
0
        public static void ResetToInitialState()
        {
            //PolyFew Doesn't show up for multiple objects so don't do anything
            if (UtilityServices.dataContainer == null)
            {
                return;
            }
            //if (Selection.gameObjects != null && Selection.gameObjects.Length > 1) { return; }
            //if (Selection.activeGameObject == null) { return; }

            UtilityServices.RestoreMeshesFromPairs(UtilityServices.dataContainer.objectMeshPairs);
            UtilityServices.dataContainer.reductionPending  = false;
            UtilityServices.dataContainer.reductionStrength = 0;

            if (Selection.activeGameObject != null)
            {
                UtilityServices.dataContainer.triangleCount = UtilityServices.CountTriangles(UtilityServices.dataContainer.reduceDeep, UtilityServices.dataContainer.objectMeshPairs, Selection.activeGameObject);
            }
        }
예제 #4
0
        public IHttpActionResult GetStaff()
        {
            try
            {
                var companyId = UtilityServices.GetHeaderValue(Request, "companyId");

                var oStaffProfile = _staffService.GetList(companyId);
                if (oStaffProfile == null)
                {
                    return(NotFound());
                }
                return(Ok(oStaffProfile));
            }
            catch (Exception ex)
            {
                LogHelper.Log(ex);
                return(InternalServerError(ex));
            }
        }
예제 #5
0
        public IHttpActionResult AuthenticateUser()
        {
            try
            {
                var emailAddress = UtilityServices.GetHeaderValue(Request, "emailaddress");
                var password     = UtilityServices.GetHeaderValue(Request, "password");

                var oStaffProfile = _staffService.Authenticate(emailAddress, password);
                if (oStaffProfile == null)
                {
                    return(BadRequest("Invalid Username/Password"));
                }
                return(Ok(oStaffProfile));
            }
            catch (Exception ex)
            {
                LogHelper.Log(ex);
                return(InternalServerError(ex));
            }
        }
예제 #6
0
        async Task DeleteConfirmation(UserDetailsDto user)
        {
            bool ok = (await DialogService.Confirm("Are you sure to delete user?", "Delete User", new ConfirmOptions()
            {
                OkButtonText = "Yes", CancelButtonText = "No"
            })).GetValueOrDefault();

            if (ok)
            {
                var result = await AuthenticationApiService.DeleteUserAsync(user.Id);

                if (result.IsSuccessful)
                {
                    ApplicationUsers.Remove(user);
                    await UsersGrid.Reload();
                }
                else
                {
                    UtilityServices.ShowNotification(NotificationSeverity.Error, "Delete User failed", result.Errors.ToArray());
                    NavigationManager.NavigateTo("/users", true);
                }
            }
        }
예제 #7
0
        static void DrawGizmoForMyScript(Transform scr, GizmoType gizmoType)
        {
            //Debug.Log("OnEnable on InspectorAttacher on PolyFew");
            if (Selection.activeGameObject == null)
            {
                return;
            }
            if (Selection.activeTransform == null || Selection.activeTransform is RectTransform)
            {
                return;
            }
            if (Selection.activeGameObject.GetComponent <PolyFewHost>() != null)
            {
                return;
            }
            if (!UtilityServices.CheckIfFeasible(Selection.activeTransform))
            {
                return;
            }
            if (Application.isPlaying)
            {
                return;
            }


            PrefabType prefabType = PrefabUtility.GetPrefabType(Selection.activeGameObject);

            /*
             * if (prefabType != PrefabType.None && prefabType != PrefabType.DisconnectedModelPrefabInstance && prefabType != PrefabType.DisconnectedPrefabInstance && prefabType != PrefabType.MissingPrefabInstance)
             * {
             *  bool positive = EditorUtility.DisplayDialog("Prefab Instance Detected",
             *      "Poly Few doesn't show up for connected prefab instances until you disconnect them. Press \"Disconnect\" to proceed with the prefab disconnection.",
             *      "Disconnect",
             *      "Cancel");
             *
             *  if(positive) { PrefabUtility.DisconnectPrefabInstance(Selection.activeGameObject); }
             * }
             */

            prefabType = PrefabUtility.GetPrefabType(Selection.activeGameObject);

            if (prefabType != PrefabType.None && prefabType != PrefabType.DisconnectedModelPrefabInstance && prefabType != PrefabType.DisconnectedPrefabInstance && prefabType != PrefabType.MissingPrefabInstance)
            {
                return;
            }


            // Attach the inspector hosting script
            if (Selection.activeGameObject != null)
            {
                //Debug.Log("Adding hosting script to gameobject  " +Selection.activeGameObject.name);
                PolyFewHost host = Selection.activeGameObject.AddComponent(typeof(PolyFewHost)) as PolyFewHost;


                oldFlags = Selection.activeGameObject.hideFlags;
                Selection.activeGameObject.hideFlags = HideFlags.DontSave;
                host.hideFlags = HideFlags.DontSave;


#pragma warning disable

                int moveUp = Selection.activeGameObject.GetComponents <Component>().Length - 2;


                /*
                 * for (int a = 0; a < moveUp; a++)
                 * {
                 *  UnityEditorInternal.ComponentUtility.MoveComponentUp(host);
                 * }
                 */


                Selection.activeGameObject.hideFlags = oldFlags;

                var backup = Selection.activeGameObject.GetComponent <LODBackupComponent>();

                if (backup)
                {
                    backup.hideFlags = HideFlags.HideInInspector;
                }
            }

            else
            {
                Debug.Log("ActiveSelection is null");
            }
        }