public static void Move(EnumDirection dir, MazeObject movee)
        {
            switch (dir)
            {
                case EnumDirection.Up:
                    SwapUpDown(movee.getSurroundings().GetUp(), movee);
                    break;

                case EnumDirection.Down:
                    SwapUpDown(movee, movee.getSurroundings().GetDown());
                    break;

                case EnumDirection.Left:
                    SwapLeftRight(movee, movee.getSurroundings().GetLeft());
                    break;

                case EnumDirection.Right:
                    SwapLeftRight(movee.getSurroundings().GetRight(), movee);
                    break;

                default:
                    throw new UnauthorizedAccessException();

            }
        }
        public override void interact(EnumDirection dir)
        {
            this.setLastMove(dir);

            MazeObject interaction = getInteractionObject(dir);

            interaction.interact(this);
        }
        /// <summary>
        /// 移动角色菜单
        /// </summary>
        public ActionResult MoveRoleMenu(IList<Guid> menuGuid, EnumDirection operateType, Guid? userID)
        {
            ModelSysUserRightManageMoveRoleMenu model = new ModelSysUserRightManageMoveRoleMenu();
            model.UserID = userID;
            model.MenuGuid = menuGuid;
            model.OperateType = operateType;
            model.RetriveData();

            return RedirectToAction("Index", "SysUserRightManage", new { id = userID });
        }
        public bool move(EnumDirection dir)
        {
            switch (dir)
            {
                case EnumDirection.Right:
                    if (_surroundings.getRight().swappable())
                    {
                        MazeObject temp = _surroundings.getRight().getObject();
                        _surroundings.getRight().setObject(_occupiedBy);
                        _occupiedBy = temp;
                        return true;
                    }
                    return false;

                case EnumDirection.Left:
                    if (_surroundings.getLeft().swappable())
                    {
                        MazeObject temp = _surroundings.getLeft().getObject();
                        _surroundings.getLeft().setObject(_occupiedBy);
                        _occupiedBy = temp;
                        return true;
                    }
                    return false;

                case EnumDirection.Up:
                    if (_surroundings.getUp().swappable())
                    {
                        MazeObject temp = _surroundings.getUp().getObject();
                        _surroundings.getUp().setObject(_occupiedBy);
                        _occupiedBy = temp;
                        return true;
                    }
                    return false;

                case EnumDirection.Down:
                    if (_surroundings.getDown().swappable())
                    {
                        MazeObject temp = _surroundings.getDown().getObject();
                        _surroundings.getDown().setObject(_occupiedBy);
                        _occupiedBy = temp;
                        return true;
                    }
                    return false;

                default:
                    return false;

            }//end switch
        }
 /// <summary>
 /// return an EnumDirection from a string
 /// </summary>
 /// <param name="strDir"></param>
 /// <returns></returns>
 public static EnumDirection stringToDirection(String strDir)
 {
     EnumDirection orientation = new EnumDirection();
     switch (strDir)
     {
         case "east":
             orientation = EnumDirection.East;
             break;
         case "diagonalSouthEast":
             orientation = EnumDirection.DiagonalSouthEast;
             break;
         case "southEast":
             orientation = EnumDirection.SouthEast;
             break;
         case "diagonalSouth":
             orientation = EnumDirection.DiagonalSouth;
             break;
         case "southWest":
             orientation = EnumDirection.SouthWest;
             break;
         case "diagonalSouthWest":
             orientation = EnumDirection.DiagonalSouthWest;
             break;
         case "west":
             orientation = EnumDirection.West;
             break;
         case "diagonalNorthWest":
             orientation = EnumDirection.DiagonalNorthWest;
             break;
         case "northWest":
             orientation = EnumDirection.NorthWest;
             break;
         case "diagonalNorth":
             orientation = EnumDirection.DiagonalNorth;
             break;
         case "northEast":
             orientation = EnumDirection.NorthEast;
             break;
         case "diagonalNorthEast":
             orientation = EnumDirection.DiagonalNorthEast;
             break;
         case "default":
             orientation = EnumDirection.Default;
             break;
     }
     return orientation;
 }
        //could this go somewhere else? -- where?
        private MazeObject GetInteractionObject(EnumDirection dir)
        {
            switch (dir)
            {
                case EnumDirection.Up:
                    return _surroundings.GetUp();

                case EnumDirection.Down:
                    return _surroundings.GetDown();

                case EnumDirection.Left:
                    return _surroundings.GetLeft();

                case EnumDirection.Right:
                    return _surroundings.GetRight();

                default:
                    throw new FieldAccessException();
            }
        }
Example #7
0
        protected bool move(EnumDirection dir)
        {
            MazeMover.move(dir, this);

            return false;
        }
 /// <summary>
 /// 移动用户所属角色
 /// </summary>
 /// <param name="nonAssignedUserID"></param>
 /// <param name="assignedUserList"></param>
 /// <param name="operateType"></param>
 /// <param name="sysRoleID"></param>
 /// <returns></returns>
 public ActionResult MoveUsers(IList<Guid> nonAssignedUserList, IList<Guid> assignedUserList, EnumDirection operateType, Guid? sysRoleID)
 {
     ModelSysRoleManageMoveUsers model = new ModelSysRoleManageMoveUsers();
     model.SysRoleID = sysRoleID;
     model.OperateType = operateType;
     model.NonAssignedUserList = nonAssignedUserList;
     model.AssignedUserList = assignedUserList;
     model.RetriveData();
     return RedirectToAction("BelongsRole", "SysRoleManage", new { id = sysRoleID });
 }
 public static EnumDirection Rotate(EnumDirection source, int rotateValue)
 {
     //Logger.Error("source : " + source.ToString() + " Dest : " + ((EnumDirection)(((int)source + rotateValue) % 12)).ToString());
     return (EnumDirection)(((int)source + rotateValue) % 12);
 }
 public static int GetDiffAngle(EnumDirection source, EnumDirection dest)
 {
     return (GetDiff(source, dest) - 6) * 30;
 }
 public static int GetDiff(EnumDirection source, EnumDirection dest)
 {
     //Logger.Error(((dest - source) + 12) % 12);
     return ((dest - source)+12)%12;
 }
        /// <summary>
        /// 移动用户类型菜单
        /// </summary>
        /// <param name="menuGuid"></param>
        /// <param name="operateType"></param>
        /// <param name="sysRoleID"></param>
        /// <returns></returns>
        public ActionResult MoveUserTypeMenu(IList<Guid> menuGuid, EnumDirection operateType, Guid? sysUserTypeID)
        {
            ModelSysUserTypeManageMoveUserTypeMenu model = new ModelSysUserTypeManageMoveUserTypeMenu();
            model.SysUserTypeID = sysUserTypeID;
            model.MenuGuid = menuGuid;
            model.OperateType = operateType;
            Error = model.MoveMenu();

            return RedirectToAction("Index", "SysUserTypeManage", new { SysUserTypeID = sysUserTypeID});
        }
 public void SetLastMove(EnumDirection dir)
 {
     _lastMoveDirection = dir;
 }
 public void Interact(EnumDirection dir)
 {
     this.SetLastMove(dir);
     MazeObject interaction = GetInteractionObject(dir);
     interaction.Interact(this);
 }
Example #15
0
File: FFT.cs Project: PtrMan/ai2
        /// <summary>
        /// Calculate Fast Fourier Transform of Input Image
        /// </summary>
        public void doFft(EnumDirection direction)
        {
            int directionAsInt;

            if( direction == EnumDirection.FORWARD )
            {
                directionAsInt = 1;
            }
            else
            {
                directionAsInt = -1;
            }

            //Initializing Fourier Transform Array
            //int i,j;
            /****Fourier =new ComplexNumber [Width,Height];****/
            Output = new ComplexNumber[Width, Height];
            //Copy Image Data to the Complex Array
            /***for (i=0;i<=Width -1;i++)
                for (j = 0; j <= Height - 1; j++)
                {
                    Fourier[i, j].real =(double) GreyImage[i, j];
                    Fourier[i, j].imag = 0;
                }***/
            //Calling Forward Fourier Transform
            Output = fft2d(Fourier, nx, ny, directionAsInt);

            if( direction == EnumDirection.BACKWARD )
            {
                int x, y;

                inverseResult = new double[Width, Height];

                for( y = 0; y < Height; y++ )
                {
                    for( x = 0; x < Width; x++ )
                    {
                        inverseResult[x, y] = Output[x, y].Magnitude();
                    }
                }
            }
            else
            {
                inverseResult = null;
            }

            return;
        }