예제 #1
0
파일: MouseEvent.cs 프로젝트: microm/eplib
 public MouseEvent(EventState eventState, MouseInfo mouseInfo)
     : this(eventState, mouseInfo, new TPoint(0, 0))
 {
 }
예제 #2
0
 public string Altitude;  //海拔
 void Start()
 {
     instance = this;
 }
예제 #3
0
        public void Update(float deltaTime, EventSystem eventSystem)
        {
            Vector2 newMousePosition = Input.mousePosition;

            for (int i = 0; i < mouseInfo.Length; ++i)
            {
                KeyCode key = KeyCode.Mouse0 + i;
                if (Input.GetKeyDown(key))
                {
                    mouseInfo[i].startPosition   = newMousePosition;
                    mouseInfo[i].currentPosition = newMousePosition;
                    mouseInfo[i].deltaPosition   = Ashe.Const.Vector2.zero;
                }
                else if (Input.GetKey(key))
                {
                    mouseInfo[i].deltaPosition   = newMousePosition - mouseInfo[i].currentPosition;
                    mouseInfo[i].currentPosition = newMousePosition;
                }
            }

            int count = _eventList.Count;

            for (int i = 0; i < count; ++i)
            {
                var _event = _eventList[i];
                if (Input.GetKeyDown(_event.keycode))
                {
                    // マウス入力とUI要素が被っていたら無視する
                    if (IsMouseButton(_event.keycode) && eventSystem.IsPointerOverGameObject())
                    {
                        continue;
                    }
                    if (_event.onDown != null)
                    {
                        MouseInfo mi = mouseInfo[0];
                        if (IsMouseButton(_event.keycode))
                        {
                            mi = mouseInfo[_event.keycode - KeyCode.Mouse0];
                        }
                        _event.onDown(mi);
                    }
                }
                else if (Input.GetKey(_event.keycode))
                {
                    // マウス入力とUI要素が被っていたら無視する
                    if (IsMouseButton(_event.keycode) && eventSystem.IsPointerOverGameObject())
                    {
                        continue;
                    }
                    if (_event.onKey != null)
                    {
                        MouseInfo mi = mouseInfo[0];
                        if (IsMouseButton(_event.keycode))
                        {
                            mi = mouseInfo[_event.keycode - KeyCode.Mouse0];
                        }
                        _event.onKey(mi);
                    }
                }
                else if (Input.GetKeyUp(_event.keycode))
                {
                    if (_event.onUp != null)
                    {
                        MouseInfo mi = mouseInfo[0];
                        if (IsMouseButton(_event.keycode))
                        {
                            mi = mouseInfo[_event.keycode - KeyCode.Mouse0];
                        }
                        _event.onUp(mi);
                    }
                }
            }
        }
예제 #4
0
파일: MouseEvent.cs 프로젝트: microm/eplib
 public MouseEvent(EventState eventState, MouseInfo mouseInfo, TPoint previousPosition)
 {
     m_curInfo = mouseInfo;
     m_state = eventState;
     m_previousPosition = previousPosition;
 }
예제 #5
0
 public MouseEvent(E_EventState eEventState, MouseInfo mouseInfo, Vector2 previousPosition)
 {
     m_curInfo          = mouseInfo;
     m_state            = eEventState;
     m_previousPosition = previousPosition;
 }
예제 #6
0
 /// <param name="control">Current control.</param>
 /// <param name="mouse">Mouse info.</param>
 public MouseClickedEventArgs(IControl control, MouseInfo mouse)
     : base(control)
 {
     Mouse = mouse;
 }
예제 #7
0
    public static jQueryObject ScrollPagerPlugin(ScrollPagerPluginOptions customOptions)
    {
        ScrollPagerPluginOptions defaultOptions = new ScrollPagerPluginOptions();

        defaultOptions.pageSize      = 10;
        defaultOptions.currentPage   = 1;
        defaultOptions.holder        = ".listcontainer";
        defaultOptions.viewport      = "";
        defaultOptions.pageHeight    = 23;
        defaultOptions.onPageChanged = null;
        defaultOptions.container     = "#listcontainerdiv";

        ScrollPagerPluginOptions options = jQuery.ExtendObject <ScrollPagerPluginOptions>(new ScrollPagerPluginOptions(), defaultOptions, customOptions);

        return(jQuery.Current.Each(delegate(int i, Element element)
        {
            jQueryObject selector = jQuery.This;
            int pageCounter = 1;
            PositionInfo iPosition = new PositionInfo();
            MouseInfo iMouse = new MouseInfo();
            Number candidatePageIndex = 0;

            //this goes through every item in the
            selector
            .Children()
            .Each(delegate(int ic, Element elc)
            {
                if (ic < pageCounter * options.pageSize && ic >= (pageCounter - 1) * options.pageSize)
                {
                    jQuery.This.AddClass("page" + pageCounter);
                }
                else
                {
                    jQuery.This.AddClass("page" + (pageCounter + 1));
                    pageCounter++;
                }
            });

            //set and default the slider item height
            int contHeight = jQuery.Select(options.container).GetHeight();
            int sliderItemHeight = contHeight;

            //show/hide the appropriate regions
            selector.Children().Hide();
            jQuery.Select(".page" + options.currentPage).Show();

            //more than one page?
            if (pageCounter > 1)
            {
                //calculate the slider item height
                sliderItemHeight = (contHeight / pageCounter);

                //Build pager navigation
                string pageNav = "<UL class=scrollbar sizcache='4' sizset='13'>";
                for (i = 1; i <= pageCounter; i++)
                {
                    if (i == options.currentPage)
                    {
                        pageNav += "<LI class='currentPage pageItem' sizcache='4' sizset='13'><A class='sliderPage' href='#' rel='" + i + "'></A>";
                    }
                    else
                    {
                        pageNav += "<LI class='pageNav" + i + " pageItem' sizcache='4' sizset='14'><A class='sliderPage' href='#' rel='" + i + "'></A>";
                    }
                }

                //Create slider item
                string sliderItem = "<LI class='thumb' sizcache='4' sizset='13' style='top:" + (options.currentPage - 1) * sliderItemHeight + "; height:" + (sliderItemHeight - 3) + "'><A class='sliderThumb' href='#' rel='" + i + "'></A>";
                pageNav += sliderItem;
                pageNav += "</LI></UL>";

                if (options.holder == "")
                {
                    selector.After(pageNav);
                }
                else
                {
                    jQuery.Select(options.holder).Append(pageNav);
                }

                //Apply the slider item height
                jQuery.Select(".pageItem").Height(sliderItemHeight);
            }

            jQueryObject oTrack = jQuery.Select(".scrollbar");
            jQueryObject oThumb = jQuery.Select(".thumb");
            //jQueryObject oViewPort = jQuery.Select(options.viewport);
            Number maxPos = (oTrack.GetHeight() - oThumb.GetHeight());
            jQueryObject pageItemCollection = jQuery.Select(".pageItem a");

            Action <jQueryObject> selectPageItem = delegate(jQueryObject pageItem)
            {
                string clickedLink = pageItem.GetAttribute("rel");
                options.onPageChanged.Invoke(pageItem, new SelectedPageEventArgs(int.Parse(clickedLink)));

                options.currentPage = int.Parse(clickedLink);
                //remove current current (!) page
                jQuery.Select("li.currentPage").RemoveClass("currentPage");
                //Add current page highlighting
                pageItem.Parent("li").AddClass("currentPage");
                //hide and show relevant links
                selector.Children().Hide();
                selector.Find(".page" + clickedLink).Show();
            };

            //Action<jQueryObject> selectPageItem = delegate(jQueryObject pageItem)
            jQueryEventHandler selectPageItemHandler = delegate(jQueryEvent pageItemClickedEvent)
            {
                //grab the REL attribute
                jQueryObject pageItem = jQuery.FromElement(pageItemClickedEvent.CurrentTarget);
                selectPageItem(pageItem);
            };


            //pager navigation behaviour
            pageItemCollection.Live("click", selectPageItemHandler);

            jQueryEventHandler wheel = delegate(jQueryEvent oEvent)
            {
            };

            jQueryEventHandler drag = delegate(jQueryEvent oEvent)
            {
                Number candidatePos = Math.Max(0, (iPosition.Start + ((oEvent.PageY) - iMouse.Start)));
                iPosition.Now = (candidatePos > maxPos) ? maxPos : candidatePos;
                candidatePageIndex = Math.Round(iPosition.Now / oThumb.GetHeight());
                oThumb.CSS("top", iPosition.Now.ToString());;
            };

            jQueryEventHandler end = null;
            end = delegate(jQueryEvent oEvent)
            {
                jQuery.Document.Unbind("mousemove", drag);
                jQuery.Document.Unbind("mouseup", end);
                oThumb.Die("mouseup", end);
                selectPageItem(jQuery.FromElement(pageItemCollection[candidatePageIndex]));
            };

            jQueryEventHandler start = delegate(jQueryEvent oEvent)
            {
                iMouse.Start = oEvent.PageY;
                string oThumbDir = oThumb.GetCSS("top");
                iPosition.Start = (oThumbDir == "auto") ? 0 : int.Parse(oThumbDir);
                jQuery.Document.Bind("mousemove", drag);
                jQuery.Document.Bind("mouseup", end);
                oThumb.Live("mouseup", end);
            };

            Action setEvents = delegate()
            {
                oThumb.Live("mousedown", start);
                oTrack.Live("mouseup", drag);
                //if (options.scroll != null)
                //{
                //    oViewPort[0].AddEventListener("DOMMouseScroll", wheel, false);
                //    oViewPort[0].AddEventListener("mousewheel", wheel, false);
                //}
                //else if (options.scroll != null)
                //{
                //    oViewPort[0].OnMouseWheel = wheel;
                //}
            };

            setEvents.Invoke();
        }));
    }
예제 #8
0
    public static jQueryObject ScrollPagerPlugin(ScrollPagerPluginOptions customOptions)
    {
        ScrollPagerPluginOptions defaultOptions =new ScrollPagerPluginOptions();
        defaultOptions.pageSize = 10;
        defaultOptions.currentPage = 1;
        defaultOptions.holder = ".listcontainer";
        defaultOptions.viewport = "";
        defaultOptions.pageHeight = 23;
        defaultOptions.onPageChanged = null;
        defaultOptions.container = "#listcontainerdiv";

        ScrollPagerPluginOptions options =jQuery.ExtendObject<ScrollPagerPluginOptions>(new ScrollPagerPluginOptions(), defaultOptions, customOptions);

        //if (options.totalRecords / options.pageSize > 1)
        //{
        //    options.showThumbNavigators = true;
        //}

        return jQuery.Current.Each(delegate(int i, Element element)
                                   	{
                                   		jQueryObject selector = jQuery.This;
                                        int pageCounter = 1;
                                        PositionInfo iPosition = new PositionInfo();
                                        MouseInfo iMouse = new MouseInfo();
                                   		Number candidatePageIndex = 0;

                                        //this goes through every item in the
                                   		selector
                                            .Children()
                                            .Each(delegate(int ic, Element elc)
                                   		                         	{
                                                                        if (ic < pageCounter * options.pageSize && ic >= (pageCounter - 1) * options.pageSize)
                                                                        {
                                                                            jQuery.This.AddClass("page" + pageCounter);
                                                                        }
                                                                        else
                                                                        {
                                                                            jQuery.This.AddClass("page" + (pageCounter+1));
                                                                            pageCounter++;
                                                                        }
                                   		                         	});

                                        //set and default the slider item height
                                        int contHeight = jQuery.Select(options.container).GetHeight();
                                        int sliderItemHeight = contHeight;

                                        //show/hide the appropriate regions
                                        selector.Children().Hide();
                                        jQuery.Select(".page" + options.currentPage).Show();

                                        //more than one page?
                                        if (pageCounter > 1)
                                        {
                                            //calculate the slider item height
                                            sliderItemHeight = (contHeight / pageCounter);
                                            int sliderThumbNavigatorHeight = 10;

                                            //Define the sliderThumbNavigators
                                            jQueryObject sliderThumbNavigate = jQuery.FromHtml("<div><div>");
                                            sliderThumbNavigate.AddClass("sliderNavigate");
                                            sliderThumbNavigate.CSS("height", sliderThumbNavigatorHeight + "px");

                                            jQueryObject sliderThumbNavigateUp = sliderThumbNavigate.Clone(true);
                                            sliderThumbNavigateUp.AddClass("up");
                                            sliderThumbNavigateUp.Text("U");

                                            jQueryObject sliderThumbNavigateDown = sliderThumbNavigate.Clone(true);
                                            sliderThumbNavigateDown.AddClass("down");
                                            sliderThumbNavigateDown.Text("D");

                                            //Build pager navigation
                                            jQueryObject pageNav = jQuery.FromHtml("<ul class=scrollbar sizcache='4' sizset='13'></ul>");
                                            for (i = 1; i <= pageCounter; i++)
                                            {
                                                if (i == options.currentPage)
                                                {
                                                    pageNav.Append("<LI class='currentPage pageItem' sizcache='4' sizset='13'><A class='sliderPage' href='#' rel='" + i + "'></A>");
                                                }
                                                else
                                                {
                                                    pageNav.Append("<LI class='pageNav" + i + " pageItem' sizcache='4' sizset='14'><A class='sliderPage' href='#' rel='" + i + "'></A>");
                                                }

                                            }

                                            //line-height:
                                            //Create slider item
                                            int sliderItemThumbPosition = Math.Round((options.currentPage - 1)*sliderItemHeight);
                                            double sliderItemThumbHeight = Math.Round((sliderItemHeight - 3));

                                            //If the height of the slide thumb is less than 3 * the height of the navigators then change the height
                                            if (options.showThumbNavigators && ((3 * sliderThumbNavigatorHeight) > sliderItemThumbHeight))
                                            {
                                                sliderItemThumbHeight = (3*sliderThumbNavigatorHeight);
                                            }

                                            jQueryObject sliderThumbObject = jQuery.FromHtml("<li></li>");
                                            sliderThumbObject.AddClass("thumb");
                                            sliderThumbObject.CSS("top", sliderItemThumbPosition.ToString());
                                            sliderThumbObject.CSS("height", sliderItemThumbHeight.ToString() + "px");

                                            jQueryObject sliderThumbBar = jQuery.FromHtml("<div></div>");
                                            sliderThumbBar.AddClass("sliderThumb");
                                            sliderThumbBar.CSS("line-height", sliderItemThumbHeight.ToString() + "px");
                                            sliderThumbBar.Attribute("rel", i.ToString());
                                            sliderThumbBar.Text(options.currentPage.ToString());

                                            //If there is more than one page of data then add navigators
                                            if (options.showThumbNavigators)
                                            {
                                                sliderThumbObject.Append(sliderThumbNavigateUp);
                                                sliderThumbObject.Append(sliderThumbBar);
                                                sliderThumbObject.Append(sliderThumbNavigateDown);
                                            }
                                            else
                                            {
                                                sliderThumbObject.Append(sliderThumbBar);
                                            }

                                            pageNav.Append(sliderThumbObject);

                                            if (options.holder == "")
                                            {
                                                selector.After(pageNav);
                                            }
                                            else
                                            {
                                                jQuery.Select(options.holder).Append(pageNav);
                                            }

                                            //Apply the slider item height
                                            jQuery.Select(".pageItem").Height(sliderItemHeight);

                                        }

                                        jQueryObject oTrack = jQuery.Select(".scrollbar");
                                        jQueryObject oThumb = jQuery.Select(".thumb");
                                        //jQueryObject oViewPort = jQuery.Select(options.viewport);
                                        Number maxPos = (oTrack.GetHeight() - oThumb.GetHeight());
                                        jQueryObject pageItemCollection = jQuery.Select(".pageItem a");

                                   		Action<jQueryObject> selectPageItem = delegate(jQueryObject pageItem)
                                   		                                      	{
                                                                                    string clickedLink = pageItem.GetAttribute("rel");
                                                                                    options.onPageChanged.Invoke(pageItem, new SelectedPageEventArgs(int.Parse(clickedLink)));

                                                                                    options.currentPage = int.Parse(clickedLink);
                                                                                    //remove current current (!) page
                                                                                    jQuery.Select("li.currentPage").RemoveClass("currentPage");
                                                                                    //Add current page highlighting
                                                                                    pageItem.Parent("li").AddClass("currentPage");
                                                                                    //hide and show relevant links
                                                                                    selector.Children().Hide();
                                                                                    selector.Find(".page" + clickedLink).Show();
                                   		                                      	};

                                        //Action<jQueryObject> selectPageItem = delegate(jQueryObject pageItem)
                                        jQueryEventHandler selectPageItemHandler = delegate(jQueryEvent pageItemClickedEvent)
                                        {
                                            //grab the REL attribute
                                            jQueryObject pageItem = jQuery.FromElement(pageItemClickedEvent.CurrentTarget);
                                            selectPageItem(pageItem);
                                        };

                                        //pager navigation behaviour
                                   		pageItemCollection.Live("click", selectPageItemHandler);

                                        jQueryEventHandler wheel = delegate(jQueryEvent oEvent)
                                   		                           	{
                                   		                           	};

                                        jQueryEventHandler drag = delegate(jQueryEvent oEvent)
                                        {
                                            Number candidatePos = Math.Max(0, (iPosition.Start + ((oEvent.PageY) - iMouse.Start)));
                                            iPosition.Now = Math.Round((candidatePos > maxPos) ? maxPos : candidatePos);
                                            candidatePageIndex = Math.Round(iPosition.Now / oThumb.GetHeight());
                                            oThumb.CSS("top", iPosition.Now.ToString() + "px");

                                            //If navigators are visible then choose the second child. NB: Going to tidy all this up as this approach is def not BP
                                            if (options.showThumbNavigators)
                                            {
                                                oThumb.Children().First().Next().Text((candidatePageIndex + 1).ToString());
                                            }
                                            else
                                            {
                                                oThumb.Children().First().Text((candidatePageIndex + 1).ToString());
                                            }
                                        };

                                        jQueryEventHandler end = null;
                                        end = delegate(jQueryEvent oEvent)
                                              	{
                                                    jQuery.Document.Unbind("mousemove", drag);
                                                    jQuery.Document.Unbind("mouseup", end);
                                                    oThumb.Die("mouseup", end);
                                                    selectPageItem(jQuery.FromElement(pageItemCollection[candidatePageIndex]));
                                                };

                                        jQueryEventHandler start = delegate(jQueryEvent oEvent)
                                        {
                                            iMouse.Start = oEvent.PageY;
                                            string oThumbDir = oThumb.GetCSS("top");
                                            iPosition.Start = (oThumbDir == "auto") ? 0 : int.Parse(oThumbDir);
                                            jQuery.Document.Bind("mousemove", drag);
                                            jQuery.Document.Bind("mouseup", end);
                                            oThumb.Live("mouseup", end);
                                        };

                                        Action setEvents = delegate()
                                        {
                                            oThumb.Live("mousedown", start);
                                            oTrack.Live("mouseup", drag);
                                            //if (options.scroll != null)
                                            //{
                                            //    oViewPort[0].AddEventListener("DOMMouseScroll", wheel, false);
                                            //    oViewPort[0].AddEventListener("mousewheel", wheel, false);
                                            //}
                                            //else if (options.scroll != null)
                                            //{
                                            //    oViewPort[0].OnMouseWheel = wheel;
                                            //}
                                        };

                                        setEvents.Invoke();

                                   	});
    }
예제 #9
0
파일: Maingame.cs 프로젝트: KHCmaster/PPD
        public override void Update(InputInfoBase inputInfo, MouseInfo mouseInfo)
        {
            if (fadeOut)
            {
                if (black.Alpha >= 1)
                {
                    black.Alpha = 1;
                    switch (fadeOutAction)
                    {
                    case FadeOutAction.Retry:
                        mainGameComponent.Retry();
                        OnAfterRetry();
                        break;

                    case FadeOutAction.Replay:
                        mainGameComponent.Replay();
                        OnAfterReplay();
                        break;

                    case FadeOutAction.SetResult:
                        ShowResult();
                        break;
                    }
                    fadeOutAction = FadeOutAction.None;
                    black.Hidden  = true;
                    fadeOut       = false;
                }
                else
                {
                    black.Alpha += 0.05f;
                    if (black.Alpha >= 1)
                    {
                        black.Alpha = 1;
                    }
                }
            }

            if (TweetFinish)
            {
                TweetFinish = false;
                OnTweetFinish();
            }
            if (reviewFinish)
            {
                reviewFinish = false;
                OnReviewFinish();
            }

            mainGameComponent.Update(inputInfo, mouseInfo);
            base.Update();

            if (!isResult && client != null && !mainGameComponent.Replaying)
            {
                client.Send(new UpdateInfo
                {
                    CurrentTime = mainGameComponent.MoviePosition,
                    CoolCount   = mainGameComponent.CoolCount,
                    GoodCount   = mainGameComponent.GoodCount,
                    SafeCount   = mainGameComponent.SafeCount,
                    SadCount    = mainGameComponent.SadCount,
                    WorstCount  = mainGameComponent.WorstCount,
                    MaxCombo    = mainGameComponent.MaxCombo,
                    Score       = mainGameComponent.Score,
                    Life        = mainGameComponent.GameResultManager.CurrentLife
                });
            }
        }
예제 #10
0
파일: TestMenu.cs 프로젝트: KHCmaster/PPD
 public override void Update(InputInfoBase inputInfo, MouseInfo mouseInfo)
 {
     base.Update();
 }
예제 #11
0
 /// <param name="control">Current control.</param>
 /// <param name="mouse">Mouse info.</param>
 public MouseClickedEventArgs(IControl control, MouseInfo mouse)
     : base(control)
 {
     Mouse = mouse;
 }
예제 #12
0
        public override void Update(InputInfoBase inputInfo, MouseInfo mouseInfo)
        {
            switch (state)
            {
            case State.Loading:
                drawRatio = AnimationUtility.GetAnimationValue(drawRatio, currentRatio / 100);
                if (drawRatio == 1)
                {
                    state           = State.Complete;
                    bootImage.Alpha = 0;
                }
                rect.Position        = new Vector2(400 - drawRatio * 100, 223);
                rect.RectangleHeight = 4;
                rect.RectangleWidth  = drawRatio * 200;
                break;

            case State.Complete:
                completeImage.Alpha = AnimationUtility.IncreaseAlpha(completeImage.Alpha);
                if (completeImage.Alpha == 1)
                {
                    state = State.Fading;
                }
                break;

            case State.Fading:
                completeImage.Alpha = loadPercentImage.Alpha = percentImage.Alpha = outCircle.Alpha = AnimationUtility.DecreaseAlpha(outCircle.Alpha);
                if (completeImage.Alpha == 0)
                {
                    state = State.Expanding;
                }
                break;

            case State.Expanding:
                rect.Position         = new Vector2(400 - drawRatio * 100, 223);
                rect.RectangleHeight  = 4;
                rect.RectangleWidth   = drawRatio * 200;
                drawRatio             = AnimationUtility.GetAnimationValue(drawRatio, 4);
                provideImage.Position = AnimationUtility.GetAnimationPosition(provideImage.Position, new Vector2(20, provideImage.Position.Y));
                if (drawRatio == 4)
                {
                    state = State.Hiding;
                }
                break;

            case State.Hiding:
                provideImage.Position = AnimationUtility.GetAnimationPosition(provideImage.Position, new Vector2(900, provideImage.Position.Y));
                if (provideImage.Position.X >= 800)
                {
                    this.AddChild(HomeScene);
                    state = State.Showing;
                }
                break;

            case State.Showing:

                topBlack.Position    = AnimationUtility.GetAnimationPosition(topBlack.Position, new Vector2(0, -230));
                bottomBlack.Position = AnimationUtility.GetAnimationPosition(bottomBlack.Position, new Vector2(0, 460));

                if (topBlack.Position.Y <= -225)
                {
                    SceneManager.CurrentScene = HomeScene;
                }

                HomeScene.Update(EmptyInputInfo.Instance, MouseInfo.Empty);
                break;
            }

            HomeScene.Hidden       = topBlack.Hidden = bottomBlack.Hidden = state < State.Showing;
            rect.Hidden            = state >= State.Showing;
            loadPercentImage.Value = (uint)(drawRatio * 100);
            circle.Ratio           = state >= State.Fading ? completeImage.Alpha : drawRatio;
            circle.Inverse         = state >= State.Fading;
            Update();
        }
예제 #13
0
 public MouseEvent(E_EventState eEventState, MouseInfo mouseInfo)
     : this(eEventState, mouseInfo, new Vector2(0, 0))
 {
 }
예제 #14
0
 public bool Is(MouseInfo info) => (MouseInfo & info) != 0;
예제 #15
0
 public override bool ProcessMouse(MouseInfo info)
 {
     return(base.ProcessMouse(info));
 }
예제 #16
0
파일: Mage.cs 프로젝트: gorco/Omega-Mage
	// Pulls info about the Mouse, adds it to mouseInfos, and returns it
	MouseInfo AddMouseInfo()
	{
		MouseInfo mInfo = new MouseInfo();
		mInfo.screenLoc = Input.mousePosition;
		mInfo.loc = Utils.mouseLoc; // Gets the position of the mouse at z=0
		mInfo.ray = Utils.mouseRay; // Gets the ray from the Main Camera through
									// the mouse pointer
		mInfo.time = Time.time;
		mInfo.Raycast(); // Default is to raycast with no mask
		if (mouseInfos.Count == 0)
		{
			// If this is the first mouseInfo
			mouseInfos.Add(mInfo); // Add mInfo to mouseInfos
		}
		else
		{
			float lastTime = mouseInfos[mouseInfos.Count - 1].time;
			if (mInfo.time != lastTime)
			{
				// if time has passed since the last mouseInfo
				mouseInfos.Add(mInfo); // Add mInfo to mouseInfos
			}
			// This time test is necessary because AddMouseInfo() could be
			// called twice in one frame
		}
		return (mInfo); // Return mInfo as well
	}
예제 #17
0
 public bool ProcessMouse(MouseInfo info)
 {
     return(((IConsole)baseConsole).ProcessMouse(info));
 }
    public static jQueryObject ScrollPagerPlugin(ScrollPagerPluginOptions customOptions)
    {
        ScrollPagerPluginOptions defaultOptions =new ScrollPagerPluginOptions();
        defaultOptions.pageSize = 10;
        defaultOptions.currentPage = 1;
        defaultOptions.holder = ".listcontainer";
        defaultOptions.viewport = "";
        defaultOptions.pageHeight = 23;
        defaultOptions.onPageChanged = null;
        defaultOptions.container = "#listcontainerdiv";

        ScrollPagerPluginOptions options =jQuery.ExtendObject<ScrollPagerPluginOptions>(new ScrollPagerPluginOptions(), defaultOptions, customOptions);

        return jQuery.Current.Each(delegate(int i, Element element)
                                   	{
                                   		jQueryObject selector = jQuery.This;
                                        int pageCounter = 1;
                                        PositionInfo iPosition = new PositionInfo();
                                        MouseInfo iMouse = new MouseInfo();
                                   		Number candidatePageIndex = 0;

                                        //this goes through every item in the
                                   		selector
                                            .Children()
                                            .Each(delegate(int ic, Element elc)
                                   		                         	{
                                                                        if (ic < pageCounter * options.pageSize && ic >= (pageCounter - 1) * options.pageSize)
                                                                        {
                                                                            jQuery.This.AddClass("page" + pageCounter);
                                                                        }
                                                                        else
                                                                        {
                                                                            jQuery.This.AddClass("page" + (pageCounter+1));
                                                                            pageCounter++;
                                                                        }
                                   		                         	});

                                        //set and default the slider item height
                                        int contHeight = jQuery.Select(options.container).GetHeight();
                                        int sliderItemHeight = contHeight;

                                        //show/hide the appropriate regions
                                        selector.Children().Hide();
                                        jQuery.Select(".page" + options.currentPage).Show();

                                        //more than one page?
                                        if (pageCounter > 1)
                                        {
                                            //calculate the slider item height
                                            sliderItemHeight = (contHeight / pageCounter);

                                            //Build pager navigation
                                            string pageNav = "<UL class=scrollbar sizcache='4' sizset='13'>";
                                            for (i = 1; i <= pageCounter; i++)
                                            {
                                                if (i == options.currentPage)
                                                {
                                                    pageNav += "<LI class='currentPage pageItem' sizcache='4' sizset='13'><A class='sliderPage' href='#' rel='" + i + "'></A>";
                                                }
                                                else
                                                {
                                                    pageNav += "<LI class='pageNav" + i + " pageItem' sizcache='4' sizset='14'><A class='sliderPage' href='#' rel='" + i + "'></A>";
                                                }

                                            }

                                            //Create slider item
                                            string sliderItem = "<LI class='thumb' sizcache='4' sizset='13' style='top:" + (options.currentPage - 1) * sliderItemHeight + "; height:" + (sliderItemHeight - 3) + "'><A class='sliderThumb' href='#' rel='" + i + "'></A>";
                                            pageNav += sliderItem;
                                            pageNav += "</LI></UL>";

                                            if (options.holder == "")
                                            {
                                                selector.After(pageNav);
                                            }
                                            else
                                            {
                                                jQuery.Select(options.holder).Append(pageNav);
                                            }

                                            //Apply the slider item height
                                            jQuery.Select(".pageItem").Height(sliderItemHeight);

                                        }

                                        jQueryObject oTrack = jQuery.Select(".scrollbar");
                                        jQueryObject oThumb = jQuery.Select(".thumb");
                                        //jQueryObject oViewPort = jQuery.Select(options.viewport);
                                        Number maxPos = (oTrack.GetHeight() - oThumb.GetHeight());
                                        jQueryObject pageItemCollection = jQuery.Select(".pageItem a");

                                   		Action<jQueryObject> selectPageItem = delegate(jQueryObject pageItem)
                                   		                                      	{
                                                                                    string clickedLink = pageItem.GetAttribute("rel");
                                                                                    options.onPageChanged.Invoke(pageItem, new SelectedPageEventArgs(int.Parse(clickedLink)));

                                                                                    options.currentPage = int.Parse(clickedLink);
                                                                                    //remove current current (!) page
                                                                                    jQuery.Select("li.currentPage").RemoveClass("currentPage");
                                                                                    //Add current page highlighting
                                                                                    pageItem.Parent("li").AddClass("currentPage");
                                                                                    //hide and show relevant links
                                                                                    selector.Children().Hide();
                                                                                    selector.Find(".page" + clickedLink).Show();
                                   		                                      	};

                                        //Action<jQueryObject> selectPageItem = delegate(jQueryObject pageItem)
                                        jQueryEventHandler selectPageItemHandler = delegate(jQueryEvent pageItemClickedEvent)
                                        {
                                            //grab the REL attribute
                                            jQueryObject pageItem = jQuery.FromElement(pageItemClickedEvent.CurrentTarget);
                                            selectPageItem(pageItem);
                                        };

                                        //pager navigation behaviour
                                   		pageItemCollection.Live("click", selectPageItemHandler);

                                        jQueryEventHandler wheel = delegate(jQueryEvent oEvent)
                                   		                           	{
                                   		                           	};

                                        jQueryEventHandler drag = delegate(jQueryEvent oEvent)
                                        {
                                            Number candidatePos = Math.Max(0, (iPosition.Start + ((oEvent.PageY) - iMouse.Start)));
                                            iPosition.Now = (candidatePos > maxPos) ? maxPos : candidatePos;
                                            candidatePageIndex = Math.Round(iPosition.Now / oThumb.GetHeight());
                                            oThumb.CSS("top", iPosition.Now.ToString()); ;
                                        };

                                        jQueryEventHandler end = null;
                                        end = delegate(jQueryEvent oEvent)
                                        {
                                            jQuery.Document.Unbind("mousemove", drag);
                                            jQuery.Document.Unbind("mouseup", end);
                                            oThumb.Die("mouseup", end);
                                            selectPageItem(jQuery.FromElement(pageItemCollection[candidatePageIndex]));
                                        };

                                        jQueryEventHandler start = delegate(jQueryEvent oEvent)
                                        {
                                            iMouse.Start = oEvent.PageY;
                                            string oThumbDir = oThumb.GetCSS("top");
                                            iPosition.Start = (oThumbDir == "auto") ? 0 : int.Parse(oThumbDir);
                                            jQuery.Document.Bind("mousemove", drag);
                                            jQuery.Document.Bind("mouseup", end);
                                            oThumb.Live("mouseup", end);
                                        };

                                        Action setEvents = delegate()
                                        {
                                            oThumb.Live("mousedown", start);
                                            oTrack.Live("mouseup", drag);
                                            //if (options.scroll != null)
                                            //{
                                            //    oViewPort[0].AddEventListener("DOMMouseScroll", wheel, false);
                                            //    oViewPort[0].AddEventListener("mousewheel", wheel, false);
                                            //}
                                            //else if (options.scroll != null)
                                            //{
                                            //    oViewPort[0].OnMouseWheel = wheel;
                                            //}
                                        };

                                        setEvents.Invoke();

                                   	});
    }
예제 #19
0
파일: PanTool.cs 프로젝트: EikeStein/Fomore
 /// <inheritdoc />
 public override bool OnCanvasMouseUp(MouseInfo mouseInfo, CreatureStructureEditorCanvasVM canvasVM, ModifierKeys modifierKeys)
 {
     IsDragging = false;
     return(false);
 }