比起楼上两种我还是给出朴素一些的做法吧。
class Scene_XXX def on_item_ok(id) create_command(id) @commadn.uppos(#........ #....... end def on_item_ok1; on_item_ok 1; end def on_item_ok2; on_item_ok 2; end # ... end
class Scene_XXX
def on_item_ok(id)
create_command(id)
@commadn.uppos(#........
#.......
end
def on_item_ok1; on_item_ok 1; end
def on_item_ok2; on_item_ok 2; end
# ...
end
or
class Scene_XXX def on_item_ok create_command(@some_window.index) @commadn.uppos(#........ #....... end end
class Scene_XXX
def on_item_ok
create_command(@some_window.index)
@commadn.uppos(#........
#.......
end
end
|