加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 九靈 于 2013-8-25 23:28 编辑
Game_Actors
#============================================================================== # ■ Game_Actors #------------------------------------------------------------------------------ # 处理角色排列的类。本类的实例请参考 # $game_actors。 #============================================================================== class Game_Actors #-------------------------------------------------------------------------- # ● 初始化对像 #-------------------------------------------------------------------------- def initialize @data = [] end #-------------------------------------------------------------------------- # ● 获取角色 # actor_id : 角色 ID #-------------------------------------------------------------------------- def [](actor_id) if actor_id > 999 or $data_actors[actor_id] == nil return nil end if @data[actor_id] == nil @data[actor_id] = Game_Actor.new(actor_id) end return @data[actor_id] end end
#==============================================================================
# ■ Game_Actors
#------------------------------------------------------------------------------
# 处理角色排列的类。本类的实例请参考
# $game_actors。
#==============================================================================
class Game_Actors
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
@data = []
end
#--------------------------------------------------------------------------
# ● 获取角色
# actor_id : 角色 ID
#--------------------------------------------------------------------------
def [](actor_id)
if actor_id > 999 or $data_actors[actor_id] == nil
return nil
end
if @data[actor_id] == nil
@data[actor_id] = Game_Actor.new(actor_id)
end
return @data[actor_id]
end
end
的[](actor_id) 方法是怎么用? 是xxx.[](actor_id) 这样吗?
我找了个疑似是调用[](actor_id)的
Game_Party
#-------------------------------------------------------------------------- # ● 设置初期同伴 #-------------------------------------------------------------------------- def setup_starting_members @actors = [] for i in $data_system.party_members @actors.push($game_actors[i]) end end
#--------------------------------------------------------------------------
# ● 设置初期同伴
#--------------------------------------------------------------------------
def setup_starting_members
@actors = []
for i in $data_system.party_members
@actors.push($game_actors[i])
end
end
中$game_actors[ i ] (是这个调用的吧...)
呃...[]是方法还是数组? |