예제 #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;

        }
    }
예제 #2
0
    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;
    }
예제 #3
0
 public void OnMouseMove( dfControl control, dfMouseEventArgs mouseEvent )
 {
     if( mouseEvent.Buttons == dfMouseButtons.Left )
     {
         updateHotspot( mouseEvent );
     }
 }
예제 #4
0
 protected void OnMouseDown( dfControl source, dfMouseEventArgs args )
 {
     StartPosition = CurrentPosition = args.Position;
     State = dfGestureState.Possible;
     StartTime = Time.realtimeSinceStartup;
     hoverTime = Time.realtimeSinceStartup;
 }
예제 #5
0
 void OnClick( dfControl sender, dfMouseEventArgs args )
 {
     if( SelectOnClick != null )
     {
         SelectOnClick.Focus();
     }
 }
예제 #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();

        }
    }
예제 #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 );

        }
    }
예제 #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 );
    }
예제 #10
0
    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");
    }
예제 #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;

        }
    }
예제 #12
0
	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;
		}

	}
예제 #13
0
 public void OnClick(dfControl control, dfMouseEventArgs mouseEvent)
 {
     rm.enabled = true;
     rm.Close();
     ManualTargetingControls.mtc.cancelAllTurrets();
     Label.Display("Target Weapon");
     Hide();
 }
예제 #14
0
 public void OnMouseHover( dfControl source, dfMouseEventArgs args )
 {
     if( State == dfGestureState.Possible && Time.realtimeSinceStartup - hoverTime >= timeout )
     {
         StartPosition = CurrentPosition = args.Position;
         StartTime = Time.realtimeSinceStartup;
     }
 }
예제 #15
0
 public void OnClick( dfControl control, dfMouseEventArgs mouseEvent )
 {
     if( colorField != null )
     {
         colorField.Hue = HSBColor.GetHue( control.Color );
         colorField.SelectedColor = control.Color;
     }
 }
예제 #16
0
    /// <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);


    }
예제 #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);
    }
예제 #18
0
    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");
    }
예제 #19
0
 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);
 }
예제 #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);
     }
 }
예제 #21
0
    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();
        }
    }
예제 #23
0
    //    private int clickCount = 0;
    public void OnClick(dfControl control, dfMouseEventArgs mouseEvent)
    {
        Debug.Log (this.transform.name);

        if (showCurrentOperation)
        {

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

        if( State == dfGestureState.Possible || State == dfGestureState.Began )
        {
            State = dfGestureState.Began;
            CurrentPosition = args.Position;
        }
    }
예제 #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;
 }
예제 #27
0
 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();
    }
예제 #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;
			}
		}
	}
예제 #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);
 }
예제 #31
0
 void TipsBehaviour_MouseHover(dfControl control, dfMouseEventArgs mouseEvent)
 {
     updateTipText(TipState.TargetBehavior);
 }
예제 #32
0
 public void OnMouseDown(dfControl control, dfMouseEventArgs mouseEvent)
 {
     isMouseDown = true;
 }
예제 #33
0
 void focusAreas_MouseHover(dfControl control, dfMouseEventArgs mouseEvent)
 {
     updateTipText(TipState.FocusAreas);
 }
예제 #34
0
 void RunBestButton_Click(dfControl control, dfMouseEventArgs mouseEvent)
 {
     Optimizer.RunBest();
 }
 void OKButton_Click(dfControl control, dfMouseEventArgs mouseEvent)
 {
     panel.Hide();
 }
예제 #36
0
 public void OnMouseDown(dfControl control, dfMouseEventArgs mouseEvent)
 {
     updateHotspot(mouseEvent);
 }
예제 #37
0
 void ForgotButton_Click(dfControl control, dfMouseEventArgs mouseEvent)
 {
     loginPanel.Disable();
     DialogPanel.ShowResetPassword();
 }
예제 #38
0
 public virtual void OnClick(dfControl control, dfMouseEventArgs args)
 {
     switchPanelBehaviour.Switch();
 }
예제 #39
0
	protected internal override void OnMouseLeave(dfMouseEventArgs args)
	{
		base.OnMouseLeave(args);
		this.hoverIndex = -1;
	}
예제 #40
0
	protected internal override void OnMouseEnter(dfMouseEventArgs args)
	{
		base.OnMouseEnter(args);
		this.touchStartPosition = args.Position;
	}
예제 #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);
 }
예제 #42
0
 public void OnClick(dfControl control, dfMouseEventArgs mouseEvent)
 {
     controller.doNotPlayLogin();
 }
예제 #43
0
 void StationMenuButton1_Click(dfControl s, dfMouseEventArgs e)
 {
     print("Market");
 }
예제 #44
0
 public void OnMouseUp(dfControl control, dfMouseEventArgs mouseEvent)
 {
     isMouseDown = false;
 }
예제 #45
0
 void StartButton_Click(dfControl control, dfMouseEventArgs mouseEvent)
 {
     Initialize();
 }
 public void OnClick(dfControl control, dfMouseEventArgs mouseEvent)
 {
     Application.LoadLevel(Application.loadedLevel);
 }
예제 #47
0
 private void MouseEventProxy(dfControl control, dfMouseEventArgs mouseEvent)
 {
     this.callProxyEventHandler();
 }
예제 #48
0
 public void UI_Button_CancelLoad_Click(dfControl s, dfMouseEventArgs e)
 {
     uim.HideUI(UIManager.UIELEMENTS.LoadGameUI);
     uim.ShowUI(UIManager.UIELEMENTS.MainMenu);
 }
예제 #49
0
 void ResetButton_MouseHover(dfControl control, dfMouseEventArgs mouseEvent)
 {
     // print("ResetButton_MouseHover");
     mouseEvent.Use();
     updateTipText(TipState.ResetButton);
 }
예제 #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;
 }
예제 #52
0
 void StationMenuButton4_Click(dfControl s, dfMouseEventArgs e)
 {
 }
예제 #53
0
 public void UI_Button_DeleteGame_Click(dfControl s, dfMouseEventArgs e)
 {
 }
예제 #54
0
 protected internal override void OnMouseDown(dfMouseEventArgs args)
 {
     base.OnMouseDown(args);
     this.touchStartPosition = args.Position;
     this.isMouseDown        = true;
 }
예제 #55
0
 void TrainButton_MouseHover(dfControl control, dfMouseEventArgs mouseEvent)
 {
     updateTipText(TipState.TrainButton);
 }
예제 #56
0
 public void MouseEventProxy(dfControl control, dfMouseEventArgs mouseEvent)
 {
     callProxyEventHandler(control, mouseEvent);
 }
예제 #57
0
 protected internal override void OnMouseUp(dfMouseEventArgs args)
 {
     base.OnMouseUp(args);
     this.isMouseDown = false;
 }
예제 #58
0
 void panel_MouseHover(dfControl control, dfMouseEventArgs mouseEvent)
 {
     updateTipText(TipState.None);
 }
예제 #59
0
 protected internal override void OnMouseUp(dfMouseEventArgs args)
 {
     base.Parent.MakePixelPerfect(true);
     args.Use();
     base.OnMouseUp(args);
 }
예제 #60
0
 void LoginButton_Click(dfControl control, dfMouseEventArgs mouseEvent)
 {
     StartCoroutine(TryLogin());
 }