From e9b2cb5eaf199c58a1ad746df7c0321dc097d2b4 Mon Sep 17 00:00:00 2001 From: Anthony Wilcox <35226681+antonwilc0x@users.noreply.github.com> Date: Tue, 11 Jun 2019 00:23:08 -0400 Subject: [PATCH] License headers - GameScn.cs now functions the same as GameScn.gd, even though the two use different techniques in changing the clothes, due to the nature of their respective languages. - Soundtrack works but not as intended. I think it's repeating the same song. - License headers have been brought back. --- project/Properties/AssemblyDynamicInfo.cs | 7 +- project/Properties/AssemblyDynamicInfo.tt | 3 + project/Properties/AssemblyInfo.cs | 2 + project/project.licenseheader | 4 + project/scn/Clothes.tscn | 2 + project/src/GameScn.cs | 97 +++++++++++++++++++---- project/src/Soundtrack.cs | 24 +++--- project/src/TitleScn.cs | 3 +- 8 files changed, 110 insertions(+), 32 deletions(-) create mode 100644 project/project.licenseheader diff --git a/project/Properties/AssemblyDynamicInfo.cs b/project/Properties/AssemblyDynamicInfo.cs index 30862ca..0051ca1 100644 --- a/project/Properties/AssemblyDynamicInfo.cs +++ b/project/Properties/AssemblyDynamicInfo.cs @@ -1,5 +1,8 @@ +// Anthony Wilcox licenses this file to you under the GPL license. +// See the LICENSE file in the project root for more information. + // This code was generated by a tool. Any changes made manually will be lost // the next time this code is regenerated. using System.Reflection; -[assembly: AssemblyVersion("0.0.1906.1102")] -[assembly: AssemblyFileVersion("0.0.1906.1102")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.1906.1104")] +[assembly: AssemblyFileVersion("0.0.1906.1104")] \ No newline at end of file diff --git a/project/Properties/AssemblyDynamicInfo.tt b/project/Properties/AssemblyDynamicInfo.tt index 9533310..06a5098 100644 --- a/project/Properties/AssemblyDynamicInfo.tt +++ b/project/Properties/AssemblyDynamicInfo.tt @@ -4,6 +4,9 @@ var now = DateTime.UtcNow; var version = $"0.0.{now.Year % 100:D2}{now.Month:D2}.{now.Day:D2}{now.Hour:D2}"; #> +// Anthony Wilcox licenses this file to you under the GPL license. +// See the LICENSE file in the project root for more information. + // This code was generated by a tool. Any changes made manually will be lost // the next time this code is regenerated. using System.Reflection; diff --git a/project/Properties/AssemblyInfo.cs b/project/Properties/AssemblyInfo.cs index 7446e71..3fad279 100644 --- a/project/Properties/AssemblyInfo.cs +++ b/project/Properties/AssemblyInfo.cs @@ -1,3 +1,5 @@ +// Anthony Wilcox licenses this file to you under the GPL license. +// See the LICENSE file in the project root for more information. using System.Reflection; // Information about this assembly is defined by the following attributes. diff --git a/project/project.licenseheader b/project/project.licenseheader new file mode 100644 index 0000000..67d8bc4 --- /dev/null +++ b/project/project.licenseheader @@ -0,0 +1,4 @@ +extensions: designer.cs generated.cs +extensions: .cs .cpp .h +// Anthony Wilcox licenses this file to you under the GPL license. +// See the LICENSE file in the project root for more information. \ No newline at end of file diff --git a/project/scn/Clothes.tscn b/project/scn/Clothes.tscn index 2e89c7c..8d088e8 100644 --- a/project/scn/Clothes.tscn +++ b/project/scn/Clothes.tscn @@ -39,6 +39,7 @@ custom_colors/font_color_bg = Color( 0.921569, 0.921569, 0.921569, 1 ) custom_colors/font_color_fg = Color( 1, 1, 1, 1 ) [node name="Pants" type="Tabs" parent="Wordrobe"] +editor/display_folded = true anchor_right = 1.0 anchor_bottom = 1.0 margin_top = 31.0 @@ -87,6 +88,7 @@ icon = ExtResource( 7 ) flat = true [node name="Shirts" type="Tabs" parent="Wordrobe"] +editor/display_folded = true visible = false anchor_right = 1.0 anchor_bottom = 1.0 diff --git a/project/src/GameScn.cs b/project/src/GameScn.cs index 6b58e68..4cdabb5 100644 --- a/project/src/GameScn.cs +++ b/project/src/GameScn.cs @@ -1,6 +1,8 @@ +// Anthony Wilcox licenses this file to you under the GPL license. +// See the LICENSE file in the project root for more information. using Godot; -public enum ClothingType +public enum ClothingLayer { Shirts, Pants, @@ -10,43 +12,63 @@ public enum ClothingType public class GameScn : Node { - void ChangeClothes(string path, ClothingType clothingType) + + void ChangeClothes(string path, ClothingLayer clothingLayer) { var texture = ResourceLoader.Load($"res://sprites/{path}"); - switch (clothingType) + switch (clothingLayer) { - case ClothingType.Shirts: + case ClothingLayer.Shirts: var top = GetNode("Nathan/Top"); top.Texture = texture; break; - case ClothingType.Pants: + case ClothingLayer.Pants: var bottom = GetNode("Nathan/Bottom"); bottom.Texture = texture; break; - case ClothingType.Undies: + case ClothingLayer.Undies: var undies = GetNode("Nathan/Undies"); undies.Texture = texture; break; - case ClothingType.Accessory: + case ClothingLayer.Accessory: var accessory = GetNode("Nathan/Accessory"); accessory.Texture = texture; break; } } - TextureButton ClothesButton(string path, ClothingType clothingType) + void ChangeClothes(ClothingLayer clothingLayer) + { + var blankTopPath = "tops_placeholder.png"; + var blankBottomPath = "bottoms_placeholder.png"; + + switch (clothingLayer) + { + case ClothingLayer.Shirts: + ChangeClothes(blankTopPath, ClothingLayer.Shirts); + break; + case ClothingLayer.Pants: + ChangeClothes(blankBottomPath, ClothingLayer.Pants); + break; + case ClothingLayer.Accessory: + ChangeClothes(blankTopPath, ClothingLayer.Accessory); + break; + } + } + + TextureButton ClothesButton(string path, ClothingLayer clothingType) { switch (clothingType) { - case ClothingType.Accessory: + case ClothingLayer.Accessory: return GetNode($"Clothes/Wordrobe/Accessoires/AccsGrid/{path}"); - case ClothingType.Undies: + case ClothingLayer.Undies: return GetNode($"Clothes/Wordrobe/Underwear/UndiesGrid/{path}"); default: - case ClothingType.Pants: + case ClothingLayer.Pants: return GetNode($"Clothes/Wordrobe/Pants/PantsGrid/{path}"); - case ClothingType.Shirts: + case ClothingLayer.Shirts: return GetNode($"Clothes/Wordrobe/Shirts/ShirtsGrid/{path}"); } } @@ -54,11 +76,54 @@ public class GameScn : Node public override void _Process(float delta) { // Accessories - if (ClothesButton("CanonCam", ClothingType.Accessory).Pressed) - ChangeClothes("camera.png", ClothingType.Accessory); + // ==================================================== + + if (ClothesButton("CanonCam", ClothingLayer.Accessory).Pressed) + ChangeClothes("camera.png", ClothingLayer.Accessory); + + //if (ClothesButton("RemoveAccessory", ClothingLayer.Accessory).Pressed) + // ChangeClothes(ClothingLayer.Accessory); // Pants - if (ClothesButton("Jeans", ClothingType.Pants).Pressed) - ChangeClothes("jeans.svg", ClothingType.Pants); + // ==================================================== + + if (ClothesButton("Jeans", ClothingLayer.Pants).Pressed) + ChangeClothes("jeans.svg", ClothingLayer.Pants); + + if (ClothesButton("Sweats", ClothingLayer.Pants).Pressed) + ChangeClothes("sweat_pants.svg", ClothingLayer.Pants); + + if (ClothesButton("BeatUpJeans", ClothingLayer.Pants).Pressed) + ChangeClothes("beat_up_jeans.svg", ClothingLayer.Pants); + + if (ClothesButton("BlueCamoJeans", ClothingLayer.Pants).Pressed) + ChangeClothes("blue_camo_jeans.svg", ClothingLayer.Pants); + + //if (ClothesButton("RemovePants", ClothingLayer.Pants).Pressed) + // ChangeClothes(ClothingLayer.Pants); + + // Underwear + // ==================================================== + + if (ClothesButton("Briefs", ClothingLayer.Undies).Pressed) + ChangeClothes("briefs.svg", ClothingLayer.Undies); + + if (ClothesButton("ZBriefs", ClothingLayer.Undies).Pressed) + ChangeClothes("z_briefs.svg", ClothingLayer.Undies); + + if (ClothesButton("Fundosi", ClothingLayer.Undies).Pressed) + ChangeClothes("fundosi.svg", ClothingLayer.Undies); + + if (ClothesButton("OwOCensor", ClothingLayer.Undies).Pressed) + ChangeClothes("owo_censor.svg", ClothingLayer.Undies); + + // Shirts + // ==================================================== + + if (ClothesButton("TrainHoodie", ClothingLayer.Shirts).Pressed) + ChangeClothes("train_hoodie.svg", ClothingLayer.Shirts); + + if (ClothesButton("Sweatshirt", ClothingLayer.Shirts).Pressed) + ChangeClothes("old_sweatshirt.svg", ClothingLayer.Shirts); } } diff --git a/project/src/Soundtrack.cs b/project/src/Soundtrack.cs index f9a6d68..b89d017 100644 --- a/project/src/Soundtrack.cs +++ b/project/src/Soundtrack.cs @@ -1,19 +1,16 @@ -using System; +// Anthony Wilcox licenses this file to you under the GPL license. +// See the LICENSE file in the project root for more information. using Godot; -public class Soundtrack : AudioStreamPlayer { - // Declare member variables here. Examples: - // private int a = 2; - // private string b = "text"; - - // Called when the node enters the scene tree for the first time. +public class Soundtrack : AudioStreamPlayer +{ public override void _Ready () { - Connect ("finished", this, "PlayRandomSong"); - PlayRandomSong (); + //Connect ("finished", this, "PlayRandomSong"); + //PlayRandomSong(); } void PlayRandomSong () { - var rand = new RandomNumberGenerator (); + var rand = new RandomNumberGenerator(); rand.Randomize (); var tracks = new string[] { @@ -22,8 +19,9 @@ public class Soundtrack : AudioStreamPlayer { "at_the_lake", "mushrooms", }; - var randDb = rand.Randi () % tracks.Length; - // var audiostream = this. - Play (); + var index = rand.RandiRange(0, tracks.Length); + var audiostream = ResourceLoader.Load($"res://music/{tracks[index]}.ogg"); + Stream = audiostream; + Play(); } } \ No newline at end of file diff --git a/project/src/TitleScn.cs b/project/src/TitleScn.cs index a968e25..08b767a 100644 --- a/project/src/TitleScn.cs +++ b/project/src/TitleScn.cs @@ -1,4 +1,5 @@ -using System; +// Anthony Wilcox licenses this file to you under the GPL license. +// See the LICENSE file in the project root for more information. using Godot; public class TitleScn : Node {