-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
399 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>CSV Reader Tool</title> | ||
<!-- Reference to FontAwesome --> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> | ||
<!-- Reference to your Stylesheet --> | ||
<link rel="stylesheet" href="styles.css"> | ||
</head> | ||
<body> | ||
<header> | ||
<h1>CSV Reader Tool</h1> | ||
</header> | ||
<main> | ||
<input type="file" id="csvFileInput" accept=".csv"> | ||
<div id="validationStatus"></div> <!-- Area to display validation status --> | ||
<div id="dataTable"></div> <!-- Container for the data table --> | ||
</main> | ||
<footer> | ||
<p>CSV Reader Tool © 2023</p> | ||
</footer> | ||
<!-- Reference to jQuery --> | ||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> | ||
<!-- Reference to PapaParse --> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/5.3.0/papaparse.min.js"></script> | ||
<!-- Reference to your JavaScript File --> | ||
<script src="scripts.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
let jsonData = []; // Global variable to hold the JSON data | ||
let testout; | ||
|
||
var numTiers = 0; | ||
|
||
|
||
document.getElementById('csvFileInput').addEventListener('change', (event) => { | ||
const file = event.target.files[0]; | ||
Papa.parse(file, { | ||
header: true, // Treat the first row as headers | ||
complete: function(results) { | ||
jsonData = results.data; // Convert CSV data to JSON | ||
console.log(jsonData); | ||
displayTable(jsonData); | ||
validateData(jsonData); | ||
generateDynamicDropdown(jsonData); | ||
|
||
} | ||
}); | ||
}); | ||
|
||
|
||
|
||
function displayTable(data) { | ||
const table = document.createElement('table'); | ||
const thead = document.createElement('thead'); | ||
const tbody = document.createElement('tbody'); | ||
|
||
// Create table header | ||
const headerRow = document.createElement('tr'); | ||
if (data.length > 0) { | ||
Object.keys(data[0]).forEach(header => { | ||
const th = document.createElement('th'); | ||
th.textContent = header; | ||
headerRow.appendChild(th); | ||
}); | ||
} | ||
thead.appendChild(headerRow); | ||
|
||
// Create table body | ||
data.forEach((row, rowIndex) => { | ||
const tr = document.createElement('tr'); | ||
Object.values(row).forEach(cell => { | ||
const td = document.createElement('td'); | ||
td.textContent = cell; | ||
tr.appendChild(td); | ||
}); | ||
tbody.appendChild(tr); | ||
|
||
// Highlight the row if it is invalid | ||
if (!isRowValid(row)) { | ||
tr.style.backgroundColor = 'red'; // Highlight the entire row | ||
} | ||
}); | ||
|
||
table.appendChild(thead); | ||
table.appendChild(tbody); | ||
document.getElementById('dataTable').innerHTML = ''; // Clear any previous data | ||
document.getElementById('dataTable').appendChild(table); | ||
} | ||
|
||
function isRowValid(row) { | ||
// Count populated cells in a row object | ||
let populatedCells = 0; | ||
Object.values(row).forEach(cell => { | ||
if (cell.trim() !== '') { | ||
populatedCells++; | ||
} | ||
}); | ||
|
||
// Check if more than two cells are populated in the row | ||
return populatedCells <= 2; | ||
} | ||
|
||
function validateData(data) { | ||
let isValidFile = true; | ||
data.slice(1).forEach(row => { | ||
if (!isRowValid(row)) { | ||
isValidFile = false; | ||
} | ||
}); | ||
|
||
const statusElement = document.getElementById('validationStatus'); | ||
numTiers = Object.keys(jsonData[0]).length; | ||
statusElement.textContent = isValidFile ? 'File is a valid '+parseInt(numTiers/2)+' tiered dynamic dropdown.' : 'File is invalid. Please check highlighted rows.'; | ||
statusElement.style.color = isValidFile ? 'green' : 'red'; | ||
} | ||
|
||
|
||
|
||
function generateDynamicDropdown(data) { | ||
// Example: Assume each row in the data has a 'category' and 'subcategory' field | ||
let categories = {}; | ||
testout = data; | ||
console.log("data: "+data) | ||
data.forEach(row => { | ||
if (row.category && row.subcategory) { | ||
if (!categories[row.category]) { | ||
categories[row.category] = []; | ||
} | ||
categories[row.category].push(row.subcategory); | ||
} | ||
}); | ||
|
||
// Now create a dropdown menu based on categories | ||
let dropdown = '<select id="categorySelect">'; | ||
for (let category in categories) { | ||
dropdown += `<optgroup label="${category}">`; | ||
categories[category].forEach(subcategory => { | ||
dropdown += `<option value="${subcategory}">${subcategory}</option>`; | ||
}); | ||
dropdown += '</optgroup>'; | ||
} | ||
dropdown += '</select>'; | ||
|
||
document.getElementById('dataTable').insertAdjacentHTML('afterend', dropdown); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* Add your CSS styles here */ | ||
body { | ||
font-family: Arial, sans-serif; | ||
} | ||
|
||
header, footer { | ||
text-align: center; | ||
padding: 1em; | ||
background-color: #f4f4f4; | ||
} | ||
|
||
main { | ||
margin: 2em; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Normalize EOL for all files that Git considers text files. | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Godot 4+ specific ignores | ||
.godot/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
extends Area3D | ||
|
||
var clicksToPop : int = 3 | ||
var sizeIncrease : float = 0.2 | ||
var scoreValue : int = 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
[gd_scene load_steps=8 format=3 uid="uid://dk17utktif2gs"] | ||
|
||
[ext_resource type="Script" path="res://BalloonPopper/Balloon.gd" id="1_iyw13"] | ||
|
||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_7ghci"] | ||
albedo_color = Color(1, 0, 0, 1) | ||
metallic = 0.85 | ||
metallic_specular = 0.24 | ||
metallic_texture_channel = 3 | ||
roughness = 0.2 | ||
rim_enabled = true | ||
rim = 0.78 | ||
rim_tint = 0.8 | ||
clearcoat_enabled = true | ||
|
||
[sub_resource type="SphereMesh" id="SphereMesh_k4erw"] | ||
|
||
[sub_resource type="SphereShape3D" id="SphereShape3D_tfo1q"] | ||
|
||
[sub_resource type="PrismMesh" id="PrismMesh_ne1ja"] | ||
|
||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_v2q1e"] | ||
albedo_color = Color(0.431373, 0.215686, 0, 1) | ||
|
||
[sub_resource type="RibbonTrailMesh" id="RibbonTrailMesh_lkiha"] | ||
material = SubResource("StandardMaterial3D_v2q1e") | ||
shape = 0 | ||
size = 0.05 | ||
|
||
[node name="Main" type="Node3D"] | ||
transform = Transform3D(0.988477, 0, 0, 0, 0.988477, 0, 0, 0, 0.988477, 0, 0, 0) | ||
|
||
[node name="Balloon" type="Area3D" parent="."] | ||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0447183, 0) | ||
script = ExtResource("1_iyw13") | ||
|
||
[node name="sphereMesh" type="MeshInstance3D" parent="Balloon"] | ||
transform = Transform3D(-0.997577, -0.0119507, -0.0685306, -0.0133845, 0.9997, 0.0205016, 0.0682651, 0.0213691, -0.997438, 0.00279832, 5.96046e-08, -0.00688982) | ||
material_override = SubResource("StandardMaterial3D_7ghci") | ||
mesh = SubResource("SphereMesh_k4erw") | ||
|
||
[node name="sphereCollision" type="CollisionShape3D" parent="Balloon"] | ||
shape = SubResource("SphereShape3D_tfo1q") | ||
|
||
[node name="bottomMesh" type="MeshInstance3D" parent="Balloon"] | ||
transform = Transform3D(0.213792, 0, 0, 0, 0.221636, 0, 0, 0, 0.116729, 0, -0.541416, 0) | ||
material_override = SubResource("StandardMaterial3D_7ghci") | ||
mesh = SubResource("PrismMesh_ne1ja") | ||
|
||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Balloon"] | ||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.935999, 0) | ||
mesh = SubResource("RibbonTrailMesh_lkiha") | ||
|
||
[node name="Camera3D" type="Camera3D" parent="."] | ||
transform = Transform3D(1, 0, 0, 0, 0.9683, 0.249789, 0, -0.249789, 0.9683, 0, 1.15235, 3.89011) | ||
fov = 86.7705 | ||
|
||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] | ||
transform = Transform3D(0.832902, 0.172366, -0.525894, 0, 0.950261, 0.311456, 0.553421, -0.259412, 0.791474, -4.72276, 3.28655, 9.76698) |
12 changes: 12 additions & 0 deletions
12
godot/GodotMiniProjects/BalloonPopper/new_standard_material_3d.tres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[gd_resource type="StandardMaterial3D" format=3 uid="uid://dmjcg37mrlljl"] | ||
|
||
[resource] | ||
albedo_color = Color(1, 0, 0, 1) | ||
metallic = 0.85 | ||
metallic_specular = 0.24 | ||
metallic_texture_channel = 3 | ||
roughness = 0.2 | ||
rim_enabled = true | ||
rim = 0.78 | ||
rim_tint = 0.8 | ||
clearcoat_enabled = true |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://cb2ofvijox614" | ||
path.s3tc="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex" | ||
metadata={ | ||
"imported_formats": ["s3tc_bptc"], | ||
"vram_texture": true | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://icon.svg" | ||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex"] | ||
|
||
[params] | ||
|
||
compress/mode=2 | ||
compress/high_quality=false | ||
compress/lossy_quality=0.7 | ||
compress/hdr_compression=1 | ||
compress/normal_map=0 | ||
compress/channel_pack=0 | ||
mipmaps/generate=true | ||
mipmaps/limit=-1 | ||
roughness/mode=0 | ||
roughness/src_normal="" | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/normal_map_invert_y=false | ||
process/hdr_as_srgb=false | ||
process/hdr_clamp_exposure=false | ||
process/size_limit=0 | ||
detect_3d/compress_to=0 | ||
svg/scale=1.0 | ||
editor/scale_with_editor_scale=false | ||
editor/convert_colors_with_editor_theme=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[gd_resource type="StandardMaterial3D" format=3 uid="uid://dmjcg37mrlljl"] | ||
|
||
[resource] | ||
albedo_color = Color(1, 0, 0, 1) | ||
metallic = 0.85 | ||
metallic_specular = 0.24 | ||
metallic_texture_channel = 3 | ||
roughness = 0.2 | ||
rim_enabled = true | ||
rim = 0.78 | ||
rim_tint = 0.8 | ||
clearcoat_enabled = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
; Engine configuration file. | ||
; It's best edited using the editor UI and not directly, | ||
; since the parameters that go here are not all obvious. | ||
; | ||
; Format: | ||
; [section] ; section goes between [] | ||
; param=value ; assign values to parameters | ||
|
||
config_version=5 | ||
|
||
[application] | ||
|
||
config/name="GodotMiniProjects" | ||
config/features=PackedStringArray("4.1", "Forward Plus") | ||
config/icon="res://icon.svg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.