1
0
Fork 0
mirror of https://github.com/tonytins/dressupzack synced 2025-06-26 00:24:44 -04:00

WIP switch to C#

This commit is contained in:
Anthony Wilcox 2019-06-10 19:57:44 -04:00
parent 25f2212d4d
commit 57e148d3e2
13 changed files with 605 additions and 25 deletions

77
project/.editorconfig Normal file
View file

@ -0,0 +1,77 @@
root = true
[*]
charset = utf-8
end_of_line = crlf
indent_style = space
indent_size = 4
insert_final_newline = false
trim_trailing_whitespace = true
[*.{csproj,proj,projitems,shproj,fsproj,target,props}]
indent_style = space
indent_size = 2
[*.{fs,fsx,fsi}]
indent_style = space
indent_size = 4
[*.cs]
# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = one_less_than_current
# only use var when it's obvious what the variable type is
csharp_style_var_for_built_in_types = true : none
csharp_style_var_when_type_is_apparent = true : none
csharp_style_var_elsewhere = true : suggestion
# Code style defaults
dotnet_sort_system_directives_first = true
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false
# Pattern matching
csharp_style_pattern_matching_over_is_with_cast_check = true : suggestion
csharp_style_pattern_matching_over_as_with_null_check = true : suggestion
csharp_style_inlined_variable_declaration = true : suggestion
# Null checking preferences
csharp_style_throw_expression = true : warning
csharp_style_conditional_delegate_call = true : warning
# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = do_not_ignore
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A84252BE-A1C7-410D-A602-3EFBEFD17D7D}</ProjectGuid>
<OutputType>Library</OutputType>
<OutputPath>.mono\temp\bin\$(Configuration)</OutputPath>
<RootNamespace>NathansDressUp</RootNamespace>
<AssemblyName>Nathan's Dress Up</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<BaseIntermediateOutputPath>.mono\temp\obj</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)\$(Configuration)</IntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>portable</DebugType>
<Optimize>true</Optimize>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Tools|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<DefineConstants>DEBUG;TOOLS;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="GodotSharp">
<HintPath>$(ProjectDir)\.mono\assemblies\GodotSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="GodotSharpEditor" Condition=" '$(Configuration)' == 'Tools' ">
<HintPath>$(ProjectDir)\.mono\assemblies\GodotSharpEditor.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="src\Soundtrack.cs" />
<Compile Include="src\TitleScn.cs" />
</ItemGroup>
<ItemGroup>
<None Include=".editorconfig" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -0,0 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nathan's Dress Up", "Nathan's Dress Up.csproj", "{A84252BE-A1C7-410D-A602-3EFBEFD17D7D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Tools|Any CPU = Tools|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A84252BE-A1C7-410D-A602-3EFBEFD17D7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A84252BE-A1C7-410D-A602-3EFBEFD17D7D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A84252BE-A1C7-410D-A602-3EFBEFD17D7D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A84252BE-A1C7-410D-A602-3EFBEFD17D7D}.Release|Any CPU.Build.0 = Release|Any CPU
{A84252BE-A1C7-410D-A602-3EFBEFD17D7D}.Tools|Any CPU.ActiveCfg = Tools|Any CPU
{A84252BE-A1C7-410D-A602-3EFBEFD17D7D}.Tools|Any CPU.Build.0 = Tools|Any CPU
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NathansDressUp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NathansDressUp")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("63f751ea-ce80-486c-9b66-bd6de40d456e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -23,14 +23,6 @@ boot_splash/bg_color=Color( 0.8, 0.8, 0.4, 1 )
config/icon="res://icon.png"
name_sv="Nathans klä upp"
[autoload]
GameKit="*res://src/GameKit.gd"
[debug]
gdscript/completion/autocomplete_setters_and_getters=true
[debug]
gdscript/completion/autocomplete_setters_and_getters=true
@ -62,3 +54,4 @@ quality/intended_usage/framebuffer_allocation.mobile=0
quality/2d/use_pixel_snap=true
vram_compression/import_etc=true
environment/default_environment="res://default_env.tres"
quality/dynamic_fonts/use_oversampling=false

View file

@ -4,7 +4,7 @@
[ext_resource path="res://sprites/icrazy_frame.svg" type="Texture" id=2]
[ext_resource path="res://sprites/lights.png" type="Texture" id=3]
[ext_resource path="res://scn/Clothes.tscn" type="PackedScene" id=4]
[ext_resource path="res://src/Soundtrack.gd" type="Script" id=5]
[ext_resource path="res://src/Soundtrack.cs" type="Script" id=5]
[ext_resource path="res://scn/PauseScn.tscn" type="PackedScene" id=6]
[ext_resource path="res://scn/Character.tscn" type="PackedScene" id=7]

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/TitleScn.gd" type="Script" id=1]
[ext_resource path="res://src/TitleScn.cs" type="Script" id=1]
[ext_resource path="res://styles/DressUpTheme.res" type="Theme" id=2]
[ext_resource path="res://sprites/title.svg" type="Texture" id=3]
[ext_resource path="res://scn/PauseScn.tscn" type="PackedScene" id=4]

View file

@ -5,17 +5,19 @@ extends Node
func _process(delta):
if Input.is_action_just_pressed("ui_pause"):
$PauseWin.show()
GameKit.is_game_paused(true)
# GameKit.is_game_paused(true)
func _on_ExitBtn_pressed():
GameKit.is_game_paused(false)
GameKit.switch_scenes("title")
# GameKit.is_game_paused(false)
# GameKit.switch_scenes("title")
pass
func _on_SettingsBtn_pressed():
$SettingsWin.show()
func _on_CreditsBtn_pressed():
GameKit.switch_scenes("credits")
# GameKit.switch_scenes("credits")
pass
func _on_LicenseBtn_pressed():
$LicenseWin.show()
@ -31,4 +33,4 @@ func _on_MusicBtn_toggled(button_pressed):
func _on_ResumeBtn_pressed():
$PauseWin.hide()
GameKit.is_game_paused(false)
# GameKit.is_game_paused(false)

29
project/src/Soundtrack.cs Normal file
View file

@ -0,0 +1,29 @@
using System;
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 override void _Ready () {
Connect ("finished", this, "PlayRandomSong");
PlayRandomSong ();
}
void PlayRandomSong () {
var rand = new RandomNumberGenerator ();
rand.Randomize ();
var tracks = new string[] {
"reminiscing",
"together_again",
"at_the_lake",
"mushrooms",
};
var randDb = rand.Randi () % tracks.Length;
// var audiostream = this.
Play ();
}
}

View file

@ -15,7 +15,7 @@ func _ready():
func play_random_song():
randomize()
var rand_db = randi() % tracks.size()
var audiostream = load('res://music/' + tracks[rand_db] + '.ogg')
stream = audiostream

18
project/src/TitleScn.cs Normal file
View file

@ -0,0 +1,18 @@
using System;
using Godot;
public class TitleScn : Node {
void _on_PlayBtn_pressed () {
GetTree ().ChangeScene ("res://scn/GameScn.tscn");
}
void _on_CreditsBtn_pressed () {
GetTree ().ChangeScene ("res://scn/CreditsScn.tscn");
}
void _on_LicenseBtn_pressed () {
var licenseWin = GetNode<Control> ("WinDialogs/LicenseWin");
licenseWin.Show ();
}
}

View file

@ -3,19 +3,24 @@
extends Node
func _ready():
$Version.text = GameKit.version
# $Version.text = GameKit.version
pass
func _on_ClassicBtn_pressed():
GameKit.switch_scenes("classic")
# GameKit.switch_scenes("classic")
pass
func _on_ModernBtn_pressed():
GameKit.switch_scenes("play")
# GameKit.switch_scenes("play")
pass
func _on_CreditsBtn_pressed():
GameKit.switch_scenes("credits")
# GameKit.switch_scenes("credits")
pass
func _on_LicenseBtn_pressed():
$WinDialogs/LicenseWin.show()
func _on_PlayBtn_pressed():
GameKit.switch_scenes("play")
# GameKit.switch_scenes("play")
pass