Commit 0e7ae05a authored by 神楽坂玲奈's avatar 神楽坂玲奈

卡片操作初步

parent ed27ab0c
...@@ -110,6 +110,9 @@ class Action ...@@ -110,6 +110,9 @@ class Action
from_field.delete_at from_pos from_field.delete_at from_pos
end end
end end
p @to_pos
p self
to_field = case @to_pos to_field = case @to_pos
when Integer when Integer
player_field.field player_field.field
...@@ -138,8 +141,8 @@ class Action ...@@ -138,8 +141,8 @@ class Action
end end
end end
class Set < Move class Set < Move
def initialize(from_player, from_pos, to_pos) def initialize(from_player, from_pos, to_pos, card)
super(from_player, from_pos, to_pos, :set) super(from_player, from_pos, to_pos, card, nil, :set)
end end
end end
class Activate < Move; end class Activate < Move; end
...@@ -157,7 +160,7 @@ class Action ...@@ -157,7 +160,7 @@ class Action
end end
class ReturnToHand < Move class ReturnToHand < Move
def initialize(from_player, from_pos, card) def initialize(from_player, from_pos, card)
super(from_player, from_pos, card, :hand) super(from_player, from_pos, :hand, card)
end end
end end
class ReturnToDeck < Move class ReturnToDeck < Move
......
...@@ -10,7 +10,8 @@ class Card ...@@ -10,7 +10,8 @@ class Card
@all = [] @all = []
@count = @db.get_first_value("select COUNT(*) from YGODATA") rescue 0 @count = @db.get_first_value("select COUNT(*) from YGODATA") rescue 0
@db.results_as_hash = true @db.results_as_hash = true
PicPath = '/media/44CACC1DCACC0D5C/game/yu-gi-oh/YGODATA/YGOPIC' #PicPath = '/media/44CACC1DCACC0D5C/game/yu-gi-oh/YGODATA/YGOPIC'
PicPath = 'E:/game/yu-gi-oh/YGODATA/YGOPIC'
CardBack = Surface.load "graphics/field/card.png" CardBack = Surface.load "graphics/field/card.png"
class << self class << self
def find(id, order_by=nil) def find(id, order_by=nil)
...@@ -19,30 +20,32 @@ class Card ...@@ -19,30 +20,32 @@ class Card
@all[id] || old_new(@db.get_first_row("select * from YGODATA where id = #{id}")) @all[id] || old_new(@db.get_first_row("select * from YGODATA where id = #{id}"))
when Symbol when Symbol
row = @db.get_first_row("select * from YGODATA where name = '#{id}'") row = @db.get_first_row("select * from YGODATA where name = '#{id}'")
@all[row['id'].to_i] || old_new(row) row && (@all[row['id'].to_i] || old_new(row))
when Hash
old_new(id)
when nil when nil
Card.find(1).instance_eval{@image = CardBack} unless @all[1] Card.find(1).instance_eval{@image = CardBack} unless @all[1]
@all[1] @all[1]
else else
sql = "select * from YGODATA where " << id sql = "select * from YGODATA where " << id
sql << " order by #{order_by}" if order_by sql << " order by #{order_by}" if order_by
@db.execute(sql).collect {|row|@all[row['id'].to_i] || old_new(row)} @db.execute(sql).collect {|row|@all[row['id'].to_i] || old_new(row)}
end end
end end
def all def all
if @all.size != @count if @all.size != @count
sql = "select * from YGODATA where id not in (#{@all.keys.join(', ')})" sql = "select * from YGODATA where id not in (#{@all.keys.join(', ')})"
@db.execute(sql).each{|row|old_new(row)} @db.execute(sql).each{|row|old_new(row)}
end end
@all @all
end end
def cache def cache
@all @all
end end
alias old_new new alias old_new new
def new(id) def new(id)
find(id) find(id)
end end
def load_from_ycff3(db = "E:/game/yu-gi-oh/YGODATA/YGODAT.mdb") def load_from_ycff3(db = "E:/game/yu-gi-oh/YGODATA/YGODAT.mdb")
require 'win32ole' require 'win32ole'
conn = WIN32OLE.new('ADODB.Connection') conn = WIN32OLE.new('ADODB.Connection')
...@@ -141,7 +144,7 @@ class Card ...@@ -141,7 +144,7 @@ class Card
Card.cache[@id] = self Card.cache[@id] = self
end end
def image def image
@image ||= Surface.load "#{PicPath}/#{@id-1}.jpg" @image ||= Surface.load "#{PicPath}/#{@id-1}.jpg" rescue Surface.load "graphics/field/card.png"
end end
def image_small def image_small
@image_small ||= image.transform_surface(0,0,54.0/image.w, 81.0/image.h,0) @image_small ||= image.transform_surface(0,0,54.0/image.w, 81.0/image.h,0)
......
...@@ -10,7 +10,8 @@ class Deck ...@@ -10,7 +10,8 @@ class Deck
attr_accessor :side attr_accessor :side
attr_accessor :extra attr_accessor :extra
attr_accessor :temp attr_accessor :temp
DeckPath = '/media/44CACC1DCACC0D5C/game/yu-gi-oh/deck' #DeckPath = '/media/44CACC1DCACC0D5C/game/yu-gi-oh/deck'
DeckPath = 'E:/game/yu-gi-oh/deck'
def initialize(main, side=[], extra=[], temp=[]) def initialize(main, side=[], extra=[], temp=[])
@main = main @main = main
@side = side @side = side
......
class Game_Card class Game_Card < Card
def initialize(card) #attr_reader :card
@card = card attr_accessor :position
end #def initialize(card)
def method_missing(method, *args) # @card = card
@card.send(method, *args) #end
end #def method_missing(method, *args)
# @card.send(method, *args)
#end
end end
\ No newline at end of file
...@@ -23,7 +23,7 @@ class Game_Field ...@@ -23,7 +23,7 @@ class Game_Field
attr_accessor :hand attr_accessor :hand
attr_accessor :graveyard attr_accessor :graveyard
attr_accessor :removed attr_accessor :removed
def initialize(deck = nil) def initialize(deck = nil)
@lp = 8000 @lp = 8000
if deck if deck
...@@ -33,80 +33,9 @@ class Game_Field ...@@ -33,80 +33,9 @@ class Game_Field
@deck = Array.new(60, Card.find(nil)) @deck = Array.new(60, Card.find(nil))
@extra = Array.new(15, Card.find(nil)) @extra = Array.new(15, Card.find(nil))
end end
@field = [] @field = Array.new(11)
@hand = [] @hand = []
@graveyard = [] @graveyard = []
@removed = [] @removed = []
end end
end
end \ No newline at end of file
__END__
=begin
def field #场上
player_field + opponent_field
end
def player_field #自己场上
@player[0,11]
end
def opponent_field #对方场上
@opponent[0,11]
end
def fieldcard #场地魔法卡
@player[0] || @opponent[0]
end
def player_fieldcard #自己的场地魔法卡
@player[0]
end
def opponent_fieldcard #对方的场地魔法卡
@opponent[0]
end
def player_deck #自己的卡组
@player[11, 60]
end
def player_extra #自己的额外卡组
@player[61, 15]
end
def player_hand #自己的手卡
@player[226, 60]
end
def opponent_hand #对方的手卡
@opponent[161, 60]
end
def graveyard #墓地
player_grave + opponent_grave
end
def player_grave #自己的墓地
@player[11, 75]
end
def opponent_grave #对方的墓地
@opponent[11, 75]
end
def removed #除外区
@player + @opponent
end
def player_removed #自己的除外区
@player[151, 75]
end
def opponent_removed #对方的除外区
@opponent[151, 75]
end
def spelltraps #魔限
player_spelltrap + opponent_spelltrap
end
def player_spelltraps #自己的魔限
@player[1,5]
end
def opponent_spelltraps #对方的魔限
@opponent[1,5]
end
def monsters #怪兽
player_monsters + opponent_monsters
end
def player_monsters #自己的怪兽
@player[6,5]
end
def opponent_monsters #对方的怪兽
@opponent[6,5]
end
=end
\ No newline at end of file
...@@ -34,7 +34,7 @@ class Iduel ...@@ -34,7 +34,7 @@ class Iduel
Event.push Error.new(0) Event.push Error.new(0)
end end
info.chomp!(RS) info.chomp!(RS)
info.encode! "UTF-8" info.encode! "UTF-8", :invalid => :replace, :undef => :replace
puts ">> #{info}" puts ">> #{info}"
Event.push Event.parse info Event.push Event.parse info
end end
......
#encoding: UTF-8
require_relative 'action' require_relative 'action'
class Action class Action
CardFilter = /(<(?:\[.*?\]\[(?:.*?)\]){0,1}[\s\d]*>|一张怪兽卡|一张魔\/陷卡)/.to_s CardFilter = /(<(?:\[.*?\]\[(?:.*?)\]){0,1}[\s\d]*>|一张怪兽卡|一张魔\/陷卡)/.to_s
...@@ -29,7 +30,8 @@ class Action ...@@ -29,7 +30,8 @@ class Action
def self.parse_card(card) def self.parse_card(card)
if index = card.rindex("[") if index = card.rindex("[")
index += 1 index += 1
Card.find(card[index, card.rindex("]")-index].to_sym) name = card[index, card.rindex("]")-index].to_sym
Card.find(name) || Card.new('id' => 0, 'number' => :"00000000", 'name' => name, 'card_type' => :通常怪兽, 'stats' => "", 'archettypes' => "", 'mediums' => "")
else else
Card.find(nil) Card.find(nil)
end end
...@@ -98,21 +100,18 @@ class Action ...@@ -98,21 +100,18 @@ class Action
"里侧表示" "里侧表示"
end end
end end
def self.escape_card(card) def self.escape_position_short(position)
if [:通常魔法, :永续魔法, :装备魔法, :场地魔法, :通常陷阱, :永续陷阱, :反击陷阱].include? card.card_type case position
if card.position == :set when :attack
"一张魔/陷卡" "表攻"
else when :defense
"<[#{card.card_type}][#{card.name}] >" "表守"
end when :set
else "里守"
if card.position == :set
"一张怪兽卡"
else
"<[#{card.card_type}][#{card.name}] #{card.atk} #{card.def}>"
end
end end
end end
def self.escape_phase(phase) def self.escape_phase(phase)
case phase case phase
when :DP when :DP
...@@ -170,7 +169,7 @@ class Action ...@@ -170,7 +169,7 @@ class Action
when /从#{PosFilter}~特殊召唤#{CardFilter}#{PosFilter}#{PositionFilter}/ when /从#{PosFilter}~特殊召唤#{CardFilter}#{PosFilter}#{PositionFilter}/
SpecialSummon.new from_player, parse_pos($1), parse_pos($3), card($2), msg, parse_position($4) SpecialSummon.new from_player, parse_pos($1), parse_pos($3), card($2), msg, parse_position($4)
when /从手卡~取#{CardFilter}盖到#{PosFilter}/ when /从手卡~取#{CardFilter}盖到#{PosFilter}/
Set.new from_player, parse_pos($2), parse_card($1) Set.new from_player, :hand, parse_pos($2), parse_card($1)
when /将#{CardFilter}从~#{PosFilter}~送往墓地/ when /将#{CardFilter}从~#{PosFilter}~送往墓地/
SendToGraveyard.new(from_player, parse_pos($2), parse_card($1)) SendToGraveyard.new(from_player, parse_pos($2), parse_card($1))
when /将#{PosFilter}#{CardFilter}从游戏中除外/ when /将#{PosFilter}#{CardFilter}从游戏中除外/
...@@ -192,35 +191,57 @@ class Action ...@@ -192,35 +191,57 @@ class Action
system("pause") system("pause")
end end
end end
def escape
case self def run
when FirstToGo $iduel.action self if @from_player
end
class FirstToGo
def escape
"[#{@id}] ◎→[11年3月1日禁卡表]先攻" "[#{@id}] ◎→[11年3月1日禁卡表]先攻"
when Reset end
"[#{@id}] ◎→[11年3月1日禁卡表] Duel!!" end
when ChangePhase class Reset
def escape
"[#{@id}] ◎→[11年3月1日禁卡表] Duel!!"
end
end
class ChangePhase
def escape
"[#{@id}] ◎→#{Action.escape_phase(@phase)}" "[#{@id}] ◎→#{Action.escape_phase(@phase)}"
end end
end end
def run class Turn_End
$iduel.action self if @from_player def escape
"[#{@id}] ◎→=[0:0:0]==回合结束==<0>=[0]\r\n"+ @field.escape
end
end end
end end
=begin class Game_Field
LP:8000 def escape
手卡数:5 "LP:#{@lp}\r\n手卡:#{@hand.size}\r\n卡组:#{@deck.size}\r\n墓地:#{@graveyard.size}\r\n除外:#{@removed.size}\r\n前场:\r\n" +
卡组:38 @field[6..10].collect{|card|" <#{"#{escape_position_short(card)}|#{card.position == :set ? '??' : "[#{card.card_type}][#{card.name}] #{card.atk}#{' '+card.def.to_s}"}" if card}>\r\n"}.join +
墓地:0 "后场:" +
除外:0 @field[1..5].collect{|card|"<#{card.position == :set ? '??' : card.escape if card}>"}.join +
前场: "\r\n场地|<#{@field[0] ? @field[0].escape : '无'}>\r\n" +
<> "◎→\\"
<> end
<> end
<> class Card
<> def escape
后场:<><><><><> if [:通常魔法, :永续魔法, :装备魔法, :场地魔法, :通常陷阱, :永续陷阱, :反击陷阱].include? @card_type
场地|<无> if @position == :set
◎→\\ "一张魔/陷卡"
=end else
\ No newline at end of file "<[#{@card_type}][#{@name}] >"
end
else
if @position == :set
"一张怪兽卡"
else
"<[#{@card_type}][#{@name}] #{@atk} #{@def}>"
end
end
end
end
#encoding: UTF-8
Iduel::Event = Class.new #避开SDL::Event问题,所以没有用class Iduel::Event::Event Iduel::Event = Class.new #避开SDL::Event问题,所以没有用class Iduel::Event::Event
class Iduel::Event class Iduel::Event
@queue = [] @queue = []
......
#encoding: UTF-8 #encoding: UTF-8
$: << "/usr/lib"
alias gbk_puts puts alias gbk_puts puts
def puts(*args) def puts(*args)
gbk_puts(*(args.collect{|item|item.encode "UTF-8"})) gbk_puts(*(args.collect{|item|item.encode "GBK", :invalid => :replace, :undef => :replace}))
end end
def p(*args) def p(*args)
print(args.collect{|item|item.inspect.encode "UTF-8"}.join("\n")+"\n") rescue print(args.join("\n")+"\n") print(args.collect{|item|item.inspect.encode "GBK", :invalid => :replace, :undef => :replace}.join("\n")+"\n") rescue print(args.join("\n")+"\n")
end end
def filesize_inspect(size) def filesize_inspect(size)
......
...@@ -32,7 +32,7 @@ class Scene_Duel < Scene ...@@ -32,7 +32,7 @@ class Scene_Duel < Scene
@phases_window = Window_Phases.new(124, 357) @phases_window = Window_Phases.new(124, 357)
@turn_player = true @turn_player = true
@player_field = Game_Field.new(Deck.load("test1.TXT")) @player_field = Game_Field.new Deck.load("test1.TXT")
@opponent_field = Game_Field.new @opponent_field = Game_Field.new
@player_field_window = Window_Field.new(4, 398, @player_field, true) @player_field_window = Window_Field.new(4, 398, @player_field, true)
...@@ -48,7 +48,8 @@ class Scene_Duel < Scene ...@@ -48,7 +48,8 @@ class Scene_Duel < Scene
@turn_player = !@turn_player @turn_player = !@turn_player
@phase = 0 @phase = 0
@phases_window.player = @turn_player @phases_window.player = @turn_player
Action::Turn_End.new(field)
Action::Turn_End.new(true, "Turn End", @player_field.lp, @player_field.hand.size, @player_field.deck.size, @player_field.graveyard.size, @player_field.removed.size, @player_field, 1).run
else else
@phase = @phases_window.phase = phase @phase = @phases_window.phase = phase
@phases_window.refresh @phases_window.refresh
...@@ -60,15 +61,26 @@ class Scene_Duel < Scene ...@@ -60,15 +61,26 @@ class Scene_Duel < Scene
def first_to_go def first_to_go
Action::FirstToGo.new(true).run Action::FirstToGo.new(true).run
end end
def handle(event) def handle(event)
case event case event
when Event::MouseMotion when Event::MouseMotion
@phases_window.mousemoved event.x, event.y self.windows.reverse.each do |window|
if window.include? event.x, event.y
@active_window = window
@active_window.mousemoved(event.x, event.y)
break
end
end
when Event::MouseButtonDown when Event::MouseButtonDown
case event.button case event.button
when Mouse::BUTTON_LEFT when Mouse::BUTTON_LEFT
@phases_window.mousemoved event.x, event.y @active_window.mousemoved(event.x, event.y)
@phases_window.clicked @active_window.clicked
when 4
@active_window.cursor_up
when 5
@active_window.cursor_down
end end
when Event::MouseButtonUp when Event::MouseButtonUp
case event.button case event.button
...@@ -81,6 +93,10 @@ class Scene_Duel < Scene ...@@ -81,6 +93,10 @@ class Scene_Duel < Scene
@phases_window.index = @phase @phases_window.index = @phase
end end
end end
when Mouse::BUTTON_RIGHT
if @player_field_window.action_window
@player_field_window.action_window.next
end
end end
when Event::KeyDown when Event::KeyDown
case event.sym case event.sym
...@@ -95,6 +111,11 @@ class Scene_Duel < Scene ...@@ -95,6 +111,11 @@ class Scene_Duel < Scene
super super
end end
end end
def handle_iduel(event) def handle_iduel(event)
case event case event
when Iduel::Event::Action when Iduel::Event::Action
......
...@@ -33,6 +33,7 @@ class Window ...@@ -33,6 +33,7 @@ class Window
def destroy def destroy
@destroted = true @destroted = true
@contents.destroy if @contents @contents.destroy if @contents
$scene.windows.delete self
end end
def destroted? def destroted?
@destroted @destroted
......
# To change this template, choose Tools | Templates
# and open the template in the editor.
class Window_Action < Window_List
def initialize(x,y,list,list_available=Array.new(list.size, true))
super(x,y,100,list.size*WLH,300)
@list = list
@item_max = @list.size
@font = TTF.open('fonts/WenQuanYi Micro Hei.ttf', 16)
refresh
self.index = @list.find_index(true) || 0
end
def index=(index)
super(index) if index
end
def draw_item(index, status=0)
case status
when 0
@font.draw_blended_utf8(@contents, @list[index] , 0, index*WLH, 0x00,0x00,0x00)
when 1
@font.draw_blended_utf8(@contents, @list[index] , 0, index*WLH, 0x00,0x00,0xFF)
end
end
def next
if index = @list[@index.next...@list.size].find_index(true)
self.index = index
elsif index = @list[0..@index].find_index(true)
self.index = index
else
self.index = (@index + 1) % @list.size
end
end
def mousemoved(x,y)
self.index = (y - @y) / WLH
end
end
class Window_Config < Window class Window_Config < Window
def initialize(x,y) def initialize(x,y)
super(x,y,$screen.w, $screen.h) super(x,y,$screen.w, $screen.h)
@checkbox = Surface.load 'graphics/system/checkbox.png' @checkbox = Surface.load 'graphics/system/checkbox.png'
@button = Surface.load 'graphics/system/button.png' @button = Surface.load 'graphics/system/button.png'
@background = Surface.load 'graphics/config/background.png' @background = Surface.load 'graphics/config/background.png'
@contents = Surface.load 'graphics/config/background.png' @contents = Surface.load 'graphics/config/background.png'
@font = TTF.open('fonts/WenQuanYi Micro Hei.ttf', 20) @font = TTF.open('fonts/WenQuanYi Micro Hei.ttf', 20)
@index = nil @index = nil
@items = { @items = {
:fullscreen => [0,0,120,WLH], :fullscreen => [0,0,120,WLH],
:avatar_cache => [220, WLH,@button.w/3, @button.h], :avatar_cache => [220, WLH,@button.w/3, @button.h],
...@@ -52,7 +54,7 @@ class Window_Config < Window ...@@ -52,7 +54,7 @@ class Window_Config < Window
clear(*item_rect(@index)) clear(*item_rect(@index))
draw_item(@index, 0) draw_item(@index, 0)
end end
if index.nil? or !index.is_a?(Symbol) if index.nil? or index.is_a?(Emulator)
@index = nil @index = nil
else else
@index = index @index = index
......
...@@ -4,34 +4,85 @@ ...@@ -4,34 +4,85 @@
#  title #  title
#============================================================================== #==============================================================================
class Window_Field class Window_Field < Window
require 'card'
require 'window_action'
Field_Pos = [[56,0], #场地魔法 Field_Pos = [[56,0], #场地魔法
[140, 84], [234,84], [328,84],[422,84], [516, 84], #后场 [140, 84], [234,84], [328,84],[422,84], [516, 84], #后场
[140, 0], [234, 0], [328, 0],[422, 0], [516, 0]] #前场 [140, 0], [234, 0], [328, 0],[422, 0], [516, 0]] #前场
Extra_Pos = [56,84] #额外卡组 Extra_Pos = [56,84] #额外卡组
Graveyard_Pos = [598,0] #墓地 Graveyard_Pos = [598,0] #墓地
Removed_Pos = [657,0] #除外区 Removed_Pos = [657,0] #除外区
Deck_Pos = [598, 84]
Hand_Pos = [0, 201, 62, 8] #手卡: x, y, width, 间距 Hand_Pos = [0, 201, 62, 8] #手卡: x, y, width, 间距
Card_Size = [Card::CardBack.w, Card::CardBack.h]
attr_reader :action_window
def initialize(x, y, field,player=true) def initialize(x, y, field,player=true)
@x = x super(x,y,711,282)
@y = y
@width = 711
@height = 282
@field = field @field = field
@player = player @player = player
@items = {
:deck => Deck_Pos + Card_Size,
:extra => Extra_Pos + Card_Size,
:removed => Removed_Pos + Card_Size,
:graveyard => Graveyard_Pos + Card_Size,
}
refresh refresh
end end
def refresh def refresh
@items.each_key{|index|draw_item(index)}
hand_width = @field.hand.size * Hand_Pos[2] + (@field.hand.size-1) * Hand_Pos[3] hand_width = @field.hand.size * Hand_Pos[2] + (@field.hand.size-1) * Hand_Pos[3]
hand_x = (@width - hand_width) / 2 hand_x = (@width - hand_width) / 2
$scene.refresh_rect(@x,@y,@width,@height) do #if @player
if @player #
@field.field.each_with_index {|card, index|Surface.blit(card.image_small, 0,0,0,0, $screen, @x+Field_Pos[index][0], @y+Field_Pos[index][1]) if card} @field.field.each_with_index {|card, index|@contents.put(card.image_small, Field_Pos[index][0], Field_Pos[index][1]) if card}
@field.hand.each_with_index {|card, index|Surface.blit(card.image_small, 0,0,0,0, $screen, @x+hand_x+index*Hand_Pos[2], @y+Hand_Pos[1]) if card} @field.hand.each_with_index {|card, index|@contents.put(card.image_small, hand_x+index*Hand_Pos[2], Hand_Pos[1]) if card}
else #else
@field.field.each_with_index {|card, index|Surface.transform_blit(card.image_small, $screen, 180, 1, 1, 0, 0, @x+@width-Field_Pos[index][0], @y+@height-Field_Pos[index][1],0) if card} #Surface.transform_blit(@field.deck.first.image_small, @contents, 180, 1, 1, 0, 0, @width-Deck_Pos[0], @height-Deck_Pos[1],0) if !@field.deck.empty?
@field.hand.each_with_index {|card, index|Surface.blit(card.image_small, 0,0,0,0, $screen, @x+@width-hand_x-index*Hand_Pos[2]-card.image_small.w, @y+@height-Hand_Pos[1]-card.image_small.h) if card} # @field.field.each_with_index {|card, index|Surface.transform_blit(card.image_small, @contents, 180, 1, 1, 0, 0, @width-Field_Pos[index][0], @height-Field_Pos[index][1],0) if card}
# @field.hand.each_with_index {|card, index|Surface.blit(card.image_small, 0,0,0,0, @contents, @width-hand_x-index*Hand_Pos[2]-card.image_small.w, @height-Hand_Pos[1]-card.image_small.h) if card}
#end
end
def draw_item(index, status=0)
case index
when :deck
@contents.put(@field.deck.first.image_small, Deck_Pos[0], Deck_Pos[1]) if !@field.deck.empty?
when :extra
@contents.put(@field.extra.first.image_small, Extra_Pos[0], Extra_Pos[1]) if !@field.extra.empty?
when :removed
@contents.put(@field.removed.first.image_small, Removed_Pos[0], Removed_Pos[1]) if !@field.removed.empty?
when :graveyard
@contents.put(@field.graveyard.first.image_small, Graveyard_Pos[0], Graveyard_Pos[1]) if !@field.graveyard.empty?
end
end
def item_rect(index)
@items[index]
end
def index=(index)
return if index == @index
if @index
clear(*item_rect(@index))
draw_item(@index, 0)
end
if index.nil? or !@items.has_key?(index)
@index = nil
@action_window.destroy if @action_window
@action_window = nil
else
@index = index
draw_item(@index, 1)
@action_window = Window_Action.new(@x+@items[index][0],@y+@items[index][1],["测试动作1", "测试动作2", "测试动作3"])
end
end
def mousemoved(x,y)
self.index = @items.each do |index, item_rect|
if x.between?(@x+item_rect[0], @x+item_rect[0]+item_rect[2]) and y.between?(@y+item_rect[1], @y+item_rect[1]+item_rect[3])
break index
end end
end end
end end
#def clicked
end end
\ No newline at end of file
#encoding: UTF-8
class Window_User < Window_List class Window_User < Window_List
WLH = 20 WLH = 20
def initialize(x, y, user) def initialize(x, y, user)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment