예제 #1
0
        private void DirModeRight(Object sender, EventArgs e)
        {
            ModeDirection = DirectionMode.Right;

            this.UpdateMessage();
            this.ExpireSolution(true);
        }
예제 #2
0
        internal string GetOpenHtmlTagPattern(DirectionMode directionMode)
        {
            var attributeFormatPattern = directionMode == DirectionMode.HtmlToBB
                                             ? "(?<{0}>.*?)"
                                             : "${{{0}}}";

            if ((Attributes == null || Attributes.Count == 0) && !SelfAttributed)
            {
                return(OpeningHtmlTag);
            }

            var result = OpeningHtmlTag;

            if (SelfAttributed)
            {
                var regex = new Regex(string.Format(@"\{{{0}}}", BbTag));
                result = regex.Replace(result, string.Format(attributeFormatPattern, BbTag));
            }

            if (Attributes != null && Attributes.Count > 0)
            {
                foreach (var attribute in Attributes)
                {
                    var regex = new Regex(string.Format(@"\{{{0}}}", attribute.Key));
                    result = regex.Replace(result, string.Format(attributeFormatPattern, attribute.Key));
                }
            }

            return(result);
        }
예제 #3
0
        public override bool Read(GH_IReader reader)
        {
            ModeDirection = (DirectionMode)reader.GetInt32("Direction");

            this.UpdateMessage();
            return(base.Read(reader));
        }
예제 #4
0
 /// <summary>
 /// MyProgressBar Constructor
 /// </summary>
 public BlockedProgressBar()
 {
     InitializeComponent();
     _blockList = new BlockList();
     _direction = DirectionMode.Horizontal;
     SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.DoubleBuffer, true);
 }
예제 #5
0
파일: Parser.cs 프로젝트: koppzuy/hackathon
        /// <summary>
        /// Returns trip information for the specified trip.
        /// The resulting TripInfo object contains a list of all the stops
        /// on the specified trip with predicted arrival or departure times.
        /// </summary>
        /// <param name="tripID">Trip ID (can be obtained from an ActualInfo object)</param>
        /// <param name="mode">Determines whether departure or arrival times are obtained</param>
        /// <returns></returns>
        public static async Task <TripInfo> GetTripInfoAsync(long tripID, DirectionMode mode)
        {
            var buster   = ((long)DateTime.Now.ToUniversalTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds) * 1000;
            var content  = new StringContent("tripId=" + tripID + "&mode=" + mode + "&cacheBuster=" + buster);
            var response = await _client.PostAsync(new Uri(_tripInfoUrl), content);

            return(await DeserializeAsync <TripInfo>(response));
        }
예제 #6
0
 public ArrowDirectional(Matrix3d matrix, DirectionMode mode, double angle = 0d)
 {
     this.BlockTableRecordId = ObjectId.Null;
     this.Origin             = new Point3d(0, 0, 0);
     this.Matrix             = matrix;
     this.Mode         = mode;
     this.BlockName    = "_DrawAnchorDeviations_" + this.Mode.ToString();
     this.DynTransient = new display.DynamicTransient();
 }
예제 #7
0
    /// <summary>
    /// 设置移动的模式
    /// </summary>
    /// <param name="luaState"></param>
    /// <returns></returns>
    public static int SetEnemyWanderMode(ILuaState luaState)
    {
        EnemyBase         enemy    = luaState.ToUserData(-3) as EnemyBase;
        InterpolationMode moveMode = (InterpolationMode)luaState.ToInteger(-2);
        DirectionMode     dirMode  = (DirectionMode)luaState.ToInteger(-1);

        enemy.SetWanderMode(moveMode, dirMode);
        return(0);
    }
예제 #8
0
        public bool Delete(T value, DirectionMode direction, out BinaryNode <T> node)
        {
            if (!Find(value, out node))
            {
                return(false);
            }

            DeleteNode(node, direction);

            return(true);
        }
예제 #9
0
 public ArrowDirectional2(Matrix3d matrix, DirectionMode mode, double angle = 0d)
     : base()
 {
     this.BlockTableRecordId = ObjectId.Null;
     this.Origin             = new Point3d(0, 0, 0);
     this.UcsMatrix          = matrix;
     this.Mode         = mode;
     this.BlockName    = "_DrawAnchorDeviations_" + this.Mode.ToString();
     this.DynTransient = new Helpers.Display.DynamicTransient();
     _entities         = new List <Entity>();
     _blockTransform   = Matrix3d.Identity;
 }
예제 #10
0
        public string Parse(string input, DirectionMode directionMode)
        {
            if (string.IsNullOrWhiteSpace(input))
                return input;

            if (replacements != null)
                foreach (var replacement in replacements)
                    input = input.Replace(
                        directionMode == DirectionMode.BBToHtml ? replacement.Key : replacement.Value,
                        directionMode == DirectionMode.BBToHtml ? replacement.Value : replacement.Key);

            return directionMode == DirectionMode.HtmlToBB ? ParseToBBCode(input) : ParseToHtml(input);
        }
예제 #11
0
        private void RightButtons(DirectionMode mode, GUILayoutOption height, GUILayoutOption width)
        {
            EditorGUILayout.BeginVertical(GUILayout.Height(135f));
            GUILayout.FlexibleSpace();

            //if (mode == DirectionMode.SixteenWay)
            //{
            //    var buttonContent = new GUIContent("ENE", "East-Northeast");

            //    var buttonStyle = GetButtonStyle(CardinalDirection.ENE);
            //    buttonStyle.margin = new RectOffset(15, 7, 0, 0);

            //    if (GUILayout.Button(buttonContent, buttonStyle, height, width))
            //    {
            //        stateDirection = CardinalDirection.ENE;
            //        directionSelector.SetSelected(CardinalDirection.ENE);
            //    }
            //}

            if (mode == DirectionMode.TwoWay || mode == DirectionMode.FourWay) // || mode == DirectionMode.EightWay || mode == DirectionMode.SixteenWay)
            {
                var buttonContent = new GUIContent("E", "East");

                var buttonStyle = GetButtonStyle(CardinalDirection.E);
                buttonStyle.margin = new RectOffset(22, 0, 5, 5);

                if (GUILayout.Button(buttonContent, buttonStyle, height, width))
                {
                    stateDirection = CardinalDirection.E;
                    directionSelector.SetSelected(CardinalDirection.E);
                }
            }

            //if (mode == DirectionMode.SixteenWay)
            //{
            //    var buttonContent = new GUIContent("ESE", "East-Southeast");

            //    var buttonStyle = GetButtonStyle(CardinalDirection.ESE);
            //    buttonStyle.margin = new RectOffset(15, 7, 0, 0);

            //    if(GUILayout.Button(buttonContent, buttonStyle, height, width))
            //    {
            //        stateDirection = CardinalDirection.ESE;
            //        directionSelector.SetSelected(CardinalDirection.ESE);
            //    }
            //}

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();
        }
예제 #12
0
        /// <summary>
        /// Determines if the given value represents a valid state of this property.
        /// </summary>
        /// <param name="value">The state that should be used.</param>
        /// <returns>True if the state is valid, otherwise false.</returns>
        protected override Boolean IsValid(CSSValue value)
        {
            if (value.Is(Keywords.Ltr))
            {
                _mode = DirectionMode.Ltr;
            }
            else if (value.Is(Keywords.Rtl))
            {
                _mode = DirectionMode.Rtl;
            }
            else
            {
                return(false);
            }

            return(true);
        }
예제 #13
0
        private void NavMode_Click(object sender, RoutedEventArgs e)
        {
            #region Setting background / foreground / mode
            SolidColorBrush bg;
            if (Mode != DirectionMode.walking)
            {
                bg = WalkBTN.Foreground as SolidColorBrush;
            }
            else
            {
                bg = DriveBTN.Foreground as SolidColorBrush;
            }
            WalkBTN.Foreground    = bg;
            DriveBTN.Foreground   = bg;
            TransitBTN.Foreground = bg;
            var c = (Color)Resources["SystemControlBackgroundAccentBrush"];
            (sender as Button).Foreground = new SolidColorBrush(c);
            switch ((sender as Button).Name)
            {
            case "WalkBTN":
                Mode = DirectionMode.walking;
                break;

            case "DriveBTN":
                Mode = DirectionMode.driving;
                break;

            case "TransitBTN":
                Mode = DirectionMode.transit;
                break;

            default:
                break;
            }
            #endregion

            foreach (var item in MapView.MapControl.MapElements)
            {
                if (item.GetType() == typeof(MapPolyline))
                {
                    MapView.MapControl.MapElements.Remove(item);
                    DirectionFinder();
                    return;
                }
            }
        }
예제 #14
0
        private void _okButton_Click(object sender, EventArgs e)
        {
            if (_allRadioButton.Checked)
            {
                FirstPageNumber = 1;
                LastPageNumber  = PageCount;
            }
            else if (_selectedRadioButton.Checked)
            {
                FirstPageNumber = SelectedPageNumber;
                LastPageNumber  = SelectedPageNumber;
            }

            Direction   = (DirectionMode)_directionComboBox.SelectedIndex;
            EventOdd    = (EvenOddMode)_evenOddComboBox.SelectedIndex;
            Orientation = (OrientationMode)_orientationComboBox.SelectedIndex;
        }
예제 #15
0
        protected override Boolean IsValid(CSSValue value)
        {
            if (value.Is("ltr"))
            {
                _mode = DirectionMode.Ltr;
            }
            else if (value.Is("rtl"))
            {
                _mode = DirectionMode.Rtl;
            }
            else if (value != CSSValue.Inherit)
            {
                return(false);
            }

            return(true);
        }
예제 #16
0
        internal string GetOpenBbTagPattern(DirectionMode directionMode)
        {
            var attributeFormatPattern = directionMode == DirectionMode.BBToHtml
                                             ? "(?<{0}>.*?)"
                                             : "${{{0}}}";

            return(string.Format(@"{0}[{1}{2}]",
                                 directionMode == DirectionMode.BBToHtml ? @"\" : string.Empty,
                                 SelfAttributed
                    ? string.Format("{0}=\"{1}\"",
                                    BbTag,
                                    string.Format(attributeFormatPattern, BbTag))
                    : BbTag,
                                 Attributes == null || Attributes.Count == 0
                    ? string.Empty
                    : string.Format(" {0}",
                                    string.Join(" ", Attributes.Select(k => string.Format("{0}=\"{1}\"",
                                                                                          k.Key,
                                                                                          string.Format(attributeFormatPattern, k.Key)))))));
        }
예제 #17
0
        internal string GetOpenBbTagPattern(DirectionMode directionMode)
        {
            var attributeFormatPattern = directionMode == DirectionMode.BBToHtml
                                             ? "(?<{0}>.*?)"
                                             : "${{{0}}}";

            return string.Format(@"{0}[{1}{2}]",
                directionMode == DirectionMode.BBToHtml ? @"\" : string.Empty,
                SelfAttributed
                    ? string.Format("{0}=\"{1}\"",
                        BbTag,
                        string.Format(attributeFormatPattern, BbTag))
                    : BbTag,
                Attributes == null || Attributes.Count == 0
                    ? string.Empty
                    : string.Format(" {0}",
                        string.Join(" ", Attributes.Select(k => string.Format("{0}=\"{1}\"",
                            k.Key,
                            string.Format(attributeFormatPattern, k.Key))))));
        }
예제 #18
0
        public void CopyFrom(Watermark watermark)
        {
            if (watermark == null)
            {
                return;
            }
            DisposeGdiResources();
            text              = watermark.Text;
            showBehind        = watermark.ShowBehind;
            pageRange         = watermark.PageRange;
            transparency      = watermark.TextTransparency;
            imageTransparency = watermark.ImageTransparency;
            imageTiling       = watermark.ImageTiling;
            foreColor         = watermark.ForeColor;
            imageViewMode     = watermark.ImageViewMode;
            textDirection     = watermark.TextDirection;
            imageAlign        = watermark.ImageAlign;

            font  = (Font)watermark.Font.Clone();
            image = CloneImage(watermark.Image);
        }
예제 #19
0
        public LinePos GetRowLinePos(int rowIdx, DirectionMode dir = DirectionMode.BOTTOM_OR_RIGHT)
        {
            RectangleF rect = GetOriginalCellRect(rowIdx, 0);

            LinePos linePos = new LinePos();
            PointF  start, end;

            if (dir == DirectionMode.UP_OR_LEFT)
            {
                start = new PointF(rect.Left, rect.Top);
                end   = new PointF(rect.Left + tbWidth, rect.Top);
            }
            else
            {
                start = new PointF(rect.Left, rect.Bottom);
                end   = new PointF(rect.Left + tbWidth, rect.Bottom);
            }

            linePos.start = start;
            linePos.end   = end;
            return(linePos);
        }
예제 #20
0
        public LinePos GetColLinePos(int colIdx, DirectionMode dir = DirectionMode.BOTTOM_OR_RIGHT)
        {
            RectangleF rect = GetOriginalCellRect(0, colIdx);

            LinePos linePos = new LinePos();
            PointF  start, end;

            if (dir == DirectionMode.UP_OR_LEFT)
            {
                start = new PointF(rect.Left, rect.Top);
                end   = new PointF(rect.Left, rect.Top + tbHeight);
            }
            else
            {
                start = new PointF(rect.Right, rect.Top);
                end   = new PointF(rect.Right, rect.Top + tbHeight);
            }

            linePos.start = start;
            linePos.end   = end;
            return(linePos);
        }
예제 #21
0
        private void NavMode_Click(object sender, RoutedEventArgs e)
        {
            #region Setting background / foreground / mode
            SolidColorBrush bg;
            if (Mode != DirectionMode.walking)
            {
                bg = WalkBTN.Foreground as SolidColorBrush;
            }
            else
            {
                bg = DriveBTN.Foreground as SolidColorBrush;
            }
            WalkBTN.Foreground    = bg;
            DriveBTN.Foreground   = bg;
            TransitBTN.Foreground = bg;
            var c = (Color)Resources["SystemControlBackgroundAccentBrush"];
            (sender as Button).Foreground = new SolidColorBrush(c);
            switch ((sender as Button).Name)
            {
            case "WalkBTN":
                Mode = DirectionMode.walking;
                break;

            case "DriveBTN":
                Mode = DirectionMode.driving;
                break;

            case "TransitBTN":
                Mode = DirectionMode.transit;
                break;

            default:
                break;
            }
            #endregion

            DirectionFinder();
        }
예제 #22
0
        public CustomSandwichLava(EntityData data, Vector2 offset)
        {
            startX    = data.Position.X + offset.X;
            Direction = data.Enum("direction", DirectionMode.CoreModeBased);
            Speed     = data.Float("speed", 20f);

            // vanilla is 160. so, setting sandwichGap to 120 requires each side to be shifted by 20 pixels towards the other ((160 - 120) / 2).
            sandwichDisplacement = (160f - data.Float("sandwichGap", 160f)) / 2;

            Depth    = -1000000;
            Collider = new ColliderList(new Hitbox(340f, 120f, 0f, -sandwichDisplacement), new Hitbox(340f, 120f, 0f, -280f + sandwichDisplacement));
            Visible  = false;

            Add(loopSfx = new SoundSource());
            Add(new PlayerCollider(OnPlayer));
            Add(new CoreModeListener(OnChangeMode));

            Add(bottomRect                = new LavaRect(400f, 200f, 4));
            bottomRect.Position           = new Vector2(-40f, 0f);
            bottomRect.OnlyMode           = LavaRect.OnlyModes.OnlyTop;
            bottomRect.SmallWaveAmplitude = 2f;

            Add(topRect                = new LavaRect(400f, 200f, 4));
            topRect.Position           = new Vector2(-40f, -360f);
            topRect.OnlyMode           = LavaRect.OnlyModes.OnlyBottom;
            topRect.SmallWaveAmplitude = 2f;
            topRect.BigWaveAmplitude   = (bottomRect.BigWaveAmplitude = 2f);
            topRect.CurveAmplitude     = (bottomRect.CurveAmplitude = 4f);

            Add(new TransitionListener {
                OnOutBegin = () => {
                    // save the Y positions
                    transitionStartY           = Y;
                    transitionStartTopRectY    = topRect.Position.Y;
                    transitionStartBottomRectY = bottomRect.Position.Y;

                    if (persistent && Scene != null && Scene.Entities.FindAll <CustomSandwichLava>().Count <= 1)
                    {
                        // no lava in the next room: leave
                        Leave();
                    }
                    else
                    {
                        // look up for all lava blocker triggers in the next room.
                        lavaBlockerTriggers = Scene.Entities.OfType <LavaBlockerTrigger>().ToList();
                    }
                },
                OnOut = progress => {
                    if (Scene != null)
                    {
                        X = (Scene as Level).Camera.X;
                        if (!leaving)
                        {
                            // make the lava elements transition smoothly to their expected positions.
                            Y = MathHelper.Lerp(transitionStartY, centerY, progress);
                            topRect.Position.Y    = MathHelper.Lerp(transitionStartTopRectY, TopOffset - topRect.Height + sandwichDisplacement, progress);
                            bottomRect.Position.Y = MathHelper.Lerp(transitionStartBottomRectY, -sandwichDisplacement, progress);
                        }
                    }

                    if ((progress > 0.95f) && leaving)
                    {
                        // lava is leaving, transition is over soon => remove it
                        RemoveSelf();
                    }
                },
                OnInEnd = () => {
                    if (entering)
                    {
                        // transition is over. grab the camera position now since it's done moving.
                        Y        = centerY;
                        entering = false;
                    }
                }
            });
        }
예제 #23
0
파일: Parser.cs 프로젝트: koppzuy/hackathon
        /// <summary>
        /// Gets a RealTimeDepartureInfo object containing information about
        /// future arrivals or departures of vehicles.
        /// </summary>
        /// <param name="stopShortName">Stop short name</param>
        /// <param name="mode">Direction mode</param>
        /// <returns>RealTimeDepartureInfo</returns>
        public async static Task <RealTimeDepartureInfo> GetRealTimeDepartureInfoAsync(int stopShortName, DirectionMode mode)
        {
            var response = await _client.GetAsync(new Uri(_realtimeInfoUrl + "?stop=" + stopShortName + "&mode=" + mode));

            return(await DeserializeAsync <RealTimeDepartureInfo>(response));
        }
예제 #24
0
        internal string GetOpenHtmlTagPattern(DirectionMode directionMode)
        {
            var attributeFormatPattern = directionMode == DirectionMode.HtmlToBB
                                             ? "(?<{0}>.*?)"
                                             : "${{{0}}}";

            if ((Attributes == null || Attributes.Count == 0) && !SelfAttributed)
                return OpeningHtmlTag;

            var result = OpeningHtmlTag;

            if (SelfAttributed)
            {
                var regex = new Regex(string.Format(@"\{{{0}}}", BbTag));
                result = regex.Replace(result, string.Format(attributeFormatPattern, BbTag));
            }

            if (Attributes != null && Attributes.Count > 0)
            {
                foreach (var attribute in Attributes)
                {
                    var regex = new Regex(string.Format(@"\{{{0}}}", attribute.Key));
                    result = regex.Replace(result, string.Format(attributeFormatPattern, attribute.Key));
                }
            }

            return result;
        }
예제 #25
0
        private GUIContent GetWayImage(DirectionMode mode, CardinalDirection stateDirection)
        {
            Texture2D texture = null;

            if (mode == DirectionMode.TwoWay)
            {
                texture = DirectionPrefabs.TwoWay;
                if (stateDirection == CardinalDirection.E)
                {
                    texture = DirectionPrefabs.TwoWayE;
                }
                else if (stateDirection == CardinalDirection.W)
                {
                    texture = DirectionPrefabs.TwoWayW;
                }
            }
            else if (mode == DirectionMode.FourWay)
            {
                texture = DirectionPrefabs.FourWay;
                if (stateDirection == CardinalDirection.N)
                {
                    texture = DirectionPrefabs.FourWayN;
                }
                else if (stateDirection == CardinalDirection.E)
                {
                    texture = DirectionPrefabs.FourWayE;
                }
                else if (stateDirection == CardinalDirection.S)
                {
                    texture = DirectionPrefabs.FourWayS;
                }
                else if (stateDirection == CardinalDirection.W)
                {
                    texture = DirectionPrefabs.FourWayW;
                }
            }
            //else if(mode == DirectionMode.EightWay)
            //{
            //    texture = DirectionPrefabs.EightWay;
            //    if (stateDirection == CardinalDirection.N)
            //    {
            //        texture = DirectionPrefabs.EightWayN;
            //    }
            //    else if (stateDirection == CardinalDirection.NE)
            //    {
            //        texture = DirectionPrefabs.EightWayNE;
            //    }
            //    else if (stateDirection == CardinalDirection.E)
            //    {
            //        texture = DirectionPrefabs.EightWayE;
            //    }
            //    else if (stateDirection == CardinalDirection.SE)
            //    {
            //        texture = DirectionPrefabs.EightWaySE;
            //    }
            //    else if (stateDirection == CardinalDirection.S)
            //    {
            //        texture = DirectionPrefabs.EightWayS;
            //    }
            //    else if (stateDirection == CardinalDirection.SW)
            //    {
            //        texture = DirectionPrefabs.EightWaySW;
            //    }
            //    else if (stateDirection == CardinalDirection.W)
            //    {
            //        texture = DirectionPrefabs.EightWayW;
            //    }
            //    else if (stateDirection == CardinalDirection.NW)
            //    {
            //        texture = DirectionPrefabs.EightWayNW;
            //    }
            //}
            //else if(mode == DirectionMode.SixteenWay)
            //{
            //    texture = DirectionPrefabs.SixteenWay;
            //    if (stateDirection == CardinalDirection.N)
            //    {
            //        texture = DirectionPrefabs.SixteenWayN;
            //    }
            //    else if (stateDirection == CardinalDirection.NNE)
            //    {
            //        texture = DirectionPrefabs.SixteenWayNNE;
            //    }
            //    else if (stateDirection == CardinalDirection.NE)
            //    {
            //        texture = DirectionPrefabs.SixteenWayNE;
            //    }
            //    else if (stateDirection == CardinalDirection.ENE)
            //    {
            //        texture = DirectionPrefabs.SixteenWayENE;
            //    }
            //    else if (stateDirection == CardinalDirection.E)
            //    {
            //        texture = DirectionPrefabs.SixteenWayE;
            //    }
            //    else if (stateDirection == CardinalDirection.ESE)
            //    {
            //        texture = DirectionPrefabs.SixteenWayESE;
            //    }
            //    else if (stateDirection == CardinalDirection.SE)
            //    {
            //        texture = DirectionPrefabs.SixteenWaySE;
            //    }
            //    else if (stateDirection == CardinalDirection.SSE)
            //    {
            //        texture = DirectionPrefabs.SixteenWaySSE;
            //    }
            //    else if (stateDirection == CardinalDirection.S)
            //    {
            //        texture = DirectionPrefabs.SixteenWayS;
            //    }
            //    else if (stateDirection == CardinalDirection.SSW)
            //    {
            //        texture = DirectionPrefabs.SixteenWaySSW;
            //    }
            //    else if (stateDirection == CardinalDirection.SW)
            //    {
            //        texture = DirectionPrefabs.SixteenWaySW;
            //    }
            //    else if (stateDirection == CardinalDirection.WSW)
            //    {
            //        texture = DirectionPrefabs.SixteenWayWSW;
            //    }
            //    else if (stateDirection == CardinalDirection.W)
            //    {
            //        texture = DirectionPrefabs.SixteenWayW;
            //    }
            //    else if (stateDirection == CardinalDirection.WNW)
            //    {
            //        texture = DirectionPrefabs.SixteenWayWNW;
            //    }
            //    else if (stateDirection == CardinalDirection.NW)
            //    {
            //        texture = DirectionPrefabs.SixteenWayNW;
            //    }
            //    else if (stateDirection == CardinalDirection.NNW)
            //    {
            //        texture = DirectionPrefabs.SixteenWayNNW;
            //    }
            //}

            var result = new GUIContent();

            result.image = texture;

            return(result);
        }
예제 #26
0
 internal string GetCloseBbTagPattern(DirectionMode directionMode)
 {
     return directionMode == DirectionMode.BBToHtml
                ? string.Format(@"\[\/{0}]", BbTag)
                : string.Format("[/{0}]", BbTag);
 }
예제 #27
0
 internal string GetCloseBbTagPattern(DirectionMode directionMode)
 {
     return(directionMode == DirectionMode.BBToHtml
                ? string.Format(@"\[\/{0}]", BbTag)
                : string.Format("[/{0}]", BbTag));
 }
예제 #28
0
 internal CSSDirectionProperty()
     : base(PropertyNames.Direction)
 {
     _mode      = DirectionMode.Ltr;
     _inherited = true;
 }
예제 #29
0
 internal override void Reset()
 {
     _mode = DirectionMode.Ltr;
 }
예제 #30
0
 public void Direction(DirectionMode direction)
 {
     SerialCom.SetCamParm(CommandList.scd, ( double )(direction == DirectionMode.Forward ? 0:1));
 }
예제 #31
0
 internal override void Reset()
 {
     _mode = Default;
 }
예제 #32
0
 public void SetState(DirectionMode mode)
 {
     _mode = mode;
 }
예제 #33
0
        private void BottomButtons(DirectionMode mode, GUILayoutOption height, GUILayoutOption width)
        {
            EditorGUILayout.BeginHorizontal(GUILayout.Width(250f));

            //if (mode == DirectionMode.EightWay || mode == DirectionMode.SixteenWay)
            //{
            //    var buttonContent = new GUIContent("SW", "Southwest");

            //    var buttonStyle = GetButtonStyle(CardinalDirection.SW);
            //    buttonStyle.margin = new RectOffset(35, 0, 0, 0);

            //    if(GUILayout.Button(buttonContent, buttonStyle, height, width))
            //    {
            //        stateDirection = CardinalDirection.SW;
            //        directionSelector.SetSelected(CardinalDirection.SW);
            //    }
            //}
            //else
            //{
            GUILayout.Label("", height, GUILayout.Width(70f));
            //}

            //if (mode == DirectionMode.SixteenWay)
            //{
            //    var buttonContent = new GUIContent("SSW", "South-Southwest");

            //    var buttonStyle = GetButtonStyle(CardinalDirection.SSW);
            //    buttonStyle.margin = new RectOffset(0, 0, 18, 0);

            //    if(GUILayout.Button(buttonContent, buttonStyle, height, width))
            //    {
            //        stateDirection = CardinalDirection.SSW;
            //        directionSelector.SetSelected(CardinalDirection.SSW);
            //    }
            //}
            //else
            //{
            GUILayout.Label("", height, width);
            //}

            if (mode == DirectionMode.FourWay) // || mode == DirectionMode.EightWay || mode == DirectionMode.SixteenWay)
            {
                var buttonContent = new GUIContent("S", "South");

                var buttonStyle = GetButtonStyle(CardinalDirection.S);
                buttonStyle.margin = new RectOffset(3, 3, 25, 0);

                if (GUILayout.Button(buttonContent, buttonStyle, height, width))
                {
                    stateDirection = CardinalDirection.S;
                    directionSelector.SetSelected(CardinalDirection.S);
                }
            }

            //if (mode == DirectionMode.SixteenWay)
            //{
            //    var buttonContent = new GUIContent("SSE", "South-Southeast");

            //    var buttonStyle = GetButtonStyle(CardinalDirection.SSE);
            //    buttonStyle.margin = new RectOffset(0, 0, 18, 0);

            //    if(GUILayout.Button(buttonContent, buttonStyle, height, width))
            //    {
            //        stateDirection = CardinalDirection.SSE;
            //        directionSelector.SetSelected(CardinalDirection.SSE);
            //    }
            //}
            //else
            //{
            GUILayout.Label("", height, width);
            //}

            //if (mode == DirectionMode.EightWay || mode == DirectionMode.SixteenWay)
            //{
            //    var buttonContent = new GUIContent("SE", "Southeast");

            //    var buttonStyle = GetButtonStyle(CardinalDirection.SE);
            //    buttonStyle.margin = new RectOffset(0, 0, 0, 25);

            //    if(GUILayout.Button(buttonContent, buttonStyle, height, width))
            //    {
            //        stateDirection = CardinalDirection.SE;
            //        directionSelector.SetSelected(CardinalDirection.SE);
            //    }
            //}
            //else
            //{
            GUILayout.Label("", height, GUILayout.Width(70f));
            //}

            EditorGUILayout.EndHorizontal();
        }
예제 #34
0
파일: Parser.cs 프로젝트: koppzuy/hackathon
        /// <summary>
        /// Gets a RealTimeDepartureInfo object containing information about
        /// future arrivals or departures of vehicles.
        /// </summary>
        /// <param name="stopShortName">Stop short name</param>
        /// <param name="mode">Direction mode</param>
        /// <param name="startTime">Start time</param>
        /// <param name="endTime">End time</param>
        /// <returns>RealTimeDepartureInfo</returns>
        public async static Task <RealTimeDepartureInfo> GetRealTimeDepartureInfoAsync(int stopShortName, DirectionMode mode, DateTime startTime, DateTime endTime)
        {
            var time     = ((long)startTime.ToUniversalTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds) * 1000;
            var buster   = ((long)DateTime.Now.ToUniversalTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds) * 1000;
            var content  = new StringContent("stop=" + stopShortName + "&mode=" + mode + "&startTime=" + time + "&timeFrame=" + (endTime - startTime).TotalMinutes + "&cacheBuster=" + buster);
            var response = await _client.PostAsync(new Uri(_realtimeInfoUrl), content);

            return(await DeserializeAsync <RealTimeDepartureInfo>(response));
        }
예제 #35
0
        public static Vector3 GetRandomDirection(SplatterSettings settings, Vector3?avgDir)
        {
            Vector3       moveDir = Vector3.zero;
            float         random;
            DirectionMode currentDirectionMode = avgDir.HasValue? DirectionMode.Vector : settings.directionMode;

            if (!avgDir.HasValue)
            {
                avgDir = settings.direction;
            }
            switch (currentDirectionMode)
            {
            case DirectionMode.Vector:
                random = Random.Range(-settings.spanAngle * 0.5f * Mathf.Deg2Rad,
                                      settings.spanAngle * 0.5f * Mathf.Deg2Rad);
                float movAngle = Mathf.Atan2(avgDir.Value.y, avgDir.Value.x);
                movAngle += random;
                if (settings.orientation == OrientationMode.Vertical)
                {
                    moveDir = new Vector3(Mathf.Cos(movAngle), Mathf.Sin(movAngle), 0f);
                }
                else
                {
                    moveDir = new Vector3(Mathf.Cos(movAngle), 0f, Mathf.Sin(movAngle));
                }
                break;

            case DirectionMode.Transform:
                if (settings.directionReference == null)
                {
                    Debug.LogError("[SPLATTER SYSTEM] Orientation reference is not set.");
                    return(Vector3.zero);
                }
                var angles = settings.directionReference.rotation.eulerAngles * Mathf.Deg2Rad;
                random = Random.Range(-settings.spanAngle * 0.5f * Mathf.Deg2Rad,
                                      settings.spanAngle * 0.5f * Mathf.Deg2Rad);
                angles.z += Mathf.Sin(random);
                if (settings.orientation == OrientationMode.Vertical)
                {
                    moveDir = new Vector3(Mathf.Cos(angles.z), Mathf.Sin(angles.z), 0f);
                }
                else
                {
                    moveDir = new Vector3(Mathf.Cos(angles.z), 0f, Mathf.Sin(angles.z));
                }
                break;

            default:
                moveDir = Random.onUnitSphere;
                if (settings.orientation == OrientationMode.Vertical)
                {
                    moveDir.z = 0;
                }
                else
                {
                    moveDir.y = 0;
                }
                break;
            }
            return(moveDir);
        }