public static void DockForm(Form form, Screen screen, ScreenPosition position)
        {
            switch (position)
            {
            case ScreenPosition.BottomRight:
                CommentSetting.PositionTop  = screen.WorkingArea.Height - form.Size.Height;
                CommentSetting.PositionLeft = screen.WorkingArea.Width - form.Size.Width;
                break;

            case ScreenPosition.BottomLeft:
                CommentSetting.PositionTop  = screen.WorkingArea.Height - form.Size.Height;
                CommentSetting.PositionLeft = 0;
                break;

            case ScreenPosition.TopRight:
                CommentSetting.PositionTop  = 0;
                CommentSetting.PositionLeft = screen.WorkingArea.Width - form.Size.Width;
                break;

            case ScreenPosition.TopLeft:
                CommentSetting.PositionTop  = 0;
                CommentSetting.PositionLeft = 0;
                break;

            default:
                CommentSetting.PositionTop  = 0;
                CommentSetting.PositionLeft = 0;
                break;
            }

            UpdateScreenPosition(form, screen);
        }
Beispiel #2
0
        public string GetDebugInformation()
        {
            String returnString = "Name : " + name + " (Key: " + Key + ")" +
                                  "\n" + "" +
                                  "\nTile Size : " + tileSize.ToString() +
                                  "\nState : " + State.ToString() +
                                  "\nIs Valid : " + IsValid.ToString() +
                                  "\nBaseScrPosition : " + BaseScreenPosition.ToString() +
                                  "\nScreenPosition : " + ScreenPosition.ToString() +
                                  "\nOrigin : " + BaseOrigin.ToString() +
                                  "\nShape Origin : " + ShapeOrigin.ToString() +
                                  "\nCursor Offset : " + CursorReturnOffset.ToString() +
                                  "\nRotation : " + rotation + " radians" +
                                  "\nRotation idx : " + currentRotationIdx +
                                  "\nCurrent Dimensions : " + CurrentMatrixDimensions.ToString() +
                                  "\n[Flipping : " + IsFlipping + "] [Rotating : " + IsRotating + "]" +
                                  "\n[FlippedX : " + isFlippedHorizontal + "] [FlippedY : " + isFlippedVertical + "]";

            returnString += "\n\nCurrent Matrix: ";

            returnString += "\n-----\n";

            for (int y = 0; y < CurrentMatrixDimensions.Y; y++)
            {
                for (int x = 0; x < CurrentMatrixDimensions.X; x++)
                {
                    returnString += CurrentMatrix[y][x] + " ";
                }

                returnString += "\n";
            }

            return(returnString);
        }
Beispiel #3
0
        public async Task ShowVideo(
            string mediaItemFilePath,
            ScreenPosition screenPosition,
            Guid mediaItemId,
            TimeSpan startOffset,
            bool startFromPaused)
        {
            _mediaItemId   = mediaItemId;
            _startPosition = startOffset;
            _lastPosition  = TimeSpan.Zero;

            ScreenPositionHelper.SetScreenPosition(_mediaElement.FrameworkElement, screenPosition);

            if (startFromPaused)
            {
                _mediaElement.Position = _startPosition;
                await _mediaElement.Play();

                OnMediaChangeEvent(new MediaEventArgs {
                    MediaItemId = _mediaItemId, Change = MediaChange.Started
                });
            }
            else
            {
                OnMediaChangeEvent(new MediaEventArgs {
                    MediaItemId = _mediaItemId, Change = MediaChange.Starting
                });
                _mediaElement.Source = new Uri(mediaItemFilePath);
            }
        }
Beispiel #4
0
    private void SetPositionByValue(int value)
    {
        Position = (ScreenPosition)ScreenPosition.ToObject(typeof(ScreenPosition), value);

        //~ Debug.Log(string.Format("value: {0} , Enum : {1}", value, Position));
        UpdatePosition();
    }
Beispiel #5
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender && firstSelect.Id != null && dateTimeFilter.Id != null)
            {
                await jSRuntime.InvokeVoidAsync("gridJsFunctions.focusElement", firstSelect);

                ScreenPosition sp = await jSRuntime.InvokeAsync <ScreenPosition>("gridJsFunctions.getPosition", dateTimeFilter);

                ScreenPosition gridComponentSP = await jSRuntime.InvokeAsync <ScreenPosition>("gridJsFunctions.getPosition", GridHeaderComponent.GridComponent.Gridmvc);

                if (GridHeaderComponent.GridComponent.Grid.Direction == GridShared.GridDirection.RTL)
                {
                    if (sp != null && gridComponentSP != null && sp.X < Math.Max(25, gridComponentSP.X))
                    {
                        _offset = -sp.X + Math.Max(25, gridComponentSP.X);
                        StateHasChanged();
                    }
                }
                else
                {
                    if (sp != null && gridComponentSP != null &&
                        sp.X + sp.Width > Math.Min(sp.InnerWidth, gridComponentSP.X
                                                   + gridComponentSP.Width + 25))
                    {
                        _offset = sp.X + sp.Width - Math.Min(sp.InnerWidth, gridComponentSP.X
                                                             + gridComponentSP.Width + 25) + 25;
                        StateHasChanged();
                    }
                }
            }
        }
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender && boolFilter.Id != null)
            {
                await jSRuntime.InvokeVoidAsync("gridJsFunctions.focusElement", boolFilter);

                ScreenPosition sp = await jSRuntime.InvokeAsync <ScreenPosition>("gridJsFunctions.getPosition", boolFilter);

                if (GridHeaderComponent.GridComponent.Grid.Direction == GridShared.GridDirection.RTL)
                {
                    if (sp != null && sp.X < 0)
                    {
                        _offset = -sp.X + 25;
                        StateHasChanged();
                    }
                }
                else
                {
                    if (sp != null && sp.X + sp.Width > sp.InnerWidth)
                    {
                        _offset = sp.X + sp.Width - sp.InnerWidth + 25;
                        StateHasChanged();
                    }
                }
            }
        }
Beispiel #7
0
        private static void ScreenPosition_PropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            Overview       overview = sender as Overview;
            ScreenPosition position = (ScreenPosition)e.NewValue;

            if (overview != null)
            {
                switch (position)
                {
                case ScreenPosition.TopLeft:
                    overview.VerticalContentAlignment   = VerticalAlignment.Top;
                    overview.HorizontalContentAlignment = HorizontalAlignment.Left;
                    break;

                case ScreenPosition.TopRight:
                    overview.VerticalContentAlignment   = VerticalAlignment.Top;
                    overview.HorizontalContentAlignment = HorizontalAlignment.Right;
                    break;

                case ScreenPosition.BottomLeft:
                    overview.VerticalContentAlignment   = VerticalAlignment.Bottom;
                    overview.HorizontalContentAlignment = HorizontalAlignment.Left;
                    break;

                case ScreenPosition.BottomRight:
                    overview.VerticalContentAlignment   = VerticalAlignment.Bottom;
                    overview.HorizontalContentAlignment = HorizontalAlignment.Right;
                    break;

                default:
                    break;
                }
            }
        }
Beispiel #8
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender && listFilter.Id != null)
            {
                await jSRuntime.InvokeVoidAsync("gridJsFunctions.focusElement", listFilter);

                ScreenPosition sp = await jSRuntime.InvokeAsync <ScreenPosition>("gridJsFunctions.getPosition", listFilter);

                ScreenPosition gridTableSP = await jSRuntime.InvokeAsync <ScreenPosition>("gridJsFunctions.getPosition", GridHeaderComponent.GridComponent.GridTable);

                if (sp != null && gridTableSP != null)
                {
                    if (gridTableSP.X + gridTableSP.Width < sp.X + sp.Width)
                    {
                        _offset = gridTableSP.X + gridTableSP.Width - sp.X - sp.Width;
                        StateHasChanged();
                    }
                    else if (sp.X < gridTableSP.X)
                    {
                        _offset = gridTableSP.X - sp.X;
                        StateHasChanged();
                    }
                }
            }
        }
Beispiel #9
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (tooltip.Id != null)
            {
                await jSRuntime.InvokeVoidAsync("gridJsFunctions.focusElement", tooltip);

                ScreenPosition sp = await jSRuntime.InvokeAsync <ScreenPosition>("gridJsFunctions.getPosition", tooltip);

                if (GridComponent.Grid.Direction == GridShared.GridDirection.RTL)
                {
                    if (sp != null && GridComponent.ScreenPosition != null &&
                        sp.X < Math.Max(35, GridComponent.ScreenPosition.X))
                    {
                        _offset = -sp.X - Math.Max(35, GridComponent.ScreenPosition.X);
                        StateHasChanged();
                    }
                }
                else
                {
                    if (sp != null && GridComponent.ScreenPosition != null &&
                        sp.X + sp.Width > Math.Min(sp.InnerWidth, GridComponent.ScreenPosition.X
                                                   + GridComponent.ScreenPosition.Width + 35))
                    {
                        _offset = sp.X + sp.Width - Math.Min(sp.InnerWidth, GridComponent.ScreenPosition.X
                                                             + GridComponent.ScreenPosition.Width + 35) - 35;
                        StateHasChanged();
                    }
                }
            }
        }
Beispiel #10
0
        public override void Draw(BMapControl c, Graphics g)
        {
            if (IsVisible)
            {
                this.map       = c;
                ScreenPosition = map.LatLngToPoint(Position);
                Point p    = ScreenPosition.GetOffSet(OffSet.X, OffSet.Y);
                var   rect = ScreenArea = new Rectangle(p, Size);
                if (IsMouseOver)
                {
                    g.FillEllipse(new SolidBrush(Color.FromArgb(0xaa, 0xff, 0xff, 0xff)), rect);

                    //if (ToolTip!=null)
                    //{
                    //    ToolTip.IsOpen=IsMouseOver;
                    //}
                }

                p.Offset(3, 3);
                var rect1 = new Rectangle(p.X, p.Y, Size.Width - 6, Size.Height - 6);
                g.FillEllipse(new SolidBrush(Color.FromArgb(0xFF, 0x11, 0x11, 0xff)), rect1);


                ToolTip.Draw(c, g);
            }
        }
Beispiel #11
0
        public Options()
        {
            // defaults
            AlwaysOnTop                = true;
            WindowedAlwaysOnTop        = true;
            LogEventLevel              = LogEventLevel.Information;
            MediaFolder                = FileUtils.GetOnlyMDefaultMediaFolder();
            ImageFadeType              = ImageFadeType.CrossFade;
            ImageFadeSpeed             = FadeSpeed.Normal;
            CacheImages                = true;
            ShowVideoSubtitles         = false;
            AllowVideoScrubbing        = true;
            AllowVideoPause            = true;
            AllowVideoPositionSeeking  = true;
            PermanentBackdrop          = true;
            JwLibraryCompatibilityMode = true;
            ConfirmVideoStop           = false;
            MaxItemCount               = DefaultMaxItemCount;
            MagnifierZoomLevel         = DefaultMagnifierZoomLevel;
            BrowserZoomLevelIncrement  = DefaultBrowserZoomLevelIncrement;
            MagnifierShape             = MagnifierShape.Circle;
            MagnifierSize              = MagnifierSize.Medium;
            MagnifierFrameThickness    = DefaultBrowserFrameThickness;

            VideoScreenPosition = new ScreenPosition();
            ImageScreenPosition = new ScreenPosition();
            WebScreenPosition   = new ScreenPosition();

            AllowMirror = true;
            MirrorZoom  = DefaultMirrorZoom;

            Sanitize();
        }
Beispiel #12
0
        public static void SetSubtitleBlockScreenPosition(TextBlock element, ScreenPosition position)
        {
            var parent = GetParentWindow(element);

            if (parent != null)
            {
                if (position.IsFullScreen())
                {
                    element.Margin   = new Thickness(0, 0, 0, parent.ActualHeight / 10);
                    element.FontSize = parent.ActualHeight / 22;
                }
                else
                {
                    double leftMargin   = (parent.ActualWidth * position.LeftMarginPercentage) / 100.0;
                    double topMargin    = (parent.ActualHeight * position.TopMarginPercentage) / 100.0;
                    double rightMargin  = (parent.ActualWidth * position.RightMarginPercentage) / 100.0;
                    double bottomMargin = (parent.ActualHeight * position.BottomMarginPercentage) / 100.0;

                    var displayHeight = parent.ActualHeight - topMargin - bottomMargin;

                    element.Margin   = new Thickness(leftMargin, topMargin, rightMargin, bottomMargin + (displayHeight / 10));
                    element.FontSize = displayHeight / 22;
                }
            }
        }
Beispiel #13
0
        private static void SetScreenMarginValue(
            ScreenPosition screenPosition,
            ScreenMarginSide marginSide,
            int newMarginValue)
        {
            switch (marginSide)
            {
            case ScreenMarginSide.Left:
                screenPosition.LeftMarginPercentage = newMarginValue;
                break;

            case ScreenMarginSide.Right:
                screenPosition.RightMarginPercentage = newMarginValue;
                break;

            case ScreenMarginSide.Top:
                screenPosition.TopMarginPercentage = newMarginValue;
                break;

            case ScreenMarginSide.Bottom:
                screenPosition.BottomMarginPercentage = newMarginValue;
                break;

            default:
                throw new ArgumentException();
            }
        }
Beispiel #14
0
        public static void make(string text, ScreenPosition position, float duration, float fontSize = 30.0f)
        {
            Debug.Log(UIControllerGame.getInstance().announcementSampleObject);
            UILabel gameObject = (UILabel)GameObject.Instantiate(UIControllerGame.getInstance().announcementSampleObject);

            gameObject.text = text;

            switch (position)
            {
            case ScreenPosition.MiddleBottom:
                gameObject.transform.parent = UIControllerGame.getInstance().panel_AnnouncementsMiddleBottom.transform;
                break;

            case ScreenPosition.MiddleCenter:
                gameObject.transform.parent = UIControllerGame.getInstance().panel_AnnouncementsMiddleCenter.transform;
                break;

            case ScreenPosition.MiddleTop:
                gameObject.transform.parent = UIControllerGame.getInstance().panel_AnnouncementsMiddleTop.transform;
                break;
            }

            gameObject.transform.localPosition = Vector3.zero;
            gameObject.transform.localScale    = new Vector3(fontSize, fontSize, 1);
            GameObject.Destroy(gameObject.gameObject, duration);
        }
Beispiel #15
0
    public static Vector2 screenPositionToScreenCoordonate(ScreenPosition position)
    {
        switch (position)
        {
        case ScreenPosition.upperLeft:
            return(new Vector2(2 / 3f, 1 / 3f));

        case ScreenPosition.lowerLeft:
            return(new Vector2(2 / 3f, 2 / 3f));

        case ScreenPosition.upperRight:
            return(new Vector2(1 / 3f, 1 / 3f));

        case ScreenPosition.lowerRight:
            return(new Vector2(1 / 3f, 2 / 3f));

        case ScreenPosition.centerLeft:
            return(new Vector2(2 / 3f, 0.5f));

        case ScreenPosition.centerRight:
            return(new Vector2(1 / 3f, 0.5f));

        case ScreenPosition.centerUp:
            return(new Vector2(0.5f, 1 / 3f));

        case ScreenPosition.centerLow:
            return(new Vector2(0.5f, 2 / 3f));
        }
        return(new Vector2(0.5f, 0.5f)); // absolute center
    }
        public LogicEngine()
        {
            ImgUtils.Init();
            KeyUtils.WindowToSendKeysIn = Constants.KO_WINDOW;
            _gos                 = new List <GameObject>();
            _initTimer           = new CTimer();
            _initTimer.Interval  = START_DELAY * 1000;
            _initTimer.AutoReset = false;

            _updateTimer           = new CTimer();
            _updateTimer.Elapsed  += OnUpdate;
            _updateTimer.AutoReset = false;
            _updateTimer.Interval  = UPDATE_DELAY * 1000;

            GameObject            go        = new GameObject();
            CharacterStateMachine sm        = new CharacterStateMachine();
            Character             character = new Character(sm);
            DirComponent          direction = new DirComponent();
            ScreenPosition        screenPos = new ScreenPosition();

            go.AddComponent(screenPos);
            go.AddComponent(sm);
            go.AddComponent(direction);
            go.AddComponent(character);
            _gos.Add(go);
            _sendStart = true;
        }
        private void Move(EDirection direction, Action onCompleted = null)
        {
            this.onMoveCompleted = onCompleted;
            this.direction       = direction;
            KeyUtils.SendCharUp('w');
            startPos = Character.Position;
            double angle    = GetAngleForDirection();
            Point  newPoint = ScreenPosition.RotateDirection(initialDirection, angle);

            ActionManager.SendDelayedAction(0.25f, () =>
            {
                ClickAt(newPoint, () =>
                {
                    if (!IsActive)
                    {
                        return;
                    }
                    timerStuck.Start();
                    ScreenPosition.SetClickPoint(newPoint);
                    KeyUtils.SendCharDown('w');
                    Character.PositionChanged -= OnMove;
                    Character.PositionChanged += OnMove;
                });
            });
        }
Beispiel #18
0
        public Vertex ToScreenCoords(Size size)
        {
            var ret = new Vertex(ScreenPosition.ToScreenCoords(size), Normal, Tangent, Binormal, WorldPosition, TextureCoords);

            ret.ClipW = ScreenPosition.W;
            return(ret);
        }
    public void ExitToRight()
    {
        var from = rect.anchoredPosition;
        var to   = positionRight;

        moving         = new LerpHelper <Vector2>(from, to, Vector2.Lerp, speed, Vector2.Distance(from, to));
        screenPosition = ScreenPosition.Left;
    }
 public Vector2 GetPositionInCameraView(FlxCamera camera = null)
 {
     if (camera == null)
     {
         camera = FlxG.Camera;
     }
     return(camera.ViewportAdapter.PointToScreen(ScreenPosition.ToPoint()).ToVector2());
 }
Beispiel #21
0
        public void SetColor(ScreenPosition screenPosition, Color value)
        {
            Text textField = GetTextField(screenPosition);

            if (textField != null)
            {
                textField.color = value;
            }
        }
Beispiel #22
0
        private Point GetScreenPoint()
        {
            Vector destinationDirection = destination - Character.Position;

            destinationDirection.Normalize();
            Point screenPoint = ScreenPosition.GetPointForDirection(destinationDirection);

            return(screenPoint);
        }
Beispiel #23
0
 public override void OnLeave()
 {
     base.OnLeave();
     Character.PositionChanged -= OnPositionChanged;
     KeyUtils.SendCharUp('w');
     ScreenPosition.StopCalculateDirection();
     timerStuck.Elapsed -= OnStuck;
     timerStuck.Stop();
 }
Beispiel #24
0
 public Scoreboard(string board, string title, ScreenPosition pos)
 {
     this.Board = board;
     if (title.Length < 32)
         this.Title = title;
     else
         this.Title = title.Substring(0, 32);
     this.Position = pos;
 }
        private void MoveBack()
        {
            Vector destinationDirection = startPos - Character.Position;

            destinationDirection.Normalize();
            Point screenPoint = ScreenPosition.GetPointForDirection(destinationDirection);

            PerformClickMove(screenPoint);
        }
Beispiel #26
0
        public void SetSize(ScreenPosition screenPosition, int value)
        {
            Text textField = GetTextField(screenPosition);

            if (textField != null)
            {
                textField.fontSize = value;
            }
        }
Beispiel #27
0
        public void SetText(ScreenPosition screenPosition, string value)
        {
            Text textField = GetTextField(screenPosition);

            if (textField != null)
            {
                textField.text = value;
            }
        }
Beispiel #28
0
        public void SetVisible(ScreenPosition screenPosition, bool isVisible, bool forceAlpha = false)
        {
            Text textField = GetTextField(screenPosition);

            if (textField != null)
            {
                textField.gameObject.SetActive(isVisible);
            }
        }
 public void Hide()
 {
     GetComponent <RectTransform>().anchoredPosition = positionLeft;
     screenPosition = ScreenPosition.Left;
     if (moving != null)
     {
         moving = null;
     }
 }
	public void StartConversation (string conversationFilePathInResources, ScreenPosition position = ScreenPosition.Right) {
		EventController.Event(PSEventType.StartConversation);

		Show();

		SetConversation (
			new Conversation(conversationFilePathInResources),
			position
		);
	}
 public void Show()
 {
     GetComponent <RectTransform>().anchoredPosition = Vector2.zero;
     screenPosition = ScreenPosition.Center;
     if (moving != null)
     {
         moving = null;
     }
     OnEnter(transitionedFrom);
 }
Beispiel #32
0
    public static Size GetWindowSize(IntPtr h)
    {
        ScreenPosition lpRect = default;

        GetClientRect(h, ref lpRect);
        var result = default(Size);

        result.Width  = lpRect.PosRight - lpRect.PosLeft;
        result.Height = lpRect.PosBottom - lpRect.PosTop;
        return(result);
    }
Beispiel #33
0
        /// <summary>
        /// Sets the form's screen position in independent coordinates.
        /// </summary>
        /// <remarks>
        /// Position is set relative to the form's current screen.
        /// </remarks>
        public static void SetScreenPosition(this MainForm form, ScreenPosition position)
        {
            var screen = Screen.FromControl(form);

            var start = form.ResolveScreenPositionEdge(position);
            var end = screen.ResolveScreenPosition(position);

            var move = end.Difference(start);

            //System.Diagnostics.Trace.WriteLine(string.Format("From {0} to {1} => {2}.", start, end, move));

            var original = form.Location;
            form.Location = new Point(original.X + move.X, original.Y + move.Y);
        }
	public void TogglePortraits (ScreenPosition position) {
		switch(position) {

		case ScreenPosition.Left:
			CharacterPortraitLeft.enabled = true;
			CharacterPortraitRight.enabled = false;
		break;

		case ScreenPosition.Right:
			CharacterPortraitLeft.enabled = false;
			CharacterPortraitRight.enabled = true;
		break;

		}
	}
        /// <summary>
        /// Sets the form's screen position in independent coordinates.
        /// </summary>
        /// <remarks>
        /// Position is set relative to the form's current screen.
        /// </remarks>
        public static void SetScreenPosition(this MainForm form, ScreenPosition position)
        {
            var screen = Screen.FromControl(form);

            Point start = form.ResolveScreenPositionEdge(position);
            Point end = screen.ResolveScreenPosition(position);

            Point move = new Point(start.X - end.X, start.Y - end.Y);

            #if DEBUG
            Console.WriteLine("From {0} to {1} => {2}.", start, end, move);
            #endif

            var original = form.Location;
            form.Location = new Point(original.X + move.X, original.Y + move.Y);
        }
 private static Point ResolveScreenPositionToRectangle(Rectangle rect, ScreenPosition position)
 {
     switch (position) {
         case ScreenPosition.TopLeft:
             return new Point(rect.X, rect.Y);
         case ScreenPosition.TopRight:
             return new Point(rect.X + rect.Width, rect.Y);
         case ScreenPosition.BottomLeft:
             return new Point(rect.X, rect.Y + rect.Height);
         case ScreenPosition.BottomRight:
             return new Point(rect.X + rect.Width, rect.Y + rect.Height);
         case ScreenPosition.Center:
             return new Point(rect.X + (rect.Width / 2), rect.Y + (rect.Height / 2));
         default:
             throw new ArgumentException("Invalid ScreenPosition value.");
     }
 }
        public void Update(GameTime gameTime, ScreenPosition playerScreenPosition, MoveDirection playerMoveDirection)
        {
            if (mCurrentState == CharacterState.Walking)
              {
            var movement = new Movement { Direction = _currentDirection, Type = MovementType.Walking };
            if (_currentDirection == MoveDirection.Left)
            {
              if (Position.X - _minX <= 20)
              {
            _currentFrameIndex = 0;
            _currentDirection = MoveDirection.Right;
              }
            }
            else if (_currentDirection == MoveDirection.Right)
            {

              if (_maxX - Position.X <= 20)
              {
            _currentFrameIndex = 1;
            _currentDirection = MoveDirection.Left;
              }
            }
            UpdateMovement(movement, playerScreenPosition, playerMoveDirection);
            _hpBar.UpdateFrameIndex(Position, Data.MaxHp, Data.CurrentHp);
            _hpBar.Update(gameTime, mSpeed, mDirection);
            base.Update(gameTime, mSpeed, mDirection);
              }
              if (IsDead)
              {
            if (_deadTime.HasValue)
            {
              if ((gameTime.TotalGameTime - _deadTime.Value).Milliseconds > 250)
              {
            DoRemove = true;
              }
            }
            else
            {
              _deadTime = gameTime.TotalGameTime;
            }
              }
        }
	public void SetCharacter (string characterName, ScreenPosition position, Sprite characterPortrait = null) {
		Image portraitFrame = null;

		switch (position) {

		case ScreenPosition.Left:
			portraitFrame = CharacterPortraitLeft;
			break;
		
		case ScreenPosition.Right:
			portraitFrame = CharacterPortraitRight;
			break;
		}

		if (characterPortrait != null) {
			portraitFrame.sprite = characterPortrait;
		}

		TogglePortraits(position);

		SetName(characterName);
	}
Beispiel #39
0
        public static void make(string text, ScreenPosition position, float duration, float fontSize = 30.0f)
        {
            Debug.Log(UIControllerGame.getInstance().announcementSampleObject);
            UILabel gameObject = (UILabel)GameObject.Instantiate(UIControllerGame.getInstance().announcementSampleObject);
            gameObject.text = text;

            switch (position)
            {
                case ScreenPosition.MiddleBottom:
                    gameObject.transform.parent = UIControllerGame.getInstance().panel_AnnouncementsMiddleBottom.transform;
                    break;
                case ScreenPosition.MiddleCenter:
                    gameObject.transform.parent = UIControllerGame.getInstance().panel_AnnouncementsMiddleCenter.transform;
                    break;
                case ScreenPosition.MiddleTop:
                    gameObject.transform.parent = UIControllerGame.getInstance().panel_AnnouncementsMiddleTop.transform;
                    break;
            }

            gameObject.transform.localPosition = Vector3.zero;
            gameObject.transform.localScale = new Vector3(fontSize, fontSize, 1);
            GameObject.Destroy(gameObject.gameObject, duration);
        }
	/// <summary>
	/// Places a Transform at one of the 9 positions around the screen edge.
	/// </summary>
	/// <param name="target">
	/// A <see cref="Transform"/>
	/// </param>
	/// <param name="position">
	/// A <see cref="ScreenPosition"/>
	/// </param>
	/// <param name="pixelsFromEdge">
	/// A <see cref="Vector2"/>
	/// </param>
	public static void ScreenPlacement(this Transform target, ScreenPosition position, Vector2 pixelsFromEdge){
		DoScreenPlacement(target.transform, position, pixelsFromEdge, Camera.main);
	}
	//Placement execution:
	private static void DoScreenPlacement(this Transform target, ScreenPosition position, Vector2 pixelsFromEdge, Camera renderingCamera){
		Vector3 screenPosition = Vector3.zero;
		float zPosition =  -renderingCamera.transform.position.z + target.position.z;
		
		switch (position) {		
		
		//uppers:
		case ScreenPosition.UpperLeft:
			screenPosition = renderingCamera.ScreenToWorldPoint(new Vector3(pixelsFromEdge.x, Screen.height-pixelsFromEdge.y, zPosition));
		break;
			
		case ScreenPosition.UpperMiddle:
			screenPosition = renderingCamera.ScreenToWorldPoint(new Vector3(Screen.width/2, Screen.height-pixelsFromEdge.y, zPosition));
		break;
			
		case ScreenPosition.UpperRight:
			screenPosition = renderingCamera.ScreenToWorldPoint(new Vector3(Screen.width-pixelsFromEdge.x, Screen.height-pixelsFromEdge.y, zPosition));
		break;	
		
		//mids:
		case ScreenPosition.Left:
			screenPosition = renderingCamera.ScreenToWorldPoint(new Vector3(pixelsFromEdge.x, Screen.height/2, zPosition));
		break;
				
		case ScreenPosition.Middle:
			screenPosition = renderingCamera.ScreenToWorldPoint(new Vector3((Screen.width/2) + pixelsFromEdge.x, (Screen.height/2) + pixelsFromEdge.y, zPosition));
		break;
			
		case ScreenPosition.Right:
			screenPosition = renderingCamera.ScreenToWorldPoint(new Vector3(Screen.width-pixelsFromEdge.x, Screen.height/2, zPosition));
		break;
		
		//lowers:
		case ScreenPosition.LowerLeft:
			screenPosition = renderingCamera.ScreenToWorldPoint(new Vector3(pixelsFromEdge.x, pixelsFromEdge.y, zPosition));
		break;
			
		case ScreenPosition.LowerMiddle:
			screenPosition = renderingCamera.ScreenToWorldPoint(new Vector3(Screen.width/2, pixelsFromEdge.y, zPosition));
		break;
			
		case ScreenPosition.LowerRight:
			screenPosition = renderingCamera.ScreenToWorldPoint(new Vector3(Screen.width-pixelsFromEdge.x, pixelsFromEdge.y, zPosition));
		break;			
			
			
		}
		
		target.transform.position = screenPosition;
	}
	/// <summary>
	/// Places a GameObject at one of the 9 positions around the screen edge.
	/// </summary>
	/// <param name="target">
	/// A <see cref="GameObject"/>
	/// </param>
	/// <param name="position">
	/// A <see cref="ScreenPosition"/>
	/// </param>
	/// <param name="pixelsFromEdge">
	/// A <see cref="Vector2"/>
	/// </param>
	/// <param name="renderingCamera">
	/// A <see cref="Camera"/>
	/// </param>
	public static void ScreenPlacement(this GameObject target, ScreenPosition position, Vector2 pixelsFromEdge, Camera renderingCamera){
		DoScreenPlacement(target.transform, position, pixelsFromEdge, renderingCamera);
	}
        /// <summary>
        /// Gets the coordinates matching an independent screen position value.
        /// </summary>
        /// <param name="ctrl">Target control for which the coordinates should be resolved.</param>
        /// <param name="position">Screen position value.</param>
        /// <returns>Pixel point in screen coordinates.</returns>
        public static Point ResolveScreenPositionEdge(this Control ctrl, ScreenPosition position)
        {
            var ctrlRegion = ctrl.RectangleToScreen(ctrl.ClientRectangle);

            return ResolveScreenPositionToRectangle(ctrlRegion, position);
        }
        /// <summary>
        /// Gets the coordinates point matching an independent screen position value.
        /// </summary>
        /// <param name="position">Screen position value.</param>
        /// <returns>Pixel point in screen coordinates.</returns>
        public static Point ResolveScreenPosition(this Screen screen, ScreenPosition position)
        {
            var rect = screen.WorkingArea;

            return ResolveScreenPositionToRectangle(rect, position);
        }
Beispiel #45
0
 public ScoreboardShow(string board, ScreenPosition pos)
 {
     this.Board = board;
     this.Position = pos;
 }
	//Transform overrides:
	
	/// <summary>
	/// Places a Transform at one of the 9 positions around the screen edge.
	/// </summary>
	/// <param name="target">
	/// A <see cref="Transform"/>
	/// </param>
	/// <param name="position">
	/// A <see cref="ScreenPosition"/>
	/// </param>
	public static void ScreenPlacement(this Transform target, ScreenPosition position){
		DoScreenPlacement(target.transform, position, Vector2.zero, Camera.main);
	}
	/// <summary>
	/// Places a Transform at one of the 9 positions around the screen edge.
	/// </summary>
	/// <param name="target">
	/// A <see cref="Transform"/>
	/// </param>
	/// <param name="position">
	/// A <see cref="ScreenPosition"/>
	/// </param>
	/// <param name="renderingCamera">
	/// A <see cref="Camera"/>
	/// </param>
	public static void ScreenPlacement(this Transform target, ScreenPosition position, Camera renderingCamera){
		DoScreenPlacement(target.transform, position, Vector2.zero, renderingCamera);
	}
        private void UpdateMovement(Movement movement, ScreenPosition playerScreenPosition, MoveDirection playerMoveDirection)
        {
            if (mCurrentState == CharacterState.Walking)
              {
            mSpeed = Vector2.Zero;
            mDirection = Vector2.Zero;
            mSpeed.X = Data.Speed;

            if (movement.Direction == MoveDirection.Left && playerScreenPosition == ScreenPosition.Right)
            {
              mSpeed.X = Data.Speed + (Data.Speed / 2);
            }

            if (movement.Direction == MoveDirection.Left && playerScreenPosition == ScreenPosition.Left)
            {
              mSpeed.X = Data.Speed / 2;
            }

            if (movement.Direction == MoveDirection.Right && playerScreenPosition == ScreenPosition.Left)
            {
              mSpeed.X = Data.Speed + (Data.Speed / 2);
            }

            if (movement.Direction == MoveDirection.Right && playerScreenPosition == ScreenPosition.Right)
            {
              if (playerMoveDirection == MoveDirection.Right) mSpeed.X = Data.Speed / 2;
            }

            if (movement.Direction == MoveDirection.Up || movement.Direction == MoveDirection.Down)
              mDirection.Y = AnimatedSprite.Constants.DirectionOffsets[movement.Direction];
            else
              mDirection.X = AnimatedSprite.Constants.DirectionOffsets[movement.Direction];
              }
        }
 public static void Draw(Texture2D tex, ScreenPosition postion, float scaleW, float scaleH)
 {
     throw new NotImplementedException("Método não implementado!");
 }
	public void SetConversation (Conversation conversation, ScreenPosition position = ScreenPosition.Right) {
		this._conversation = conversation;
		SetText();
		SetCharacter(
			this._conversation.GetCurrentSpeaker(),
			position
		);
	}
Beispiel #51
0
 public ScreenState(ScreenPosition pos, DateTime start, DateTime end)
 {
     this._start = start;
     this._end = end;
     this._pos = pos;
 }
Beispiel #52
0
 public ScreenState(ScreenState goalState)
 {
     this._start = goalState._start;
     this._end = goalState._end;
     this._pos = goalState._pos;
 }