コード例 #1
0
 public void SetOrientation(Vector3Int position, Orientations orientation)
 {
     if (ValidateCellPosition(position))
     {
         m_Cells[GetCellIndex(position)].orientation = orientation;
     }
 }
コード例 #2
0
ファイル: Ili9341.cs プロジェクト: wwkkww1983/ILI9341Driver
        public void SetRotation(Orientations orientation)
        {
            SendCommand(Commands.MemoryAccessControl);

            switch (orientation)
            {
            default:
            case Orientations.Portrait:
                SendData((byte)(MemoryAccessControl.MX | MemoryAccessControl.BGR));
                Width  = 240;
                Height = 320;
                break;

            case Orientations.Landscape:
                SendData((byte)(MemoryAccessControl.MV | MemoryAccessControl.BGR));
                Width  = 320;
                Height = 240;
                break;

            case Orientations.PortraitFlip:
                SendData((byte)(MemoryAccessControl.MY | MemoryAccessControl.ML | MemoryAccessControl.BGR));
                Width  = 240;
                Height = 320;
                break;

            case Orientations.LandscapeFlip:
                SendData((byte)(MemoryAccessControl.ML | MemoryAccessControl.MV | MemoryAccessControl.MX | MemoryAccessControl.MY | MemoryAccessControl.BGR));
                Width  = 320;
                Height = 240;
                break;
            }
        }
コード例 #3
0
        public override Dictionary<string, string> GenerateReplacementDictionary(
            ExportProperties exportProperties,
            BuildData buildData)
        {
            Dictionary<string, string> replacements = this.ParentPlatform.GenerateReplacementDictionary(exportProperties, buildData);
            replacements["ORGANIZATION_NAME"] = "Organization Name";

            replacements["DEVELOPMENT_TEAM_ALL_CAPS"] = "";
            replacements["DEVELOPMENT_TEAM_NOT_CAPS"] = "";
            string developmentTeam = exportProperties.IosDevTeamId;
            if (developmentTeam != null)
            {
                replacements["DEVELOPMENT_TEAM_NOT_CAPS"] = "DevelopmentTeam = " + developmentTeam + ";";
                replacements["DEVELOPMENT_TEAM_ALL_CAPS"] = "DEVELOPMENT_TEAM = " + developmentTeam + ";";
            }

            string bundleIdPrefix = exportProperties.IosBundlePrefix;
            replacements["IOS_BUNDLE_ID"] = bundleIdPrefix == null
                ? exportProperties.ProjectID
                : bundleIdPrefix + "." + exportProperties.ProjectID;

            Orientations orientations = exportProperties.Orientations;
            replacements["IOS_SUPPORTED_ORIENTATIONS_INFO_PLIST"] = string.Join("",
                "\t<array>\n",
                orientations.SupportsPortrait ? "\t\t<string>UIInterfaceOrientationPortrait</string>\n" : "",
                orientations.SupportsUpsideDown ? "\t\t<string>UIInterfaceOrientationPortraitUpsideDown</string>\n" : "",
                orientations.SupportsLandscapeLeft ? "\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n" : "",
                orientations.SupportsLandscapeRight ? "\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n" : "",
                "\t</array>");

            return replacements;
        }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GridViewModel"/> class.
 /// This constructor is used in copying and model convertions
 /// </summary>
 /// <param name="name">Question name</param>
 /// <param name="top">Top position on parent canvas</param>
 /// <param name="left">Left position on parent canvas</param>
 /// <param name="width">Question's width</param>
 /// <param name="height">Question's height</param>
 /// <param name="parentTemplate">The view model of parent template</param>
 /// <param name="orientation"></param>
 public GridViewModel(string name, double top, double left, double width, double height, TemplateViewModel parentTemplate, Orientations orientation)
 {
     this.InitializeValues(name, top, left, width, height);
     this.ParentTemplate  = parentTemplate;
     this.SelectedMapping = this.AnswersMapping[latestSelectedMapping];
     this.orientation     = orientation;
 }
コード例 #5
0
    public void CreateModules(bool respectNeigborExclusions = true)
    {
        int count   = 0;
        var modules = new List <Module>();

        var prototypes = this.getPrototypes().ToArray();

        var scenePrototype = new Dictionary <Module, ModulePrototype>();

        for (int i = 0; i < prototypes.Length; i++)
        {
            var prototype = prototypes[i];
            for (int face = 0; face < 6; face++)
            {
                if (prototype.Faces[face].ExcludedNeighbours == null)
                {
                    prototype.Faces[face].ExcludedNeighbours = new ModulePrototype[0];
                }
            }

            for (int rotation = 0; rotation < 4; rotation++)
            {
                if (rotation == 0 || !prototype.CompareRotatedVariants(0, rotation))
                {
                    var module = new Module(prototype.gameObject, rotation, count);
                    modules.Add(module);
                    scenePrototype[module] = prototype;
                    count++;
                }
            }

            EditorUtility.DisplayProgressBar("Creating module prototypes...", prototype.gameObject.name, (float)i / prototypes.Length);
        }

        ModuleData.Current = modules.ToArray();

        foreach (var module in modules)
        {
            module.PossibleNeighbors = new ModuleSet[6];
            for (int direction = 0; direction < 6; direction++)
            {
                var face = scenePrototype[module].Faces[Orientations.Rotate(direction, module.Rotation)];
                module.PossibleNeighbors[direction] = new ModuleSet(modules
                                                                    .Where(neighbor => module.Fits(direction, neighbor) &&
                                                                           (!respectNeigborExclusions || (
                                                                                !face.ExcludedNeighbours.Contains(scenePrototype[neighbor]) &&
                                                                                !scenePrototype[neighbor].Faces[Orientations.Rotate((direction + 3) % 6, neighbor.Rotation)].ExcludedNeighbours.Contains(scenePrototype[module])) &&
                                                                            (!face.EnforceWalkableNeighbor || scenePrototype[neighbor].Faces[Orientations.Rotate((direction + 3) % 6, neighbor.Rotation)].Walkable) &&
                                                                            (face.Walkable || !scenePrototype[neighbor].Faces[Orientations.Rotate((direction + 3) % 6, neighbor.Rotation)].EnforceWalkableNeighbor))
                                                                           ));
            }

            module.PossibleNeighborsArray = module.PossibleNeighbors.Select(ms => ms.ToArray()).ToArray();
        }
        EditorUtility.ClearProgressBar();

        this.Modules = modules.ToArray();
        EditorUtility.SetDirty(this);
        AssetDatabase.SaveAssets();
    }
コード例 #6
0
        public RequestModel(Modes mode, IEnumerable <string> options = null, string user = "", string size = "", Orientations orientation = Orientations.Any)
        {
            Mode        = mode;
            Orientation = orientation;
            Size        = size;
            switch (mode)
            {
            case Modes.collection:
            {
                this.collections = options;
                break;
            }

            case Modes.featured:
            {
                this.features = options;
                break;
            }

            case Modes.user:
            {
                this.User = user;
                break;
            }
            }
            ;
        }
コード例 #7
0
        public static Tuple <RobotConstructionStatus, IRobotCleaner> GetRobot(RobotParametersDto parameters)
        {
            Orientations.InitializeOrientations();
            //Create a validator in order to do basic verifications
            IRobotCleanerValidator validator = new RobotCleanerValidator();
            var result = Tuple.Create <RobotConstructionStatus, IRobotCleaner>(RobotConstructionStatus.Error, null);

            //if the parameters given are not valid, it will return null with the enum value in Error.
            if (!validator.IsRobotValid(parameters) || !validator.IsMapValid(parameters))
            {
                return(result);
            }

            //Here the dependencies are created and injected in the robot object.
            var                currentPosition   = new CurrentPosition(GetAxis(parameters.Start["X"]), GetAxis(parameters.Start["Y"]));
            IMap               map               = new Map(parameters.Map, currentPosition);
            IReturnAlgorithm   returnAlgorithm   = new ReturnAlgorithm(new FirstStep());
            ICleaningAlgorithm cleaningAlgorithm = new CleaningAlgorithm(parameters.Commands);
            var                movingStrategies  = Orientations.GetMovingStrategies();

            result = Tuple.Create <RobotConstructionStatus, IRobotCleaner>(RobotConstructionStatus.Success,
                                                                           new Implementations.RobotCleaner(currentPosition.X,
                                                                                                            currentPosition.Y,
                                                                                                            Orientations.GetFacingPosition(parameters.Start["facing"]),
                                                                                                            parameters.Battery, map, returnAlgorithm, movingStrategies, cleaningAlgorithm));


            return(result);
        }
コード例 #8
0
        public void SetRotation(Orientations orientation)
        {
            SendCommand(Commands.MemoryAccessControl);
            switch (orientation)
            {
            default:
            case Orientations.Portrait:
                SendData(_orientationFlags[(int)Orientations.Portrait]);
                Width  = 240;
                Height = 320;
                break;

            case Orientations.Landscape:
                SendData(_orientationFlags[(int)Orientations.Landscape]);
                Width  = 320;
                Height = 240;
                break;

            case Orientations.PortraitFlip:
                SendData(_orientationFlags[(int)Orientations.PortraitFlip]);
                Width  = 240;
                Height = 320;
                break;

            case Orientations.LandscapeFlip:
                SendData(_orientationFlags[(int)Orientations.LandscapeFlip]);
                Width  = 320;
                Height = 240;
                break;
            }
        }
コード例 #9
0
    public void EnforceWalkway(Vector3i start, Vector3i destination)
    {
        int direction = Orientations.GetIndex((destination - start).ToVector3());

        this.EnforceWalkway(start, direction);
        this.EnforceWalkway(destination, (direction + 3) % 6);
    }
コード例 #10
0
        public bool IsConvex(out Orientations orientation, float threshold = 1E-05f)
        {
            orientation = Orientations.None;
            int num  = this._edges.Length;
            int num2 = 0;
            int num3 = num - 1;

            for (int i = 0; i < num; i++)
            {
                Vector2 vector    = -this._edges[num3].Direction;
                Vector2 direction = this._edges[i].Direction;
                float   num4      = vector.DotPerp(direction);
                int     num5      = (num4 <-threshold || num4> threshold) ? ((num4 > 0f) ? 1 : -1) : 0;
                if (num5 != 0)
                {
                    if (num2 != 0)
                    {
                        if ((num2 > 0 && num5 < 0) || (num2 < 0 && num5 > 0))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        num2 += num5;
                    }
                }
                num3 = i;
            }
            orientation = ((num2 == 0) ? Orientations.None : ((num2 > 0) ? Orientations.CW : Orientations.CCW));
            return(orientation != Orientations.None);
        }
コード例 #11
0
        public static IVisualContainer GetStackPanel <TViewModel, TProperty>(Orientations orientation,
                                                                             String propertyName)
        {
            var prop = typeof(TViewModel).GetProperty(propertyName);

            if (prop == null)
            {
                throw new InvalidOperationException();
            }

            var isCollection = typeof(IEnumerable <TProperty>).IsAssignableFrom(prop.PropertyType);

            if (isCollection)
            {
                var binding = new DeferredPropertyBinding <IEnumerable <TProperty> >(prop);
                return(new StackPanel <IEnumerable <TProperty> >
                {
                    Binding = binding, Orientation = orientation
                });
            }
            else
            {
                var binding = new DeferredPropertyBinding <TProperty>(prop);
                return(new StackPanel <TProperty>
                {
                    Binding = binding, Orientation = orientation
                });
            }
        }
コード例 #12
0
 internal static Vector2 Scale(this Orientations o)
 {
     /*if (o == Orientations.Up_Left)
      * {
      *  return new ScaleTransform(-1, -1);
      * }
      * else if (o == Orientations.Up)
      * {
      *  return new ScaleTransform(1, -1);
      * }
      * else if (o == Orientations.Right)
      * {
      *  return new ScaleTransform(-1, 1);
      * }
      * return new ScaleTransform(1, 1);*/
     if (o == Orientations.Up_Left)
     {
         return(new Vector2(-1, -1));
     }
     else if (o == Orientations.Up)
     {
         return(new Vector2(1, -1));
     }
     else if (o == Orientations.Right)
     {
         return(new Vector2(-1, 1));
     }
     return(new Vector2(1, 1));
 }
コード例 #13
0
        public SpringGreen(Vector2 position, Orientations orientation, string spritePath)
            : base(position, orientation, true)
        {
            if (string.IsNullOrWhiteSpace(spritePath))
            {
                spritePath = "objects/DJMapHelper/springGreen/";
            }

            if (!spritePath.EndsWith("/"))
            {
                spritePath += "/";
            }

            Sprite sprite = new(GFX.Game, spritePath);

            sprite.Add("idle", "", 0.0f, new int[1]);
            sprite.Add("bounce", "", 0.07f, "idle", 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 5);
            sprite.Add("disabled", "white", 0.07f);
            sprite.Play("idle");
            sprite.Origin.X = sprite.Width / 2f;
            sprite.Origin.Y = sprite.Height;
            if (orientation == Orientations.WallLeft)
            {
                sprite.Rotation = 1.570796f;
            }
            else if (orientation == Orientations.WallRight)
            {
                sprite.Rotation = -1.570796f;
            }

            if (SpringSprite.GetValue(this) is Sprite origSprite)
            {
                SpriteCloneInto.Invoke(sprite, new object[] { origSprite });
            }
        }
コード例 #14
0
        /// <summary>
        /// Prints an image.
        /// </summary>
        /// <param name="image">Image to be printed</param>
        /// <param name="jobName">Name of the printing job</param>
        /// <param name="onFinishCallback">
        /// Action to perform after printing is finished.
        /// Is performed even if the printing was cancelled.
        /// </param>
        /// <param name="colorMode">Color mode of printing</param>
        /// <param name="orientation">Sheet orientation of printing</param>
        /// <param name="scaleMode">Scale mode of printing</param>
        /// <exception cref="ArgumentNullException"></exception>
        public static void PrintImage([NotNull] Texture2D image, [NotNull] string jobName, Action onFinishCallback = null,
                                      ColorModes colorMode = ColorModes.Color, Orientations orientation = Orientations.Portrait, ScaleModes scaleMode = ScaleModes.Fit)
        {
            if (AGUtils.IsNotAndroid())
            {
                return;
            }

            if (image == null)
            {
                throw new ArgumentNullException("image");
            }

            if (jobName == null)
            {
                throw new ArgumentNullException("jobName");
            }

            _printHelper = new AndroidJavaObject(C.AndroidPrintHelper, AGUtils.Activity);
            _printHelper.Call("setColorMode", (int)colorMode);
            _printHelper.Call("setOrientation", (int)orientation);
            _printHelper.Call("setScaleMode", (int)scaleMode);

            _onPrintSuccess = onFinishCallback;

            var helperClass = new AndroidJavaClass(C.PrintHelperUtilsClass);

            helperClass.CallStatic("printBitmap", jobName, AGUtils.Texture2DToAndroidBitmap(image), _printHelper);
        }
コード例 #15
0
 public Edge(Vertex v1, Vertex v2, Orientations orientation)
 {
     _V1           = v1;
     _V2           = v2;
     _Orientation  = orientation;
     _Multiplicity = 1;
 }
コード例 #16
0
    public bool CompareRotatedVariants(int r1, int r2)
    {
        if (!(this.Faces[Orientations.UP] as VerticalFaceDetails).Invariant || !(this.Faces[Orientations.DOWN] as VerticalFaceDetails).Invariant)
        {
            return(false);
        }

        for (int i = 0; i < 4; i++)
        {
            var face1 = this.Faces[Orientations.Rotate(Orientations.HorizontalDirections[i], r1)] as HorizontalFaceDetails;
            var face2 = this.Faces[Orientations.Rotate(Orientations.HorizontalDirections[i], r2)] as HorizontalFaceDetails;

            if (face1.Connector != face2.Connector)
            {
                return(false);
            }

            if (!face1.Symmetric && !face2.Symmetric && face1.Flipped != face2.Flipped)
            {
                return(false);
            }
        }

        return(true);
    }
コード例 #17
0
 public PlaceCommand(ToyRobot toy, PlacementCoordinates placementVar)
 {
     toyRobot            = toy;
     xCoordinate         = placementVar.XPlacement;
     yCooridinate        = placementVar.YPlacement;
     startingOrientation = placementVar.orientations;
 }
コード例 #18
0
        public static bool Rotate(uint DisplayNumber, Orientations Orientation)
        {
            if (DisplayNumber == 0)
            {
                throw new ArgumentOutOfRangeException("DisplayNumber", DisplayNumber, "First display is 1.");
            }

            var result = false;
            var d      = new DISPLAY_DEVICE();
            var dm     = new DEVMODE();

            d.cb = Marshal.SizeOf(d);

            if (!ShowMe.EnumDisplayDevices(null, DisplayNumber - 1, ref d, 0))
            {
                throw new ArgumentOutOfRangeException("DisplayNumber", DisplayNumber,
                                                      "Number is greater than connected displays.");
            }

            if (0 != ShowMe.EnumDisplaySettings(
                    d.DeviceName, ShowMe.ENUM_CURRENT_SETTINGS, ref dm))
            {
                if ((dm.dmDisplayOrientation + (int)Orientation) % 2 == 1)  // Need to swap height and width?
                {
                    var temp = dm.dmPelsHeight;
                    dm.dmPelsHeight = dm.dmPelsWidth;
                    dm.dmPelsWidth  = temp;
                }

                switch (Orientation)
                {
                case Orientations.DEGREES_CW_90:
                    dm.dmDisplayOrientation = ShowMe.DMDO_270;
                    break;

                case Orientations.DEGREES_CW_180:
                    dm.dmDisplayOrientation = ShowMe.DMDO_180;
                    break;

                case Orientations.DEGREES_CW_270:
                    dm.dmDisplayOrientation = ShowMe.DMDO_90;
                    break;

                case Orientations.DEGREES_CW_0:
                    dm.dmDisplayOrientation = ShowMe.DMDO_DEFAULT;
                    break;

                default:
                    break;
                }

                var ret = ShowMe.ChangeDisplaySettingsEx(
                    d.DeviceName, ref dm, IntPtr.Zero,
                    DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);

                result = ret == 0;
            }

            return(result);
        }
コード例 #19
0
 public override void Arrange <TRenderRect>(Orientations orientation,
                                            TRenderRect bounds,
                                            IRenderContext renderContext)
 {
     _currentRow = 0;
     _currentY   = 0;
     base.Arrange(orientation, bounds, renderContext);
 }
コード例 #20
0
 /// <summary>
 /// Retrieves the JPEG orientation from the specified screen rotation
 /// </summary>
 /// <param name="rotation"></param>
 /// <returns></returns>
 private int GetOrientation(int rotation)
 {
     // Sensor orientation is 90 for most devices, or 270 for some devices (eg. Nexus 5X)
     // We have to take that into account and rotate JPEG properly.
     // For devices with orientation of 90, we simply return our mapping from ORIENTATIONS.
     // For devices with orientation of 270, we need to rotate the JPEG 180 degrees.
     return((Orientations.Get(rotation) + mSensorOrientation + 270) % 360);
 }
コード例 #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChangeGridOrientationAction"/> class
 /// </summary>
 /// <param name="gridViewModel">Changed grid view model</param>
 /// <param name="orientationBefore">Orientation value before the change</param>
 /// <param name="orientationAfter">Orientation value after the change</param>
 /// <param name="choiceBoxesBefore">Child choice boxes before the change</param>
 /// <param name="choiceBoxesAfter">Child choice boxes after the change</param>
 public ChangeGridOrientationAction(GridViewModel gridViewModel, Orientations orientationBefore, Orientations orientationAfter, List <ChoiceBoxViewModel> choiceBoxesBefore, List <ChoiceBoxViewModel> choiceBoxesAfter)
 {
     this.gridViewModel     = gridViewModel;
     this.orientationBefore = orientationBefore;
     this.orientationAfter  = orientationAfter;
     this.choiceBoxesBefore = choiceBoxesBefore;
     this.choiceBoxesAfter  = choiceBoxesAfter;
 }
コード例 #22
0
        /// <summary>
        /// Tracks orientation change in grid question
        /// </summary>
        /// <param name="gridViewModel">Changed grid view model</param>
        /// <param name="orientationBefore">Orientation value before the change</param>
        /// <param name="orientationAfter">Orientation value after the change</param>
        /// <param name="choiceBoxesBefore">Child choice boxes before the change</param>
        /// <param name="choiceBoxesAfter">Child choice boxes after the change</param>
        public static void TrackGridOrientationChange(GridViewModel gridViewModel, Orientations orientationBefore,
                                                      Orientations orientationAfter, List <ChoiceBoxViewModel> choiceBoxesBefore,
                                                      List <ChoiceBoxViewModel> choiceBoxesAfter)
        {
            ChangeGridOrientationAction action = new ChangeGridOrientationAction(gridViewModel, orientationBefore, orientationAfter, choiceBoxesBefore, choiceBoxesAfter);

            TrackAction(action);
        }
コード例 #23
0
        public static DISP_CHANGE Rotate(uint displayNumber, Orientations orientation)
        {
            if (displayNumber == 0)
            {
                throw new ArgumentOutOfRangeException("displayNumber", displayNumber, "First display is 1.");
            }

            DISP_CHANGE    result = DISP_CHANGE.Failed;
            DISPLAY_DEVICE d      = new DISPLAY_DEVICE();
            DEVMODE        dm     = new DEVMODE();

            d.cb = Marshal.SizeOf(d);

            if (!NativeMethods.EnumDisplayDevices(null, displayNumber - 1, ref d, 0))
            {
                throw new ArgumentOutOfRangeException("displayNumber", displayNumber,
                                                      "Number is greater than connected displays.");
            }

            if (0 != NativeMethods.EnumDisplaySettings(
                    d.DeviceName, ENUM_CURRENT_SETTINGS, ref dm))
            {
                if ((dm.dmDisplayOrientation + (int)orientation) % 2 == 1)  // Need to swap height and width?
                {
                    int temp = dm.dmPelsHeight;
                    dm.dmPelsHeight = dm.dmPelsWidth;
                    dm.dmPelsWidth  = temp;
                }

                switch (orientation)
                {
                case Orientations.DEGREES_CW_90:
                    dm.dmDisplayOrientation = DMDO_270;
                    break;

                case Orientations.DEGREES_CW_180:
                    dm.dmDisplayOrientation = DMDO_180;
                    break;

                case Orientations.DEGREES_CW_270:
                    dm.dmDisplayOrientation = DMDO_90;
                    break;

                case Orientations.DEGREES_CW_0:
                    dm.dmDisplayOrientation = DMDO_DEFAULT;
                    break;

                default:
                    break;
                }

                result = NativeMethods.ChangeDisplaySettingsEx(
                    d.DeviceName, ref dm, IntPtr.Zero,
                    DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
            }

            return(result);
        }
コード例 #24
0
        /// <summary>
        /// Creates an <see cref="OrientedlLine"/> by combining two symmetrical
        /// <see cref="DirectionalLine"/> s related to the
        /// <paramref name="orientation"/>. For more information, see <see cref="DirectionalLine.FromBoard(Board, int, int, Piece, Directions, int, int)"/>.
        /// </summary>
        /// <param name="board">the <see cref="Board"/> to be used</param>
        /// <param name="x">the starting <see cref="Tile.X"/></param>
        /// <param name="y">the starting <see cref="Tile.Y"/></param>
        /// <param name="piece">
        /// the <see cref="Logic.Piece"/> that will determine <see cref="GetSameTiles()"/>
        /// </param>
        /// <param name="orientation">the <see cref="Orientations"/> to traverse</param>
        /// <param name="maxTile">the max number of <see cref="Tile"/> to traverse</param>
        /// <param name="blankTolerance">
        /// the max number of <see cref="Pieces.None"/> tiles before the traversing stops
        /// </param>
        /// <returns>a <see cref="OrientedlLine"/></returns>
        public static OrientedlLine FromBoard(
            Board board,
            int x,
            int y,
            Piece type,
            Orientations orientation,
            int maxTile,
            int blankTolerance)
        {
            if (board is null)
            {
                throw new ArgumentNullException(nameof(board));
            }

            if (x < 0 || x > board.Width)
            {
                throw new ArgumentException("Value is out of range", nameof(x));
            }

            if (y < 0 || y > board.Height)
            {
                throw new ArgumentException("Value is out of range", nameof(y));
            }

            if (maxTile < 0)
            {
                throw new ArgumentException(nameof(maxTile));
            }

            if (blankTolerance < 0)
            {
                throw new ArgumentException(nameof(blankTolerance));
            }

            return(orientation switch
            {
                Orientations.Horizontal => new OrientedlLine(
                    type,
                    orientation,
                    DirectionalLine.FromBoard(board, x, y, type, Directions.Left, maxTile, blankTolerance),
                    DirectionalLine.FromBoard(board, x, y, type, Directions.Right, maxTile, blankTolerance)),
                Orientations.Vertical => new OrientedlLine(
                    type,
                    orientation,
                    DirectionalLine.FromBoard(board, x, y, type, Directions.Up, maxTile, blankTolerance),
                    DirectionalLine.FromBoard(board, x, y, type, Directions.Down, maxTile, blankTolerance)),
                Orientations.Diagonal => new OrientedlLine(
                    type,
                    orientation,
                    DirectionalLine.FromBoard(board, x, y, type, Directions.UpLeft, maxTile, blankTolerance),
                    DirectionalLine.FromBoard(board, x, y, type, Directions.DownRight, maxTile, blankTolerance)),
                Orientations.RvDiagonal => new OrientedlLine(
                    type,
                    orientation,
                    DirectionalLine.FromBoard(board, x, y, type, Directions.UpRight, maxTile, blankTolerance),
                    DirectionalLine.FromBoard(board, x, y, type, Directions.DownLeft, maxTile, blankTolerance)),
                _ => throw new InvalidOperationException("Unexpected value"),
            });
コード例 #25
0
ファイル: TileHelper.cs プロジェクト: nemec/4Realms
 public Wall(Index2D start, Index2D end, Orientations or, TileTypes t, Element theme = Element.DEFAULT, bool move = false)
 {
     StartCell   = start;
     EndCell     = end;
     Type        = t;
     Theme       = theme;
     Traversable = move;
     Orientation = or;
 }
コード例 #26
0
ファイル: BaseViewModel.cs プロジェクト: K-Tobin15/Tutorials
 protected void RaiseOrientationChanged(Orientations oldValue, Orientations newValue)
 {
     if (OrientationChanged != null)
         OrientationChanged(this, new OrientationChangedEventArgs
         {
             OldValue = oldValue,
             NewValue = newValue
         });
 }
コード例 #27
0
 public Rover(int xPos, int yPos, Orientations orientation)
 {
     HasFoundObstacle = false;
     Position         = new Coordinates()
     {
         X = xPos, Y = yPos
     };
     Orientation = orientation;
 }
コード例 #28
0
ファイル: Texture.cs プロジェクト: Lucasrsv1/Pescaria_CG_TP1
 public Texture(OpenGL gl, uint id, int qtyFrames, int duration, Orientations orientation, int xFramesQty = 0)
 {
     this.gl          = gl;
     this.ID          = id;
     this.QtyFrames   = qtyFrames;
     this.Duration    = duration;
     this.Orientation = orientation;
     this.XFramesQty  = xFramesQty;
 }
コード例 #29
0
        public GameObject CreateWall(MazeChunk chunk, Orientations orientation)
        {
            var wall = Instantiate(Wall);

            wall.transform.parent        = chunk.CachedTransform;
            wall.transform.localPosition = Vector3.zero;
            wall.transform.localRotation = ToRotation(orientation);

            return(wall);
        }
コード例 #30
0
ファイル: Shape.cs プロジェクト: jithuin/infogeezer
 private void turnCounterClockwise()
 {
     //switch the orientation
     if (m_orientation == Orientations.Left)
         m_orientation = Orientations.Down;
     else
         m_orientation -= 1;
     //actualise drawing
     updateSquares();
 }
コード例 #31
0
 public override ValueSize Measure <TRenderSize>(IVisualElement container,
                                                 Orientations orientation,
                                                 TRenderSize availableSpace,
                                                 IMeasureContext measureContext)
 {
     _currentRow = 0;
     _currentY   = 0;
     RowHeights.Clear();
     return(base.Measure(container, orientation, availableSpace, measureContext));
 }
コード例 #32
0
        public static bool Rotate(uint DisplayNumber, Orientations Orientation)
        {
            bool           result = false;
            DISPLAY_DEVICE d      = new DISPLAY_DEVICE();
            DEVMODE        dm     = new DEVMODE();

            d.cb = Marshal.SizeOf(d);

            if (!Display.EnumDisplayDevices(null, DisplayNumber, ref d, 0))
            {
                throw new ArgumentOutOfRangeException("DisplayNumber", DisplayNumber, "Number is greater than connected displays.");
            }

            if (Display.EnumDisplaySettings(
                    d.DeviceName, Display.ENUM_CURRENT_SETTINGS, ref dm) != 0)
            {
                if ((dm.dmDisplayOrientation + (int)Orientation) % 2 == 1) // Need to swap height and width?
                {
                    int temp = dm.dmPelsHeight;
                    dm.dmPelsHeight = dm.dmPelsWidth;
                    dm.dmPelsWidth  = temp;
                }

                switch (Orientation)
                {
                case Orientations.DEGREES_CW_90:
                    dm.dmDisplayOrientation = 3;
                    break;

                case Orientations.DEGREES_CW_180:
                    dm.dmDisplayOrientation = 2;
                    break;

                case Orientations.DEGREES_CW_270:
                    dm.dmDisplayOrientation = 1;
                    break;

                case Orientations.DEGREES_CW_0:
                    dm.dmDisplayOrientation = 0;
                    break;

                default:
                    break;
                }

                DISP_CHANGE ret = Display.ChangeDisplaySettingsEx(
                    d.DeviceName, ref dm, IntPtr.Zero,
                    DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);

                result = ret == 0;
            }

            return(result);
        }
コード例 #33
0
    public void BeginTrial(Orientations orientation, float startTime)
    {
        this.startTime = startTime;
        this.orientation = orientation;

        SetRotation(orientation);

        currentTrial = new Trial(orientation, startTime);

        if (Phenotype != null) {
          Phenotype.AddTrial(currentTrial);
        }
    }
コード例 #34
0
 public static Point2 ToDirection(Orientations orientation)
 {
     switch (orientation)
     {
         default:
             return Point2.Right;
         case Orientations.Down:
             return Point2.Down;
         case Orientations.Left:
             return Point2.Left;
         case Orientations.Up:
             return Point2.Up;
     }
 }
コード例 #35
0
 public static Orientations ToOpposite(Orientations orientation)
 {
     switch (orientation)
     {
         default:
             return Orientations.Left;
         case Orientations.Down:
             return Orientations.Up;
         case Orientations.Left:
             return Orientations.Right;
         case Orientations.Up:
             return Orientations.Down;
     }
 }
コード例 #36
0
        /// <summary>
        /// Crea una pared con un punto de origen, el tamaño de la pared y la orientación de la misma, especificando
        /// el tiling de la textura
        /// </summary>
        /// <param name="origin">Punto de origen de la pared</param>
        /// <param name="size">Dimensiones de la pared. Uno de los valores será ignorado, según la orientación elegida</param>
        /// <param name="orientation">Orientacion de la pared</param>
        /// <param name="texture">Textura de la pared</param>
        /// <param name="uTile">Cantidad de tile de la textura en coordenada U</param>
        /// <param name="vTile">Cantidad de tile de la textura en coordenada V</param>
        public TgcPlaneWall(Vector3 origin, Vector3 size, Orientations orientation, TgcTexture texture, float uTile, float vTile)
            : this()
        {
            setTexture(texture);

            autoAdjustUv = false;
            this.origin = origin;
            this.size = size;
            this.orientation = orientation;
            this.uTile = uTile;
            this.vTile = vTile;

            updateValues();
        }
コード例 #37
0
 public Ship(int x, int y, int size, Orientations o)
 {
     this.x = x;
     this.y = y;
     this.size = size;
     this.o = o;
     this.plage = new int[this.size];
     for (int i = 0; i < this.size; i++)
     {
         if (o == Orientations.Horizontal)
             plage[i] = this.x + i;
         else
             plage[i] = this.y + i;
     }
 }
コード例 #38
0
ファイル: Shape.cs プロジェクト: jithuin/infogeezer
        public Shape()
        {
            m_shape = Shapes.I;
            m_orientation = Orientations.Up;
            m_squares = new List<Square>(4);
            m_location = new Point(100, 100);
            m_blockSize = new Size(10, 10);

            for (int i = 0; i < 4; i++)
                m_squares.Add(
                    new Square(
                        new Point(m_location.X, m_location.Y - (i + 1) * m_blockSize.Height),
                        new Size(m_blockSize.Width - 2, m_blockSize.Height - 2)
                    )
                );

        } 
コード例 #39
0
ファイル: BaseViewModel.cs プロジェクト: K-Tobin15/Tutorials
 private void UpdateOrientations()
 {
     var oldValue = this.Orientation;
     switch (Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().Orientation)
     {
         case Windows.UI.ViewManagement.ApplicationViewOrientation.Landscape:
             this.Orientation = Orientations.Horizontal;
             break;
         case Windows.UI.ViewManagement.ApplicationViewOrientation.Portrait:
             this.Orientation = Orientations.Vertical;
             break;
     }
     if (Windows.UI.Xaml.Window.Current.Bounds.Width == 320)
         this.Orientation = Orientations.Snap;
     if (!oldValue.Equals(this.Orientation))
         RaiseOrientationChanged(oldValue, this.Orientation);
 }
コード例 #40
0
    IEnumerator EvaluateBatch(int batchIndex, Phenotype[] batch, Orientations orientation)
    {
        IList<EvaluationBehaviour> evaluations = new List<EvaluationBehaviour>();

        var layout = new TransformLayout(28.0f, 18.0f, batchSize, Mathf.FloorToInt(Mathf.Sqrt(batchSize)))
          .GetEnumerator();

        foreach (var phenotype in batch) {
          layout.MoveNext();

          var t = PoolManager.Pools["Evaluations"].Spawn(prefab, layout.Current, Quaternion.identity, transform);

          var controllerBehaviour = t.GetComponent<ControllerBehaviour>();
          controllerBehaviour.Network = NetworkPorts.FromGenotype(phenotype.Genotype);

          var evaluationBehaviour = t.GetComponent<EvaluationBehaviour>();
          evaluationBehaviour.Phenotype = phenotype;
          evaluationBehaviour.BeginTrial(orientation, Time.time);

          evaluations.Add(evaluationBehaviour);
        }

        // Wait for evaluations to complete
        while (evaluations.Any(ev => !ev.IsComplete)) {
          if (BestEvaluation != null) {
        var ordered = evaluations.OrderByDescending(ev => ev.CurrentTrial.Fitness);
        var best = ordered.First();
        BestEvaluation(best);
          }
          yield return new WaitForFixedUpdate();
        }

        // Cleanup
        List<Transform> children = new List<Transform>(transform.childCount);
        foreach (Transform child in transform) {
          if (child.gameObject.activeInHierarchy) {
        children.Add(child);
          }
        }
        foreach (Transform child in children) {
          PoolManager.Pools["Evaluations"].Despawn(child, null);
        }
    }
コード例 #41
0
 public VectorPosition(int x, int y, Orientations orientation)
 {
     X = x;
     Y = y;
     Orientation = orientation;
 }
コード例 #42
0
 public static Quaternion ToRotation(Orientations orientation)
 {
     switch (orientation)
     {
         default:
             return Quaternion.identity;
         case Orientations.Down:
             return Quaternion.Euler(0f, 0f, 270f);
         case Orientations.Left:
             return Quaternion.Euler(0f, 0f, 180f);
         case Orientations.Up:
             return Quaternion.Euler(0f, 0f, 90f);
     }
 }
コード例 #43
0
 /// <summary>
 /// 矫正图片
 /// 创建人:孙佳杰  创建时间:2016年1月27日22:45:36
 /// </summary>
 /// <param name="img"></param>
 /// <param name="width"></param>
 /// <param name="height"></param>
 /// <param name="orien"></param>
 public void Rotating(Bitmap img, ref int width, ref int height, Orientations orientations)
 {
     int ow = width;
     switch (orientations)
     {
         case Orientations.TopRight:
             img.RotateFlip(RotateFlipType.RotateNoneFlipX);//horizontal flip
             break;
         case Orientations.BottomRight:
             img.RotateFlip(RotateFlipType.Rotate180FlipNone);//right-top
             break;
         case Orientations.BottomLeft:
             img.RotateFlip(RotateFlipType.RotateNoneFlipY);//vertical flip
             break;
         case Orientations.LeftTop:
             img.RotateFlip(RotateFlipType.Rotate90FlipX);
             break;
         case Orientations.RightTop:
             img.RotateFlip(RotateFlipType.Rotate90FlipNone);//right-top
             width = height;
             height = ow;
             break;
         case Orientations.RightBottom:
             img.RotateFlip(RotateFlipType.Rotate270FlipX);
             break;
         case Orientations.LftBottom:
             img.RotateFlip(RotateFlipType.Rotate270FlipNone);//left-bottom
             width = height;
             height = ow;
             break;
         default:
             break;
     }
 }
コード例 #44
0
 void SetRotation(Orientations orientation)
 {
     if (orientation == Orientations.Random) {
       var orientations = Enum.GetValues(typeof(Orientations));
       cart.localRotation = Quaternion.Euler(0f, 0f,
     (float)(Orientations)orientations.GetValue(UnityEngine.Random.Range(0, orientations.Length)));
     } else {
       cart.localRotation = Quaternion.Euler(0f, 0f, (float)orientation);
     }
 }
コード例 #45
0
 public Trial(Orientations orientation, float startTime)
 {
     this.orientation = orientation;
     this.startTime = startTime;
     this.fitnessHistory.Fill(0.0f);
 }
コード例 #46
0
 protected virtual void OrientationChanged(Orientations newOrientation)
 {
 }
コード例 #47
0
        public GameObject CreateWall(MazeChunk chunk, Orientations orientation)
        {
            var wall = Instantiate(Wall);
            wall.transform.parent = chunk.CachedTransform;
            wall.transform.localPosition = Vector3.zero;
            wall.transform.localRotation = ToRotation(orientation);

            return wall;
        }
コード例 #48
0
        public MazeChunk CreateChunk(Point2 position, Orientations orientation, GameObject maze, MazeChunk[,] map)
        {
            position += ToDirection(orientation);

            var chunk = Instantiate(Chunks.GetRandom());
            chunk.name = string.Format("{0}_{1}", position.X, position.Y);
            chunk.Position = position;
            chunk.Orientation = orientation;
            chunk.CachedTransform.parent = maze.transform;
            chunk.CachedTransform.localPosition = position;
            map[position.X, position.Y] = chunk;

            CreateWalls(chunk, map);

            return chunk;
        }
コード例 #49
0
ファイル: Trigger.cs プロジェクト: nemec/4Realms
 /// <summary>
 /// Constructor for the Level Editor
 /// </summary>
 /// <param name="name">Sprite name of Trigger</param>
 /// <param name="initialPos">Position of Trigger</param>
 /// <param name="orientation">Trigger's orientation/direction</param>
 public PartyCrossTrigger(string name, Vector2 initialPosition, Orientations orientation = Orientations.Up)
     : this(name, Tile.TileSize, Tile.TileSize, (This.Game.LoadingLevel as FrostbyteLevel).allies)
 {
     Orientation = orientation;
     SpawnPoint = initialPosition;
 }
コード例 #50
0
ファイル: TileHelper.cs プロジェクト: nemec/4Realms
 public Wall(Index2D start, Index2D end, Orientations or, TileTypes t, Element theme = Element.DEFAULT, bool move = false)
 {
     StartCell = start;
     EndCell = end;
     Type = t;
     Theme = theme;
     Traversable = move;
     Orientation = or;
 }
コード例 #51
0
ファイル: Door.cs プロジェクト: nemec/4Realms
 /// <summary>
 /// Constructor for the Level Editor
 /// </summary>
 /// <param name="name">Sprite name of Door</param>
 /// <param name="initialPos">Position of door</param>
 /// <param name="orientation">Door's orientation/direction</param>
 public Door(string name, Vector2 initialPos, Orientations orientation=Orientations.Up)
     : this(name)
 {
     SpawnPoint = initialPos;
     this.Orientation = orientation;
 }