Compare commits

..

6 commits

12 changed files with 319 additions and 15 deletions

Binary file not shown.

View file

@ -26,7 +26,7 @@ script = ExtResource( 2 )
transform = Transform( 0.4, 0, 0, 0, 2.98023e-008, -0.4, 0, 0.4, 2.98023e-008, 0, -0.6, -1.3 ) transform = Transform( 0.4, 0, 0, 0, 2.98023e-008, -0.4, 0, 0.4, 2.98023e-008, 0, -0.6, -1.3 )
[node name="OppHand" type="Spatial" parent="Camera"] [node name="OppHand" type="Spatial" parent="Camera"]
transform = Transform( 0.3, 0, 0, 0, -1.31134e-008, 0.3, 0, -0.3, -1.31134e-008, -2.48878e-016, 0.629771, -1.3 ) transform = Transform( 0.3, 0, 0, 0, -1.49012e-008, 0.3, 0, -0.3, -1.49012e-008, 0, 0.63, -1.3 )
[node name="MeshInstance" type="MeshInstance" parent="."] [node name="MeshInstance" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.001, 0 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.001, 0 )
@ -38,39 +38,39 @@ material/0 = null
[node name="Cards" type="Spatial" parent="."] [node name="Cards" type="Spatial" parent="."]
[node name="P1Deck" parent="Cards" instance=ExtResource( 5 )] [node name="P1Deck" parent="Cards" instance=ExtResource( 5 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -4.30889, 0, 3.52858 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -4.309, 0, 2.529 )
title = "Deck" title = "Deck"
zoneName = "player1.deck" zoneName = "player1.deck"
faceDown = true faceDown = true
editable = true editable = true
[node name="P1Graveyard" parent="Cards" instance=ExtResource( 5 )] [node name="P1Graveyard" parent="Cards" instance=ExtResource( 5 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5.23371, 0, 3.52858 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5.234, 0, 2.529 )
title = "Discard pile" title = "Discard pile"
zoneName = "player1.graveyard" zoneName = "player1.graveyard"
editable = true editable = true
[node name="P1Banished" parent="Cards" instance=ExtResource( 5 )] [node name="P1Banished" parent="Cards" instance=ExtResource( 5 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5.23371, 0, 2.40401 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5.234, 0, 1.404 )
title = "Banished" title = "Banished"
zoneName = "player1.banished" zoneName = "player1.banished"
editable = true editable = true
[node name="P2Deck" parent="Cards" instance=ExtResource( 5 )] [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 ) transform = Transform( -1, 0, -8.74228e-008, 0, 1, 0, 8.74228e-008, 0, -1, 4.309, 0, -2.529 )
title = "Deck" title = "Deck"
zoneName = "player2.deck" zoneName = "player2.deck"
faceDown = true faceDown = true
editable = true editable = true
[node name="P2Graveyard" parent="Cards" instance=ExtResource( 5 )] [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 ) transform = Transform( -1, 0, -8.74228e-008, 0, 1, 0, 8.74228e-008, 0, -1, 5.234, 0, -2.529 )
title = "Discard pile" title = "Discard pile"
zoneName = "player2.graveyard" zoneName = "player2.graveyard"
editable = true editable = true
[node name="P2Banished" parent="Cards" instance=ExtResource( 5 )] [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 ) transform = Transform( -1, 0, -8.74228e-008, 0, 1, 0, 8.74228e-008, 0, -1, 5.234, 0, -1.404 )
title = "Banished" title = "Banished"
zoneName = "player2.banished" zoneName = "player2.banished"
editable = true editable = true

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=4 format=2] [gd_scene load_steps=5 format=2]
[ext_resource path="res://Scenes/Scripts/BoardUI.gd" type="Script" id=1] [ext_resource path="res://Scenes/Scripts/BoardUI.gd" type="Script" id=1]
[ext_resource path="res://MLPAssets/Placeholders/unknowncard.jpg" type="Texture" id=2] [ext_resource path="res://MLPAssets/Placeholders/unknowncard.jpg" type="Texture" id=2]
[ext_resource path="res://Scenes/UI/PhaseIcon.tscn" type="PackedScene" id=3]
[sub_resource type="Animation" id=1] [sub_resource type="Animation" id=1]
resource_name = "fade ui card" resource_name = "fade ui card"
@ -41,7 +42,19 @@ tracks/2/keys = {
"times": PoolRealArray( 0, 0.1 ), "times": PoolRealArray( 0, 0.1 ),
"transitions": PoolRealArray( 1, 1 ), "transitions": PoolRealArray( 1, 1 ),
"update": 0, "update": 0,
"values": [ 0.0, 40.0 ] "values": [ 20, 60 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("CardZoom:rect_size")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0, 0.1 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector2( 344, 500 ), Vector2( 344, 500 ) ]
} }
[node name="BoardUI" type="Control"] [node name="BoardUI" type="Control"]
@ -50,16 +63,40 @@ anchor_bottom = 1.0
mouse_filter = 2 mouse_filter = 2
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="Panel" type="Panel" parent="."]
anchor_right = 1.0
margin_bottom = 40.0
[node name="CardZoom" type="TextureRect" parent="."] [node name="CardZoom" type="TextureRect" parent="."]
visible = false visible = false
modulate = Color( 1, 1, 1, 0 ) modulate = Color( 1, 1, 1, 0 )
anchor_bottom = 1.0
margin_left = 40.0 margin_left = 40.0
margin_top = 20.0
margin_right = 384.0 margin_right = 384.0
margin_bottom = 520.0 margin_bottom = -280.0
rect_scale = Vector2( 0.8, 0.8 ) rect_scale = Vector2( 0.8, 0.8 )
mouse_filter = 2 mouse_filter = 2
size_flags_horizontal = 3
size_flags_vertical = 3
texture = ExtResource( 2 ) texture = ExtResource( 2 )
expand = true
stretch_mode = 5 stretch_mode = 5
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
"anims/fade ui card" = SubResource( 1 ) "anims/fade ui card" = SubResource( 1 )
[node name="ReadyPhase" parent="." instance=ExtResource( 3 )]
position = Vector2( 565, 40 )
[node name="TroublePhase" parent="." instance=ExtResource( 3 )]
position = Vector2( 615, 40 )
phaseID = 1
[node name="MainPhase" parent="." instance=ExtResource( 3 )]
position = Vector2( 665, 40 )
phaseID = 2
[node name="ScorePhase" parent="." instance=ExtResource( 3 )]
position = Vector2( 715, 40 )
phaseID = 3

View file

@ -32,10 +32,10 @@ onready var texture: Texture = cardImage.get_surface_material(0)
func set_cardid(val: String): func set_cardid(val: String):
cardID = val cardID = val
if ready: if ready:
Remote.fetch(Remote.IMGURL + val + ".jpg", self, "_card_fetched") Remote.fetch(Remote.IMGURL + val + ".webp", self, "_card_fetched")
func _ready(): func _ready():
Remote.fetch(Remote.IMGURL + cardID + ".jpg", self, "_card_fetched") Remote.fetch(Remote.IMGURL + cardID + ".webp", self, "_card_fetched")
ready = true ready = true
func _mouse_hover(): func _mouse_hover():
@ -85,7 +85,7 @@ func _check_drop_anim(anim_name):
func _card_fetched(result: int, response_code: int, headers: PoolStringArray, body: PoolByteArray): func _card_fetched(result: int, response_code: int, headers: PoolStringArray, body: PoolByteArray):
assert(result == HTTPRequest.RESULT_SUCCESS) assert(result == HTTPRequest.RESULT_SUCCESS)
var img = Image.new() var img = Image.new()
var err = img.load_jpg_from_buffer(body) var err = img.load_webp_from_buffer(body)
assert(err == OK) assert(err == OK)
# Depending if card pic is a problem or not, rotate the card image mesh # Depending if card pic is a problem or not, rotate the card image mesh
if img.get_width() > img.get_height(): if img.get_width() > img.get_height():

View file

@ -18,6 +18,9 @@ func fetch(url: String, cbObj: Object, cbFn: String):
cbObj.call(cbFn, HTTPRequest.RESULT_SUCCESS, 200, [], buf) cbObj.call(cbFn, HTTPRequest.RESULT_SUCCESS, 200, [], buf)
return return
var req := HTTPRequest.new() var req := HTTPRequest.new()
# On HTML5 we cannot use threaded requests
# On other platforms (such as Android), we *need* to!
req.use_threads = !OS.has_feature("HTML5")
add_child(req) add_child(req)
req.connect("request_completed", self, "_request_completed", [url, cbObj, cbFn]) req.connect("request_completed", self, "_request_completed", [url, cbObj, cbFn])
req.request(url) req.request(url)

View file

@ -47,6 +47,9 @@ func _ready():
for i in range(0,6): for i in range(0,6):
draw_card(0, "player1.deck") draw_card(0, "player1.deck")
for i in range(0,6):
draw_card(1, "player1.deck")
func _input(event: InputEvent): func _input(event: InputEvent):
# Camera zoom # Camera zoom
if event.is_action("zoom_in"): if event.is_action("zoom_in"):
@ -190,7 +193,10 @@ func reparent(object: Node, from: Node, to: Node):
from.remove_child(object) from.remove_child(object)
to.add_child(object) to.add_child(object)
object.set_owner(to) object.set_owner(to)
reorder_hand(0) if to == hand or from == hand:
reorder_hand(0)
if to == oppHand or from == oppHand:
reorder_hand(1)
func add_card(cardID: String, playerID: int, zone: String): func add_card(cardID: String, playerID: int, zone: String):
var card := CardTemplate.instance() var card := CardTemplate.instance()
@ -227,7 +233,10 @@ func draw_card(playerID: int, from: String):
card.inZone = false card.inZone = false
card.flipped = false card.flipped = false
card.animation.queue("flip-back-fast") card.animation.queue("flip-back-fast")
reparent(card, zones[from], hand) var target := hand
if playerID != 0:
target = oppHand
reparent(card, zones[from], target)
func check_hand_drop(card: Card): func check_hand_drop(card: Card):
# Re-order hand as soon as the animation is over # Re-order hand as soon as the animation is over

8
Scenes/UI/PhaseIcon.gd Normal file
View file

@ -0,0 +1,8 @@
extends Node2D
export var phaseID = 0
const iconSize = 80
func _ready():
$Icon.region_rect.position.x = phaseID * iconSize

13
Scenes/UI/PhaseIcon.tscn Normal file
View file

@ -0,0 +1,13 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Scenes/UI/PhaseIcon.gd" type="Script" id=1]
[ext_resource path="res://UIAssets/GameBar/phase-icons.png" type="Texture" id=2]
[node name="PhaseIcon" type="Node2D"]
script = ExtResource( 1 )
[node name="Icon" type="Sprite" parent="."]
scale = Vector2( 0.65, 0.65 )
texture = ExtResource( 2 )
region_enabled = true
region_rect = Rect2( 0, 0, 80, 80 )

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/phase-icons.png-d392634a9aaae505bec07ec577a1a735.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://UIAssets/GameBar/phase-icons.png"
dest_files=[ "res://.import/phase-icons.png-d392634a9aaae505bec07ec577a1a735.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=2
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -20,3 +20,201 @@ html/custom_html_shell=""
html/head_include="" html/head_include=""
custom_template/release="" custom_template/release=""
custom_template/debug="" custom_template/debug=""
[preset.1]
name="Android"
platform="Android"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="B:/OneDrive/Documenti/VC/mlpcardgame-html/index.apk"
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""
[preset.1.options]
graphics/32_bits_framebuffer=true
one_click_deploy/clear_previous_install=true
custom_package/debug=""
custom_package/release=""
command_line/extra_args=""
version/code=1
version/name="1.0"
package/unique_name="com.mcg.mlpcardgame"
package/name="MLP CARD GAME"
package/signed=true
screen/immersive_mode=true
screen/orientation=0
screen/support_small=true
screen/support_normal=true
screen/support_large=true
screen/support_xlarge=true
screen/opengl_debug=false
launcher_icons/xxxhdpi_192x192=""
launcher_icons/xxhdpi_144x144=""
launcher_icons/xhdpi_96x96=""
launcher_icons/hdpi_72x72=""
launcher_icons/mdpi_48x48=""
keystore/debug=""
keystore/debug_user=""
keystore/debug_password=""
keystore/release=""
keystore/release_user=""
keystore/release_password=""
apk_expansion/enable=false
apk_expansion/SALT=""
apk_expansion/public_key=""
architectures/armeabi-v7a=true
architectures/arm64-v8a=true
architectures/x86=false
architectures/x86_64=false
permissions/custom_permissions=PoolStringArray( )
permissions/access_checkin_properties=false
permissions/access_coarse_location=false
permissions/access_fine_location=false
permissions/access_location_extra_commands=false
permissions/access_mock_location=false
permissions/access_network_state=true
permissions/access_surface_flinger=false
permissions/access_wifi_state=false
permissions/account_manager=false
permissions/add_voicemail=false
permissions/authenticate_accounts=false
permissions/battery_stats=false
permissions/bind_accessibility_service=false
permissions/bind_appwidget=false
permissions/bind_device_admin=false
permissions/bind_input_method=false
permissions/bind_nfc_service=false
permissions/bind_notification_listener_service=false
permissions/bind_print_service=false
permissions/bind_remoteviews=false
permissions/bind_text_service=false
permissions/bind_vpn_service=false
permissions/bind_wallpaper=false
permissions/bluetooth=false
permissions/bluetooth_admin=false
permissions/bluetooth_privileged=false
permissions/brick=false
permissions/broadcast_package_removed=false
permissions/broadcast_sms=false
permissions/broadcast_sticky=false
permissions/broadcast_wap_push=false
permissions/call_phone=false
permissions/call_privileged=false
permissions/camera=false
permissions/capture_audio_output=false
permissions/capture_secure_video_output=false
permissions/capture_video_output=false
permissions/change_component_enabled_state=false
permissions/change_configuration=false
permissions/change_network_state=false
permissions/change_wifi_multicast_state=false
permissions/change_wifi_state=false
permissions/clear_app_cache=false
permissions/clear_app_user_data=false
permissions/control_location_updates=false
permissions/delete_cache_files=false
permissions/delete_packages=false
permissions/device_power=false
permissions/diagnostic=false
permissions/disable_keyguard=false
permissions/dump=false
permissions/expand_status_bar=false
permissions/factory_test=false
permissions/flashlight=false
permissions/force_back=false
permissions/get_accounts=false
permissions/get_package_size=false
permissions/get_tasks=false
permissions/get_top_activity_info=false
permissions/global_search=false
permissions/hardware_test=false
permissions/inject_events=false
permissions/install_location_provider=false
permissions/install_packages=false
permissions/install_shortcut=false
permissions/internal_system_window=false
permissions/internet=true
permissions/kill_background_processes=false
permissions/location_hardware=false
permissions/manage_accounts=false
permissions/manage_app_tokens=false
permissions/manage_documents=false
permissions/master_clear=false
permissions/media_content_control=false
permissions/modify_audio_settings=false
permissions/modify_phone_state=false
permissions/mount_format_filesystems=false
permissions/mount_unmount_filesystems=false
permissions/nfc=false
permissions/persistent_activity=false
permissions/process_outgoing_calls=false
permissions/read_calendar=false
permissions/read_call_log=false
permissions/read_contacts=false
permissions/read_external_storage=true
permissions/read_frame_buffer=false
permissions/read_history_bookmarks=false
permissions/read_input_state=false
permissions/read_logs=false
permissions/read_phone_state=false
permissions/read_profile=false
permissions/read_sms=false
permissions/read_social_stream=false
permissions/read_sync_settings=false
permissions/read_sync_stats=false
permissions/read_user_dictionary=false
permissions/reboot=false
permissions/receive_boot_completed=false
permissions/receive_mms=false
permissions/receive_sms=false
permissions/receive_wap_push=false
permissions/record_audio=false
permissions/reorder_tasks=false
permissions/restart_packages=false
permissions/send_respond_via_message=false
permissions/send_sms=false
permissions/set_activity_watcher=false
permissions/set_alarm=false
permissions/set_always_finish=false
permissions/set_animation_scale=false
permissions/set_debug_app=false
permissions/set_orientation=false
permissions/set_pointer_speed=false
permissions/set_preferred_applications=false
permissions/set_process_limit=false
permissions/set_time=false
permissions/set_time_zone=false
permissions/set_wallpaper=false
permissions/set_wallpaper_hints=false
permissions/signal_persistent_processes=false
permissions/status_bar=false
permissions/subscribed_feeds_read=false
permissions/subscribed_feeds_write=false
permissions/system_alert_window=false
permissions/transmit_ir=false
permissions/uninstall_shortcut=false
permissions/update_device_stats=false
permissions/use_credentials=false
permissions/use_sip=false
permissions/vibrate=false
permissions/wake_lock=false
permissions/write_apn_settings=false
permissions/write_calendar=false
permissions/write_call_log=false
permissions/write_contacts=false
permissions/write_external_storage=true
permissions/write_gservices=false
permissions/write_history_bookmarks=false
permissions/write_profile=false
permissions/write_secure_settings=false
permissions/write_settings=false
permissions/write_sms=false
permissions/write_social_stream=false
permissions/write_sync_settings=false
permissions/write_user_dictionary=false

View file

@ -44,6 +44,8 @@ Remote="*res://Scenes/Global/Remote.tscn"
window/size/width=1280 window/size/width=1280
window/size/height=800 window/size/height=800
window/stretch/mode="2d"
window/stretch/aspect="expand"
[input] [input]