Ejemplo n.º 1
0
 private void graphControl_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState, PointF mousePosition)
 {
     foreach (var pane in GraphPanes)
     {
         pane.EnsureYMin();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// МАСШТАБ СОБЫТИЕ.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="oldState"></param>
        /// <param name="newState"></param>
        static void zc_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState)
        {
            // enforce value constraints
            var xs = sender.GraphPane.XAxis.Scale;
            var ys = sender.GraphPane.YAxis.Scale;

            double xw = xs.Max - xs.Min;
            double yw = ys.Max - ys.Min;
            double XW = X1 - X0;
            double YW = Y1 - Y0;
            bool   ch = false;

            if (yw >= YW) // DUMB USER is not allowed to scale out of range
            {
                if (YW > 0)
                {
                    ys.Min = Y0;
                    ys.Max = Y1;
                }
                else
                {
                    ys.MinAuto = ys.MaxAuto = true;
                }
                sender.IsEnableVZoom = sender.IsEnableVPan = false;
                ch = true;
            }

            // update
            if (ch)
            {
                sender.AxisChange(); sender.Invalidate();
            }
        }
Ejemplo n.º 3
0
    private void Zoom()
    {
        //   Vector3 position = camera.transform.localPosition;

        state = CalculateZoomState();

        switch (state)
        {
        case ZoomState.ZoomIn:
            camera.orthographicSize -= zoomSpeed;
            break;

        case ZoomState.ZoomOut:
            camera.orthographicSize += zoomSpeed;
            break;

        case ZoomState.Stay:
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }

        if (camera.orthographicSize < minZoom)
        {
            camera.orthographicSize = minZoom;
        }

        if (camera.orthographicSize > maxZoom)
        {
            camera.orthographicSize = maxZoom;
        }
    }
Ejemplo n.º 4
0
        private void xxxGraph_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState)
        {
            ZedGraphControl zgc = (ZedGraphControl)sender;

            zgc.AxisChange();
            zgc.Invalidate();
        }
Ejemplo n.º 5
0
    private ZoomState CalculateZoomState()
    {
        ZoomState state = ZoomState.ZoomIn;
        float     correctedZoomInBorders  = zoomInBorders / 2f;
        float     correctedZoomOutBorders = zoomOutBorders / 2f;

        for (int i = 0; i < followedObjects.Count; i++)
        {
            if (followedObjects[i] != null)
            {
                Vector3 viewPoint = camera.WorldToViewportPoint(followedObjects[i].position);

                Rect innerRect = new Rect(correctedZoomInBorders, correctedZoomInBorders, 1 - zoomInBorders, 1 - zoomInBorders);
                Rect outerRect = new Rect(correctedZoomOutBorders, correctedZoomOutBorders, 1 - zoomOutBorders, 1 - zoomOutBorders);

                if (!innerRect.Contains(viewPoint))
                {
                    state = ZoomState.Stay;
                }

                if (!outerRect.Contains(viewPoint))
                {
                    state = ZoomState.ZoomOut;
                    return(state);
                }
            }
        }

        return(state);
    }
Ejemplo n.º 6
0
        private void zedGraphControl2_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState)
        {
            GraphPane pane = sender.GraphPane;

            pane.XAxis.Scale.Min = 0;
            pane.YAxis.Scale.Max = M0 * 1.5;
        }
Ejemplo n.º 7
0
        private void GC_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState)
        {
            var      g1 = GC.MasterPane[0];
            var      g2 = GC.MasterPane[1];
            DateTime d0 = new XDate(g1.XAxis.Scale.Min);
            DateTime d1 = new XDate(g1.XAxis.Scale.Max);
            DateTime d2 = new XDate(g2.XAxis.Scale.Min);
            DateTime d3 = new XDate(g2.XAxis.Scale.Max);

            var ts1 = d1 - d0;
            var ts2 = d3 - d2;

            if (ts1.TotalSeconds < ts2.TotalSeconds)
            {
                g2.XAxis.Scale.Min = g1.XAxis.Scale.Min;
                g2.XAxis.Scale.Max = g1.XAxis.Scale.Max;
                SetXStep(ts1.TotalSeconds, g1);
                SetXStep(ts1.TotalSeconds, g2);
            }
            else
            {
                g1.XAxis.Scale.Min = g2.XAxis.Scale.Min;
                g1.XAxis.Scale.Max = g2.XAxis.Scale.Max;
                SetXStep(ts2.TotalSeconds, g1);
                SetXStep(ts2.TotalSeconds, g2);
            }
        }
Ejemplo n.º 8
0
        public LevelPresenter(PresenterManager pm, EditorPresenter editor, Level level)
        {
            _pm = pm;
            _pm.InstanceRegistered   += PresenterRegsitered;
            _pm.InstanceUnregistered += PresenterUnregistered;

            _editor = editor;
            _level  = level;

            _zoom = new ZoomState();
            _zoom.ZoomLevelChanged += ZoomStateLevelChanged;

            _info = new LevelInfoPresenter(this);

            _layerPresenters = new Dictionary <Guid, LevelLayerPresenter>();

            _history = new CommandHistory();
            _history.HistoryChanged += HistoryChangedHandler;

            _annotations = new ObservableCollection <Annotation>();

            InitializeCommandManager();
            InitializeLayerHierarchy();
            InitializeLayers();
        }
Ejemplo n.º 9
0
	//initialization
	void Start ()
	{

		thisState = ZoomState.start;
		zoomTotem = gameObject.GetComponent<Animator> ();

	}
        /// <summary>
        /// Handler for the "Set Scale to Default" context menu item.  Sets the scale ranging to
        /// full auto mode for all axes.
        /// </summary>
        /// <remarks>
        /// This method differs from the <see cref="ZoomOutAll" /> method in that it sets the scales
        /// to full auto mode.  The <see cref="ZoomOutAll" /> method sets the scales to their initial
        /// setting prior to any user actions (which may or may not be full auto mode).
        /// </remarks>
        /// <param name="primaryPane">The <see cref="GraphPane" /> object which is to have the
        /// scale restored</param>
        public void RestoreScale(GraphPane primaryPane)
        {
            if (primaryPane != null)
            {
                //Go ahead and save the old zoomstates, which provides an "undo"-like capability
                //ZoomState oldState = primaryPane.ZoomStack.Push( primaryPane, ZoomState.StateType.Zoom );
                ZoomState oldState = new ZoomState(primaryPane, ZoomState.StateType.Zoom);

                using (Graphics g = this.CreateGraphics())
                {
                    if (_isSynchronizeXAxes || _isSynchronizeYAxes)
                    {
                        foreach (GraphPane pane in _masterPane._paneList)
                        {
                            pane.ZoomStack.Push(pane, ZoomState.StateType.Zoom);
                            ResetAutoScale(pane, g);
                        }
                    }
                    else
                    {
                        primaryPane.ZoomStack.Push(primaryPane, ZoomState.StateType.Zoom);
                        ResetAutoScale(primaryPane, g);
                    }

                    // Provide Callback to notify the user of zoom events
                    if (this.ZoomEvent != null)
                    {
                        this.ZoomEvent(this, oldState, new ZoomState(primaryPane, ZoomState.StateType.Zoom));
                    }

                    //g.Dispose();
                }
                Refresh();
            }
        }
Ejemplo n.º 11
0
 private void ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState)
 {
     if (m_bnegativeerrorval)
     {
         if (m_bDBF)
         {
             if (sender.GraphPane.YAxis.Scale.Min == 3e-4)
             {
                 m_biszoomed = false;
                 return;
             }
         }
         else if (m_bisQfour)
         {
             if (sender.GraphPane.YAxis.Scale.Min == 1e-12)
             {
                 m_biszoomed = false;
                 return;
             }
         }
         else
         {
             if (sender.GraphPane.YAxis.Scale.Min == 1e-11)
             {
                 m_biszoomed = false;
                 return;
             }
         }
         m_biszoomed = true;
     }
 }
Ejemplo n.º 12
0
        // Fit to selected zoom
        protected virtual void FitToZoom(ZoomState zoomState)
        {
            var rc       = this.ClipSize;
            var dataSize = this.GetDataSize();

            if (rc.IsZero || dataSize.IsZero)
            {
                ZoomNeedsUpdate = true;
                return;
            }
            ZoomNeedsUpdate = false;
            dataSize        = new Size(dataSize.Width + 2, dataSize.Height + 2);
            switch (zoomState)
            {
            case ZoomState.FitToScreen:
                _zoomFactor = Math.Min(
                    rc.Width / dataSize.Width,
                    rc.Height / dataSize.Height);
                break;

            case ZoomState.FitToWidth:
                _zoomFactor = rc.Width / dataSize.Width;
                break;

            case ZoomState.FitToHeigth:
                _zoomFactor = rc.Height / dataSize.Height;
                break;

            case ZoomState.Original:
                _zoomFactor = 1.0f;
                break;
            }
        }
Ejemplo n.º 13
0
        void MSGraphControl_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState, PointF mousePosition)
        {
            MSGraphPane pane = MasterPane.FindChartRect(mousePosition) as MSGraphPane;

            if (pane == null)
            {
                mousePosition = PointToClient(new Point(ContextMenuStrip.Left, ContextMenuStrip.Top));
            }
            pane = MasterPane.FindChartRect(mousePosition) as MSGraphPane;
            if (pane == null)
            {
                return;
            }

            Graphics g = CreateGraphics();

            pane.SetScale(g);

            if (IsSynchronizeXAxes)
            {
                foreach (MSGraphPane syncPane in MasterPane.PaneList)
                {
                    if (syncPane == pane)
                    {
                        continue;
                    }

                    syncPane.SetScale(g);
                }
            }

            Refresh();
        }
        /// <summary>
        /// Handler for the "Undo All Zoom/Pan" context menu item.  Restores the scale ranges to the values
        /// before all zoom and pan operations
        /// </summary>
        /// <remarks>
        /// This method differs from the <see cref="RestoreScale" /> method in that it sets the scales
        /// to their initial setting prior to any user actions.  The <see cref="RestoreScale" /> method
        /// sets the scales to full auto mode (regardless of what the initial setting may have been).
        /// </remarks>
        /// <param name="primaryPane">The <see cref="GraphPane" /> object which is to be zoomed out</param>
        public void ZoomOutAll(GraphPane primaryPane)
        {
            if (primaryPane != null && !primaryPane.ZoomStack.IsEmpty)
            {
                ZoomState.StateType type = primaryPane.ZoomStack.Top.Type;

                ZoomState oldState = new ZoomState(primaryPane, type);
                //ZoomState newState = pane.ZoomStack.PopAll( pane );
                ZoomState newState = null;
                if (_isSynchronizeXAxes || _isSynchronizeYAxes)
                {
                    foreach (GraphPane pane in _masterPane._paneList)
                    {
                        ZoomState state = pane.ZoomStack.PopAll(pane);
                        if (pane == primaryPane)
                        {
                            newState = state;
                        }
                    }
                }
                else
                {
                    newState = primaryPane.ZoomStack.PopAll(primaryPane);
                }

                // Provide Callback to notify the user of zoom events
                if (this.ZoomEvent != null)
                {
                    this.ZoomEvent(this, oldState, newState);
                }

                Refresh();
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Обработчик события при изменении масштаба
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="oldState"></param>
        /// <param name="newState"></param>
        void zedGraph_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState)
        {
            GraphPane pane = sender.GraphPane;

            // Для простоты примера будем ограничивать масштабирование
            // только в сторону уменьшения размера графика

            // Проверим интервал для каждой оси и
            // при необходимости скорректируем его

            if (pane.XAxis.Scale.Min <= -100)
            {
                pane.XAxis.Scale.Min = -100;
            }

            if (pane.XAxis.Scale.Max >= 100)
            {
                pane.XAxis.Scale.Max = 100;
            }

            if (pane.YAxis.Scale.Min <= -1)
            {
                pane.YAxis.Scale.Min = -1;
            }

            if (pane.YAxis.Scale.Max >= 2)
            {
                pane.YAxis.Scale.Max = 2;
            }
        }
Ejemplo n.º 16
0
    void Update()
    {
        if (curState != PointerState.Idle)
        {
            if (zoomTimer >= zoomDetectTime)
            {
                if (curState == PointerState.Entering)
                {
                    curZoomState = ZoomState.ZoomedIn;
                }
                else
                {
                    curZoomState = ZoomState.ZoomedOut;
                }
                curState  = PointerState.Idle;
                zoomTimer = 0;

                if (curZoomState == ZoomState.ZoomedIn)
                {
                    CameraManager.Instance.ControlRoomCam.transform.position = camZoomPos;
                    Debug.Log("Zoomed in");
                }
                else
                {
                    //zoom out
                    CameraManager.Instance.ControlRoomCam.transform.position = Vector3.zero;
                    Debug.Log("Zoomed out");
                }
            }
            zoomTimer += Time.deltaTime;
        }
    }
Ejemplo n.º 17
0
        protected void ZedGraphControlPrime_ZoomScaler(ZedGraphControl sender, ZoomState z1, ZoomState z2)
        {
            z2.ApplyState(this.GraphPane);

            double d = this.GraphPane.XAxis.Scale.Max - this.GraphPane.XAxis.Scale.Min;

            this.GraphPane.XAxis.Scale.Format = "yyyy";
            if (d < 1000)
            {
                this.GraphPane.XAxis.Title.Text   = "Year";
                this.GraphPane.XAxis.Scale.Format = "yyyy-MM";
            }
            if (d < 150)
            {
                this.GraphPane.XAxis.Title.Text   = "Year";
                this.GraphPane.XAxis.Scale.Format = "yyyy-MM-dd";
            }
            if (d < 3)
            {
                this.GraphPane.XAxis.Title.Text   = ((XDate)this.GraphPane.XAxis.Scale.Min).DateTime.Date.ToString("yyyy-MM-dd");
                this.GraphPane.XAxis.Scale.Format = "HH";
            }
            if (d < .3)
            {
                this.GraphPane.XAxis.Title.Text   = ((XDate)this.GraphPane.XAxis.Scale.Min).DateTime.Date.ToString("yyyy-MM-dd");
                this.GraphPane.XAxis.Scale.Format = "HH:mm";
            }
        }
        private void zgcScan_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState)
        {
            if (changing)
            {
                return;
            }

            changing = true;
            try
            {
                if (tvMRM.SelectedNode.Level == 1)
                {
                    return;
                }

                foreach (GraphPane pane in zgcPeptide.MasterPane.PaneList)
                {
                    newState.ApplyState(pane);
                }
            }
            finally
            {
                changing = false;
            }
        }
Ejemplo n.º 19
0
        public bool JoinZoom(string meetingID, string meetingPSW)
        {
            TimeSpan timeoutForGUIFunctions = TimeSpan.FromSeconds(15);
            TimeSpan timeoutForZoomStart    = TimeSpan.FromSeconds(30);

            StartZoom();
            OpenZoomJoinMenu(timeoutForZoomStart);
            ZoomEnterIDAndJoin(timeoutForGUIFunctions, meetingID);

            ZoomState currentState = GetZoomStateAfterJoin(timeoutForGUIFunctions);

            if (currentState == ZoomState.PasswordRequired)
            {
                ZoomEnterPasswordAndJoin(meetingPSW, timeoutForGUIFunctions);
                currentState = ZoomWaitUntilStateIsNot(ZoomState.PasswordRequired, timeoutForGUIFunctions);
            }

            if (currentState == ZoomState.CamPreviewWindow)
            {
                ZoomSkipCameraDialog(timeoutForGUIFunctions);
                currentState = ZoomWaitUntilStateIsNot(ZoomState.CamPreviewWindow, timeoutForGUIFunctions);
            }

            return(currentState == ZoomState.JoinedMeeting);
        }
Ejemplo n.º 20
0
    /* Player toggled camera, update the state and play the right sound. */
    public void toggleZoom()
    {
        lerp_timer = 0;
        switch (zState)
        {
        case ZoomState.ZOOMING_OUT:
            zState = ZoomState.ZOOMING_IN;
            zoomInSound.Play();
            break;

        case ZoomState.ZOOMED_OUT:
            zState = ZoomState.ZOOMING_IN;
            zoomInSound.Play();
            break;

        case ZoomState.ZOOMING_IN:
            zState = ZoomState.ZOOMING_OUT;
            zoomOutSound.Play();
            break;

        case ZoomState.ZOOMED_IN:
            zState = ZoomState.ZOOMING_OUT;
            zoomOutSound.Play();
            break;
        }
    }
Ejemplo n.º 21
0
        /// <summary>
        /// Focuses the plot on a specific point.  This is used for when the user clicks the fragment ladder and we want to hilight that point
        /// </summary>
        /// <param name="focusValue">The x value to focus on in the plot</param>
        public void FocusPlotOnPoint(double focusValue)
        {
            var arrowPoint = msPlot.m_arrowPoint;

            if (msPlot.m_arrowShowing && Math.Abs((float)focusValue - arrowPoint.X) < Single.Epsilon)
            {
                msPlot.m_arrowShowing = false;
            }
            else
            {
                int offset = msPlot.m_options.focusOffset;

                //change the zoom of the graph
                ZoomState oldZoom = new ZoomState(msPlot.GraphPane, ZoomState.StateType.Zoom);
                msPlot.GraphPane.XAxis.Scale.Min     = focusValue - offset;
                msPlot.GraphPane.XAxis.Scale.Max     = focusValue + offset;
                msPlot.GraphPane.YAxis.Scale.MinAuto = true;
                msPlot.GraphPane.YAxis.Scale.MaxAuto = true;
                msPlot.GraphPane.ZoomStack.Add(oldZoom);

                //place a cursor below the axis
                PointF graphPoint = new PointF((float)focusValue, (float)msPlot.GraphPane.YAxis.Scale.Min);
                msPlot.PaintArrow(graphPoint);
            }
            msPlot.Invalidate();
        }
Ejemplo n.º 22
0
        private void tryToFindTargetForZoomingIn()
        {
            //check if we can find a die under the mouse pointer
            RaycastHit info;
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            bool infoFound = Physics.Raycast(ray, out info);
            Die  dieFound  = infoFound ? info.transform.GetComponent <Die>() : null;

            if (infoFound && dieFound && (_zoomInOnARollingDieAllowed || !dieFound.isRolling))
            {
                //get the position
                _endPosition = info.transform.position + Vector3.up * _zoomDistance;
                //get the rotation by first getting an orientation vector from camera to die
                Vector3    forward         = info.transform.position - _camera.transform.position;
                Quaternion forwardRotation = Quaternion.LookRotation(forward);
                //then rotate THAT vector downward to Vector3.down, gives a nicer camera orientation
                Quaternion downwardRotation = Quaternion.FromToRotation(forward, Vector3.down) * forwardRotation;
                _endRotation = downwardRotation;

                //start over with the interpolation
                _interpolationAlpha = 0;
                _zoomState          = ZoomState.ZOOMING_IN;

                //set the current zoom die
                _lastZoomedDie = dieFound;
            }

            /*
             * else
             * {
             *  Debug.Log("Could not find target");
             * }
             */
        }
Ejemplo n.º 23
0
        private void Zoom(ZoomState zoom)
        {
            if (_zoomState == zoom)
            {
                return;
            }
            _zoomState = zoom;

            switch (zoom)
            {
            case ZoomState.None:
                LoadHistoryEntries();
                break;

            case ZoomState.Hour:
                Zoom(new TimeSpan(0, 1, 0, 0));
                break;

            case ZoomState.Day:
                Zoom(new TimeSpan(1, 0, 0, 0));
                break;

            case ZoomState.Week:
                Zoom(new TimeSpan(7, 0, 0, 0));
                break;

            case ZoomState.Month:
                Zoom(TimeSpan.Zero);     //months dont work with a timespan
                break;
            }
            ShowEntries();
            FormatDates();
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Assure the Y value range from 0 to 360.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="oldState"></param>
        /// <param name="newState"></param>
        private void zedGeoView_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState)
        {
            sender.GraphPane.YAxis.Scale.Min = 0;
            sender.GraphPane.YAxis.Scale.Max = 360;

            double xMax = sender.GraphPane.XAxis.Scale.Max;

            foreach (GraphObj obj in sender.GraphPane.GraphObjList)
            {
                if (!(obj is TextObj))
                {
                    continue;
                }

                TextObj  text = obj as TextObj;
                LineItem line = (LineItem)curveOf(sender, text.Text);
                if (line != null && line.Symbol.Type == SymbolType.None)
                {
                    obj.Location.X = xMax;
                    int closestIndex = Math.Max(0, (int)(xMax - since.DateTime.ToOADate()));

                    for (int i = closestIndex; i <= line.NPts; i++)
                    {
                        if (line[i].X < xMax)
                        {
                            continue;
                        }

                        closestIndex = i;
                        break;
                    }
                    obj.Location.Y = line[closestIndex].Y;
                }
            }
        }
Ejemplo n.º 25
0
 public void ZoomIn()
 {
     thisButton = MenuButton.none;
     zoomTotem.SetTrigger("zoomActivate");
     title.Zoom();
     thisState = ZoomState.totemZoomedIn;
     StartCoroutine(WaitASec());
 }
Ejemplo n.º 26
0
 public void ZoomOut()
 {
     thisButton = MenuButton.none;
     zoomTotem.SetTrigger("zoomActivate");
     title.Zoom();
     thisState = ZoomState.start;
     ButtonsObj.SetActive(false);
 }
Ejemplo n.º 27
0
 //Returns the new state, will throw on timeout
 ZoomState ZoomWaitUntilStateIsNot(ZoomState stateNotToBe, TimeSpan timeout)
 {
     return(Retry.While(() =>
     {
         return GetZoomStateAfterJoin(timeout);
     }, (state) => state == stateNotToBe,
                        timeout, DefaultIntervalForFunctions, true, true).Result);
 }
Ejemplo n.º 28
0
 public override void ScrollUp()
 {
     if (thisState.Equals(ZoomState.scrolledDown))
     {
         zoomTotem.SetTrigger("totemScroll");
         thisState = ZoomState.totemZoomedIn;
     }
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Fires just afer the form is done zooming.  Reevaluates the annotations for the new scale
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="oldState"></param>
 /// <param name="newState"></param>
 void MyZedGraph_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState)
 {
     if (m_manager.DataLoaded == true)
     {
         ReevaluateAnnotations();
     }
     //m_arrowShowing = false;
 }
Ejemplo n.º 30
0
 private void UpdateZoomState(ZoomState zoom)
 {
     if (_trackBarZoom != null && _trackBarZoom.Value != zoom.ZoomIndex)
     {
         _trackBarZoom.Value  = zoom.ZoomIndex;
         _statusZoomText.Text = zoom.ZoomText;
     }
 }
Ejemplo n.º 31
0
	public void Init(string _speciesName, char _speciesType, float _bodySize,
					 float _startPopulation, float _maxPopulation, float _minPopulation,
	                 GameObject _picture, Color border) {
		name = _speciesName;
		bodySize = _bodySize;
		maxPopulation = _maxPopulation;
		minPopulation = _minPopulation;
		speciesType = _speciesType;
		picture = Instantiate(_picture) as GameObject;
		picture.transform.parent = transform;
		picture.name = "picture";
		zoomState = ZoomState.zoom0;

		UpdatePopulation(_startPopulation);

		transferredAmounts = new Dictionary<string, float>();

		baseSpringZoom0 = gameObject.AddComponent<SpringJoint2D>();
		baseSpringZoom0.autoConfigureDistance = false;
		baseSpringZoom0.distance = 0.005f;
		baseSpringZoom0.dampingRatio = 0.7f;
		baseSpringZoom0.frequency = 0.8f;

		if (speciesType == 'p') {
			// TODO: change this arrangement from random to something similar that minion thing Physics.CheckSphere()
			baseSpringZoom0.connectedAnchor = new Vector2(Random.Range(-4f, 4f), -3f);
		} else {
			baseSpringZoom0.connectedAnchor = new Vector2(Random.Range(-4f, 4f), Mathf.Max(-1f, (Mathf.Log(bodySize)) - 1f));
		}
		transform.Find("border").gameObject.GetComponent<SpriteRenderer>().color = border;

		deathSpringZoom0 = gameObject.AddComponent<SpringJoint2D>();
		// TODO: implement the choice of dead animals
		deathSpringZoom0.connectedAnchor = new Vector2(7f, 0);
		deathSpringZoom0.autoConfigureDistance = false;
		deathSpringZoom0.distance = 0.005f;
		deathSpringZoom0.dampingRatio = 1f;
		deathSpringZoom0.frequency = 2f;
		deathSpringZoom0.enabled = false;

		interactionSpringsZoom0 = new List<SpringJoint2D>();

		baseSpringZoom1 = gameObject.AddComponent<SpringJoint2D>();
		baseSpringZoom1.autoConfigureDistance = false;
		baseSpringZoom1.distance = 0.005f;
		baseSpringZoom1.dampingRatio = 1f;
		baseSpringZoom1.frequency = 2f;
		baseSpringZoom1.enabled = false;

		if (population == 0) {
			alive = false;
			transform.position = deathSpringZoom0.connectedAnchor;
		} else {
			alive = true;
			transform.position = baseSpringZoom0.connectedAnchor;
		}
		SetZoom0();
	}
Ejemplo n.º 32
0
 void graph_ZoomEvent(ZedGraphControl sender, ZoomState oldState, ZoomState newState)
 {
     if (sender != graph)
     {
         return;
     }
     // TODO: not for every event
     RefreshLabels(graph.GraphPane);
 }
        protected override bool OnMouseDown(MouseEventArgs eventArgs)
        {
            if (eventArgs.Button == MouseButtons.Left)
            {
                this.currentState = ((Control.ModifierKeys & Keys.Shift) != 0) ? ((this.initialState == ZoomState.In) ? ZoomState.Out : ZoomState.In) : this.initialState;

                bool forwardMessage = (this.fastZoomingMessageFilter == null);
                RefreshUIState();
                if (forwardMessage && this.fastZoomingMessageFilter != null)
                    ((IWorkflowDesignerMessageSink)this.fastZoomingMessageFilter).OnMouseDown(eventArgs);
            }
            return true;
        }
 protected override bool OnKeyDown(KeyEventArgs eventArgs)
 {
     if (eventArgs.KeyValue == 0x1b)
     {
         base.ParentView.RemoveDesignerMessageFilter(this);
     }
     else
     {
         this.currentState = ((eventArgs.Modifiers & Keys.Shift) != Keys.None) ? ((this.initialState == ZoomState.In) ? ZoomState.Out : ZoomState.In) : this.initialState;
         this.RefreshUIState();
     }
     return true;
 }
Ejemplo n.º 35
0
        public static ZoomState Update(int gameTime)
        {
            buzzCooldown -= gameTime;
            if (buzzCooldown < 0)
                buzzCooldown = 0;
            if (state == ZoomState.None)
            {
                SelectPlayerRoom();
            }
            if (state == ZoomState.Sector)
            {
                Vector3 idealTarget = Engine.sectorList[selectedSectorIndex].center;
                if (cameraDistance < roomZoomThreshold)
                {
                    idealTarget = Engine.roomList[selectedRoomIndex].center;

                }
                Vector3 dif = (idealTarget - cameraTarget);
                if (dif.Length() > 4)
                {
                    dif.Normalize();
                    cameraTarget += .1f * dif * gameTime;
                    if (Math.Abs(cameraDistance - roomZoomThreshold) > 5)
                        cameraDistance = (cameraPosition - cameraTarget).Length();
                }
            }

            if (state == ZoomState.Sector && GamePad.GetState(Game1.activePlayer).IsButtonDown(Buttons.LeftTrigger))
            {
                cameraDistance += .1f * gameTime;
            }
            if (state == ZoomState.Sector && GamePad.GetState(Game1.activePlayer).IsButtonDown(Buttons.RightTrigger))
            {
                cameraDistance -= .1f * gameTime;
            }
            int currentScrollWheel = Mouse.GetState().ScrollWheelValue;
            if (state == ZoomState.Sector && currentScrollWheel > Controls.scrollWheelPrev)
            {
                cameraDistance -= 1.5f * gameTime;

                if (cameraDistance < Engine.roomList[selectedRoomIndex].size.Length())
                    cameraDistance = Engine.roomList[selectedRoomIndex].size.Length();
            }
            if (state == ZoomState.Sector && currentScrollWheel < Controls.scrollWheelPrev)
            {
                cameraDistance += 1.5f * gameTime;
                if (cameraDistance > 600)
                    cameraDistance = 600;
            }
            if ((state == ZoomState.World) && currentScrollWheel > Controls.scrollWheelPrev)
            {
                cameraDistance -= 2f * gameTime;
                if (cameraDistance < 100)
                    cameraDistance = 100;
            }
            if ((state == ZoomState.World) && currentScrollWheel < Controls.scrollWheelPrev)
            {
                cameraDistance += 2f * gameTime;
                if (cameraDistance > 900)
                    cameraDistance = 900;
            }

            if (state == ZoomState.ZoomToWorld)
            {

                WorldMap.worldZoomLevel += WorldMap.zoomSpeed * gameTime;
                cameraPosition = (1-worldZoomLevel) * sectorCameraPosition + (worldZoomLevel) * worldCameraPosition;
                cameraTarget = (1-worldZoomLevel) * sectorCameraTarget + (worldZoomLevel) * worldCameraTarget;
                cameraDistance = (1 - worldZoomLevel) * cameraDistance + (worldZoomLevel) * worldCameraDefaultZoom;
                if (WorldMap.worldZoomLevel > 1f)
                {
                    WorldMap.worldZoomLevel = 1f;
                    state = ZoomState.World;
                }
            }
            if (state == ZoomState.ZoomFromWorld)
            {

                WorldMap.worldZoomLevel -= WorldMap.zoomSpeed * gameTime;
                cameraPosition = (1 - worldZoomLevel) * sectorCameraPosition + (worldZoomLevel) * worldCameraPosition;
                cameraTarget = (1 - worldZoomLevel) * sectorCameraTarget + (worldZoomLevel) * worldCameraTarget;
                cameraDistance = (1 - worldZoomLevel) * sectorCameraDefaultZoom + (worldZoomLevel) * cameraDistance;
                if (WorldMap.worldZoomLevel < 0f)
                {
                    WorldMap.worldZoomLevel = 0f;
                    state = ZoomState.Sector;
                    Engine.roomList[selectedRoomIndex].roomHighlight = true;
                }
            }
            if (state == ZoomState.ZoomToSector)
            {

                WorldMap.zoomLevel += WorldMap.zoomSpeed * gameTime;
                cameraPosition = (1 - zoomLevel) * playerCameraPosition + (zoomLevel) * sectorCameraPosition;
                cameraTarget = (1 - zoomLevel) * playerCameraTarget + (zoomLevel) * sectorCameraTarget;
                cameraUp = (1 - zoomLevel) * playerCameraUp + (zoomLevel) * sectorCameraUp;
                if (WorldMap.zoomLevel > 1f)
                {
                    //cameraDistance = sectorCameraDefaultZoom;

                    WorldMap.zoomLevel = 1f;
                    state = ZoomState.Sector;
                    if (skipToInventory == true)
                        state = ZoomState.Inventory;
                    Engine.reDraw = true;
                    skipToInventory = false;
                }
            }
            if (state == ZoomState.ZoomFromSector)
            {
                if(WorldMap.zoomLevel == 1f) Engine.reDraw = true;
                WorldMap.zoomLevel -= WorldMap.zoomSpeed * gameTime;
                cameraPosition = (1 - zoomLevel) * playerCameraPosition + (zoomLevel) * sectorCameraPosition;
                cameraTarget = (1 - zoomLevel) * playerCameraTarget + (zoomLevel) * sectorCameraTarget;
                cameraUp = (1 - zoomLevel) * playerCameraUp + (zoomLevel) * sectorCameraUp;
                if (WorldMap.zoomLevel < 0f)
                {
                    WorldMap.zoomLevel = 0f;
                    state = ZoomState.None;
                    Engine.reDraw = true;
                    Controls.CenterMouse();
                    Engine.state = EngineState.Active;
                    Engine.roomList[selectedRoomIndex].roomHighlight = false;
                }
            }

            return state;
        }
Ejemplo n.º 36
0
	public void SetZoom0() {
		zoomState = ZoomState.zoom0;
		if (alive == true) {
			transform.Find("text").GetComponent<TextMesh>().text = "hello";
		} else {
			transform.Find("text").GetComponent<TextMesh>().text = "byee";
		}

		ActivateZoom0Springs();
		baseSpringZoom1.enabled = false; //TODO: change this into a function for future, zoom2
		Resize();
	}
Ejemplo n.º 37
0
	public void SetZoom1other(float interaction, GameObject zoomedSpecies) {
		zoomState = ZoomState.zoom1other;
		transform.Find("text").GetComponent<TextMesh>().text = "hi";
		DeactivateZoom0Springs();
		baseSpringZoom1.enabled = true;

		if (alive == false) {
			Vector2 zoom0Anchor = deathSpringZoom0.connectedAnchor;
			baseSpringZoom1.connectedAnchor = new Vector2(zoom0Anchor.x + 3, zoom0Anchor.y);
		} else {
			if (interaction == 0) {
				Vector2 zoom0Anchor = baseSpringZoom0.connectedAnchor;
				if (bodySize > zoomedSpecies.GetComponent<SpeciesIcon>().bodySize) {
					baseSpringZoom1.connectedAnchor = new Vector2(zoom0Anchor.x, zoom0Anchor.y + 10f);
				} else {
					baseSpringZoom1.connectedAnchor = new Vector2(zoom0Anchor.x, zoom0Anchor.y - 10f);
				}
			} else if (interaction < 0) {
				baseSpringZoom1.connectedAnchor = new Vector2(baseSpringZoom0.connectedAnchor.x,3);
			} else if (interaction > 0) {
				baseSpringZoom1.connectedAnchor = new Vector2(baseSpringZoom0.connectedAnchor.x,-3);
			}
			Resize();
		}
	}
        private void UpdateZoom(int zoomLevel, Point center)
        {
            PointF relativeCenterF = PointF.Empty;
            WorkflowView parentView = ParentView;

            Point layoutOrigin = parentView.LogicalPointToClient(Point.Empty);
            center.X -= layoutOrigin.X; center.Y -= layoutOrigin.Y;
            relativeCenterF = new PointF((float)center.X / (float)parentView.HScrollBar.Maximum, (float)center.Y / (float)parentView.VScrollBar.Maximum);

            parentView.Zoom = Math.Min(Math.Max(zoomLevel, AmbientTheme.MinZoom), AmbientTheme.MaxZoom);

            Point newCenter = new Point((int)((float)parentView.HScrollBar.Maximum * relativeCenterF.X), (int)((float)parentView.VScrollBar.Maximum * relativeCenterF.Y));
            parentView.ScrollPosition = new Point(newCenter.X - parentView.HScrollBar.LargeChange / 2, newCenter.Y - parentView.VScrollBar.LargeChange / 2);

            this.currentState = ((Control.ModifierKeys & Keys.Shift) != 0) ? ((this.initialState == ZoomState.In) ? ZoomState.Out : ZoomState.In) : this.initialState;
            RefreshUIState();
        }
Ejemplo n.º 39
0
 /// <summary>
 /// Clear the collection of saved states.
 /// </summary>
 private void ZoomStateClear()
 {
     _zoomStateStack.Clear();
     _zoomState = null;
 }
Ejemplo n.º 40
0
        /// <summary>
        /// 
        /// </summary>
        private void InitializeDrawable()
        {
            var context = this.DataContext as EditorContext;
            if (context == null)
                return;

            context.Invalidate =
                () =>
                {
                    InitializeLayers();
                    ResizeDrawable();

                    var container = context.Editor.Project.CurrentContainer;
                    if (container != null)
                    {
                        container.Invalidate();
                    }
                };

            _state = new ZoomState(context);

            context.Commands.ZoomResetCommand =
                Command.Create(
                    () =>
                    {
                        _state.ResetZoom();
                        if (context.Invalidate != null)
                        {
                            context.Invalidate();
                        }
                    },
                    () => true);

            context.Commands.ZoomExtentCommand =
                Command.Create(
                    () =>
                    {
                        _state.AutoFit();
                        if (context.Invalidate != null)
                        {
                            context.Invalidate();
                        }
                    },
                    () => true);

            this.PointerPressed +=
                (sender, e) =>
                {
                    if (_state == null)
                        return;

                    var p = e.GetPosition(this);

                    if (e.MouseButton == MouseButton.Middle)
                    {
                        _state.MiddleDown(p.X, p.Y);
                        // TODO: this.Cursor = Cursors.Pointer;
                    }

                    if (e.MouseButton == MouseButton.Left)
                    {
                        this.Focus();
                        _state.PrimaryDown(p.X, p.Y);
                    }

                    if (e.MouseButton == MouseButton.Right)
                    {
                        this.Focus();
                        _state.AlternateDown(p.X, p.Y);
                    }
                };

            this.PointerReleased +=
                (sender, e) =>
                {
                    if (_state == null)
                        return;

                    var p = e.GetPosition(this);

                    if (e.MouseButton == MouseButton.Middle)
                    {
                        this.Focus();
                        _state.MiddleUp(p.X, p.Y);
                        // TODO: this.Cursor = Cursors.Default;
                    }

                    if (e.MouseButton == MouseButton.Left)
                    {
                        this.Focus();
                        _state.PrimaryUp(p.X, p.Y);
                    }

                    if (e.MouseButton == MouseButton.Right)
                    {
                        this.Focus();
                        _state.AlternateUp(p.X, p.Y);
                    }
                };

            this.PointerMoved +=
                (sender, e) =>
                {
                    if (_state == null)
                        return;

                    var p = e.GetPosition(this);
                    _state.Move(p.X, p.Y);
                };

            this.PointerWheelChanged +=
                (sender, e) =>
                {
                    if (_state == null)
                        return;

                    var p = e.GetPosition(this);
                    _state.Wheel(p.X, p.Y, e.Delta.Y);
                };
        }
Ejemplo n.º 41
0
        /// <summary>
        /// Save the current states of the GraphPanes to a separate collection.  Save a single
        /// (<see paramref="primaryPane" />) GraphPane if the panes are not synchronized
        /// (see <see cref="IsSynchronizeXAxes" /> and <see cref="IsSynchronizeYAxes" />),
        /// or save a list of states for all GraphPanes if the panes are synchronized.
        /// </summary>
        /// <param name="primaryPane">The primary GraphPane on which zoom/pan/scroll operations
        /// are taking place</param>
        /// <param name="type">The <see cref="ZoomState.StateType" /> that describes the
        /// current operation</param>
        /// <returns>The <see cref="ZoomState" /> that corresponds to the
        /// <see paramref="primaryPane" />.
        /// </returns>
        private ZoomState ZoomStateSave(GraphPane primaryPane, ZoomState.StateType type)
        {
            ZoomStateClear();

            if (_isSynchronizeXAxes || _isSynchronizeYAxes)
            {
                foreach (GraphPane pane in _masterPane._paneList)
                {
                    ZoomState state = new ZoomState(pane, type);
                    if (pane == primaryPane)
                        _zoomState = state;
                    _zoomStateStack.Add(state);
                }
            }
            else
                _zoomState = new ZoomState(primaryPane, type);

            return _zoomState;
        }
 private void UpdateZoom(int zoomLevel, Point center)
 {
     PointF empty = PointF.Empty;
     WorkflowView parentView = base.ParentView;
     Point point = parentView.LogicalPointToClient(Point.Empty);
     center.X -= point.X;
     center.Y -= point.Y;
     empty = new PointF(((float) center.X) / ((float) parentView.HScrollBar.Maximum), ((float) center.Y) / ((float) parentView.VScrollBar.Maximum));
     parentView.Zoom = Math.Min(Math.Max(zoomLevel, 10), 400);
     Point point2 = new Point((int) (parentView.HScrollBar.Maximum * empty.X), (int) (parentView.VScrollBar.Maximum * empty.Y));
     parentView.ScrollPosition = new Point(point2.X - (parentView.HScrollBar.LargeChange / 2), point2.Y - (parentView.VScrollBar.LargeChange / 2));
     this.currentState = ((Control.ModifierKeys & Keys.Shift) != Keys.None) ? ((this.initialState == ZoomState.In) ? ZoomState.Out : ZoomState.In) : this.initialState;
     this.RefreshUIState();
 }
        /// <summary>
        /// Handler for the "Undo All Zoom/Pan" context menu item.  Restores the scale ranges to the values
        /// before all zoom and pan operations
        /// </summary>
        /// <remarks>
        /// This method differs from the <see cref="RestoreScale" /> method in that it sets the scales
        /// to their initial setting prior to any user actions.  The <see cref="RestoreScale" /> method
        /// sets the scales to full auto mode (regardless of what the initial setting may have been).
        /// </remarks>
        /// <param name="primaryPane">The <see cref="GraphPane" /> object which is to be zoomed out</param>
        public void ZoomOutAll( GraphPane primaryPane )
        {
            if ( primaryPane != null && !primaryPane.ZoomStack.IsEmpty )
            {
                ZoomState.StateType type = primaryPane.ZoomStack.Top.Type;

                ZoomState oldState = new ZoomState( primaryPane, type );
                //ZoomState newState = pane.ZoomStack.PopAll( pane );
                ZoomState newState = null;
                if ( _isSynchronizeXAxes || _isSynchronizeYAxes )
                {
                    foreach ( GraphPane pane in _masterPane._paneList )
                    {
                        ZoomState state = pane.ZoomStack.PopAll( pane );
                        if ( pane == primaryPane )
                            newState = state;
                    }
                }
                else
                    newState = primaryPane.ZoomStack.PopAll( primaryPane );

                // Provide Callback to notify the user of zoom events
                if ( this.ZoomEvent != null )
                    this.ZoomEvent( this, oldState, newState );

                Refresh();
            }
        }
Ejemplo n.º 44
0
    // DEBUG ----------------------------------------
    //public void OnGUI()
    //{
    //   if (GameState.Instance.inGame())
    //   {
    //      GUILayout.Label(Input.mousePosition.ToString());
    //      GUILayout.Label(Input.GetAxis("Mouse X").ToString() + " " + Input.GetAxis("Mouse Y").ToString());
    //   }
    //}
    public void Start()
    {
        // disable mouse cursor
          Cursor.visible = false;
          zoomState = gameObject.GetComponent<ZoomState>();

          if (crosshairImage == null)
          {
         Debug.LogError("Crosshair texture for ChaseState is not set!");
          }
    }
 protected override bool OnKeyUp(KeyEventArgs eventArgs)
 {
     this.currentState = ((eventArgs.Modifiers & Keys.Shift) != 0) ? ((this.initialState == ZoomState.In) ? ZoomState.Out : ZoomState.In) : this.initialState;
     RefreshUIState();
     return true;
 }
Ejemplo n.º 46
0
 void HandleZoom()
 {
     if (Zooming && Input.GetKeyUp(KeyCode.LeftShift)) {
         if (GetZoomInKey) { Trigger(OnZoomInEnd); }
         if (GetZoomOutKey) { Trigger(OnZoomOutEnd); }
         zooming = ZoomState.NONE;
         return;
     }
     if (ZoomingIn && Input.GetKey(KeyCode.LeftShift) && GetZoomInKey) {
         Trigger(OnZoomInProgress);
         return;
     }
     if (ZoomingOut && Input.GetKey(KeyCode.LeftShift) && GetZoomOutKey) {
         Trigger(OnZoomOutProgress);
         return;
     }
     if (UndefinedZooming && Input.GetKey(KeyCode.LeftShift) && !GetZoomInKey && !GetZoomOutKey) {
         Trigger(OnZoomProgress);
         return;
     }
     if (Input.GetKeyDown(KeyCode.LeftShift)) {
         Trigger(OnZoomStart);
         zooming = ZoomState.ZOOMING;
         return;
     }
     if (!ZoomingIn && GetZoomInKey) {
         Trigger(OnZoomInStart);
         zooming = ZoomState.ZOOMING_IN;
         return;
     }
     if (!ZoomingOut && GetZoomOutKey) {
         Trigger(OnZoomOutStart);
         zooming = ZoomState.ZOOMING_OUT;
         return;
     }
 }
 internal ZoomingMessageFilter(bool initiateZoomIn)
 {
     this.currentState = this.initialState = (initiateZoomIn) ? ZoomState.In : ZoomState.Out;
 }
Ejemplo n.º 48
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public ZeeGraphControl()
        {
            _dragPane = null;
            InitializeComponent();

            // Use double-buffering for flicker-free updating:
            SetStyle(ControlStyles.UserPaint |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.DoubleBuffer |
                     ControlStyles.ResizeRedraw, true);

            SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            _resourceManager = new ResourceManager("ZeeGraph.ZeeGraphLocale",
                                                   Assembly.GetExecutingAssembly());

            Rectangle rect = new Rectangle(0, 0, Size.Width, Size.Height);
            _masterPane = new MasterPane("", rect);
            _masterPane.Margin.All = 0;
            _masterPane.Title.IsVisible = false;

            string titleStr = _resourceManager.GetString("title_def");
            string xStr = _resourceManager.GetString("x_title_def");
            string yStr = _resourceManager.GetString("y_title_def");

            GraphPane graphPane = new GraphPane(rect, titleStr, xStr, yStr);
            using (Graphics g = CreateGraphics())
            {
                graphPane.AxisChange(g);
                //g.Dispose();
            }
            _masterPane.Add(graphPane);

            hScrollBar1.Minimum = 0;
            hScrollBar1.Maximum = 100;
            hScrollBar1.Value = 0;

            vScrollBar1.Minimum = 0;
            vScrollBar1.Maximum = 100;
            vScrollBar1.Value = 0;

            _xScrollRange = new ScrollRange(true);
            _yScrollRangeList = new ScrollRangeList();
            _y2ScrollRangeList = new ScrollRangeList();

            _yScrollRangeList.Add(new ScrollRange(true));
            _y2ScrollRangeList.Add(new ScrollRange(false));

            _zoomState = null;
            _zoomStateStack = new ZoomStateStack();
        }
Ejemplo n.º 49
0
 internal void FireZoomEvent(ZoomState zoomState, EventArgs e)
 {
     if (_onZoom != null)
         _onZoom(this, CreateAxisZoomEventArgs(zoomState, e));
 }
Ejemplo n.º 50
0
        /// <summary>
        /// Initialize <see cref="ZoomState"/> object
        /// </summary>
        private void InitializeState()
        {
            var context = this.DataContext as EditorContext;
            if (context == null)
                return;

            context.Editor.Invalidate = () => this.InvalidateVisual();

            _state = new ZoomState(context.Editor);

            if (context.Renderers != null && context.Renderers[0].State.EnableAutofit)
            {
                AutoFit(this.Bounds.Width, this.Bounds.Height);
            }

            this.PointerPressed +=
                (sender, e) =>
                {
                    if (_state == null)
                        return;

                    var p = e.GetPosition(this);

                    if (e.MouseButton == MouseButton.Left)
                    {
                        this.Focus();
                        _state.LeftDown(p.X, p.Y);
                    }

                    if (e.MouseButton == MouseButton.Right)
                    {
                        this.Cursor = new Cursor(StandardCursorType.Hand);
                        this.Focus();
                        _state.RightDown(p.X, p.Y);
                    }
                };

            this.PointerReleased +=
                (sender, e) =>
                {
                    if (_state == null)
                        return;

                    var p = e.GetPosition(this);

                    if (e.MouseButton == MouseButton.Left)
                    {
                        this.Focus();
                        _state.LeftUp(p.X, p.Y);
                    }

                    if (e.MouseButton == MouseButton.Right)
                    {
                        this.Cursor = new Cursor(StandardCursorType.Arrow);
                        this.Focus();
                        _state.RightUp(p.X, p.Y);
                    }
                };

            this.PointerMoved +=
                (sender, e) =>
                {
                    if (_state == null)
                        return;

                    var p = e.GetPosition(this);
                    _state.Move(p.X, p.Y);
                };

            this.PointerWheelChanged +=
                (sender, e) =>
                {
                    if (_state == null)
                        return;

                    if (context == null || context.Editor == null || context.Editor.Project == null)
                        return;

                    var container = context.Editor.Project.CurrentContainer;
                    if (container == null)
                        return;

                    var p = e.GetPosition(this);
                    _state.Wheel(
                        p.X,
                        p.Y,
                        e.Delta.Y,
                        this.Bounds.Width,
                        this.Bounds.Height,
                        container.Template.Width,
                        container.Template.Height);
                };
        }
Ejemplo n.º 51
0
	// TODO: HERE TOO
	public void PullFromGraveyard() {
		alive = true;
		zoomState = ZoomState.zoom0;
		//baseSpringZoom0.enabled = true;
		//deathSpringZoom0.enabled = false;
	}
Ejemplo n.º 52
0
	public override void UpKey ()
	{
		switch (thisState) {
		case ZoomState.start:
			ZoomIn();
			break;
		case ZoomState.totemZoomedIn:
			thisButton--;
			switch (thisButton) {
			case (MenuButton.underflow):
			case(MenuButton.none):
				thisButton = MenuButton.quit;
				zoomTotem.SetTrigger ("totemScroll");
				thisState = ZoomState.scrolledDown;
				break;
			case(MenuButton.startGame):
				break;
			case(MenuButton.resumeGame):
				break;	
			case(MenuButton.options):
				break;
			case(MenuButton.quit):
				break;
			}
			break;
		case ZoomState.scrolledDown:
			thisButton--;
			switch (thisButton) {
			case(MenuButton.none):
				break;
			case(MenuButton.startGame):
				zoomTotem.SetTrigger ("totemScroll");
				thisState = ZoomState.totemZoomedIn;
				break;
			case(MenuButton.resumeGame):
				
				zoomTotem.SetTrigger ("totemScroll");
				if (thisState.Equals (ZoomState.totemZoomedIn))
					thisState = ZoomState.scrolledDown;
				else if (thisState.Equals (ZoomState.scrolledDown))
					thisState = ZoomState.totemZoomedIn;
				break;	
			case(MenuButton.options):
				
				break;
			case(MenuButton.quit):
				
				break;
			}
			break;
		}
	}
Ejemplo n.º 53
0
	public void SetZoom1main(float birthRate, float selfInteraction) {
		zoomState = ZoomState.zoom1main;

		transform.Find("text").GetComponent<TextMesh>().text = name + "\npopulation: " + population + "\nweight: " + bodySize + "\nbirthrate: " + birthRate;
		transform.localRotation = Quaternion.identity;

		DeactivateZoom0Springs();
		baseSpringZoom1.enabled = true;
		baseSpringZoom1.connectedAnchor = new Vector2(0,0);
		Resize();
		// TODO: make this change in size smoooooth
	}
Ejemplo n.º 54
0
	public override void ScrollUp ()
	{
		if (thisState.Equals (ZoomState.scrolledDown)) {
			zoomTotem.SetTrigger ("totemScroll");
			thisState = ZoomState.totemZoomedIn;
		}
	}
Ejemplo n.º 55
0
	public void ZoomIn ()
	{
		thisButton = MenuButton.none;
		zoomTotem.SetTrigger ("zoomActivate");
		title.Zoom();
		thisState = ZoomState.totemZoomedIn;
		StartCoroutine(WaitASec());

	}
Ejemplo n.º 56
0
	public void ZoomOut ()
	{

		thisButton = MenuButton.none;
		zoomTotem.SetTrigger ("zoomActivate");
		title.Zoom ();
		thisState = ZoomState.start;
		ButtonsObj.SetActive(false);
	}
Ejemplo n.º 57
0
        public static void ZoomToSector()
        {
            UnHightlightSector();
            worldZoomLevel = 0;
            zoomLevel = 0;
            cameraTarget = playerCameraTarget = Engine.player.cameraTarget;
            cameraPosition = playerCameraPosition = Engine.player.cameraPos;
            cameraUp = playerCameraUp = Engine.player.cameraUp;

            for (int i = 0; i < Engine.roomList.Count; i++)
            {
                if (Engine.roomList[i] == Engine.player.currentRoom)
                {
                    selectedRoomIndex = i;
                    Engine.player.currentRoom.roomHighlight = true;
                }
            }
            for (int i = 0; i < Engine.sectorList.Count; i++)
            {
                if (Engine.roomList[selectedRoomIndex].parentSector == Engine.sectorList[i])
                {
                    selectedSectorIndex = i;
                }
            }
            sectorCameraUp = Engine.player.up;
            sectorCameraTarget = Engine.sectorList[selectedSectorIndex].center;
            Vector3 dif = Engine.player.center.normal + 1.1f * Engine.player.up + 1.4f * Engine.player.right;
            dif.Normalize();
            cameraDistance = sectorCameraDefaultZoom;
            sectorCameraPosition = sectorCameraTarget + dif * cameraDistance;
            state = ZoomState.ZoomToSector;
            zoomToPlayer = false;
            displayMouse = false;
        }
Ejemplo n.º 58
0
        internal AxisZoomEventArgs CreateAxisZoomEventArgs(ZoomState zoomState, EventArgs e)
        {
            AxisZoomEventArgs eventArgs = new AxisZoomEventArgs(e);

            eventArgs.MinValue = zoomState.MinXValue;
            eventArgs.MaxValue = zoomState.MaxXValue;

            return eventArgs;
        }
        /// <summary>
        /// Handler for the "Set Scale to Default" context menu item.  Sets the scale ranging to
        /// full auto mode for all axes.
        /// </summary>
        /// <remarks>
        /// This method differs from the <see cref="ZoomOutAll" /> method in that it sets the scales
        /// to full auto mode.  The <see cref="ZoomOutAll" /> method sets the scales to their initial
        /// setting prior to any user actions (which may or may not be full auto mode).
        /// </remarks>
        /// <param name="primaryPane">The <see cref="GraphPane" /> object which is to have the
        /// scale restored</param>
        public void RestoreScale( GraphPane primaryPane )
        {
            if ( primaryPane != null )
            {
                //Go ahead and save the old zoomstates, which provides an "undo"-like capability
                //ZoomState oldState = primaryPane.ZoomStack.Push( primaryPane, ZoomState.StateType.Zoom );
                ZoomState oldState = new ZoomState( primaryPane, ZoomState.StateType.Zoom );

                using ( Graphics g = this.CreateGraphics() )
                {
                    if ( _isSynchronizeXAxes || _isSynchronizeYAxes )
                    {
                        foreach ( GraphPane pane in _masterPane._paneList )
                        {
                            pane.ZoomStack.Push( pane, ZoomState.StateType.Zoom );
                            ResetAutoScale( pane, g );
                        }
                    }
                    else
                    {
                        primaryPane.ZoomStack.Push( primaryPane, ZoomState.StateType.Zoom );
                        ResetAutoScale( primaryPane, g );
                    }

                    // Provide Callback to notify the user of zoom events
                    if ( this.ZoomEvent != null )
                        this.ZoomEvent( this, oldState, new ZoomState( primaryPane, ZoomState.StateType.Zoom ) );

                    //g.Dispose();
                }
                Refresh();
            }
        }
Ejemplo n.º 60
0
        /// <summary>
        /// Initialize the <see cref="Drawable"/> panel.
        /// </summary>
        public void Initialize()
        {
            this.SetStyle(
                ControlStyles.UserPaint
                | ControlStyles.AllPaintingInWmPaint
                | ControlStyles.OptimizedDoubleBuffer
                | ControlStyles.SupportsTransparentBackColor,
                true);

            this.BackColor = Color.Transparent;

            _state = new ZoomState(Context.Editor);

            this.MouseDown +=
                (sender, e) =>
                {
                    var p = e.Location;

                    if (e.Button == MouseButtons.Left)
                    {
                        this.Focus();
                        _state.LeftDown(p.X, p.Y);
                    }

                    if (e.Button == MouseButtons.Right)
                    {
                        this.Focus();
                        this.Cursor = Cursors.Hand;
                        _state.RightDown(p.X, p.Y);
                    }
                };

            this.MouseUp +=
                (sender, e) =>
                {
                    var p = e.Location;

                    if (e.Button == MouseButtons.Left)
                    {
                        this.Focus();
                        _state.LeftUp(p.X, p.Y);
                    }

                    if (e.Button == MouseButtons.Right)
                    {
                        this.Focus();
                        this.Cursor = Cursors.Default;
                        _state.RightUp(p.X, p.Y);
                    }
                };

            this.MouseMove +=
                (sender, e) =>
                {
                    var p = e.Location;
                    _state.Move(p.X, p.Y);
                };

            this.MouseWheel +=
                (sender, e) =>
                {
                    var p = e.Location;

                    if (Context == null || Context.Editor.Project == null)
                        return;

                    var container = Context.Editor.Project.CurrentContainer;
                    _state.Wheel(
                        p.X,
                        p.Y, e.Delta,
                        this.Width,
                        this.Height,
                        container.Template.Width,
                        container.Template.Height);
                };
        }