Benutzerinformationen überspringen
Motto: Aufgeben ist es, was den Menschen tötet. Nur der Mensch, der sich weigert aufzugeben, hat sich das Recht verdient, auf dem glanzvollen Pfad der Menschheit zu wandeln.
Überarbeitung des Optionsmenü
ich suche einen Skripter, der mir das Optionsmenü ein wenig aufhübschen kann.
Das Original stammt von DerVVulfman:
|
|
Ruby Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 |
#============================================================================== # ** Sarah's Configuration Screen #------------------------------------------------------------------------------ # by DerVVulfman # version 1.1 # 08-09-2014 # SDK 2.2+ Compliant (Rewrites four audio systems in Game_System) #------------------------------------------------------------------------------ # # INTRODUCTION: # # This script is yet another configuration system as you would likely encoun- # ter everywhere in the RPGMaker series of forums. Not much would be differ- # ent either, save for the fact this one is virtually plug-and-play and saves # a configuration file rather than storing its values within a savegame. # #------------------------------------------------------------------------------ # # FEATURES: # # * The standard Music and SE Volume control center. # * Enhanced Audio control system for 'battle animation' SE. # * Fullscreen / Windowed toggle system. # * Disables ALT+Enter fullscreen toggle. # * Saves as an outside config file. # * Can be run in-menu or in an event call. # # * * * # # Feature 1: Standard Music and SE Volume control center. # Like this needs explaining? You can control the audio level of both # the background music and sound effects that play throughout the game # with this handy pair of scroll bars. # # Feature 2: Enhanced Audio Control system for 'battle animation' SE. # What some people may not realize is that a configuration script that # controls the audio system in GAME_SYSTEM will not affect the volume # of the SE in battle animations. The audio in battle animations are # performed within the RPG module's SPRITE class & are barely touched. # Included in this system is my good old 'Battle Animation Audio Fix'. # With it, you have access to the SPRITE class and gain control of the # battle animation's volume. # # Feature 3: Fullscreen / Windowed toggle system. # I know... I know... there's many a games that have this feature, but # it would be incomplete without one. # # Feature 4: Disables ALT+Enter fullscreen toggle. # Without this, the player could merely hit the ALT+Enter key to turn on # and off the fullscreen mode. As this is now added into the system, # the player will now be forced to use the Fullscreen toggle option. # # Feature 5: Saves as an outside config file. # Rather than have the system record your audio levels and system set- # tings placed within a savegame, this system saves them in a config # file. This allows the settings to load the moment the game starts # to run rather than having the settings load only upon the load of a # saved game. # # Feature 6: Can be run in-menu or in an event call. # Not much of a feature, but entertaining none-the-less. You may use # this call to access the configuration screen: # # $game_temp.scs_config_calling = true # $scene = Scene_Config.new # # If the $game_temp.scs_config_calling statement is not invokes, then # the system assumes the configuration screen is part of a main menu. # # With a little more work, an intrepid scripter could have the system # begin before even the TITLE screen loads. ^_^ # #------------------------------------------------------------------------------ # # ADDITIONAL FEATURES: # # I leave those up to you. This script is meant to be a skeleton for other # game creators and one can never account for every wanted nuance. # #------------------------------------------------------------------------------ # # METHOD LISTINGS: # # Here, I describe the methods used in the script, both those aliased or re- # written and those new. It is a guide for anyone using or altering the # system for their tastes. It will also give indications of which scripts # were rewritten or merely aliased after the names of the methods affected. # # # * RPG::Config # - initialize # This method creates the startup values that are stored within the # $data_config global object. When the game first runs, these will # be the overwritten by the default values for the audio and full- # screen toggle values recorded in Scene_Title (Scene_Title.main). # As a bonus, it uses Win32API commands to disable the use of the # ALT + ENTER combination, so you may ONLY toggle fullscreen from # within the configuration screen. # # * * * # # * RPG::Sprite # - animation_process_timing (REWRITE) # This method adds additional arguments to the Audio.se_play state- # ment, otherwise audio effects from battle animations would not be # altered by the volume control. This was an often overlooked issue # until 2009 when I first introduced the audio fix. ^_^ Yay me! # # * * * # # * Game_Temp # - initialize (ALIASED) # This method adds a new 'scs_config_calling' variable which should # be turned on (set to true) when the player is calling the command # from the field map. This was described in 'Feature 5' above. # # * * * # # * Game_System # - bgm_play (REWRITE) # - bgs_play (REWRITE) # - me_play (REWRITE) # - se_play (REWRITE) # All four of these methods were rewritten to include the volume # control arguments. # # * * * # # * Window_Slider # - initialize # This value begins the creation of an audio 'slider' bar window. # It accepts a simple string (text) that informs the bar whether it # is used to adjust music or sound effect volume. It also sets how # large the font in the window will be adjusted, and sets the range # of the bar from 0 to 100. # # - index= # While you can get the index value from a window, this command can # let you set (or reset) the index value. This is used to reset the # volume level and cursor position when the menu is activated. # # - refresh # The refresh method is your typical 'draw the window' method. In # this version, I clear the window, acqyure the configurable values # (to make them visibly manageable), set the colors of the bar and # cursor. After that, I draw the text displaying the percent mar- # kers across the bar, calculate the width of the slider bar, draw # the slider bar, figure out the position of the cursor, and then # draw the cursor. The bulk of the drawing methods were broken into # their own methods to make it easier to manage. # # - refresh_percentages # Called from the refresh method (see above), this method draws the # percentage indicator that appears above the bar itself. It does # so after retrieving the size of the font used, where the first # indicator value (0%) is to appear,and how many pixels across each # indicator is to be spaced. # # - refresh_bar # Called from the refresh method (see above), this method draws the # actual slider bar by using three fill_rect values. In succession, # it first draws a large rectangle of one color, a second rectangle # of another color just within, and a third rectangle of another # color within both. # # - refresh_cursor # Called from the refresh method (see above), this method draws the # cursor within the slider bar. It operates very much like the # refresh_bar method, except it also accepts an x (left-to-right) # value indicating its position in the bar. # # - update # This method is used to allow the player to control the slider bar # itself. It has checks to ensure it only operates when the window # is active,and exits when the player presses the 'ESC/Cancel' key. # After that, it turns the window off if the UP/DOWN directional # keys are pressed, or runs methods that increases or decreases the # volume settings. After that, it copies the volume data into the # appropriate value in the '$data_config' variable object, and then # refreshes the window. # ** NOTE: This does not save the volume data, but only stores it # temporarily in the $data_config variable. Only if the # player actively SAVES the data, will it be recorded in # the configuration file. # # - update_cancel # This method returns a either a true or false value, indicating if # the player has chosen to (true value) exit from the configuration # system, or not (false). Only when the player hits the 'Input::B' # key will the system deactivate the window and return a true value # to indicate the player is exiting the system. # # - update_left and update_right # These methods lets the player move the volume slider bars to the # left or right, thus increasing or decreasing the volume of the # type of audio it controls. The bar will either control music or # sound effects afterall. After seeing if the button is pressed, it # does a check to ensure it isn't going outside its range (0-100 or # '0' to '@item_max'). It then branches to either the 'BGM' or 'SE' # set of commands. For the BGM set, it quickly memorizes and plays # back the music currently playing. As it does this, the bgm_play # method in Game_System adjusts the playback volume. After that, # it then plays the classic 'decision' SE. But for the SE set, it # merely plays the decision SE effect. In both cases, it uses the # altered se_play system so the configured volume for the sound # effects is used. This method will exit with a returned 'true' # value as long as you slide the bar without trying to go outside # the volume range, otherwise it returns 'false' and plays a buzzer # sound effect. # # * * * # # * Scene_Title # - main (ALIASED) # The additions to the 'main' method creates default values for the # volume and fullscreen toggle controls before it attempts to load # the configuration file. It is HERE that you determine if the game # starts with 100% volume or if it begins in fullscreen mode. It # does not create the configuration file, but only checks to see if # one can be loaded. After that, it performs a 'fullscreen' effect # on the game, but only after seeing if the $data_config.fullscreen # value is set to true. Once that is all done, it performs the rest # of the main method itself. # # * * * # # * Scene_Config # - initialize # Initially not needed, this sets the index of the options menu to # an index position of '0' (the top of the menu), or lets the game # designer set the index position when the Config menu is called. # # - main # This is the basic engine that runs the configuration menu, from # beginning to end. It begins by running the 'initialize windows' # call, a method that creates the windows in the menu, performs a # classic transition system, runs a generic loop...end block, and # ends after disposing of the windows. # # - initialize_windows # Here, we call out to other methods that create their own special- # ized windows in the options menu. We begin by running the method # that can create a spriteset background which is useful if you in- # tend to show the field map behind the menu. After that, we call # the method that makes a command window, much like the main menu # in that it gives you a list of options. We then create an actual # @help_window object rather than performing a comand call. And, # after that, we call two more methods that creates our two slider # windows, one for the music and one for sound effects. # # - initialize_spriteset # This method creates an object called the @spriteset object. It # will allow the current field map to be shown behind the config # menu. But before the @spriteset object is made, this method # checks to ensure the script is configured to use a spriteset,and # that the menu was called from the field map. # # - initialize_window_command # - initialize_window_bgm # - initialize_window_se # These methods create the small windows being shown on the screen # when you start the configuration menu. Each handles a different # facet, whether it be the main menu listing the options, or the # two individual slider menus, each covering either music of sound # effect volumes. The cursor of the command window can be set to # highlight a specific selection by way of the @menu_index value # as set in the initialize method above. However, the index of the # volume slider windows are set based on either the music or sound # effect settings from the $data_config object. # # - dispose # This method disposes of the command, help and both slider bar # windows, along with eliminating the @spriteset window if it was # set to show the field map behind the window. # # - update # This method is repeatedly called from the main method over and # over, and updates the command window menu. It will either update # the slider window windows or perform command menu operations, # depending on which window within the configuration system is ac- # tive. It will handle one active window at a time. # # - update_help # When this method is called, it prints a text message within the # help window at the top. This message will indicate which option # is highlighted in the command menu, and is keyed to the command # window's index value. # # - update_command # Executed by the update method when the command window is active, # this method decides what windows or highlighted options are able # to be executed. It either turns on one of the two slider volume # windows, or passes control to the methods that toggles the full- # screen window option or saves the configuration data itself. # # - command_toggle_fullscreen # This method only allows execution if the decision key has been # pressed. And if it has, the method will perform a Windows 32API # routine that turns the fullscreen system on/off. After that, it # changes the flag used by the $data_config object that manages # the fullscreen value. # # - command_save # While you can adjust volume and fullscreen/windowed toggles when # playing a game, you need to save the data. This function does # precisely that. It only performs if the user triggers the deci- # sion key, and when it does, it opens... writes... and saves the # configuration file. After that, it checks to see if it was told # to return to the field map, or passes control to the main menu. # # - command_debug # When you are in the command window, you can call the debug sys- # tem by pressing the F9 key as usual . However, it does require # the debug calling flag to be turned off and forces the player # character to be properly straightened (standing still) before it # runs the Scene_Debug system. # # #------------------------------------------------------------------------------ # # COMPATABILITY: # # This system should be compatible with other systems, but other systems may # hardwire sound effects into themselves. Scripts that perform 'bell rings' # and 'alert buzzes' may need some minor editing by encorporating the follo- # wing addendum to a volume setting: # # 'volume' * $data_config.se_volume / 100 # # This will typically occur only if the other script calls Audio.play_se or # similar Audio Module class calls. # # #============================================================================== # Bar Appearance and Control # ========================== # This configuration section controls the width of the scrolling bars and # the cursor within, along with how many increments are within the bar. # ** The width of the drawn bar itself is the width of the cursor multiplied # by the scale value given and by 100. width = cursor X scale X 100. # --------------------------------------------------------------------------- # SCS_CURSOR_WIDTH = 18 # Width of the cursor SCS_SCALE = 2 # Scaling value for bar width calculation SCS_INCREMENTS = 5 # Percent SCS_INCREMENTS to scroll (ie 5 = 5%) # Basic Menu Appearance and Control # ================================= # This configuration section handles the basic appearance of the configura- # tion menu, dealing with both font size and if the field map is shown through # the menu itself. It also lets you identify which main menu option to high- # light if you are returning from the configuration menu to the main menu. # --------------------------------------------------------------------------- # SCS_FONT_SIZE = 24 # Size of the font used in the screen SCS_SPRITESET = true # If Fieldmap background shows through SES_EXIT = 4 # Return to main menu option: Scene_Menu.new(4) # Filename # ======== # Not much to be said. This determines the actual name of your game's con- # figuration file. # --------------------------------------------------------------------------- # SCS_FILENAME = "MyGame.cfg" #============================================================================== # ** RPG #------------------------------------------------------------------------------ # A module containing RPGXP's data structures and more. #============================================================================== module RPG #============================================================================ # ** Config #---------------------------------------------------------------------------- # A module containing the configuration file's data structure #============================================================================ class Config #-------------------------------------------------------------------------- # * Win32API Definitions #-------------------------------------------------------------------------- RegHotKey = Win32API.new('user32','RegisterHotKey', 'liii', 'i') FindWindow = Win32API.new('user32','FindWindowEx', %w(l l p p), 'i') #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :bgm_volume attr_accessor :se_volume attr_accessor :fullscreen #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- def initialize # Startup values bgm_volume = 100 se_volume = 100 fullscreen = false # Turn off Alt+Enter system (only allow config version) hwnd = FindWindow.call(0,0,"RGSS Player",0) RegHotKey.call(hwnd, 1, 0x0001, 0x0D) end end end #-------------------------------------------------------------------------- # * Global Array Initialization #-------------------------------------------------------------------------- $data_config = RPG::Config.new #============================================================================== # ** EDIT: Animation Audio Fix #------------------------------------------------------------------------------ # This update to the Animation Timer allows for volume adjustment through the # Options Menu. Without this module, all battle animations would be at full # volume. #============================================================================== module RPG class Sprite < ::Sprite def animation_process_timing(timing, hit) if (timing.condition == 0) or (timing.condition == 1 and hit == true) or (timing.condition == 2 and hit == false) if timing.se.name != "" se = timing.se Audio.se_play("Audio/SE/" + se.name, se.volume * $data_config.se_volume / 100 , se.pitch) end case timing.flash_scope when 1 self.flash(timing.flash_color, timing.flash_duration * 2) when 2 if self.viewport != nil self.viewport.flash(timing.flash_color, timing.flash_duration * 2) end when 3 self.flash(nil, timing.flash_duration * 2) end end end end end #============================================================================== # ** Game_Temp #------------------------------------------------------------------------------ # This class handles temporary data that is not included with save data. # Refer to "$game_temp" for the instance of this class. #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :scs_config_calling # option calling flag #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias scs_config_init initialize def initialize scs_config_init @scs_config_calling = false end end #============================================================================== # ** Game_System #------------------------------------------------------------------------------ # This class handles data surrounding the system. Backround music, etc. # is managed here as well. Refer to "$game_system" for the instance of # this class. #============================================================================== class Game_System #-------------------------------------------------------------------------- # * Play Background Music # bgm : background music to be played #-------------------------------------------------------------------------- def bgm_play(bgm) @playing_bgm = bgm if bgm != nil and bgm.name != "" Audio.bgm_play("Audio/BGM/"+ bgm.name, bgm.volume * $data_config.bgm_volume / 100 , bgm.pitch) else Audio.bgm_stop end Graphics.frame_reset end #-------------------------------------------------------------------------- # * Play Background Sound # bgs : background sound to be played #-------------------------------------------------------------------------- def bgs_play(bgs) @playing_bgs = bgs if bgs != nil and bgs.name != "" Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume * $data_config.se_volume / 100, bgs.pitch) else Audio.bgs_stop end Graphics.frame_reset end #-------------------------------------------------------------------------- # * Play Music Effect # me : music effect to be played #-------------------------------------------------------------------------- def me_play(me) if me != nil and me.name != "" Audio.me_play("Audio/ME/"+me.name, me.volume * $data_config.bgm_volume / 100, me.pitch) else Audio.me_stop end Graphics.frame_reset end #-------------------------------------------------------------------------- # * Play Sound Effect # se : sound effect to be played #-------------------------------------------------------------------------- def se_play(se) if se != nil and se.name != "" Audio.se_play("Audio/SE/"+se.name, se.volume * $data_config.se_volume / 100 ,se.pitch) end end end #============================================================================== # ** Window_Slider #------------------------------------------------------------------------------ # This window displays a slider bar for use in configuration control systems. #============================================================================== class Window_Slider < Window_Base #-------------------------------------------------------------------------- # * Object Initialization # text : text in slider window #-------------------------------------------------------------------------- def initialize(text = "") super(0, 0, 380, 120) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.size = SCS_FONT_SIZE self.active = false @text = text @index = 0 if @index.nil? @item_max = 100 self.visible = false refresh end #-------------------------------------------------------------------------- # * Set Cursor Position # index : new cursor position #-------------------------------------------------------------------------- def index=(index) @index = index refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear # Clear Contents # Handle configurables font_size = SCS_FONT_SIZE # Font Size cursor_width = SCS_CURSOR_WIDTH # Cursor Width scale = SCS_SCALE # Scale Size # Handle bar colors outer_border = Color.new(100,200,200,140) # Bar inner_border = Color.new( 28,128,128,190) # Borders fill = Color.new( 64, 64, 64,190) # And Fill Colors cur_border = Color.new(100,100,100,215) # Cursor Border cur_fill = Color.new( 90, 90, 90,215) # Cursor Fill # Handle bar calculations and display refresh_percentages(font_size, 32, 50) # Draw Percentages bar_width = @item_max * scale + cursor_width # Calc bar width refresh_bar(bar_width, outer_border, inner_border, fill) # Draw Bar x = (@index * (@item_max * scale) ) / @item_max + 36 # Calculate X refresh_cursor(x, cursor_width, cur_border, cur_fill) # Draw Cursor end #-------------------------------------------------------------------------- # * Refresh percentage text #-------------------------------------------------------------------------- def refresh_percentages(font_size, start, incr) self.contents.draw_text( 0, 0, 128, font_size, @text + " volume", 0) self.contents.draw_text(start * (incr*0), 60, 80, font_size, "0%") self.contents.draw_text(start * (incr*1), 60, 80, font_size, "25%") self.contents.draw_text(start * (incr*2), 60, 80, font_size, "50%") self.contents.draw_text(start * (incr*3), 60, 80, font_size, "75%") self.contents.draw_text(start * (incr*4), 60, 80, font_size, "100%") end #-------------------------------------------------------------------------- # * Refresh bar #-------------------------------------------------------------------------- def refresh_bar(width, outer, inner, fill) self.contents.fill_rect(32, 30, width + 8, 20, outer) self.contents.fill_rect(34, 32, width + 4, 16, inner) self.contents.fill_rect(36, 34, width, 12, fill) end #-------------------------------------------------------------------------- # * Refresh cursor #-------------------------------------------------------------------------- def refresh_cursor(x, width, border, fill) self.contents.fill_rect(x, 33, width, 14, border) self.contents.fill_rect(x+4, 36, width-8, 8, fill) end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Exit method checks return unless self.active # End method unless active return if update_cancel # Deactivate if Cancel # Cursor Control Actions self.active = false if Input.repeat?(Input::UP) # Deactivate if UP self.active = false if Input.repeat?(Input::DOWN) # Deactivate if DOWN return if update_left # Decrease Bar if LEFT return if update_right # Increase Bar if RIGHT # Adjust volume values based on bar case @text # Branch based on Text when "BGM" ; $data_config.bgm_volume = @index # Accept new BGM data when "SE" ; $data_config.se_volume = @index # Accept new SE data end # End Branch refresh # And refresh the Slider end #-------------------------------------------------------------------------- # * Frame Update (When detecting Cancel/Escape) #-------------------------------------------------------------------------- def update_cancel return false unless Input.repeat?(Input::B) # Exit false unless B pressed self.active = false # Deactivate the window return true # And return control true end #-------------------------------------------------------------------------- # * Frame Update (When detecting LEFT key to decrease bar) #-------------------------------------------------------------------------- def update_left return false unless Input.repeat?(Input::LEFT) # Exit unless LEFT if @index != 0 # Perform unless 0 vol case @text # Branch on sound type when "BGM" # Handle BGM case @index -= SCS_INCREMENTS # Reduce Bar $game_system.bgm_play($game_system.bgm_memorize) # Play memorized music $game_system.se_play($data_system.decision_se) # Play Decision SE when "SE" # Handle SE case $game_system.se_play($data_system.decision_se) # Play Decision SE @index -= SCS_INCREMENTS # Reduce Bar end # End of Branch return true # Return True end # End ...if case $game_system.se_play($data_system.buzzer_se) # Play buzzer SE return false # Return False end #-------------------------------------------------------------------------- # * Frame Update (When detecting RIGHT key to increase bar) #-------------------------------------------------------------------------- def update_right # If RIGHT button was pressed return false unless Input.repeat?(Input::RIGHT) # Exit unless RIGHT if @index < @item_max # Perform unless maxed case @text # Branch on sound type when "BGM" # Handle BGM Case @index += SCS_INCREMENTS # Increase bar $game_system.bgm_play($game_system.bgm_memorize) # Play memorized music $game_system.se_play($data_system.decision_se) # Play Decision SE when "SE" # Handle SE case $game_system.se_play($data_system.decision_se) # Play Decision SE @index += SCS_INCREMENTS # Increase bar end # End of Branch return true # Return true end # End ...if case $game_system.se_play($data_system.buzzer_se) # Play buzzer SE return false # Return false end end #============================================================================== # ** Scene_Title #------------------------------------------------------------------------------ # This class performs title screen processing. #============================================================================== class Scene_Title #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- alias scs_config_main main def main # Establish default config values $data_config.bgm_volume = 100 $data_config.se_volume = 100 $data_config.fullscreen = false # Load Config if config file exists if FileTest.exist?(SCS_FILENAME) $data_config = load_data(SCS_FILENAME) end # Reset screen mode if config set to fullscreen if $data_config.fullscreen == true showm = Win32API.new 'user32', 'keybd_event', %w(l l l l), '' showm.call(18,0,0,0) ; showm.call(13,0,0,0) showm.call(13,0,2,0) ; showm.call(18,0,2,0) end # Perform the original call scs_config_main end end #============================================================================== # ** Scene_Config #------------------------------------------------------------------------------ # This class performs configuration system option processing. #============================================================================== class Scene_Config #-------------------------------------------------------------------------- # * Object Initialization # menu_index : command cursor's initial position #-------------------------------------------------------------------------- def initialize(menu_index = 0) @menu_index = menu_index end #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main initialize_windows # Create the windows Graphics.transition # Execute transition loop do # Begin the main loop Graphics.update # Update game screen Input.update # Update input information update # Frame update break if $scene != self # Abort loop if screen is changed end # End the main loop and restart Graphics.freeze # Prepare for transition dispose # Dispose of windows end #-------------------------------------------------------------------------- # * Initialize Windows #-------------------------------------------------------------------------- def initialize_windows initialize_spriteset # Make a spriteset window initialize_window_command # Make command window @help_window = Window_Help.new # Make help window initialize_window_bgm # Make background music window initialize_window_se # Make sound effect window end #-------------------------------------------------------------------------- # * Initialize Spriteset #-------------------------------------------------------------------------- def initialize_spriteset return unless SCS_SPRITESET == true # Only if configured return unless $game_temp.debug_calling == true # Only if from map @spriteset = Spriteset_Map.new # Create spriteset end #-------------------------------------------------------------------------- # * Initialize Window : Command Window #-------------------------------------------------------------------------- def initialize_window_command s1 = "Music Volume" # Make a music option s2 = "Sound Volume" # Make a sound option s3 = "Window Mode" # Make a window option s4 = "Exit" # Make an exit option list = [s1, s2, s3, s4] # Make the menu list @command_window = Window_Command.new(260, list) # Make the menu @command_window.y = 64 # Move it vertically @command_window.index = @menu_index # Highlight an option end #-------------------------------------------------------------------------- # * Initialize Window : BGM Slider #-------------------------------------------------------------------------- def initialize_window_bgm @bgm_window = Window_Slider.new("BGM") # Make a window for BGM @bgm_window.index = $data_config.bgm_volume # Set the cursor position @bgm_window.x = 260 # Move the window horiz... @bgm_window.y = 64 # Move the window vert... @bgm_window.visible = true # Make it visible end #-------------------------------------------------------------------------- # * Initialize Window : SE Slider #-------------------------------------------------------------------------- def initialize_window_se @se_window = Window_Slider.new("SE") # Make a window for SEs @se_window.index = $data_config.se_volume # Set the cursor position @se_window.x = 260 # Move the window horiz... @se_window.y = 184 # Move the window vert... @se_window.visible = true # Make it visible end #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- def dispose @spriteset.dispose unless @spriteset.nil? # Erase the fieldmap sprite @command_window.dispose # set if it exists, and then @help_window.dispose # erase all other config @bgm_window.dispose # menu windows. @se_window.dispose end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update @command_window.update # Update command window command_debug if $DEBUG # Update debug commands return @bgm_window.update if @bgm_window.active # Update BGM if active return @se_window.update if @se_window.active # Update SE if active return update_command if @command_window.active # Update commands end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update_help case @command_window.index when 0; @help_window.set_text("Set the volume of the background music.",1) when 1; @help_window.set_text("Set the volume of audible sound effects.",1) when 2; @help_window.set_text("Toggle Fullscreen / Windowed Game Screen.",1) when 3; @help_window.set_text("Return to Menu.",1) end end #-------------------------------------------------------------------------- # * Frame Update (when command window is active) #-------------------------------------------------------------------------- def update_command update_help # Update the help window. case @command_window.index # Branch based on command selected. when 0 ; @bgm_window.active = true # Make BGM window active. when 1 ; @se_window.active = true # Make SE window active. when 2 ; command_toggle_fullscreen # Run Fullscreen Toggle method. when 3 ; command_save # Run Save and Exit method. end end #-------------------------------------------------------------------------- # * Command Action: (performing Fullscreen / Window Toggle) #-------------------------------------------------------------------------- def command_toggle_fullscreen return unless Input.trigger?(Input::C) # Abort unless C is pressed. $game_system.se_play($data_system.decision_se) # Play the decision SE. showm = Win32API.new 'user32', 'keybd_event', # One of a few fullscreen %w(l l l l), '' # toggle methods that I've showm.call(18,0,0,0) ; showm.call(13,0,0,0) # seen. It performs some showm.call(13,0,2,0) ; showm.call(18,0,2,0) # pseudo keyboard presses. if $data_config.fullscreen == true # If the flag is set to true $data_config.fullscreen = nil # Turn off the flag else # Otherwise $data_config.fullscreen = true # turn it on end # And be done with it. end #-------------------------------------------------------------------------- # * Command Action: (performing Save and Exit) #-------------------------------------------------------------------------- def command_save return unless Input.trigger?(Input::C) # Abort unless C pressed $game_system.se_play($data_system.decision_se) # Play the decision SE file = File.open(SCS_FILENAME, "wb") # Open the config data file Marshal.dump($data_config, file) # Write the data to the file file.close # And close the file if $game_temp.scs_config_calling # If called from event $game_temp.scs_config_calling = false # Clear save call flag $scene = Scene_Map.new # Switch to map screen return # And End Method end # End of ...if decision $scene = Scene_Menu.new(SES_EXIT) # Switch to menu screen end #-------------------------------------------------------------------------- # * Command Action: (performing Debug Call) #-------------------------------------------------------------------------- def command_debug return unless Input.press?(Input::F9) # Abort unless F9 pressed $game_temp.debug_calling = false # Clear debug call flag $game_system.se_play($data_system.decision_se) # Play decision SE $game_player.straighten # Straighten player $scene = Scene_Debug.new # Switch to debug screen end end |
Ich habe bereits vor einiger Zeit das Menü dahingehend überarbeitet, dass die BGM- und Soundlautstärke
nicht mehr per Slider sondern per Command_Window eingestellt werden kann (da, der Slider nicht Mausskript- kompatibel ist).
Außerdem habe ich eine weitere Option hinzugefügt, die dem Spieler erlaubt, die Text Skip Option aus dem UMS zu aktivieren bzw
deaktivieren.
Hinzu kommt eine "bessere" optische Darstellung, ob der Vollbildmodus an oder aus ist.
Wie man sieht, sieht die Auswahl der BGM-und Soundlautstärke improvisiert aus, was es auch ist.
Wäre cool, wenn entweder der Slider maustüchtig und wieder eingefügt werden würde, oder vielleicht hat jemand
ja eine ganz andere Idee, damit das besser aussieht.
Hier mein momentanes Skript:
Optionen
|
|
Ruby Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 |
#============================================================================== # ** Sarah's Configuration Screen #------------------------------------------------------------------------------ # by DerVVulfman # version 1.0 # 01-05-2009 # SDK 2.2+ Compliant (Rewrites four audio systems in Game_System) #------------------------------------------------------------------------------ # # INTRODUCTION: # This script is yet another configuration system as you would likely encoun- # ter everywhere in the RPGMaker series of forums. Not much would be differ- # ent either, save for the fact this one is virtually plug-and-play and saves # a configuration file rather than storing its values within a savegame. # #------------------------------------------------------------------------------ # # FEATURES: # * The standard Music and SE Volume control center. # * Enhanced Audio control system for 'battle animation' SE. # * Fullscreen / Windowed toggle system. # * Saves as an outside config file. # * Can be run in-menu or in an event call. # # Feature 1: Standard Music and SE Volume control center. # Like this needs explaining? You can control the audio level of both # the background music and sound effects that play throughout the game # with this handy pair of scroll bars. # # Feature 2: Enhanced Audio Control system for 'battle animation' SE. # What some people may not realize is that a configuration script that # controls the audio system in GAME_SYSTEM will not affect the volume # of the SE in battle animations. The audio in battle animations are # performed within the RPG module's SPRITE class & are barely touched. # Included in this system is my good old 'Battle Animation Audio Fix'. # With it, you have access to the SPRITE class and gain control of the # battle animation's volume. # # Feature 3: Fullscreen / Windowed toggle system. # I know... I know... there's many a games that have this feature, but # it would be incomplete without one. # # Feature 4: Saves as an outside config file. # Rather than have the system record your audio levels and system set- # tings placed within a savegame, this system saves them in a config # file. This allows the settings to load the moment the game starts # to run rather than having the settings load only upon the load of a # saved game. # # Feature 5: Can be run in-menu or in an event call. # Not much of a feature, but entertaining none-the-less. You may use # this call to access the configuration screen: # # $game_temp.scs_config_calling = true # $scene = Scene_Config.new # # With a little more work, an intrepid scripter could have the system # begin before even the TITLE screen loads. ^_^ # #------------------------------------------------------------------------------ # # ADDITIONAL FEATURES: # I leave those up to you. This script is meant to be a skeleton for other # game creators and one can never account for every wanted nuance. # #------------------------------------------------------------------------------ # # COMPATABILITY: # This system should be compatible with other systems, but other systems may # hardwire sound effects into themselves. Scripts that perform 'bell rings' # and 'alert buzzes' may need some minor editing by encorporating the follo- # wing addendum to a volume setting: # # 'volume' * $data_config.se_volume / 100 # # This will typically occur only if the other script calls Audio.play_se or # similar Audio Module class calls. # # #============================================================================== # - Configuring the config screen :P # Basic Menu Appearance and Control SCS_FONT_SIZE = 24 # Size of the font used in the screen SES_EXIT = 4 # Return to main menu option: Scene_Menu.new(4) # Bar Appearance and Control SCS_CURSOR_WIDTH = 18 # Width of the cursor SCS_SCALE = 2 # SCS_SCALE of the Scrolling bar (cursor * SCS_SCALE * 100) SCS_INCREMENTS = 5 # Percent SCS_INCREMENTS to scroll (ie 5 = 5%) # Filename SCS_FILENAME = "Settings.cfg" #============================================================================== # ** RPG #------------------------------------------------------------------------------ # A module containing RPGXP's data structures and more. #============================================================================== module RPG #============================================================================ # ** Config #---------------------------------------------------------------------------- # A module containing the configuration file's data structure #============================================================================ class Config #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :bgm_volume attr_accessor :se_volume attr_accessor :fullscreen attr_accessor :text_skip #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- def initialize bgm_volume = 100 se_volume = 100 fullscreen = false text_skip = false end end end #-------------------------------------------------------------------------- # * Global Array Initialization #-------------------------------------------------------------------------- $data_config = RPG::Config.new #============================================================================== # ** EDIT: Animation Audio Fix #------------------------------------------------------------------------------ # This update to the Animation Timer allows for volume adjustment through the # Options Menu. Without this module, all battle animations would be at full # volume. #============================================================================== module RPG class Sprite < ::Sprite def animation_process_timing(timing, hit) if (timing.condition == 0) or (timing.condition == 1 and hit == true) or (timing.condition == 2 and hit == false) if timing.se.name != "" se = timing.se Audio.se_play("Audio/SE/" + se.name, se.volume * $data_config.se_volume / 100 ,se.pitch) end case timing.flash_scope when 1 self.flash(timing.flash_color, timing.flash_duration * 2) when 2 if self.viewport != nil self.viewport.flash(timing.flash_color, timing.flash_duration * 2) end when 3 self.flash(nil, timing.flash_duration * 2) end end end end end #============================================================================== # ** Game_Temp #------------------------------------------------------------------------------ # This class handles temporary data that is not included with save data. # Refer to "$game_temp" for the instance of this class. #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :scs_config_calling # option calling flag #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias scs_config_init initialize def initialize scs_config_init @scs_config_calling = false end end #============================================================================== # ** Game_System #------------------------------------------------------------------------------ # This class handles data surrounding the system. Backround music, etc. # is managed here as well. Refer to "$game_system" for the instance of # this class. #============================================================================== class Game_System #-------------------------------------------------------------------------- # * Play Background Music # bgm : background music to be played #-------------------------------------------------------------------------- def bgm_play(bgm) @playing_bgm = bgm if bgm != nil and bgm.name != "" Audio.bgm_play("Audio/BGM/"+ bgm.name, bgm.volume * $data_config.bgm_volume / 100 , bgm.pitch) else Audio.bgm_stop end Graphics.frame_reset end #-------------------------------------------------------------------------- # * Play Background Sound # bgs : background sound to be played #-------------------------------------------------------------------------- def bgs_play(bgs) @playing_bgs = bgs if bgs != nil and bgs.name != "" Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume * $data_config.se_volume / 100, bgs.pitch) else Audio.bgs_stop end Graphics.frame_reset end #-------------------------------------------------------------------------- # * Play Music Effect # me : music effect to be played #-------------------------------------------------------------------------- def me_play(me) if me != nil and me.name != "" Audio.me_play("Audio/ME/"+me.name, me.volume * $data_config.bgm_volume / 100, me.pitch) else Audio.me_stop end Graphics.frame_reset end #-------------------------------------------------------------------------- # * Play Sound Effect # se : sound effect to be played #-------------------------------------------------------------------------- def se_play(se) if se != nil and se.name != "" Audio.se_play("Audio/SE/"+se.name, se.volume * $data_config.se_volume / 100 ,se.pitch) end end end #============================================================================== # ** Window_Slider #------------------------------------------------------------------------------ # This window displays a slider bar for use in configuration control systems. #============================================================================== class Window_Slider < Window_Base #-------------------------------------------------------------------------- # * Object Initialization # text : text in slider window #-------------------------------------------------------------------------- def initialize(text = "") super(0, 0, 380, 120) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.size = SCS_FONT_SIZE self.active = false; @text = text # Ensure no invalid index value if @index == nil; @index = 0; end @item_max = 100; self.visible = false refresh end #-------------------------------------------------------------------------- # * Set Cursor Position # index : new cursor position #-------------------------------------------------------------------------- def index=(index) @index = index; refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear # Draw text and percentage values self.contents.draw_text( 0, 0, 128, SCS_FONT_SIZE, @text + " volume", 0) self.contents.draw_text( 32, 60, 80, SCS_FONT_SIZE, "0%") self.contents.draw_text( 82, 60, 80, SCS_FONT_SIZE, "25%") self.contents.draw_text(132, 60, 80, SCS_FONT_SIZE, "50%") self.contents.draw_text(182, 60, 80, SCS_FONT_SIZE, "75%") self.contents.draw_text(232, 60, 80, SCS_FONT_SIZE, "100%") # Calculate bar max size bar_width = @item_max * SCS_SCALE + SCS_CURSOR_WIDTH # Draw empty bar and borders from above calculations self.contents.fill_rect(32, 30, bar_width + 8, 20, Color.new(100,200,200,140)) self.contents.fill_rect(34, 32, bar_width + 4, 16, Color.new( 28,128,128,190)) self.contents.fill_rect(36, 34, bar_width, 12, Color.new( 64, 64, 64,190)) # Calculate cursor position based in bar x = (@index * (@item_max * SCS_SCALE) ) / @item_max + 36 # Draw cursor in bar self.contents.fill_rect(x, 33, SCS_CURSOR_WIDTH, 14, Color.new(100,100,100,215)) self.contents.fill_rect(x+4, 36, SCS_CURSOR_WIDTH-8, 8, Color.new( 90, 90, 90,215)) end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update if self.active # If B button was pressed if Input.repeat?(Input::B) # Deactivate the window and return control self.active = false return end # Deactivate the window if UP or Down was pressed self.active = false if Input.repeat?(Input::UP) self.active = false if Input.repeat?(Input::DOWN) # If LEFT button was pressed if Input.repeat?(Input::LEFT) if @index != 0 # Branch on sound type case @text when "BGM" @index -= SCS_INCREMENTS $game_system.bgm_play($game_system.bgm_memorize) $game_system.se_play($data_system.decision_se) when "SE" $game_system.se_play($data_system.decision_se) @index -= SCS_INCREMENTS end; return end $game_system.se_play($data_system.buzzer_se) end # If RIGHT button was pressed if Input.repeat?(Input::RIGHT) if @index < @item_max # Branch on sound type case @text when "BGM" @index += SCS_INCREMENTS $game_system.bgm_play($game_system.bgm_memorize) $game_system.se_play($data_system.decision_se) when "SE" $game_system.se_play($data_system.decision_se) @index += SCS_INCREMENTS end; return end $game_system.se_play($data_system.buzzer_se) end case @text when "BGM" $data_config.bgm_volume = @index when "SE" $data_config.se_volume = @index end refresh return end end end #============================================================================== # ** Scene_Title #------------------------------------------------------------------------------ # This class performs title screen processing. #============================================================================== class Scene_Title #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- alias scs_config_main main def main # Establish default config values $data_config.bgm_volume = 100 $data_config.se_volume = 100 $data_config.fullscreen = false $data_config.text_skip = false # Load Config if config file exists if FileTest.exist?(SCS_FILENAME) $data_config = load_data(SCS_FILENAME) end # Reset screen mode if config set to fullscreen if $data_config.fullscreen == true $showm = Win32API.new 'user32', 'keybd_event', %w(l l l l), '' $showm.call(18,0,0,0) $showm.call(13,0,0,0) $showm.call(13,0,2,0) $showm.call(18,0,2,0) end # Perform the original call scs_config_main end end #==============================================================================\ # ** Scene_Config #------------------------------------------------------------------------------ # This class performs configuration system option processing. #============================================================================== class Scene_Config #-------------------------------------------------------------------------- # * Object Initialization # menu_index : command cursor's initial position #-------------------------------------------------------------------------- def initialize(index_c) @index_c = index_c end #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main spriteset = Spriteset_Map.new # Make command window s1 = "Musiklautstärke" s2 = "Soundlautstärke" s3 = "Vollbild" s4 = "Text" s5 = "Zurück" @command_window = Window_Command.new(260, [s1, s2, s3, s4,s5]) @command_window.y = 64 @command_window.index = @index_c # Make help window @help_window = Window_Help.new # Execute transition Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze # Dispose of windows @command_window.dispose @help_window.dispose end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # Update windows @command_window.update # If command window is active: call update_command if @command_window.active update_command update_help return end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update_help modus = "Festermodus |" if $data_config.fullscreen == true then modus = "Vollbild |" end #skip = "Text Überspringen AN |" if $data_config.text_skip == false then if [$game_switches[3] == false] skip = "Text Überspringen AUS |" end end if $data_config.text_skip == true then if [$game_switches[3] == true] skip = "Text Überspringen AN |" end end test = "Ah" + "BU" bgm_vol=$data_config.bgm_volume.to_s se_vol=$data_config.se_volume.to_s vol = "BGM Vol.: "+ bgm_vol + "| SE Vol.: " + se_vol + "| " text = vol + modus + skip case @command_window.index when 0; @help_window.set_text(text,1) when 1; @help_window.set_text(text,1) when 2; @help_window.set_text(text,1) when 3; @help_window.set_text(text,1) when 4; @help_window.set_text(text,1) end end #-------------------------------------------------------------------------- # * Frame Update (when command window is active) #-------------------------------------------------------------------------- def update_command if Input.trigger?(Input::B) # Play cancel SE $game_system.se_play($data_system.cancel_se) # Switch to menu screen $scene = Scene_Menu.new(0,0,0,1) return end case @command_window.index when 0 # BGM if Input.trigger?(Input::C) main_bgm end when 1 # SE if Input.trigger?(Input::C) main_se end when 2 # FULLSCREEN TOGGLE if Input.trigger?(Input::C) main_vollbild end when 3 # Text_Skip if Input.trigger?(Input::C) main_text_skip end when 4 # SAVE & EXIT # If C button was pressed if Input.trigger?(Input::C) # Play Decision SE $game_system.se_play($data_system.decision_se) # Write config data file = File.open(SCS_FILENAME, "wb") Marshal.dump($data_config, file) file.close # If called from event if $game_temp.scs_config_calling # Clear save call flag $game_temp.scs_config_calling = false # Switch to map screen $scene = Scene_Menu.new(6) #$scene = Scene_Map.new return end # Switch to menu screen $scene = Scene_Menu.new(SES_EXIT) end end end #-------------------------------------------------------------------------- # * Fullscreen / Window Toggle #-------------------------------------------------------------------------- def command_toggle_fullscreen # One of a few fullscreen toggle methods. ^_^ $showm = Win32API.new 'user32', 'keybd_event', %w(l l l l), '' $showm.call(18,0,0,0) $showm.call(13,0,0,0) $showm.call(13,0,2,0) $showm.call(18,0,2,0) # Set the fullscreen flag in the config data if $data_config.fullscreen == true $data_config.fullscreen = nil else $data_config.fullscreen = true end end #-------------------------------------------------------------------------- # * Debug Call #-------------------------------------------------------------------------- def call_debug # Clear debug call flag $game_temp.debug_calling = false # Play decision SE $game_system.se_play($data_system.decision_se) # Straighten player position $game_player.straighten # Switch to debug screen $scene = Scene_Debug.new end #-------------------------------------------------------------------------- # # # * BGM # # #-------------------------------------------------------------------------- def main_bgm # Make command window s0 = "0%" s1 = "10%" s2 = "20%" s3 = "30%" s4 = "40%" s5 = "50%" s6 = "60%" s7 = "70%" s8 = "80%" s9 = "90%" s10 = "100%" s11 = "Zurück" @command_window_b = Window_Command.new(192, [s0, s1, s2,s3,s4,s5,s6,s7,s8,s9,s10,s11]) @command_window_b.x = 260 @command_window_b.y = 64 # Execute transition Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update_bgm # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze # Dispose of command window @command_window_b.dispose # Dispose of title graphic end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update_bgm # Update command window @command_window_b.update # If C button was pressed if Input.trigger?(Input::C) # Branch by command window cursor position case @command_window_b.index when 0 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.bgm_volume = 0 scene_back end when 1 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.bgm_volume = 10 scene_back end when 2 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.bgm_volume = 20 scene_back end when 3 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.bgm_volume = 30 scene_back end when 4 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.bgm_volume = 40 scene_back end when 5 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.bgm_volume = 50 scene_back end when 6 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.bgm_volume = 60 scene_back end when 7 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.bgm_volume = 70 scene_back end when 8 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.bgm_volume = 80 scene_back end when 9 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.bgm_volume = 90 scene_back end when 10 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.bgm_volume = 100 scene_back end when 11 if Input.trigger?(Input::C) #Zurück $game_system.se_play($data_system.cancel_se) $scene = Scene_Config.new(0) return end end end update_help end #-------------------------------------------------------------------------- # * Scene abbrechen #-------------------------------------------------------------------------- def scene_back $scene = Scene_Config.new(0) return end #-------------------------------------------------------------------------- # # # * SE # # #-------------------------------------------------------------------------- def main_se # Make command window s0 = "0%" s1 = "10%" s2 = "20%" s3 = "30%" s4 = "40%" s5 = "50%" s6 = "60%" s7 = "70%" s8 = "80%" s9 = "90%" s10 = "100%" s11 = "Zurück" @command_window_s = Window_Command.new(192, [s0, s1, s2,s3,s4,s5,s6,s7,s8,s9,s10,s11]) @command_window_s.x = 260 @command_window_s.y = 64 # Execute transition Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update_se # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze # Dispose of command window @command_window_s.dispose # Dispose of title graphic end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update_se # Update command window @command_window_s.update # If C button was pressed if Input.trigger?(Input::C) # Branch by command window cursor position case @command_window_s.index when 0 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.se_volume = 0 scene_back_se end when 1 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.se_volume = 10 scene_back_se end when 2 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.se_volume = 20 scene_back_se end when 3 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.se_volume = 30 scene_back_se end when 4 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.se_volume = 40 scene_back_se end when 5 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.se_volume = 50 scene_back_se end when 6 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.se_volume = 60 scene_back_se end when 7 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.se_volume = 70 scene_back_se end when 8 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.se_volume = 80 scene_back_se end when 9 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.se_volume = 90 scene_back_se end when 10 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.se_volume = 100 scene_back_se end when 11 if Input.trigger?(Input::C) #Zurück $game_system.se_play($data_system.cancel_se) $scene = Scene_Config.new(1) return end end end update_help end #-------------------------------------------------------------------------- # * Scene abbrechen #-------------------------------------------------------------------------- def scene_back_se $scene = Scene_Config.new(1) return end #-------------------------------------------------------------------------- # # # * Vollbild # # #-------------------------------------------------------------------------- def main_vollbild # Make command window s0 = "Modus ändern" s1 = "Zurück" @command_window_v = Window_Command.new(192, [s0, s1]) @command_window_v.x = 260 @command_window_v.y = 64 # Execute transition Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update_vollbild # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze # Dispose of command window @command_window_v.dispose # Dispose of title graphic end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update_vollbild # Update command window @command_window_v.update # If C button was pressed if Input.trigger?(Input::C) # Branch by command window cursor position case @command_window_v.index when 0 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) command_toggle_fullscreen end when 1 if Input.trigger?(Input::C) #Zurück $game_system.se_play($data_system.cancel_se) $scene = Scene_Config.new(2) return end end end update_help end #-------------------------------------------------------------------------- # * Fullscreen #-------------------------------------------------------------------------- def command_toggle_fullscreen # One of a few fullscreen toggle methods. ^_^ $showm = Win32API.new 'user32', 'keybd_event', %w(l l l l), '' $showm.call(18,0,0,0) $showm.call(13,0,0,0) $showm.call(13,0,2,0) $showm.call(18,0,2,0) # Set the fullscreen flag in the config data if $data_config.fullscreen == true $data_config.fullscreen = nil else $data_config.fullscreen = true end end #-------------------------------------------------------------------------- # # # * Text_Skip # # #-------------------------------------------------------------------------- def main_text_skip # Make command window s0 = "Text Überspringen AUS" s1 = "Text Überspringen AN" s2 = "Zurück" @command_window_t = Window_Command.new(192, [s0, s1, s2]) @command_window_t.x = 260 @command_window_t.y = 64 # Execute transition Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update_text_skip # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze # Dispose of command window @command_window_t.dispose # Dispose of title graphic end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update_text_skip # Update command window @command_window_t.update # If C button was pressed if Input.trigger?(Input::C) # Branch by command window cursor position case @command_window_t.index when 0 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.text_skip = false $game_switches[67] = false $game_system.text_skip = false scene_back_t end when 1 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $data_config.text_skip = true $game_switches[67] = true $game_system.text_skip = true scene_back_t end when 2 if Input.trigger?(Input::C) #Zurück $game_system.se_play($data_system.cancel_se) $scene = Scene_Config.new(3) return end end end update_help end #-------------------------------------------------------------------------- # * Scene abbrechen #-------------------------------------------------------------------------- def scene_back_t $scene = Scene_Config.new(0) return end end |
Mausskript
|
|
Ruby Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 |
#---------------------------------------------------------------------------- #Credits: This is an adaptation from a script created by shun (http://simp.nobody.jp/) #Also looked at Cybersam's work and Astro_mech and Mr.Mo's mouse script edits to #learn how onmouse events work. #---------------------------------------------------------------------------- # TO USE: # In each map event, put the name of the cursor you want to show as a comment. # The comment must be the first event command. Make sure that you put the cursor # in your Icons directory (name in comment and icon name must match exactly) #---------------------------------------------------------------------------- module Input #-------------------------------------------------------------------------- # ● get winAPIs #-------------------------------------------------------------------------- #gsm = Win32API.new('user32', 'GetSystemMetrics', 'i', 'i') @mouse_status = [[0, 1], [0, 2], [0, 4]] #left, right, middle mouse @gaks = Win32API.new('user32', 'GetAsyncKeyState', 'i', 'i') @cursor_pos = Win32API.new('user32', 'GetCursorPos', 'p', 'i') @scr2cli = Win32API.new('user32', 'ScreenToClient', %w(l p), 'i') @client_rect = Win32API.new('user32', 'GetClientRect', %w(l p), 'i') @readini = Win32API.new('kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l') @findwindow = Win32API.new('user32', 'FindWindowA', %w(p p), 'l') show_cursor = Win32API.new('user32', 'ShowCursor', 'l', 'l') @last_pos = [0, 0].pack('ll') @pos_x = @pos_y = 0 @width = 0 @height = 0 n = (true ? 0 : 1) show_cursor.call(n) module_function #-------------------------------------------------------------------------- # ● get the window #-------------------------------------------------------------------------- def hwnd game_name = "\0" * 256 @readini.call('Game', 'Title', '', game_name, 255, ".\\Game.ini") game_name.delete!("\0") h = @findwindow.call('RGSS Player', game_name) if h == 0 n = 0 while h == 0 h = @findwindow.call('RGSS Player', "#{game_name} - #{n} FPS") n += 1 end end return h end #-------------------------------------------------------------------------- # ● get the global position of the mouse #-------------------------------------------------------------------------- def global_pos pos = [0, 0].pack('ll') if @cursor_pos.call(pos) != 0 return pos.unpack('ll') else return nil end end #-------------------------------------------------------------------------- # ● Position of the mouse in the game # catch_anywhere : get position if mouse is outside of game screen #-------------------------------------------------------------------------- def pos(catch_anywhere = true) if (global_pos != @last_pos) @last_pos = *global_pos string = global_pos.to_s + " " + @last_pos.to_s $debug_string = string.to_s @pos_x, @pos_y = screen_to_client(*global_pos) @width, @height = client_size end if (@pos_x >= 0 and @pos_y >= 0 and @pos_x < @width and @pos_y < @height) return @pos_x, @pos_y else return 0, 0 end end #-------------------------------------------------------------------------- # ● Position of the mouse on screen # x : x coordinate # y : y coordinate #-------------------------------------------------------------------------- def screen_to_client(x, y) return nil unless x and y pos = [x, y].pack('ll') if @scr2cli.call(hwnd, pos) != 0 return pos.unpack('ll') else return nil end end #-------------------------------------------------------------------------- # ● Size of the game window #-------------------------------------------------------------------------- def client_size rect = [0, 0, 0, 0].pack('l4') @client_rect.call(hwnd, rect) right, bottom = rect.unpack('l4')[2..3] return right, bottom end #-------------------------------------------------------------------------- # ● Check to see if the mouse is over an event #-------------------------------------------------------------------------- def check_event(x, y) for event in $game_map.events.values # change icon if an event is encountered if (event.x == x or event.x == (x-1)) and (event.y == y or event.y == (y+1)) if event.list && event.list[0].code == 108 icon = event.list[0].parameters icon = icon.to_s if icon == "Arrow2" || icon == "Arrow3" || icon == "Arrow4" || icon == "Arrow5" || icon == "Arrow6" $mouse_icon = icon.to_s end end break end # if even is not encountered, use default icon $mouse_icon = "Arrow" end end def icon_name(name) $msg = name.to_s $mouse_icon = name.to_s end #-------------------------------------------------------------------------- # ● watch for left mouse actions # id : Mouse (0:Left, 1:Right, 2:Center) #-------------------------------------------------------------------------- def mouse_press?(id = 0) if $scene.is_a?(Scene_Map) # get the icon to display if @mouse_status[id][0] <= 0 $hoverx = (pos[0] + $game_map.display_x / 4) / 32 $hovery = (pos[1] + $game_map.display_y / 4) / 32 icon = check_event($hoverx,$hovery) end # move character when mouse is pressed if @mouse_status[id][0] > 0 $mousex = pos[0] + $game_map.display_x / 4 $mousey = pos[1] + $game_map.display_y / 4 $move = 1 end # don't move character if message window showing if $game_temp.message_window_showing $move = 0 end end return @mouse_status[id][0] > 0 end #-------------------------------------------------------------------------- # ● Watch for mouse button actions (especially right mouse button) # id : mouse (0:Left, 1:Right, 2:Center) #-------------------------------------------------------------------------- def mouse_trigger?(id = 0) return @mouse_status[id][0] == 1 end #-------------------------------------------------------------------------- # ● Check to see if a mouse action was repeated # id : mouse (0:Left, 1:Right, 2:Center) #-------------------------------------------------------------------------- def mouse_repeat?(id = 0) if @mouse_status[id][0] <= 0 return false else result = @mouse_status[id][0] % 5 == 1 and @mouse_status[id][0] % 5 != 2 return result end end #-------------------------------------------------------------------------- # ● Update the mouse #-------------------------------------------------------------------------- def mouse_update for i in @mouse_status n = @gaks.call(i[1]) if n == 0 or n == 1 i[0] = (i[0] > 0 ? i[0] * -1 : 0) else i[0] = (i[0] > 0 ? i[0] + 1 : 1) end end end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- class << Input #-------------------------------------------------------------------------- # ● Update old input calls #-------------------------------------------------------------------------- alias old_update update unless $@ def Input.update old_update mouse_update $mouse.update end #-------------------------------------------------------------------------- # ● Update old input triggers # num : A, B, C #-------------------------------------------------------------------------- alias old_trigger? trigger? unless $@ def Input.trigger?(num) return old_trigger?(num) if Input.pos(false) == nil case num when Input::A return (old_trigger?(num) or mouse_trigger?(2)) when Input::B return (old_trigger?(num) or mouse_trigger?(1)) when Input::C return (old_trigger?(num) or mouse_trigger?) else return old_trigger?(num) end end #-------------------------------------------------------------------------- # ● Check to see if an old input call was repeated # num : B #-------------------------------------------------------------------------- alias old_repeat? repeat? unless $@ def repeat?(num) return old_repeat?(num) if Input.pos(false) == nil if num == Input::B return (old_repeat?(num) or mouse_repeat?(1)) else return old_repeat?(num) end end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- class Game_Player < Game_Character #-------------------------------------------------------------------------- # ● Move the player toward the mouse #-------------------------------------------------------------------------- alias mouse_update update def update rx = $mousex - (@real_x / 4 + 16) ry = $mousey - (@real_y / 4 + 16) # if an arrow key is pressed, stop path finding $move = 0 if Input.dir4 != 0 # move to a specified area on the map, using the mouse if $move == 1 unless moving? or $game_system.map_interpreter.running? or @move_route_forcing or $game_temp.message_window_showing or (rx.abs <= 16 and ry.abs <= 16) rad = -(Math.atan2(ry, rx) / Math::PI * 180) case rad when -157.5...-112.5 move_lower_left when -112.5...-67.5 move_down when -67.5...-22.5 move_lower_right when -22.5...22.5 move_right when 22.5...67.5 move_upper_right when 67.5...112.5 move_up when 112.5...157.5 move_upper_left else move_left end end # if the path has been reached, stop moving if (rx.abs <= 16 and ry.abs <= 16) $move = 0 end end #update the mouse mouse_update end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- class Sprite_Mouse < Sprite #-------------------------------------------------------------------------- # ● Initialize the mouse #-------------------------------------------------------------------------- def initialize super self.bitmap = RPG::Cache.icon($mouse_icon.to_s) self.z = 10001 self.ox, self.oy = [16, 0] self.visible = false self.src_rect.set(0, 0, 32, 32) update end #-------------------------------------------------------------------------- # ● Dispose of the mouse #-------------------------------------------------------------------------- def dispose if self.bitmap != nil self.bitmap.dispose end super end #-------------------------------------------------------------------------- # ● Update the mouse #-------------------------------------------------------------------------- def update super self.bitmap = RPG::Cache.icon($mouse_icon.to_s) self.visible = true if self.visible == false and $scene != nil self.x, self.y = Input.pos if Input.mouse_press? self.src_rect.set(0, 0, 32, 32) end return end end $mouse = Sprite_Mouse.new class Window_Selectable < Window_Base #-------------------------------------------------------------------------- # ● Initialize the mouse #-------------------------------------------------------------------------- alias mouse_initialize initialize def initialize(x, y, width, height) mouse_initialize(x, y, width, height) @scroll_wait = 0 end #-------------------------------------------------------------------------- # ● Update the mouse #-------------------------------------------------------------------------- alias mouse_update update def update mouse_update mouse_operation if self.active end #-------------------------------------------------------------------------- # ○ Perform mouse operations #-------------------------------------------------------------------------- def mouse_operation mx = Input.pos[0] - (self.x - self.ox + 16) my = Input.pos[1] - (self.y - self.oy + 16) width = self.width / @column_max - 32 height = 32 for index in 0...@item_max x = index % @column_max * (width + 32) y = index / @column_max * 32 if mx > x and mx < x + width and my > y and my < y + height mouse_cursor(index) break end end end #-------------------------------------------------------------------------- # ○ Track the position of the mouse cursor #-------------------------------------------------------------------------- def mouse_cursor(index) return if @index == index @scroll_wait -= 1 if @scroll_wait > 0 row1 = @index / @column_max row2 = index / @column_max bottom = self.top_row + (self.page_row_max - 1) if row1 == self.top_row and row2 < self.top_row return if @scroll_wait > 0 @index = [@index - @column_max, 0].max @scroll_wait = 4 elsif row1 == bottom and row2 > bottom return if @scroll_wait > 0 @index = [@index + @column_max, @item_max - 1].min @scroll_wait = 4 else @index = index end $game_system.se_play($data_system.cursor_se) end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- class Window_MenuStatus < Window_Selectable def mouse_operation return if @index < 0 mx = Input.pos[0] - (self.x - self.ox + 16) my = Input.pos[1] - (self.y - self.oy + 16) x = 0 width = self.width - 32 height = 96 for index in 0...@item_max y = index * 116 if mx > x and mx < x + width and my > y and my < y + height mouse_cursor(index) break end end end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- class Window_Target < Window_Selectable def mouse_operation return if @index <= -1 mx = Input.pos[0] - (self.x - self.ox + 16) my = Input.pos[1] - (self.y - self.oy + 16) x = 0 width = self.width - 32 height = 96 for index in 0...@item_max y = index * 116 if mx > x and mx < x + width and my > y and my < y + height mouse_cursor(index) break end end end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- class Window_NameInput < Window_Base #-------------------------------------------------------------------------- # ● Update the position of the mouse #-------------------------------------------------------------------------- alias mouse_update update def update mouse_update mouse_operation if self.active end #-------------------------------------------------------------------------- # ● Perform mouse operations #-------------------------------------------------------------------------- def mouse_operation last_index = @index mx = Input.pos[0] - (self.x - self.ox + 16) my = Input.pos[1] - (self.y - self.oy + 16) width = 28 height = 32 for index in 0...180 x = 4 + index / 5 / 9 * 152 + index % 5 * 28 y = index / 5 % 9 * 32 if mx > x and mx < x + width and my > y and my < y + height @index = index break end end x = 544 y = 9 * 32 width = 64 if mx > x and mx < x + width and my > y and my < y + height @index = 180 end $game_system.se_play($data_system.cursor_se) unless @index == index end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- class Window_Message < Window_Selectable #-------------------------------------------------------------------------- # ● Perform mouse operations #-------------------------------------------------------------------------- def mouse_operation mx = Input.pos[0] - (self.x - self.ox + 16) my = Input.pos[1] - (self.y - self.oy + 16) x = 8 width = 128 height = 32 for index in 0...@item_max y = ($game_temp.choice_start + index) * 32 if mx > x and mx < x + width and my > y and my < y + height mouse_cursor(index) break end end end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- class Window_PartyCommand < Window_Selectable def mouse_operation mx = Input.pos[0] - (self.x - self.ox + 16) my = Input.pos[1] - (self.y - self.oy + 16) y = 0 width = 128 height = 32 for index in 0...@item_max x = 160 + index * 160 if mx > x and mx < x + width and my > y and my < y + height mouse_cursor(index) break end end end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- class Window_MenuPosition < Window_Selectable def mouse_operation mx = Input.pos[0] - (self.x - self.ox + 16) my = Input.pos[1] - (self.y - self.oy + 16) y = 0 width = self.contents.width / @item_max - 10 height = 32 for index in 0...@item_max x = self.contents.width / (@item_max) * index + 4 if mx > x and mx < x + width and my > y and my < y + height mouse_cursor(index) break end end end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- class Arrow_Base < Sprite alias mouse_update update def update mouse_update mouse_operation end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- class Arrow_Enemy < Arrow_Base def mouse_operation mx, my = Input.pos for index in 0...$game_troop.enemies.size enemy = $game_troop.enemies[index] bitmap = RPG::Cache.battler(enemy.battler_name, 0) width = bitmap.width height = bitmap.height x = enemy.screen_x - width / 2 y = enemy.screen_y - height if mx > x and mx < x + width and my > y and my < y + height break if @index == index @index = index $game_system.se_play($data_system.cursor_se) break end end end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- class Arrow_Actor < Arrow_Base def mouse_operation mx, my = Input.pos for index in 0...$game_party.actors.size index = $game_party.actors.size - index - 1 actor = $game_party.actors[index] bitmap = RPG::Cache.battler(actor.battler_name, 0) width = bitmap.width height = bitmap.height x = actor.screen_x - width / 2 y = actor.screen_y - height if mx > x and mx < x + width and my > y and my < y + height break if @index == index @index = index $game_system.se_play($data_system.cursor_se) break end end end end #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- class Scene_File #-------------------------------------------------------------------------- # ● Update the mouse #-------------------------------------------------------------------------- alias mouse_update update def update mouse_update save = false mx, my = Input.pos x = 0 width = (save ? 160 : 640) height = 104 for index in 0...3 y = 64 + index % 4 * 104 if mx > x and mx < x + width and my > y and my < y + height break if @file_index == index @savefile_windows[@file_index].selected = false @file_index = index @savefile_windows[@file_index].selected = true $game_system.se_play($data_system.cursor_se) break end end end end |
Mausaddon von Kagu
|
|
Ruby Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
module Input def self.mouse?(btn=:l) key = {:l => 0x01, :r => 0x02, :m => 0x04}[btn] @gaks.call(key) & 128 == 128 end def self.mx; @pos_x; end def self.my; @pos_y; end def self.mouse_coord_in_v(x, y) $game_variables[x] = mx $game_variables[y] = my end end |
Screens:
Original (unterstützt keine Maus):
Neue Version:
-
Projekte -
Tutorials & Hilfreiches aus der Eventtechnik
[Tutorial] Skills, Stats und Bosse - So erstellt ihr einen guten Bosskampf
[Tutorial] Kampf - Unendlich Gegner erscheinen lassen
[Tutorial] Kämpfe, Klassen und Balancing
[Tutorial] Entwickler Talk: Skalierungen

NPC verfolgt Held durch Türen

Pokemon- Fangskript

Monstergruppenführer

Automatisches prioritätsgesteuertes Anordnen von Bildern

Doppelte Eventfunktionen auf Map

Objekte schieben & ziehen
Ansonsten kann ich mich mal die Tage dransetzen.
Besondere Wünsche zum aussehen? Ich würde das nämlich etwas umstrukturieren - ein Fenster, statt zwei Commandwindows zum Beispiel, aber wenn dir das egal ist, tobe ich mich da frei aus.

Was ist das RGSS ? RGSS-Dokumentation auf Sc
Kyoshiros Makerkurs

Musik von Shabraxxx für euch
Guide zu den Audioformaten

Skripte von mir (Auswahl):
Atmungssystem
| Streichholzsystem
| Animiert durch Bücher blättern
Random : Marktsystem für Kardor
| Staterelated Battlergraphic
| Hinweis auf mögliche Aktionen
SelfSwitchExpirationtimer Skript - Gameplayerweiterung für Pilzesammler und Farmspiele
Meine Skripte werden gerade hier gesammelt.Benutzerinformationen überspringen
Motto: Aufgeben ist es, was den Menschen tötet. Nur der Mensch, der sich weigert aufzugeben, hat sich das Recht verdient, auf dem glanzvollen Pfad der Menschheit zu wandeln.
Sein.
Zum Aussehen habe ich mir noch keine konkreten Gedanken gemacht, aber so
Wie es jetzt aussieht finde ich es richtig langweilig.
Ich wuerde dazu tendieren den kompletten Bildschirm auszunutzen und die Fenster
Ein wenig transparent zu machen.
Tob dich ruhig mal aus

-
Projekte -
Tutorials & Hilfreiches aus der Eventtechnik
[Tutorial] Skills, Stats und Bosse - So erstellt ihr einen guten Bosskampf
[Tutorial] Kampf - Unendlich Gegner erscheinen lassen
[Tutorial] Kämpfe, Klassen und Balancing
[Tutorial] Entwickler Talk: Skalierungen

NPC verfolgt Held durch Türen

Pokemon- Fangskript

Monstergruppenführer

Automatisches prioritätsgesteuertes Anordnen von Bildern

Doppelte Eventfunktionen auf Map

Objekte schieben & ziehen
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Mitsch93« (6. Dezember 2014, 13:47)
Dann kann ich ein potenzieller Helfer das Skript direkt in der passenden Kompatibilität entwickeln.

Was ist das RGSS ? RGSS-Dokumentation auf Sc
Kyoshiros Makerkurs

Musik von Shabraxxx für euch
Guide zu den Audioformaten

Skripte von mir (Auswahl):
Atmungssystem
| Streichholzsystem
| Animiert durch Bücher blättern
Random : Marktsystem für Kardor
| Staterelated Battlergraphic
| Hinweis auf mögliche Aktionen
SelfSwitchExpirationtimer Skript - Gameplayerweiterung für Pilzesammler und Farmspiele
Meine Skripte werden gerade hier gesammelt.Benutzerinformationen überspringen
Motto: Aufgeben ist es, was den Menschen tötet. Nur der Mensch, der sich weigert aufzugeben, hat sich das Recht verdient, auf dem glanzvollen Pfad der Menschheit zu wandeln.
-
Projekte -
Tutorials & Hilfreiches aus der Eventtechnik
[Tutorial] Skills, Stats und Bosse - So erstellt ihr einen guten Bosskampf
[Tutorial] Kampf - Unendlich Gegner erscheinen lassen
[Tutorial] Kämpfe, Klassen und Balancing
[Tutorial] Entwickler Talk: Skalierungen

NPC verfolgt Held durch Türen

Pokemon- Fangskript

Monstergruppenführer

Automatisches prioritätsgesteuertes Anordnen von Bildern

Doppelte Eventfunktionen auf Map

Objekte schieben & ziehen
Frage das nur vorher nach, weil ich gerne mal ein Skript überarbeite und dann am Ende höre "ja aber das muss Abwärtskompatibel sein" >_>

Was ist das RGSS ? RGSS-Dokumentation auf Sc
Kyoshiros Makerkurs

Musik von Shabraxxx für euch
Guide zu den Audioformaten

Skripte von mir (Auswahl):
Atmungssystem
| Streichholzsystem
| Animiert durch Bücher blättern
Random : Marktsystem für Kardor
| Staterelated Battlergraphic
| Hinweis auf mögliche Aktionen
SelfSwitchExpirationtimer Skript - Gameplayerweiterung für Pilzesammler und Farmspiele
Meine Skripte werden gerade hier gesammelt.Benutzerinformationen überspringen
Motto: Aufgeben ist es, was den Menschen tötet. Nur der Mensch, der sich weigert aufzugeben, hat sich das Recht verdient, auf dem glanzvollen Pfad der Menschheit zu wandeln.
Das muss nicht mit der kompatibel sein finde die Lösung damit sowieso sehr
Suboptimal. Im Spiel ist es einsezbar spielt aber momentan keine grosse Rolle.
Also kannst dich da ruhig austoben.
-
Projekte -
Tutorials & Hilfreiches aus der Eventtechnik
[Tutorial] Skills, Stats und Bosse - So erstellt ihr einen guten Bosskampf
[Tutorial] Kampf - Unendlich Gegner erscheinen lassen
[Tutorial] Kämpfe, Klassen und Balancing
[Tutorial] Entwickler Talk: Skalierungen

NPC verfolgt Held durch Türen

Pokemon- Fangskript

Monstergruppenführer

Automatisches prioritätsgesteuertes Anordnen von Bildern

Doppelte Eventfunktionen auf Map

Objekte schieben & ziehen
|
|
Ruby Quellcode |
1 2 |
# Filename SCS_FILENAME = "Settings.cfg" |

Was ist das RGSS ? RGSS-Dokumentation auf Sc
Kyoshiros Makerkurs

Musik von Shabraxxx für euch
Guide zu den Audioformaten

Skripte von mir (Auswahl):
Atmungssystem
| Streichholzsystem
| Animiert durch Bücher blättern
Random : Marktsystem für Kardor
| Staterelated Battlergraphic
| Hinweis auf mögliche Aktionen
SelfSwitchExpirationtimer Skript - Gameplayerweiterung für Pilzesammler und Farmspiele
Meine Skripte werden gerade hier gesammelt.Benutzerinformationen überspringen
Motto: Aufgeben ist es, was den Menschen tötet. Nur der Mensch, der sich weigert aufzugeben, hat sich das Recht verdient, auf dem glanzvollen Pfad der Menschheit zu wandeln.
-
Projekte -
Tutorials & Hilfreiches aus der Eventtechnik
[Tutorial] Skills, Stats und Bosse - So erstellt ihr einen guten Bosskampf
[Tutorial] Kampf - Unendlich Gegner erscheinen lassen
[Tutorial] Kämpfe, Klassen und Balancing
[Tutorial] Entwickler Talk: Skalierungen

NPC verfolgt Held durch Türen

Pokemon- Fangskript

Monstergruppenführer

Automatisches prioritätsgesteuertes Anordnen von Bildern

Doppelte Eventfunktionen auf Map

Objekte schieben & ziehen
Ähnliche Themen
-
RGSS 1 Probleme & Talk »-
Itemkategorisierung von Playm - Überarbeitung
(7. Oktober 2014, 19:44)
-
Entwürfe und Entwicklung »-
[Demo] Saat des Lebens
(27. September 2012, 06:45)
-
Computer & Technik »-
[Hilfe gesucht] Vollbild Bug RPGMaker XP
(28. Juli 2012, 04:20)
-
Skript-Anfragen »-
BloodRage! Braucht skripte Theard ;D
(2. November 2007, 17:31)
-
Archiv Spielvorstellungen »-
[Idee] 4 Elements
(1. Juli 2007, 15:00)
