示例#1
0
            public static ScreenHandler <ExcavOSContext> GetScreenHandler(string name, ExcavOSContext context)
            {
                if (_handlers.ContainsKey(name))
                {
                    return(_handlers[name]);
                }

                ScreenHandler <ExcavOSContext> handler;

                switch (name)
                {
                case ExcavOSScreen.SCREEN_NAME:
                    handler = new ExcavOSScreen(context);
                    break;

                case CargoScreen.SCREEN_NAME:
                    handler = new CargoScreen(context);
                    break;

                case WeightScreen.SCREEN_NAME:
                    handler = new WeightScreen(context);
                    break;

                case UtilityScreen.SCREEN_NAME:
                    handler = new UtilityScreen(context);
                    break;

                case AllCargoScreen.SCREEN_NAME:
                    handler = new AllCargoScreen(context);
                    break;

                default:
                    handler = new BlankScreen(context);
                    break;
                }
                _handlers.Add(name, handler);
                return(handler);
            }
示例#2
0
    public IEnumerator ScreenFade(CameraFadeType fadeType, bool destroyOnComplete = true)
    {
        float transitionSpeed = 2;
        float waitTime = 0.25f;

        BlankScreen screen = new BlankScreen((fadeType == CameraFadeType.FadeIn) ? Color.black : Color.clear);
        Keyframe[] keys = new Keyframe[]{new Keyframe(0, 0, 0, 0), new Keyframe(1, 1, 2, 0)};
        AnimationCurve curve = new AnimationCurve(keys);

        float alpha = (fadeType == CameraFadeType.FadeIn) ? 1 : 0;
        bool isDone = false;

        yield return new WaitForSeconds(waitTime);

        while (!isDone)
        {
            alpha += (fadeType == CameraFadeType.FadeIn) ? -(transitionSpeed * Time.deltaTime) : (transitionSpeed * Time.deltaTime);

            screen.SetAlpha(curve.Evaluate(alpha));

            if (alpha < 0 || alpha > 1)
            {
                isDone = true;
            }

            yield return null;
        }

        if (destroyOnComplete)
        {
            screen.DestroyScreen();
        }
    }
示例#3
0
        public void InitializeGestures()
        {
            gestureController  = new GestureController();
            blankScreen        = new BlankScreen();
            nui.ElevationAngle = 10;
            comm = new CommunicationManager("9600");

            /*IRelativeGestureSegment[] waveLeftSegments = new IRelativeGestureSegment[6];
             * WaveLeftSegment1 waveLeftSegment1 = new WaveLeftSegment1();
             * WaveLeftSegment2 waveLeftSegment2 = new WaveLeftSegment2();
             * waveLeftSegments[0] = waveLeftSegment1;
             * waveLeftSegments[1] = waveLeftSegment2;
             * waveLeftSegments[2] = waveLeftSegment1;
             * waveLeftSegments[3] = waveLeftSegment2;
             * waveLeftSegments[4] = waveLeftSegment1;
             * waveLeftSegments[5] = waveLeftSegment2;
             * this.gestureController.AddGesture(GestureType.WaveLeft, waveLeftSegments);*/


            /*IRelativeGestureSegment[] swipeUpSegments = new IRelativeGestureSegment[3];
             * swipeUpSegments[0] = new SwipeUpSegment1();
             * swipeUpSegments[1] = new SwipeUpSegment2();
             * swipeUpSegments[2] = new SwipeUpSegment3();
             * gestureController.AddGesture(GestureType.SwipeUp, swipeUpSegments);
             *
             * IRelativeGestureSegment[] swipeDownSegments = new IRelativeGestureSegment[3];
             * swipeDownSegments[0] = new SwipeDownSegment1();
             * swipeDownSegments[1] = new SwipeDownSegment2();
             * swipeDownSegments[2] = new SwipeDownSegment3();
             * gestureController.AddGesture(GestureType.SwipeDown, swipeDownSegments);
             *
             * IRelativeGestureSegment[] swipeLeftSegments = new IRelativeGestureSegment[3];
             * swipeLeftSegments[0] = new SwipeLeftSegment1();
             * swipeLeftSegments[1] = new SwipeLeftSegment2();
             * swipeLeftSegments[2] = new SwipeLeftSegment3();
             * gestureController.AddGesture(GestureType.SwipeLeft, swipeLeftSegments);
             *
             * IRelativeGestureSegment[] swipeRightSegments = new IRelativeGestureSegment[3];
             * swipeRightSegments[0] = new SwipeRightSegment1();
             * swipeRightSegments[1] = new SwipeRightSegment2();
             * swipeRightSegments[2] = new SwipeRightSegment3();
             * gestureController.AddGesture(GestureType.SwipeRight, swipeRightSegments);*/

            IRelativeGestureSegment[] menuSegments = new IRelativeGestureSegment[20];
            MenuSegment1 menuSegment = new MenuSegment1();

            for (int i = 0; i < 20; i++)
            {
                // gesture consists of the same thing 20 times
                menuSegments[i] = menuSegment;
            }
            gestureController.AddGesture(GestureType.Menu, menuSegments);

            /*IRelativeGestureSegment[] zoomInSegments = new IRelativeGestureSegment[3];
             * zoomInSegments[0] = new ZoomSegment1();
             * zoomInSegments[1] = new ZoomSegment2();
             * zoomInSegments[2] = new ZoomSegment3();
             * gestureController.AddGesture(GestureType.ZoomIn, zoomInSegments);*/

            IRelativeGestureSegment[] joinedHandsSegments = new IRelativeGestureSegment[10];

            /* JoinedHandsSegment1 JoinedHandsSegment = new JoinedHandsSegment1();
             * for (int i = 0; i < 10; i++)
             * {
             *   // gesture consists of the same thing 10 times
             *   JoinedHandsSegments[i] = JoinedHandsSegment;
             * }
             * this.gestureController.AddGesture(GestureType.JoinedHands, JoinedHandsSegments);*/


            IRelativeGestureSegment[] joinedZoom         = new IRelativeGestureSegment[13];
            JoinedHandsSegment1       joinedHandsSegment = new JoinedHandsSegment1();

            for (int i = 0; i < 10; i++)
            {
                joinedZoom[i] = joinedHandsSegment;
                //joinedHandsSegments[i] = joinedHandsSegment;
            }
            //this.gestureController.AddGesture(GestureType.JoinedHands, joinedHandsSegments);

            joinedZoom[10] = new ZoomSegment1();
            joinedZoom[11] = new ZoomSegment2();
            joinedZoom[12] = new ZoomSegment3();
            gestureController.AddGesture(GestureType.JoinedZoom, joinedZoom);


            /*IRelativeGestureSegment[] zoomOutSegments = new IRelativeGestureSegment[3];
             * zoomOutSegments[0] = new ZoomSegment3();
             * zoomOutSegments[1] = new ZoomSegment2();
             * zoomOutSegments[2] = new ZoomSegment1();
             * gestureController.AddGesture(GestureType.ZoomOut, zoomOutSegments);
             */


            gestureController.GestureRecognized += OnGestureRecognized;
        }