Beispiel #1
0
            }   // end of Shared c'tor

            private void ChangeExpression(Boku.Base.GameTimer timer)
            {
                int newFace = BokuGame.bokuGame.rnd.Next(6);

                switch (newFace)
                {
                case 0:
                    boku.DisplayEmotionalState(Face.FaceState.Crazy, (float)(1.0 + BokuGame.bokuGame.rnd.NextDouble()));
                    break;

                case 1:
                    boku.DisplayEmotionalState(Face.FaceState.Happy, (float)(1.0 + BokuGame.bokuGame.rnd.NextDouble()));
                    break;

                case 2:
                    boku.DisplayEmotionalState(Face.FaceState.Mad, (float)(1.0 + BokuGame.bokuGame.rnd.NextDouble()));
                    break;

                case 3:
                    boku.DisplayEmotionalState(Face.FaceState.Remember, (float)(1.0 + BokuGame.bokuGame.rnd.NextDouble()));
                    break;

                case 4:
                    boku.DisplayEmotionalState(Face.FaceState.Sad, (float)(1.0 + BokuGame.bokuGame.rnd.NextDouble()));
                    break;

                case 5:
                    boku.DisplayEmotionalState(Face.FaceState.Squint, (float)(1.0 + BokuGame.bokuGame.rnd.NextDouble()));
                    break;
                }

                timer.Reset(4.0 + 4.0 * BokuGame.bokuGame.rnd.NextDouble());
            }   // end of ChangeExpression()
Beispiel #2
0
 protected void RepeatPress(Boku.Base.GameTimer timer)
 {
     // NOTE: do not call Start on this timer, it is being used in a caller update model
     timerAutoRepeat.Reset(timeAutoRepeat);
     FireRepeatEvent(digitalPosition);
     if (digitalPosition != DigitalPosition.centered && this.PositionRepeatPress != null)
     {
         this.PositionRepeatPress(this, new StickEventArgs(this.position));
     }
 }
Beispiel #3
0
 protected void OnRepeatPress(Boku.Base.GameTimer timer)
 {
     // NOTE: do not call Start on this timer, it is being used in a caller update model
     timerAutoRepeat.Reset(timeAutoRepeat);
     if (RepeatPress != null)
     {
         RepeatPress(this, new System.EventArgs());
     }
     this.state = ButtonCommandState.Repeat;
 }
 protected void OnRepeatPress(Boku.Base.GameTimer timer)
 {
     // NOTE: do not call Start on this timer, it is being used in a caller update model
     timerAutoRepeat.Reset(timeAutoRepeat);
     if (RepeatPress != null || CharInput != null)
     {
         for (int indexKey = 0; indexKey < this.pressedKeys.Length; indexKey++)
         {
             Keys key = this.pressedKeys[indexKey];
             if (!IsModifierKey(key))
             {
                 if (RepeatPress != null)
                 {
                     RepeatPress(this, new KeyboardKeyEventArgs(key));
                 }
                 if (CharInput != null)
                 {
                     OnChar(key);
                 }
             }
         }
     }
     this.state = KeyCommandState.Repeat;
 }
Beispiel #5
0
            // c'tor
            public Shared(MainMenu parent)
            {
                // Set up the options menu.
                optionsMenu = new OptionsMenu();
                liveFeed    = new LiveFeedDisplay();

                if (BokuGame.bMarsMode)
                {
                    boku = ActorManager.GetActor("RoverGreeter").CreateNewInstance() as BokuGreeter;
                }
                else
                {
                    boku = ActorManager.GetActor("BokuGreeter").CreateNewInstance() as BokuGreeter;
                }
                boku.SetColor(Classification.Colors.White);

                bokuCamera.NearClip = 0.1f;
                bokuCamera.FarClip  = 20.0f;
                // These are the values for the model when its translation off the ground has been thrown away (and added back via constant)
                bokuCamera.From = 1.3f * new Vector3(1.5f, 0.3f, 0.5f);
                bokuCamera.At   = new Vector3(0.0f, -0.5f, 0.0f);
                // These are the values for a "correct" model - that is raised off the ground in Max and whose translation is intact
                // bokuCamera.From = new Vector3(1.5f, 0.3f, 1.4f);
                // bokuCamera.At = new Vector3(0.0f, -0.5f, 0.7f);

                // Move camera to look at menu from an angle.
                //camera.From = 0.9f * camera.From;
                camera.At = new Vector3(-0.6f, 0, 0);
                Matrix foo = Matrix.CreateRotationY(-0.3f) * Matrix.CreateTranslation(new Vector3(1.0f, 0.0f, -2.0f));

                camera.At   = Vector3.Transform(camera.At, foo);
                camera.From = Vector3.Transform(camera.From, foo);

                // We'll be using a 1280x720 rendertarget for all rendering.
                camera.Resolution     = new Point(1280, 720);
                bokuCamera.Resolution = new Point(1280, 720);

                timer = new Boku.Base.GameTimer(Boku.Base.GameTimer.ClockType.WallClock, 3.1415927);
                timer.TimerElapsed += ChangeExpression;

                // Create text elements.
                // Start with a blob of common parameters.
                UIGridElement.ParamBlob blob = new UIGridElement.ParamBlob();
                blob.width            = 3.4f;
                blob.height           = 0.5f;
                blob.edgeSize         = 0.06f;
                blob.Font             = UI2D.Shared.GetGameFont24Bold;
                blob.textColor        = Color.White;
                blob.dropShadowColor  = Color.Black;
                blob.useDropShadow    = true;
                blob.invertDropShadow = true;
                blob.unselectedColor  = new Color(new Vector3(4, 100, 90) / 255.0f);
                blob.selectedColor    = new Color(new Vector3(5, 180, 160) / 255.0f);
                blob.normalMapName    = @"Slant0Smoothed5NormalMap";
                blob.justify          = UIGrid2DTextElement.Justification.Left;

                menu             = new ModularMenu(blob, null /*Strings.Localize("mainMenu.mainMenu")*/);
                menu.OnSelect    = parent.OnSelect;
                menu.OnCancel    = parent.OnCancel;
                menu.UseRtCoords = true;


                menu.AddText(Strings.Localize("mainMenu.new"));
                menu.AddText(Strings.Localize("mainMenu.play"));
#if NETFX_CORE
                menu.AddText(Strings.Localize("mainMenu.import"));
#else
                if (WinStoreHelpers.RunningAsUWP)
                {
                    menu.AddText(Strings.Localize("mainMenu.import"));
                }
#endif
                menu.AddText(Strings.Localize("mainMenu.community"));
                menu.AddText(Strings.Localize("mainMenu.options"));
                menu.AddText(Strings.Localize("mainMenu.help"));
#if !NETFX_CORE
                // Once you run an app in Win8, you are never allowed to kill it.
                // Only the system can kill it.
                menu.AddText(Strings.Localize("mainMenu.exit"));
#endif

                // And then remove what we don't want.
                if (!Program2.SiteOptions.CommunityEnabled)
                {
                    menu.DeleteText(Strings.Localize("mainMenu.community"));
                }

                menu.WorldMatrix = Matrix.CreateScale(0.9f, 1.0f, 1.0f);

                string signOutStr = Strings.Localize("textDialog.signOut");
                signOutButton = new Button(signOutStr, Color.White, null, UI2D.Shared.GetGameFont20);

                //Because this button has no texture and we can't set the width of the texture passed in explicitly. Just use the fixed size based on text size.
                UI2D.Shared.GetFont Font = UI2D.Shared.GetGameFont20;
                Vector2             size = (null != Font) ? Font().MeasureString(signOutStr) : new Vector2(60.0f, 20.0f);
                signOutButton.FixedSize    = size;
                signOutButton.UseFixedSize = true;

                textBlob = new TextBlob(UI2D.Shared.GetGameFont24, "", 340);
            }   // end of Shared c'tor
Beispiel #6
0
 protected void OnRepeatPress(Boku.Base.GameTimer timer)
 {
     // NOTE: do not call Start on this timer, it is being used in a caller update model
     timerAutoRepeat.Reset(timeAutoRepeat);
     FireRepeatEvent(digitalPosition);
 }