Change host, make problem stack not editable

This commit is contained in:
Hamcha 2019-05-17 00:03:05 +02:00
parent fb6a1a0dc9
commit a66f6258d5
Signed by: hamcha
GPG Key ID: A40413D21021EAEE
5 changed files with 49 additions and 50 deletions

View File

@ -42,42 +42,50 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -4.30889, 0, 3.52858 )
title = "Deck"
zoneName = "player1.deck"
faceDown = true
editable = true
[node name="P1Graveyard" parent="Cards" instance=ExtResource( 5 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5.23371, 0, 3.52858 )
title = "Discard pile"
zoneName = "player1.graveyard"
editable = true
[node name="P1Banished" parent="Cards" instance=ExtResource( 5 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5.23371, 0, 2.40401 )
title = "Banished"
zoneName = "player1.banished"
editable = true
[node name="P2Deck" parent="Cards" instance=ExtResource( 5 )]
transform = Transform( -1, 0, -8.74228e-008, 0, 1, 0, 8.74228e-008, 0, -1, 4.309, 0, -3.529 )
title = "Deck"
zoneName = "player2.deck"
faceDown = true
editable = true
[node name="P2Graveyard" parent="Cards" instance=ExtResource( 5 )]
transform = Transform( -1, 0, -8.74228e-008, 0, 1, 0, 8.74228e-008, 0, -1, 5.234, 0, -3.529 )
title = "Discard pile"
zoneName = "player2.graveyard"
editable = true
[node name="P2Banished" parent="Cards" instance=ExtResource( 5 )]
transform = Transform( -1, 0, -8.74228e-008, 0, 1, 0, 8.74228e-008, 0, -1, 5.234, 0, -2.404 )
title = "Banished"
zoneName = "player2.banished"
editable = true
[node name="P1Problem" parent="Cards" instance=ExtResource( 5 )]
transform = Transform( -6.55671e-008, 0, -1.5, 0, 1, 0, 1.5, 0, -6.55671e-008, 2.5, 0, 0 )
title = "Problem"
zoneName = "player1.problem"
offset = -0.01
[node name="P2Problem" parent="Cards" instance=ExtResource( 5 )]
transform = Transform( -6.55671e-008, 0, 1.5, 0, 1, 0, -1.5, 0, -6.55671e-008, -2.5, 0, 0 )
title = "Problem"
zoneName = "player2.problem"
offset = -0.01
[connection signal="card_picked" from="Cards/P1Deck" to="." method="_card_picked_zone" binds= [ "player1.deck" ]]
[connection signal="card_picked" from="Cards/P1Graveyard" to="." method="_card_picked_zone" binds= [ "player1.graveyard" ]]
[connection signal="card_picked" from="Cards/P1Banished" to="." method="_card_picked_zone" binds= [ "player1.banished" ]]

View File

@ -51,6 +51,12 @@ func _input_event(camera, event, click_position, click_normal, shape_idx):
lifted = true
var origin: Vector3 = camera.project_ray_origin(event.position)
var direction: Vector3 = camera.project_ray_normal(event.position)
if flipped:
$CardModel/Border.translation = Vector3(0, 0.01, 0)
$CardModel/Border.rotation = Vector3(0, 0, PI)
else:
$CardModel/Border.translation = Vector3.ZERO
$CardModel/Border.rotation = Vector3.ZERO
if inHand:
translation = Vector3(direction.x * 3.0, 0.25, -0.25)
# Fix rotation if coming from hand
@ -58,12 +64,6 @@ func _input_event(camera, event, click_position, click_normal, shape_idx):
elif inZone:
translation = Vector3.ZERO
rotation = Vector3.ZERO
if flipped:
$CardModel/Border.translation = Vector3(0, 0.01, 0)
$CardModel/Border.rotation = Vector3(0, 0, PI)
else:
$CardModel/Border.translation = Vector3.ZERO
$CardModel/Border.rotation = Vector3.ZERO
else:
var denom := Vector3.UP.dot(direction)
var t: float = (-camera.transform.origin).dot(Vector3.UP) / denom;
@ -98,16 +98,6 @@ func _input_event(camera, event, click_position, click_normal, shape_idx):
animation.queue("tap")
exhausted = true
func clickable() -> bool:
#TODO Better control over if a card can be taken or not
if playerID == 0:
return true
return false
func reset_transform():
$CardModel.translation = Vector3.ZERO
$CardModel.rotation = Vector3.ZERO
func _menu_action(id: int):
match id:
0: # Flip
@ -122,25 +112,6 @@ func _check_drop_anim(anim_name):
if anim_name == "drop":
emit_signal("card_dropped_anim")
func tween_move_to(targetPos: Vector3, duration: float = 0.1):
$Tween.interpolate_property(self, "translation",
translation, targetPos, duration,
Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
func tween_rotate(targetRot: Vector3, duration: float = 0.1):
$Tween.interpolate_property(self, "rotation",
rotation, targetRot, duration,
Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
func tween():
$Tween.start()
func disableInput():
$CollisionShape.disabled = true
func enableInput():
$CollisionShape.disabled = false
# warning-ignore:unused_argument
func _card_fetched(result: int, response_code: int, headers: PoolStringArray, body: PoolByteArray):
assert(result == HTTPRequest.RESULT_SUCCESS)
@ -159,3 +130,32 @@ func _card_fetched(result: int, response_code: int, headers: PoolStringArray, bo
texture.create_from_image(img)
mat.albedo_texture = texture
cardImage.set_surface_material(0, mat)
func tween_move_to(targetPos: Vector3, duration: float = 0.1):
$Tween.interpolate_property(self, "translation",
translation, targetPos, duration,
Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
func tween_rotate(targetRot: Vector3, duration: float = 0.1):
$Tween.interpolate_property(self, "rotation",
rotation, targetRot, duration,
Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
func tween():
$Tween.start()
func disableInput():
$CollisionShape.disabled = true
func enableInput():
$CollisionShape.disabled = false
func clickable() -> bool:
#TODO Better control over if a card can be taken or not
if playerID == 0:
return true
return false
func reset_transform():
$CardModel.translation = Vector3.ZERO
$CardModel.rotation = Vector3.ZERO

View File

@ -9,6 +9,8 @@ signal card_picked(card)
export var title: String
export var zoneName: String
export var faceDown: bool
export var editable: bool
export var offset: float
var clicked: bool = false
var cards: Array = []
@ -47,5 +49,5 @@ func reorder_cards():
var i := 0
var count := cards.size()
for card in cards:
card.translation.y = (count-i)*CARD_DISTANCE
card.translation.y = offset+(count-i)*CARD_DISTANCE
i += 1

View File

@ -1,6 +1,6 @@
extends Node
const HOST = "https://mlpccg.zyg.ovh/"
const HOST = "https://mcg.zyg.ovh/"
const IMGURL = HOST + "images/cards/"
func res_file_name(url: String) -> String:

View File

@ -31,18 +31,7 @@ onready var zones: Dictionary = {
}
func _ready():
add_card("pr10", 0, false)
add_card("ff33", 0, true)
add_card("ff100", 0, true)
add_card("ff44", 0, true)
add_card("eo11", 0, true)
add_card("pr168", 0, true)
add_card("ad176", 0, true)
add_card("ff33", 1, true)
add_card("ff33", 1, true)
add_card("ff33", 1, true)
add_card("ff33", 1, true)
add_card("pr12", 0, false)
reorder_hand(0)
reorder_hand(1)
@ -113,7 +102,7 @@ func _physics_process(delta):
var to: Vector3 = from + camera.project_ray_normal(absMousePos) * 1000
var result := space_state.intersect_ray(from, to, [self, holdingCard], 0x7FFFFFFF, true, true)
if result:
if result.collider is Stack:
if result.collider is Stack and result.collider.editable:
currentZone = result.collider
else:
currentZone = null