Ejemplo n.º 1
0
    void Start()
    {
        instance = this;

        AFModeIsInAR = true;
        //AFModeIsInAR = TurnOffPanelAfterTwee
    }
Ejemplo n.º 2
0
    void Start()
    {
        instance = this;

        AFModeIsInAR = true;
        //AFModeIsInAR = TurnOffPanelAfterTwee
    }
Ejemplo n.º 3
0
 private void SetupMoveCaretLeft()
 {
     _insertUtil
     .Setup(x => x.RunInsertCommand(InsertCommand.NewMoveCaret(Direction.Left)))
     .Returns(CommandResult.NewCompleted(ModeSwitch.NewSwitchMode(ModeKind.Normal)))
     .Verifiable();
 }
Ejemplo n.º 4
0
 protected void SetupRunCompleteMode(bool moveCaret)
 {
     _insertUtil
     .Setup(x => x.RunInsertCommand(InsertCommand.NewCompleteMode(moveCaret)))
     .Returns(CommandResult.NewCompleted(ModeSwitch.NewSwitchMode(ModeKind.Normal)))
     .Verifiable();
 }
Ejemplo n.º 5
0
        public static bool IsSwitchModeWithArgument(this ModeSwitch mode, ModeKind kind, ModeArgument argument)
        {
            if (!mode.IsSwitchModeWithArgument)
            {
                return(false);
            }

            var value = (ModeSwitch.SwitchModeWithArgument)mode;

            return(value.Item1 == kind && value.Item2.Equals(argument));
        }
Ejemplo n.º 6
0
 // Start is called before the first frame update
 void Start()
 {
     rb     = GetComponent <Rigidbody>();
     ModeS  = ModeSwitch.Start;
     NForce = new Vector3(0f, 1.0f, 5.0f);
     ZF     = 0f;
     YF     = 0f;
     // ZFString = "0";
     // YFString = "0";
     StartPos   = transform.position;
     StartForce = rb.transform.position;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Update the splash screen.
        /// </summary>
        public void UpdateSplash()
        {
            // Calculate the upper-left corner of the splash screen image
            int x = (graphics.ScreenWidth - splash.Width) >> 1;
            int y = (graphics.ScreenHeight - splash.Height) >> 1;

            // The source region is the entire image
            src.X      = 0;
            src.Y      = 0;
            src.Width  = splash.Width;
            src.Height = splash.Height;

            // Draw the splash screen
            graphics.DrawBitmap(x, y, src, splash);

            // Flip the back buffers
            graphics.Flip();

            // Store the tick at which this frame started
            Timer.Stopwatch sw        = new Timer.Stopwatch();
            Int64           startTick = sw.CurrentTick();

            // Draw the splash screen
            graphics.DrawBitmap(x, y, src, splash);

            // Draw a "Loading" message as this might take a while
            graphics.DrawText(graphics.ScreenWidth >> 1,
                              graphics.ScreenHeight - 50,
                              "Loading...",
                              Color.White, ui.Font, FontDrawOptions.DrawTextCenter);

            // Flip the back buffers
            graphics.Flip();

            if (!introLoaded)
            {
                LoadIntro();
            }

            // delay if the splash screen hasn't been up long enough
            while (sw.DeltaTimeMilliseconds(sw.CurrentTick(), startTick)
                   < TotalSplashTime * 1000.0F)
            {
                Thread.Sleep(0);
            }

            mode = ModeSwitch.UpdateIntro;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Update the intro that leads into the current level.
        /// </summary>
        public void UpdateIntro()
        {
            // If the level has finished loading and the intro is done
            // playing then start the count down
            if (levelLoaded && intro.Done)
            {
                mode = ModeSwitch.UpdateCountdown;
                return;
            }

            // Update the intro
            intro.Update(graphics);

            // Draw the intro
            intro.Draw(graphics);

            // Flip the back buffers
            graphics.Flip();
        }
Ejemplo n.º 9
0
        public void Control_OpenBracket2()
        {
            _broker
            .SetupGet(x => x.IsCompletionActive)
            .Returns(true)
            .Verifiable();
            _broker
            .Setup(x => x.DismissDisplayWindows())
            .Verifiable();
            _insertUtil
            .Setup(x => x.RunInsertCommand(InsertCommand.NewMoveCaret(Direction.Left)))
            .Returns(CommandResult.NewCompleted(ModeSwitch.NewSwitchMode(ModeKind.Normal)))
            .Verifiable();
            var ki  = KeyInputUtil.CharWithControlToKeyInput('[');
            var res = _mode.Process(ki);

            Assert.IsTrue(res.IsSwitchMode(ModeKind.Normal));
            _factory.Verify();
        }
        void ReleaseDesignerOutlets()
        {
            if (HelloLabel != null)
            {
                HelloLabel.Dispose();
                HelloLabel = null;
            }

            if (logo2 != null)
            {
                logo2.Dispose();
                logo2 = null;
            }

            if (MainImage != null)
            {
                MainImage.Dispose();
                MainImage = null;
            }

            if (ModeLable != null)
            {
                ModeLable.Dispose();
                ModeLable = null;
            }

            if (ModeSwitch != null)
            {
                ModeSwitch.Dispose();
                ModeSwitch = null;
            }

            if (testButton != null)
            {
                testButton.Dispose();
                testButton = null;
            }
        }
Ejemplo n.º 11
0
    //part of api

    /*private void OnGUI()
     * {
     *  YFString = GUI.TextField(new Rect(300, 10, 200, 20), YFString, 25);
     *
     * }*/

    //test movement
    void move()
    {
        if (reset == true)
        {
            ModeS = ModeSwitch.Start;
        }

        /*if(accel == true){
         *  ModeS = ModeSwitch.Acceleration;
         * }*/
        /* if (impu == true)
         * {
         *   ModeS = ModeSwitch.Impulse;
         * }*/
        if (FR == true)
        {
            ModeS = ModeSwitch.Force;
        }

        /*  if (VC == true)
         * {
         *    ModeS = ModeSwitch.VelocityChange;
         * }*/
    }
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Switch> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement != null || e.NewElement == null)
            {
                return;
            }
            view = (ModeSwitch)Element;
            if (Build.VERSION.SdkInt >= BuildVersionCodes.JellyBean)
            {
                if (Control != null)
                {
                    int[][] states = new int[][] {
                        new int[] { Android.Resource.Attribute.StateEnabled },  // enabled
                        new int[] { -Android.Resource.Attribute.StateEnabled }, // disabled
                    };
                    var backgroundColorsList = new Android.Content.Res.ColorStateList(states,
                                                                                      new int[] {
                        view.BackgroundTintColor.ToAndroid(),
                        view.BackgroundTintColor.WithLuminosity(.9).ToAndroid()
                    });

                    var thumbColorsList = new Android.Content.Res.ColorStateList(states,
                                                                                 new int[] {
                        view.ThumbTintColor.ToAndroid(),
                        view.ThumbTintColor.WithSaturation(.4).WithLuminosity(.8).ToAndroid()
                    });


                    //var thumbColor = view.ThumbTintColor.ToAndroidPreserveDisabled(thumbColorsList);

                    Control.TrackTintList = backgroundColorsList;
                    Control.ThumbTintList = thumbColorsList;
                }
            }
        }
Ejemplo n.º 13
0
 private void SelectorButton_OnClick(object sender, RoutedEventArgs e)
 {
     _currentMode = ModeSwitch.Selector;
 }
Ejemplo n.º 14
0
            public void SwitchModeOneTimeCommand_SetProperty()
            {
                var mode = CreateAndAddInsertMode(MockBehavior.Loose);

                mode.Setup(x => x.Process(It.IsAny <KeyInput>())).Returns(ProcessResult.NewHandled(ModeSwitch.NewSwitchModeOneTimeCommand(ModeKind.Normal)));
                _vimBuffer.SwitchMode(ModeKind.Insert, ModeArgument.None);
                _vimBuffer.Process('c');
                Assert.True(_vimBuffer.InOneTimeCommand.IsSome(ModeKind.Insert));
            }
Ejemplo n.º 15
0
 public static ModeSwitch.SwitchModeWithArgument AsSwitchModeWithArgument(this ModeSwitch mode)
 {
     Assert.IsTrue(mode.IsSwitchModeWithArgument);
     return((ModeSwitch.SwitchModeWithArgument)mode);
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Start the game.  This method loads the game resources and
        /// runs the main game loop.
        /// </summary>
        public void Run()
        {
            // Load and validate the splash screen
            splash = graphics.CreateBitmap(GetFullPath(@"Data\Splash\splash.bmp"), false);
            Debug.Assert(splash != null,
                         "GameMain.Run: Failed to initialized splash screen");
            Debug.Assert(splash.Width <= graphics.ScreenWidth &&
                         splash.Height <= graphics.ScreenHeight,
                         "GameMain.Run: Splash screen has invalid dimensions");

            // Load the game ui now because it has font information that is
            // needed for drawing the 'Loading...' tag
            DataSet dsUI = new DataSet();

            Debug.Assert(dsUI != null,
                         "GameMain.LoadLevel: Failed to initialize UI DataSet");

            dsUI.Locale = CultureInfo.InvariantCulture;

            // Load the ui xml file
            dsUI.ReadXml(GetFullPath(@"Data\UI\ui.xml"));

            // Load the resources specified in the xml file
            ui = new UserInterface(dsUI, graphics, level);
            Debug.Assert(ui != null,
                         "GameMain.LoadLevel: Failed to initialize UI");

            // Set the current update method as the splash screen updater
            update = new UpdateDelegate(UpdateSplash);

            // Loop until the game is done
            while (!done)
            {
                // Switch the update delegate if a switch was requested.
                switch (mode)
                {
                case ModeSwitch.UpdateLevel:
                    gi.ClearKeyPresses();
                    update    = new UpdateDelegate(UpdateLevel);
                    numFrames = 0;
                    secondsElapsedForCurrentFrames = 0;
                    break;

                case ModeSwitch.UpdateCountdown:
                    intro.Dispose();
                    intro = null;
                    level.Update(gi);
                    update = new UpdateDelegate(UpdateCountdown);
                    break;

                case ModeSwitch.UpdateIntro:
                    LoadLevel();
                    update = new UpdateDelegate(UpdateIntro);
                    splash.Dispose();
                    splash = null;
                    break;
                }

                mode = ModeSwitch.None;

                // Store the tick at which this frame started
                Int64 startTick = sw.CurrentTick();

                // Check if the user pressed the exit key
                if (gi.KeyPressed((int)gi.HardwareKeys[Player.ButtonMap()[
                                                           (int)Player.Buttons.Quit]]))
                {
                    done = true;
                }
                else if (levelLoaded && (level.Done || gi.KeyPressed(
                                             (int)gi.HardwareKeys[Player.ButtonMap()[
                                                                      (int)Player.Buttons.ResetLevel]])))
                {
                    Reset();
                    Application.DoEvents();
                    continue;
                }

                // Update the game
                update();

                // Check for pending events from the OS
                Application.DoEvents();

                // Lock the framerate...
                Int64 deltaMS = sw.DeltaTimeMilliseconds(sw.CurrentTick(), startTick);
                Int64 minMS   = (Int64)(1000.0F * MinSecondsPerFrame);
                Int64 maxMS   = (Int64)(1000.0F * MaxSecondsPerFrame);

                // Check if the frame time was fast enough
                if (deltaMS <= minMS)
                {
                    // Loop until the frame time is met
                    do
                    {
                        if (gi.KeyPressed((int)gi.HardwareKeys[
                                              Player.ButtonMap()[(int)Player.Buttons.Quit]]))
                        {
                            done = true;
                            break;
                        }

                        // Thread.Sleep(0);
                        Application.DoEvents();
                        deltaMS = sw.DeltaTimeMilliseconds(sw.CurrentTick(),
                                                           startTick);
                    } while (deltaMS < minMS);
                }

                // Increment the number of frames
                numFrames++;
                // Increment the overall time for these frames
                if (deltaMS < maxMS)
                {
                    secondsElapsedForCurrentFrames += deltaMS / 1000.0F;
                }
                else
                {
                    secondsElapsedForCurrentFrames += maxMS / 1000.0F;
                }

                // Make sure enough time has elapsed since the last check
                if (level != null && secondsElapsedForCurrentFrames >
                    level.FrameRateCheckRate)
                {
                    currentSecondsPerFrame =
                        secondsElapsedForCurrentFrames / numFrames;
                    numFrames = 0;
                    secondsElapsedForCurrentFrames = 0;
                }
            }
        }
Ejemplo n.º 17
0
 public static bool IsSwitchMode(this ModeSwitch mode, ModeKind kind)
 {
     return(mode.IsSwitchMode && ((ModeSwitch.SwitchMode)mode).Item == kind);
 }
Ejemplo n.º 18
0
 // Use this for initialization
 void Awake()
 {
     PM = GetComponent<PlayerMovement>();
     MS = GetComponent<managerscript>();
     modeSwitch = GameObject.Find("Controller").GetComponent<ModeSwitch>();
 }
Ejemplo n.º 19
0
 private void MoveButton_OnClick(object sender, RoutedEventArgs e)
 {
     _currentMode = ModeSwitch.Move;
 }
Ejemplo n.º 20
0
 private void Delete_Click(object sender, RoutedEventArgs e)
 {
     _currentMode = ModeSwitch.Delete;
 }
Ejemplo n.º 21
0
 private void TriangleButton_OnClick(object sender, RoutedEventArgs e)
 {
     _currentMode = ModeSwitch.Triangle;
 }
Ejemplo n.º 22
0
 private void DisplayButton_OnClick(object sender, RoutedEventArgs e)
 {
     _currentMode = ModeSwitch.Display;
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Update the count down that is displayed before gameplay starts.
        /// </summary>
        public void UpdateCountdown()
        {
            if (startCountDown)
            {
                // Decrement the count
                countDown -= currentSecondsPerFrame;

                // Check if the count down is done
                if (countDown <= 0.0F)
                {
                    // Start updating the level
                    mode = ModeSwitch.UpdateLevel;
                    return;
                }
            }

            // Update UI
            ui.Update(level);

            // Draw
            level.Draw();
            ui.Draw(graphics);

            // Display the time left until the game starts. If the time is
            // less than 1/2 second then flash
            if (startCountDown && (countDown > 0.5F ||
                                   (countDown <= 0.5F && (numFrames % 2 == 0))))
            {
                // Display "Start" for the last 1/2 second
                graphics.DrawText(graphics.ScreenWidth >> 1,
                                  graphics.ScreenHeight >> 1,
                                  countDown > 0.5F ? string.Format(CultureInfo.InvariantCulture,
                                                                   "{0}",
                                                                   (int)(countDown + .49F)) : "Start",
                                  Color.White, ui.Font, FontDrawOptions.DrawTextCenter);
            }

            if (!startCountDown)
            {
                int fireId = Player.ButtonMap()[(int)Player.Buttons.FireShot]
                             + 1;
                int quitId  = Player.ButtonMap()[(int)Player.Buttons.Quit] + 1;
                int resetId = Player.ButtonMap()[
                    (int)Player.Buttons.ResetLevel] + 1;
                int x = graphics.ScreenWidth >> 1;
                int y = (graphics.ScreenHeight >> 1) - 60;

                graphics.DrawText(x, y, "<- -> to move player", Color.Yellow,
                                  ui.Font, FontDrawOptions.DrawTextCenter);

#if (SMARTPHONE || MAINSTONE || DESKTOP)
                y += 20;
                graphics.DrawText(x, y, string.Format(
                                      CultureInfo.InvariantCulture,
                                      "Button {0} to fire",
                                      fireId), Color.Yellow, ui.Font,
                                  FontDrawOptions.DrawTextCenter);

                y += 20;
                graphics.DrawText(x, y, string.Format(
                                      CultureInfo.InvariantCulture,
                                      "Button {0} to Quit",
                                      quitId), Color.Yellow, ui.Font,
                                  FontDrawOptions.DrawTextCenter);

                y += 20;
                graphics.DrawText(x, y, string.Format(
                                      CultureInfo.InvariantCulture,
                                      "Button {0} to Reset",
                                      resetId), Color.Yellow, ui.Font,
                                  FontDrawOptions.DrawTextCenter);
#else // PPC
                y += 20;
                graphics.DrawText(x, y,
                                  "Action button to fire",
                                  Color.Yellow, ui.Font,
                                  FontDrawOptions.DrawTextCenter);

                y += 20;
                graphics.DrawText(x, y,
                                  "Click the upper right",
                                  Color.Yellow, ui.Font,
                                  FontDrawOptions.DrawTextCenter);

                y += 20;
                graphics.DrawText(x, y,
                                  "corner GMan to quit",
                                  Color.Yellow, ui.Font,
                                  FontDrawOptions.DrawTextCenter);
#endif

                y += 20;
                graphics.DrawText(x, y, "Press any key to start", Color.Red,
                                  ui.Font, FontDrawOptions.DrawTextCenter);

                if (gi.AnyKeyPressed())
                {
                    startCountDown = true;
                }
            }

            // Flip the back buffer
            graphics.Flip();
        }
Ejemplo n.º 24
0
 void Awake() {
     instance = this;
 }