Exemple #1
1
    public void OnMouseMove( dfControl control, dfMouseEventArgs args )
    {
        if( animating || !dragging )
            return;

        this.momentum = ( momentum + args.MoveDelta.Scale( 1, -1 ) ) * 0.5f;

        args.Use();

        if( args.Buttons.IsSet( dfMouseButtons.Left ) )
        {

            var ray = args.Ray;
            var distance = 0f;
            var direction = Camera.main.transform.TransformDirection( Vector3.back );
            var plane = new Plane( direction, lastPosition );
            plane.Raycast( ray, out distance );

            var pos = ( ray.origin + ray.direction * distance ).Quantize( control.PixelsToUnits() );
            var offset = pos - lastPosition;

            var transformPos = ( control.transform.position + offset ).Quantize( control.PixelsToUnits() );
            control.transform.position = transformPos;

            lastPosition = pos;

        }
    }
    public void OnMouseDown( dfControl source, dfMouseEventArgs args )
    {
        if( State == dfGestureState.Possible )
        {

            var elapsed = Time.realtimeSinceStartup - StartTime;
            if( elapsed <= timeout && Vector2.Distance( args.Position, StartPosition ) <= maxDistance )
            {

                StartPosition = CurrentPosition = args.Position;

                State = dfGestureState.Began;

                if( DoubleTapGesture != null ) DoubleTapGesture( this );
                gameObject.Signal( "OnDoubleTapGesture", this );

                endGesture();

                return;

            }

        }

        StartPosition = CurrentPosition = args.Position;
        State = dfGestureState.Possible;
        StartTime = Time.realtimeSinceStartup;
    }
 public void OnMouseMove( dfControl control, dfMouseEventArgs mouseEvent )
 {
     if( mouseEvent.Buttons == dfMouseButtons.Left )
     {
         updateHotspot( mouseEvent );
     }
 }
 protected void OnMouseDown( dfControl source, dfMouseEventArgs args )
 {
     StartPosition = CurrentPosition = args.Position;
     State = dfGestureState.Possible;
     StartTime = Time.realtimeSinceStartup;
     hoverTime = Time.realtimeSinceStartup;
 }
 void OnClick( dfControl sender, dfMouseEventArgs args )
 {
     if( SelectOnClick != null )
     {
         SelectOnClick.Focus();
     }
 }
Exemple #6
0
 public void OnMouseDown( dfControl source, dfMouseEventArgs args )
 {
     StartPosition = CurrentPosition = args.Position;
     State = dfGestureState.Possible;
     StartTime = Time.realtimeSinceStartup;
     Delta = Vector2.zero;
 }
    public void OnMouseDown( dfControl control, dfMouseEventArgs args )
    {
        if( !args.Used && args.Buttons == dfMouseButtons.Middle )
        {

            if( contextMenu.IsOpen )
            {
                contextMenu.Close();
                return;
            }

            args.Use();

            var hitPosition = control.GetHitPosition( args );
            var host = contextMenu.host;

            host.RelativePosition = hitPosition - host.Size * 0.5f;
            host.BringToFront();
            host.Show();
            host.Focus();

            contextMenu.Open();

        }
    }
Exemple #8
0
    public void OnMouseMove( dfControl source, dfMouseEventArgs args )
    {
        if( State == dfGestureState.Possible )
        {
            if( Vector2.Distance( args.Position, StartPosition ) >= minDistance )
            {

                State = dfGestureState.Began;

                CurrentPosition = args.Position;
                Delta = args.Position - StartPosition;

                if( PanGestureStart != null ) PanGestureStart( this );
                gameObject.Signal( "OnPanGestureStart", this );

            }
        }
        else if( State == dfGestureState.Began || State == dfGestureState.Changed )
        {

            State = dfGestureState.Changed;

            Delta = args.Position - CurrentPosition;
            CurrentPosition = args.Position;

            if( PanGestureMove != null ) PanGestureMove( this );
            gameObject.Signal( "OnPanGestureMove", this );

        }
    }
Exemple #9
0
    protected internal override void OnMouseMove( dfMouseEventArgs args )
    {
        args.Use();

        if( args.Buttons.IsSet( dfMouseButtons.Left ) )
        {

            var ray = args.Ray;
            var distance = 0f;
            var direction = GetCamera().transform.TransformDirection( Vector3.back );
            var plane = new Plane( direction, lastPosition );
            plane.Raycast( ray, out distance );

            var pos = ( ray.origin + ray.direction * distance ).Quantize( parent.PixelsToUnits() );
            var offset = pos - lastPosition;

            var transformPos = ( parent.transform.position + offset ).Quantize( parent.PixelsToUnits() );
            parent.transform.position = transformPos;

            lastPosition = pos;

        }

        base.OnMouseMove( args );
    }
    public void OnClick(dfControl control, dfMouseEventArgs mouseEvent)
    {

        Ship.PlayerController.pHull hull;
        switch(shipSelect.selectedIndex)
        {
            case 0:
                hull = Ship.PlayerController.pHull.Viper;
                GameManager.Instance.initializeShip(hull);
                break;
            case 1:
                hull = Ship.PlayerController.pHull.Anvil;
                GameManager.Instance.initializeShip(hull);
                break;
            case 2:
                hull = Ship.PlayerController.pHull.Shark;
                GameManager.Instance.initializeShip(hull);
                break;
            case 3:
                hull = Ship.PlayerController.pHull.Marauder;
                GameManager.Instance.initializeShip(hull);
                break;
            case 4:
                hull = Ship.PlayerController.pHull.Vulture;
                GameManager.Instance.initializeShip(hull);
                break;

        }
        Application.LoadLevel("CustomizeShip");
    }
Exemple #11
0
    public void OnClick( dfControl sender, dfMouseEventArgs args )
    {
        // No need to do anything unless an actual item was clicked
        if( args.Source == container )
            return;

        // Do not process click event if the user was scrolling by
        // dragging the mouse. Not needed for mobile.
        if( Vector2.Distance( args.Position, touchStartPosition ) > 20 )
            return;

        // Find highest-level control containing the click
        var source = args.Source;
        while( source != null && !controls.Contains( source ) )
        {
            source = source.Parent;
        }

        // If an item in the scroller was clicked, select it
        if( source != null )
        {

            // Select the clicked item
            lastSelected = -1;
            setSelectedIndex( controls.IndexOf( source ) );

            // Do not need to try to select "most centered" item
            isMouseDown = false;

        }
    }
	public void OnMouseHover( dfControl control, dfMouseEventArgs mouseEvent )
	{

		if( isTooltipVisible )
			return;

		var isSpellSlot = actionBar.Controls.Contains( mouseEvent.Source );
		if( isSpellSlot )
		{

			target = mouseEvent.Source;
			if( target == lastTarget )
				return;

			lastTarget = target;

			isTooltipVisible = true;

			var slot = target.GetComponentInChildren<SpellSlot>();
			if( string.IsNullOrEmpty( slot.Spell ) )
				return;

			var spell = SpellDefinition.FindByName( slot.Spell );
			if( spell == null )
				return;

			ActionbarsTooltip.Show( spell );

		}
		else
		{
			lastTarget = null;
		}

	}
 public void OnClick(dfControl control, dfMouseEventArgs mouseEvent)
 {
     rm.enabled = true;
     rm.Close();
     ManualTargetingControls.mtc.cancelAllTurrets();
     Label.Display("Target Weapon");
     Hide();
 }
 public void OnMouseHover( dfControl source, dfMouseEventArgs args )
 {
     if( State == dfGestureState.Possible && Time.realtimeSinceStartup - hoverTime >= timeout )
     {
         StartPosition = CurrentPosition = args.Position;
         StartTime = Time.realtimeSinceStartup;
     }
 }
 public void OnClick( dfControl control, dfMouseEventArgs mouseEvent )
 {
     if( colorField != null )
     {
         colorField.Hue = HSBColor.GetHue( control.Color );
         colorField.SelectedColor = control.Color;
     }
 }
    /// <summary>
    /// Starts a new game
    /// </summary>
    /// <param name="s">Button</param>
    /// <param name="e">Mouse events</param>
    /// <remarks>
    /// <para>
    /// Only hides the main menu and displays the New Game UI
    /// </para>
    /// </remarks>
    public void UI_Button_NewGame_Click(dfControl s, dfMouseEventArgs e)
    {
        //Show the New Game UI
        uim.HideUI(UIManager.UIELEMENTS.MainMenu);
        uim.ShowUI(UIManager.UIELEMENTS.NewGameUI);


    }
Exemple #17
0
    public void HelpClicked(dfControl control, dfMouseEventArgs args)
    {
        args.Use();
        TextAsset description = Resources.Load<TextAsset>("Descriptions/" + bi.className);
        GameObject prefab = (GameObject)Resources.Load("Prefabs/Buildings/" + bi.className);

        Dialog.Instance.SetDialog(bi.buildingName, description.text, "Continue", true, false,prefab);
    }
    public bool loadNext = false; // load the next scenario instead of the one specified.

    #endregion Fields

    #region Methods

    public void OnClick( dfControl control, dfMouseEventArgs mouseEvent )
    {
        if(loadNext) {
            CaseHandler.Instance.ActivateNext();
        } else {
            CaseHandler.Instance.ActivateCase(CaseType);
        }
        Application.LoadLevel("IntroRespCase");
    }
 public void OnClick( dfControl control, dfMouseEventArgs mouseEvent )
 {
     if(UILogger.UILog.ContainsKey(this.name)) {
         UILogger.UILog[this.name]++;
     } else {
         UILogger.UILog.Add(this.name,1);
     }
     UILogger.ButtonsPressed.Add(this.name);
 }
Exemple #20
0
 public void OnButtonClicked(dfControl control, dfMouseEventArgs mouseEvent)
 {
     int num = int.Parse(control.Tooltip);
     this.Setup(this.pageCount, num);
     if (this.OnPageSwitch != null)
     {
         this.OnPageSwitch(num);
     }
 }
    void OnClick( dfControl sender, dfMouseEventArgs args )
    {
        #if UNITY_EDITOR
        if( Application.isEditor )
            UnityEditor.EditorApplication.isPlaying = false;
        #endif

        Application.Quit();
    }
    public void OnClick( dfControl control, dfMouseEventArgs mouseEvent )
    {
        keyListener.HideQuitPanel();
        keyListener.QuitPanelShowing = false;

        if (Application.loadedLevelName.Equals("Game"))
        {
            GlobalPreferences.TogglePause();
        }
    }
    //    private int clickCount = 0;
    public void OnClick(dfControl control, dfMouseEventArgs mouseEvent)
    {
        Debug.Log (this.transform.name);

        if (showCurrentOperation)
        {

            StartCoroutine (ShowMessage (text, 3));
        }
    }
 public void OnClick(dfControl control, dfMouseEventArgs mouseEvent)
 {
     if (!CrewPanel.cp.isOpen)
     {
         CrewPanel.cp.Show();
         return;
     }
     else
         CrewPanel.cp.Hide();
 }
    public void OnMouseMove( dfControl source, dfMouseEventArgs args )
    {
        hoverTime = Time.realtimeSinceStartup;

        if( State == dfGestureState.Possible || State == dfGestureState.Began )
        {
            State = dfGestureState.Began;
            CurrentPosition = args.Position;
        }
    }
Exemple #26
0
 public void OnClick(dfControl control, dfMouseEventArgs mouseEvent)
 {
     if(StethescopeOverride && StethescopeTarget != null) {
         handler.HandleStethescopeAnimation(StethescopeTarget);
         return;
     } else if(StethescopeTarget == null && StethescopeOverride) {
         throw new MissingReferenceException("Stethoscope target is missing");
     }
     handler.HandleAnimation (transform.name);
     CaseInitializer.Instance.ActiveCase.isCorrect = IsAnswer;
 }
 public void OnClick(dfControl control, dfMouseEventArgs mouseEvent)
 {
     if (SpecializationsPanel.sp.isOpen)
     {
         SpecializationsPanel.sp.Hide();
         infoPanel.ip.Show();
         PowerManagementPanel.pmp.Show();
     }
     PowerManagementPanel.pmp.setTab(1);
     infoPanel.ip.setTab(1);
 }
    public void OnClick( dfControl control, dfMouseEventArgs mouseEvent )
    {
        //Use Parse to save this score to the global rankings.
        ParseObject HighScoreObject = new ParseObject("HighScoreObject");

        HighScoreObject["Name"] = NameEntry.Text;
        HighScoreObject["Score"] = PlayerObject.Score;

        GlobalPreferences.LastHighScoreName = NameEntry.Text;
        HighScoreObject.SaveAsync();
    }
Exemple #29
0
	public void OnMouseMove( dfControl source, dfMouseEventArgs args )
	{
		if( State == dfGestureState.Possible || State == dfGestureState.Began )
		{
			CurrentPosition = args.Position;
			if( Vector2.Distance( args.Position, StartPosition ) > maxDistance )
			{
				State = dfGestureState.Failed;
			}
		}
	}
Exemple #30
0
 protected internal override void OnMouseDown(dfMouseEventArgs args)
 {
     base.GetRootContainer().BringToFront();
     args.Use();
     Plane plane = new Plane(this.parent.transform.TransformDirection(Vector3.back), this.parent.transform.position);
     Ray ray = args.Ray;
     float single = 0f;
     plane.Raycast(args.Ray, out single);
     this.lastPosition = ray.origin + (ray.direction * single);
     base.OnMouseDown(args);
 }
 void TipsBehaviour_MouseHover(dfControl control, dfMouseEventArgs mouseEvent)
 {
     updateTipText(TipState.TargetBehavior);
 }
Exemple #32
0
 public void OnMouseDown(dfControl control, dfMouseEventArgs mouseEvent)
 {
     isMouseDown = true;
 }
 void focusAreas_MouseHover(dfControl control, dfMouseEventArgs mouseEvent)
 {
     updateTipText(TipState.FocusAreas);
 }
 void RunBestButton_Click(dfControl control, dfMouseEventArgs mouseEvent)
 {
     Optimizer.RunBest();
 }
 void OKButton_Click(dfControl control, dfMouseEventArgs mouseEvent)
 {
     panel.Hide();
 }
Exemple #36
0
 public void OnMouseDown(dfControl control, dfMouseEventArgs mouseEvent)
 {
     updateHotspot(mouseEvent);
 }
 void ForgotButton_Click(dfControl control, dfMouseEventArgs mouseEvent)
 {
     loginPanel.Disable();
     DialogPanel.ShowResetPassword();
 }
Exemple #38
0
 public virtual void OnClick(dfControl control, dfMouseEventArgs args)
 {
     switchPanelBehaviour.Switch();
 }
Exemple #39
0
	protected internal override void OnMouseLeave(dfMouseEventArgs args)
	{
		base.OnMouseLeave(args);
		this.hoverIndex = -1;
	}
Exemple #40
0
	protected internal override void OnMouseEnter(dfMouseEventArgs args)
	{
		base.OnMouseEnter(args);
		this.touchStartPosition = args.Position;
	}
Exemple #41
0
 protected internal override void OnMouseWheel(dfMouseEventArgs args)
 {
     this.SelectedIndex = Mathf.Max(0, this.SelectedIndex - Mathf.RoundToInt(args.WheelDelta));
     args.Use();
     base.OnMouseWheel(args);
 }
Exemple #42
0
 public void OnClick(dfControl control, dfMouseEventArgs mouseEvent)
 {
     controller.doNotPlayLogin();
 }
Exemple #43
0
 void StationMenuButton1_Click(dfControl s, dfMouseEventArgs e)
 {
     print("Market");
 }
Exemple #44
0
 public void OnMouseUp(dfControl control, dfMouseEventArgs mouseEvent)
 {
     isMouseDown = false;
 }
Exemple #45
0
 void StartButton_Click(dfControl control, dfMouseEventArgs mouseEvent)
 {
     Initialize();
 }
 public void OnClick(dfControl control, dfMouseEventArgs mouseEvent)
 {
     Application.LoadLevel(Application.loadedLevel);
 }
Exemple #47
0
 private void MouseEventProxy(dfControl control, dfMouseEventArgs mouseEvent)
 {
     this.callProxyEventHandler();
 }
Exemple #48
0
 public void UI_Button_CancelLoad_Click(dfControl s, dfMouseEventArgs e)
 {
     uim.HideUI(UIManager.UIELEMENTS.LoadGameUI);
     uim.ShowUI(UIManager.UIELEMENTS.MainMenu);
 }
 void ResetButton_MouseHover(dfControl control, dfMouseEventArgs mouseEvent)
 {
     // print("ResetButton_MouseHover");
     mouseEvent.Use();
     updateTipText(TipState.ResetButton);
 }
Exemple #50
0
 public void OnClick(dfControl control, dfMouseEventArgs mouseEvent)
 {
     StartCoroutine("ShowLeaderBoard");
 }
 public void OnMouseDown(dfControl source, dfMouseEventArgs args)
 {
     State         = dfGestureState.Possible;
     StartPosition = CurrentPosition = args.Position;
     StartTime     = Time.realtimeSinceStartup;
 }
Exemple #52
0
 void StationMenuButton4_Click(dfControl s, dfMouseEventArgs e)
 {
 }
Exemple #53
0
 public void UI_Button_DeleteGame_Click(dfControl s, dfMouseEventArgs e)
 {
 }
Exemple #54
0
 protected internal override void OnMouseDown(dfMouseEventArgs args)
 {
     base.OnMouseDown(args);
     this.touchStartPosition = args.Position;
     this.isMouseDown        = true;
 }
 void TrainButton_MouseHover(dfControl control, dfMouseEventArgs mouseEvent)
 {
     updateTipText(TipState.TrainButton);
 }
Exemple #56
0
 public void MouseEventProxy(dfControl control, dfMouseEventArgs mouseEvent)
 {
     callProxyEventHandler(control, mouseEvent);
 }
Exemple #57
0
 protected internal override void OnMouseUp(dfMouseEventArgs args)
 {
     base.OnMouseUp(args);
     this.isMouseDown = false;
 }
 void panel_MouseHover(dfControl control, dfMouseEventArgs mouseEvent)
 {
     updateTipText(TipState.None);
 }
Exemple #59
0
 protected internal override void OnMouseUp(dfMouseEventArgs args)
 {
     base.Parent.MakePixelPerfect(true);
     args.Use();
     base.OnMouseUp(args);
 }
 void LoginButton_Click(dfControl control, dfMouseEventArgs mouseEvent)
 {
     StartCoroutine(TryLogin());
 }