Example #1
0
        public override bool Load()
        {
            myGame = GameHost as MyGame;

            this.AddChild((allSlideSprite = new SpriteObject(device)));

            firstSprite = new SlideSprite(device, ResourceManager, Sound)
            {
                FirstSlide = true
            };

            firstSprite.AddSelection(Utility.Language["Exit"]);
            firstSprite.AddSelection(Utility.Language["Back"]);
            firstSprite.AddSelection(Utility.Language["KeyAndButtonSetting"]);
            firstSprite.AddSelection(Utility.Language["VolumeSetting"]);
            firstSprite.AddSelection(Utility.Language["GoHome"]);

            allSlideSprite.AddChild(firstSprite);

            focusManager = new FocusManager();
            focusManager.Focus(firstSprite);

            firstSprite.Selected += slideSprite_Selected;
            this.MouseRightClick += CloseOverlay_MouseRightClick;

            this.AddChild(new RectangleComponent(device, ResourceManager, PPDColors.Black)
            {
                Alpha           = 0.65f,
                RectangleHeight = 450,
                RectangleWidth  = 800
            });
            return(true);
        }
Example #2
0
        public ChangeVolumeSprite(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager, MyGame myGame, ISound sound) : base(device)
        {
            this.resourceManager = resourceManager;
            this.myGame          = myGame;
            this.sound           = sound;

            texts   = new TextureString[3];
            rects   = new RectangleComponent[3];
            spheres = new PictureObject[3];
            var sprite = new SpriteObject(device,
                                          texts[0] = new TextureString(device, Utility.Language["Master"], 18, PPDColors.White),
                                          texts[1] = new TextureString(device, Utility.Language["Movie"], 18, PPDColors.White)
            {
                Position = new SharpDX.Vector2(0, 25)
            },
                                          texts[2] = new TextureString(device, Utility.Language["SE"], 18, PPDColors.White)
            {
                Position = new SharpDX.Vector2(0, 50)
            },
                                          rects[0] = new RectangleComponent(device, resourceManager, PPDColors.White)
            {
                Position = new SharpDX.Vector2(RectStartX, 10), RectangleHeight = 2, RectangleWidth = RectWidth
            },
                                          rects[1] = new RectangleComponent(device, resourceManager, PPDColors.White)
            {
                Position = new SharpDX.Vector2(RectStartX, 35), RectangleHeight = 2, RectangleWidth = RectWidth
            },
                                          rects[2] = new RectangleComponent(device, resourceManager, PPDColors.White)
            {
                Position = new SharpDX.Vector2(RectStartX, 60), RectangleHeight = 2, RectangleWidth = RectWidth
            },
                                          spheres[0] = new PictureObject(device, resourceManager, Utility.Path.Combine("sphere.png"), true)
            {
                Position = new SharpDX.Vector2(RectStartX, 10)
            },
                                          spheres[1] = new PictureObject(device, resourceManager, Utility.Path.Combine("sphere.png"), true)
            {
                Position = new SharpDX.Vector2(RectStartX, 35)
            },
                                          spheres[2] = new PictureObject(device, resourceManager, Utility.Path.Combine("sphere.png"), true)
            {
                Position = new SharpDX.Vector2(RectStartX, 60)
            },
                                          select = new PictureObject(device, resourceManager, Utility.Path.Combine("right.png"), true)
            {
                Position = new SharpDX.Vector2(30, 0),
                Scale    = new SharpDX.Vector2(0.5f, 0.5f)
            }
                                          )
            {
                Position = new SharpDX.Vector2(160, 225 - 75 / 2f)
            };

            modified = true;

            this.AddChild(sprite);
            AdjustPosition();
            Inputed     += ChangeVolumeSprite_Inputed;
            LostFocused += ChangeVolumeSprite_LostFocused;
        }
Example #3
0
        public StartPanel(PPDDevice device, MyGame myGame, PPDFramework.Resource.ResourceManager resourceManager) : base(device)
        {
            this.myGame          = myGame;
            this.resourceManager = resourceManager;

            contentSprite = new SpriteObject(device);
            this.AddChild(contentSprite);

            var sprite = new SpriteObject(device);

            sprite.AddChild(new TextureString(device, Utility.Language["WelcomeToPPD"], 20, true, PPDColors.White)
            {
                Position = new SharpDX.Vector2(400, 200)
            });
            sprite.AddChild(new TextureString(device, Utility.Language["StartInitialSetting"], 16, true, PPDColors.White)
            {
                Position = new SharpDX.Vector2(400, 240)
            });
            Add(sprite);

            sprite = new SpriteObject(device);
            sprite.AddChild(new TextureString(device, Utility.Language["StartKeyButtonSetting"], 20, true, PPDColors.White)
            {
                Position = new SharpDX.Vector2(400, 200)
            });
            sprite.AddChild(new TextureString(device, Utility.Language["InsertKeyboardAndController"], 16, true, PPDColors.White)
            {
                Position = new SharpDX.Vector2(400, 240)
            });
            Add(sprite);

            sprite = new SpriteObject(device);
            sprite.AddChild((controllerNameText = new TextureString(device, "", 14, true, PPDColors.White)
            {
                Position = new SharpDX.Vector2(400, 10)
            }));
            reload = new FadableButton(device, resourceManager, Utility.Path.Combine("reload.png"), Utility.Path.Combine("reload_select.png"), "");
            reload.MouseLeftClick += reload_MouseLeftClick;
            up = new FadableButton(device, resourceManager, Utility.Path.Combine("up.png"), Utility.Path.Combine("up_select.png"), "");
            up.MouseLeftClick += up_MouseLeftClick;
            down = new FadableButton(device, resourceManager, Utility.Path.Combine("down.png"), Utility.Path.Combine("down_select.png"), "");
            down.MouseLeftClick += down_MouseLeftClick;
            sprite.AddChild(up);
            sprite.AddChild(down);
            sprite.AddChild(reload);
            up.Position = down.Position = reload.Position = new SharpDX.Vector2(400, 225);
            sprite.AddChild(new PictureObject(device, resourceManager, Utility.Path.Combine("keysettinggrid.png"))
            {
                Position = new SharpDX.Vector2(290, 30)
            });
            sprite.AddChild(new TextButton(device, resourceManager)
            {
                Position = new SharpDX.Vector2(320, 390), Text = Utility.Language["Start"]
            });
            sprite.AddChild(new TextButton(device, resourceManager)
            {
                Position = new SharpDX.Vector2(320, 420), Text = Utility.Language["Home"]
            });
            keys    = new TextureString[ButtonUtility.Array.Length];
            buttons = new TextureString[ButtonUtility.Array.Length];
            if (myGame.KeyConfigManager.Configs.Length > 0)
            {
                keyConfig = myGame.KeyConfigManager[0];
            }
            for (int i = 0; i < ButtonUtility.Array.Length; i++)
            {
                var textButton = new TextButton(device, resourceManager)
                {
                    Position = new SharpDX.Vector2(530, 90 + i * 30), Text = Utility.Language["Change"], Index = i
                };
                textButton.MouseLeftDown += textButton_MouseLeftDown;

                keys[i] = new TextureString(device, keyConfig.GetKeyMap((ButtonType)i).ToString(), 14, true, PPDColors.White)
                {
                    Position = new SharpDX.Vector2(388, 82 + i * 30)
                };
                buttons[i] = new TextureString(device, keyConfig.GetButtonMap((ButtonType)i).ToString(), 14, true, PPDColors.White)
                {
                    Position = new SharpDX.Vector2(460, 82 + i * 30)
                };
                sprite.AddChild(textButton);
                sprite.AddChild(keys[i]);
                sprite.AddChild(buttons[i]);
            }
            Add(sprite);

            sprite = new SpriteObject(device);
            sprite.AddChild(new TextureString(device, Utility.Language["SettingCompleted"], 20, true, PPDColors.White)
            {
                Position = new SharpDX.Vector2(400, 200)
            });
            sprite.AddChild(new TextureString(device, Utility.Language["UserKeyboardOrController"], 16, true, PPDColors.White)
            {
                Position = new SharpDX.Vector2(400, 240)
            });
            Add(sprite);

            right = new FadableButton(device, resourceManager, Utility.Path.Combine("right.png"), Utility.Path.Combine("right_select.png"), "Next")
            {
                Position = new SharpDX.Vector2(770, 225)
            };
            this.AddChild(right);
            left = new FadableButton(device, resourceManager, Utility.Path.Combine("left.png"), Utility.Path.Combine("left_select.png"), "Back")
            {
                Position = new SharpDX.Vector2(30, 225)
            };
            this.AddChild(left);

            left.MouseLeftClick  += left_MouseLeftClick;
            right.MouseLeftClick += right_MouseLeftClick;

            focusManager = new FocusManager();
            focusManager.Focus(this);

            left.Alpha = 0;
            this.Alpha = 0;
        }
Example #4
0
            public ChangeKeyConfigSprite(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager, MyGame myGame, KeyConfig keyConfig, ISound sound) : base(device)
            {
                this.resourceManager = resourceManager;
                this.myGame          = myGame;
                this.keyConfig       = keyConfig;
                this.sound           = sound;

                var sprite = new SpriteObject(device);

                sprite.AddChild(new PictureObject(device, resourceManager, Utility.Path.Combine("keysettinggrid.png"))
                {
                    Position = new SharpDX.Vector2(290, 30)
                });
                sprite.AddChild(new TextButton(device, resourceManager)
                {
                    Position = new SharpDX.Vector2(320, 390), Text = Utility.Language["Start"]
                });
                sprite.AddChild(new TextButton(device, resourceManager)
                {
                    Position = new SharpDX.Vector2(320, 420), Text = Utility.Language["Home"]
                });
                keys        = new TextureString[ButtonUtility.Array.Length];
                buttons     = new TextureString[ButtonUtility.Array.Length];
                textButtons = new TextButton[ButtonUtility.Array.Length];
                if (myGame.KeyConfigManager.CurrentConfigIndex < myGame.KeyConfigManager.Configs.Length)
                {
                    keyConfig = myGame.KeyConfigManager.Configs[myGame.KeyConfigManager.CurrentConfigIndex];
                }
                for (int i = 0; i < ButtonUtility.Array.Length; i++)
                {
                    var textButton = new TextButton(device, resourceManager)
                    {
                        Position = new SharpDX.Vector2(530, 90 + i * 30), Text = Utility.Language["Change"], Index = i
                    };
                    textButton.MouseLeftDown += textButton_MouseLeftDown;
                    textButtons[i]            = textButton;

                    keys[i] = new TextureString(device, keyConfig.GetKeyMap((ButtonType)i).ToString(), 14, true, PPDColors.White)
                    {
                        Position = new SharpDX.Vector2(388, 82 + i * 30)
                    };
                    buttons[i] = new TextureString(device, keyConfig.GetButtonMap((ButtonType)i).ToString(), 14, true, PPDColors.White)
                    {
                        Position = new SharpDX.Vector2(460, 82 + i * 30)
                    };
                    sprite.AddChild(textButton);
                    sprite.AddChild(keys[i]);
                    sprite.AddChild(buttons[i]);
                }

                this.AddChild(sprite);
                this.AddChild((select = new PictureObject(device, resourceManager, Utility.Path.Combine("right.png"), true)
                {
                    Position = new SharpDX.Vector2(280, 0),
                    Scale = new SharpDX.Vector2(0.5f, 0.5f)
                }));

                Inputed     += ChangeKeyConfigSprite_Inputed;
                LostFocused += ChangeKeyConfigSprite_LostFocused;
                GotFocused  += ChangeKeyConfigSprite_GotFocused;
            }
Example #5
0
 public SettingPanel(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager, MyGame myGame, ISound sound) : base(device)
 {
     this.resourceManager = resourceManager;
     this.myGame          = myGame;
     this.sound           = sound;
 }
Example #6
0
        static void Initialize(string[] args)
        {
            var arg = new PPDExecuteArg(args);

            PPDSetting.Initialize(
                isDebug: arg.Count > 0,
                songDir: arg.ContainsKey("songdir") ? arg["songdir"] : "",
                langIso: arg.ContainsKey("lang") ? arg["lang"] : null,
                disableExpansion: arg.ContainsKey("disableexpansion"),
                disableShader: arg.ContainsKey("disableshader"));
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var errorHandler = new SendErrorHandler();

            errorHandler.Initialize();
            if (args == null || args.Length == 0)
            {
                if (!CheckInstallInfo())
                {
                    MessageBox.Show(Utility.Language["InstallInfoError"]);
                    return;
                }
                if (!CheckVersion())
                {
                    MessageBox.Show(Utility.Language["UpdateExists"]);
#if DEBUG
#else
                    if (File.Exists("PPDUpdater.exe"))
                    {
                        var psi = new ProcessStartInfo();
                        psi.FileName = "PPDUpdater.exe";
                        Process.Start(psi);
                    }
#endif
                    return;
                }
                if (!CheckAssembly(out string errors))
                {
                    MessageBox.Show(String.Format("{0}:\r\n{1}", Utility.Language["AssemblyError"], errors));
                    return;
                }
            }
            RunExpansion();
            using (MyGame game = new MyGame(arg))
            {
                try
                {
                    game.Run();
                }
                catch (Exception e)
                {
                    errorHandler.ProcessError(e);
                }
            }

            if (expansionProcess != null && !expansionProcess.HasExited)
            {
                expansionProcess.CloseMainWindow();
                if (!expansionProcess.WaitForExit(1000))
                {
                    expansionProcess.Kill();
                }
            }
        }