Commit d1bdc32e authored by 神楽坂玲奈's avatar 神楽坂玲奈

背面卡图更换

parent d5296ddb
......@@ -13,6 +13,8 @@ class Card
#PicPath = '/media/44CACC1DCACC0D5C/game/yu-gi-oh/YGODATA/YGOPIC'
PicPath = 'E:/game/yu-gi-oh/YGODATA/YGOPIC'
CardBack = Surface.load "graphics/field/card.jpg"
CardBack_Small = Surface.load "graphics/field/card_small.gif"
class << self
def find(id, order_by=nil)
case id
......@@ -24,8 +26,7 @@ class Card
when Hash
old_new(id)
when nil
Card.find(1)#.instance_eval{@image = CardBack} unless @all[1]
@all[1]
Card::Unknown
else
sql = "select * from YGODATA where " << id
sql << " order by #{order_by}" if order_by
......@@ -165,4 +166,6 @@ attr_accessor :tokens
def spell?
[:通常魔法, :速攻魔法, :装备魔法, :场地魔法, :仪式魔法, :永续魔法].include? card_type
end
Unknown = Card.new('id' => 0, 'number' => :"00000000", 'name' => "", 'lore' => '', 'card_type' => :通常怪兽, 'stats' => "", 'archettypes' => "", 'mediums' => "")
Unknown.instance_eval{@image = CardBack; @image_small = CardBack_Small}
end
\ No newline at end of file
#encoding: UTF-8
class Game_Card
attr_accessor :card, :position #attack|defense|set,
attr_accessor :atk, :def
@@count = 0
def initialize(card=nil)
@@count += 1
puts "创建活动卡片<#{card ? card.name : '??'}>,共计#{@@count}张"
@card = card || Card.find(nil)
reset
end
def reset
@position = :set
@atk = @card.atk
@def = @card.def
end
def known?
true
@card != Card::Unknown
end
def image_small
if @position == :set
......@@ -19,6 +25,9 @@ class Game_Card
end
end
def method_missing(method, *args)
if method.to_s[0,9]== "original_"
method = method.to_s[9, method.to_s.size-9]
end
@card.send(method, *args)
end
end
\ No newline at end of file
......@@ -42,7 +42,7 @@ class Scene_Duel < Scene
@player_field = Game_Field.new Deck.load("test1.TXT")
@opponent_field = Game_Field.new
@fieldback_window = Window_FieldBack.new(128,175)
@fieldback_window = Window_FieldBack.new(130,174)
@player_field_window = Window_Field.new(4, 398, @player_field, true)
@opponent_field_window = Window_Field.new(4, 60, @opponent_field, false)
......@@ -54,7 +54,6 @@ class Scene_Duel < Scene
@cardinfo_window = Window_CardInfo.new(1024-160, 0)
@action_window = Window_Action.new
$screen.update_rect(0,0,0,0)
end
def change_phase(phase)
......
......@@ -26,7 +26,7 @@ class Window_Field < Window
super(x,y,711,282)
@field = field
@player = player
@font = TTF.open('fonts/WenQuanYi Micro Hei.ttf', 12)
@items = {}
@cards = {}
refresh
......@@ -81,6 +81,16 @@ class Window_Field < Window
@contents.put(@cards[index].image_small, @items[index][0], @items[index][1])
@contents.put(@border, @items[index][0]-1, @items[index][1]-1) if status == 1
end
if (6..10).include?(index) and @cards[index].position != :set
size = @font.text_size('/')
y = Field_Pos[index][1] + Card_Size[1] - size[1]
size = size[0]
x = Field_Pos[index][0] + (Card_Size[0] - size) / 2
@font.draw_blended_utf8(@contents, '/' , x, y, 0xFF, 0xFF, 0xFF)
@font.draw_blended_utf8(@contents, @cards[index].atk.to_s , x - @font.text_size(@cards[index].atk.to_s)[0], y, 0xFF, 0xFF, 0xFF)
@font.draw_blended_utf8(@contents, @cards[index].def.to_s , x + size, y, 0xFF, 0xFF, 0xFF)
end
end
def item_rect(index)
@items[index]
......@@ -172,7 +182,7 @@ class Window_Field < Window
}
end
$scene.action_window.list = @action_names
$scene.cardinfo_window.card = @card
$scene.cardinfo_window.card = @card if @card.known?
$scene.action_window.x = @x + @items[@index][0] - ($scene.action_window.width - @items[@index][2])/2
$scene.action_window.y = @y + @items[@index][1] - $scene.action_window.viewport[3]#height
end
......
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