New features to smooth gameplay and storytelling

This commit is contained in:
CreepyCrafter24 2019-09-15 21:31:36 +02:00
parent 7c62a71358
commit 8c11682cc0
28 changed files with 1928 additions and 106 deletions

6
1/1.cs
View File

@ -13,7 +13,7 @@ namespace LaptopSimulator2015.Levels
class Lvl1 : Level
{
static Image _installer;
public string installerHeader
public string name
{
get {
switch (CultureInfo.CurrentUICulture.Name.Split('-')[0])
@ -39,7 +39,7 @@ namespace LaptopSimulator2015.Levels
}
}
public Image installerIcon
public Image icon
{
get {
if (_installer == null)
@ -53,7 +53,7 @@ namespace LaptopSimulator2015.Levels
}
}
public int LevelNumber => 1;
public int levelNumber => 1;
public int gameClock => 17;

6
2/2.cs
View File

@ -13,7 +13,7 @@ namespace LaptopSimulator2015.Levels
{
class Lvl2 : Level
{
public string installerHeader
public string name
{
get {
switch (CultureInfo.CurrentUICulture.Name.Split('-')[0])
@ -40,7 +40,7 @@ namespace LaptopSimulator2015.Levels
}
static Image _installer;
public Image installerIcon
public Image icon
{
get {
if (_installer == null)
@ -54,7 +54,7 @@ namespace LaptopSimulator2015.Levels
}
}
public int LevelNumber => 2;
public int levelNumber => 2;
public int gameClock => 17;

6
3/3.cs
View File

@ -13,7 +13,7 @@ namespace LaptopSimulator2015.Levels
{
class Lvl3 : Level
{
public string installerHeader
public string name
{
get {
switch (CultureInfo.CurrentUICulture.Name.Split('-')[0])
@ -40,7 +40,7 @@ namespace LaptopSimulator2015.Levels
}
static Image _installer;
public Image installerIcon
public Image icon
{
get {
if (_installer == null)
@ -54,7 +54,7 @@ namespace LaptopSimulator2015.Levels
}
}
public int LevelNumber => 3;
public int levelNumber => 3;
public int gameClock => 17;

504
3g/3.cs Normal file

File diff suppressed because one or more lines are too long

60
3g/3g.csproj Normal file
View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E61E2797-62B4-471C-ACBF-31EAB7C746CF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LaptopSimulator2015.Levels</RootNamespace>
<AssemblyName>3g</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="3.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Base\Base.csproj">
<Project>{9A9561A7-DD5F-43A5-A3F5-A95F35DA204D}</Project>
<Name>Base</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>if not exist "$(SolutionDir)tmp1" mkdir "$(SolutionDir)tmp1"
copy "$(TargetPath)" "$(SolutionDir)tmp1"</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,36 @@
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("3g")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("3g")]
[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("e61e2797-62b4-471c-acbf-31eab7c746cf")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

6
4/4.cs
View File

@ -10,7 +10,7 @@ namespace LaptopSimulator2015.Levels
{
class Lvl4 : Level
{
public string installerHeader
public string name
{
get {
switch (CultureInfo.CurrentUICulture.Name.Split('-')[0])
@ -37,7 +37,7 @@ namespace LaptopSimulator2015.Levels
}
static Image _installer;
public Image installerIcon
public Image icon
{
get {
if (_installer == null)
@ -51,7 +51,7 @@ namespace LaptopSimulator2015.Levels
}
}
public int LevelNumber => 4;
public int levelNumber => 4;
public int gameClock => 17;
public Panel desktopIcon { get; set; }
public int installerProgressSteps => 500;

View File

@ -45,7 +45,7 @@
<ItemGroup>
<Compile Include="Drawing.cs" />
<Compile Include="Input.cs" />
<Compile Include="Level.cs" />
<Compile Include="Minigame.cs" />
<Compile Include="Misc.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Vector2.cs" />

View File

@ -8,16 +8,26 @@ using System.Windows.Forms;
namespace LaptopSimulator2015
{
public interface Level
public interface Minigame
{
string installerHeader { get; }
string installerText { get; }
Image installerIcon { get; }
int LevelNumber { get; }
string name { get; }
Image icon { get; }
int levelNumber { get; }
int gameClock { get; }
Panel desktopIcon { get; set; }
int installerProgressSteps { get; }
void initGame(Graphics g, Panel minigamePanel, Timer minigameTimer);
void gameTick(Graphics g, Panel minigamePanel, Timer minigameTimer, uint minigameTime);
}
public interface Level : Minigame
{
string installerText { get; }
int installerProgressSteps { get; }
}
public interface Goal : Minigame
{
int playableAfter { get; }
string[] availableText { get; }
string[] incompleteText { get; }
string[] completeText { get; }
}
}

View File

@ -8,6 +8,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaptopSimulator2015", "Lapt
{0965C803-49B2-4311-B62F-1E60DBD9185F} = {0965C803-49B2-4311-B62F-1E60DBD9185F}
{8109040E-9D8D-43E7-A461-83475B2939C9} = {8109040E-9D8D-43E7-A461-83475B2939C9}
{4AA1EF48-BC5E-4FE4-9B7D-BAE6D6AB9529} = {4AA1EF48-BC5E-4FE4-9B7D-BAE6D6AB9529}
{E61E2797-62B4-471C-ACBF-31EAB7C746CF} = {E61E2797-62B4-471C-ACBF-31EAB7C746CF}
{DFA2FB97-D676-4B0D-B281-2685F85781EE} = {DFA2FB97-D676-4B0D-B281-2685F85781EE}
EndProjectSection
EndProject
@ -40,6 +41,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ToDo.txt = ToDo.txt
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Goals", "Goals", "{7D9F2BFD-61B6-4C6C-97CC-D9AD51A04959}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "3g", "3g\3g.csproj", "{E61E2797-62B4-471C-ACBF-31EAB7C746CF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lv3g_t", "lv3g_t\lv3g_t.csproj", "{E6BF80E0-8848-4A6F-B114-FEC5055E1D9E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -90,12 +97,19 @@ Global
{4AA1EF48-BC5E-4FE4-9B7D-BAE6D6AB9529}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4AA1EF48-BC5E-4FE4-9B7D-BAE6D6AB9529}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4AA1EF48-BC5E-4FE4-9B7D-BAE6D6AB9529}.Release|Any CPU.Build.0 = Release|Any CPU
{E61E2797-62B4-471C-ACBF-31EAB7C746CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E61E2797-62B4-471C-ACBF-31EAB7C746CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E61E2797-62B4-471C-ACBF-31EAB7C746CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E61E2797-62B4-471C-ACBF-31EAB7C746CF}.Release|Any CPU.Build.0 = Release|Any CPU
{E6BF80E0-8848-4A6F-B114-FEC5055E1D9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E6BF80E0-8848-4A6F-B114-FEC5055E1D9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E6BF80E0-8848-4A6F-B114-FEC5055E1D9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E6BF80E0-8848-4A6F-B114-FEC5055E1D9E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{9A9561A7-DD5F-43A5-A3F5-A95F35DA204D} = {83BF22F9-3A2D-42A3-9DB0-C1E2AA1DD218}
{DFA2FB97-D676-4B0D-B281-2685F85781EE} = {83BF22F9-3A2D-42A3-9DB0-C1E2AA1DD218}
{52CE6BEB-EC81-4A14-85DD-3F8DB8E33202} = {69DC5824-3F89-4B47-BF1A-F25942094195}
{D80DBBF2-307F-40A0-86F1-871C8DAA394B} = {69DC5824-3F89-4B47-BF1A-F25942094195}
@ -105,6 +119,8 @@ Global
{8109040E-9D8D-43E7-A461-83475B2939C9} = {83BF22F9-3A2D-42A3-9DB0-C1E2AA1DD218}
{22D618C0-F0A4-417F-A815-C760BF4376B2} = {69DC5824-3F89-4B47-BF1A-F25942094195}
{4AA1EF48-BC5E-4FE4-9B7D-BAE6D6AB9529} = {83BF22F9-3A2D-42A3-9DB0-C1E2AA1DD218}
{E61E2797-62B4-471C-ACBF-31EAB7C746CF} = {7D9F2BFD-61B6-4C6C-97CC-D9AD51A04959}
{E6BF80E0-8848-4A6F-B114-FEC5055E1D9E} = {69DC5824-3F89-4B47-BF1A-F25942094195}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9631F8FF-AFC1-4583-9D27-6C2D97D3A2E9}

View File

@ -45,6 +45,7 @@ namespace LaptopSimulator2015
this.winMenuExit = new System.Windows.Forms.Button();
this.winTaskbar = new System.Windows.Forms.Panel();
this.subsLabel = new System.Windows.Forms.Label();
this.winTimeLabel = new System.Windows.Forms.Label();
this.winDesktop = new System.Windows.Forms.FlowLayoutPanel();
this.options_1 = new System.Windows.Forms.Panel();
this.options_2 = new System.Windows.Forms.Panel();
@ -65,9 +66,9 @@ namespace LaptopSimulator2015
this.levelWindowIcon = new System.Windows.Forms.Panel();
this.levelWindowTitle = new System.Windows.Forms.Label();
this.levelWindowProgressT = new System.Windows.Forms.Timer(this.components);
this.winTimeLabel = new System.Windows.Forms.Label();
this.winTimeTimer = new System.Windows.Forms.Timer(this.components);
this.minigamePanel = new System.Windows.Forms.Panel();
this.minigameClose = new System.Windows.Forms.Label();
this.minigameClockT = new System.Windows.Forms.Timer(this.components);
this.optionsWindow = new System.Windows.Forms.Panel();
this.optionsWindowReset = new System.Windows.Forms.Button();
@ -93,6 +94,7 @@ namespace LaptopSimulator2015
this.levelWindow2.SuspendLayout();
this.levelWindow3.SuspendLayout();
this.levelWindowHeader.SuspendLayout();
this.minigamePanel.SuspendLayout();
this.optionsWindow.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.optionsWindowWam)).BeginInit();
this.optionsWindowHeader.SuspendLayout();
@ -190,11 +192,25 @@ namespace LaptopSimulator2015
//
this.subsLabel.AutoSize = true;
this.subsLabel.BackColor = System.Drawing.Color.Navy;
this.subsLabel.Location = new System.Drawing.Point(6, 9);
this.subsLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.subsLabel.ForeColor = System.Drawing.Color.White;
this.subsLabel.Location = new System.Drawing.Point(6, 7);
this.subsLabel.Name = "subsLabel";
this.subsLabel.Size = new System.Drawing.Size(0, 13);
this.subsLabel.Size = new System.Drawing.Size(0, 16);
this.subsLabel.TabIndex = 0;
//
// winTimeLabel
//
this.winTimeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.winTimeLabel.AutoSize = true;
this.winTimeLabel.BackColor = System.Drawing.Color.Navy;
this.winTimeLabel.ForeColor = System.Drawing.Color.White;
this.winTimeLabel.Location = new System.Drawing.Point(1305, 9);
this.winTimeLabel.Name = "winTimeLabel";
this.winTimeLabel.Size = new System.Drawing.Size(49, 13);
this.winTimeLabel.TabIndex = 0;
this.winTimeLabel.Text = "00:00:00";
//
// winDesktop
//
this.winDesktop.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -410,18 +426,6 @@ namespace LaptopSimulator2015
//
this.levelWindowProgressT.Tick += new System.EventHandler(this.LevelWindowProgressT_Tick);
//
// winTimeLabel
//
this.winTimeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.winTimeLabel.AutoSize = true;
this.winTimeLabel.BackColor = System.Drawing.Color.Navy;
this.winTimeLabel.ForeColor = System.Drawing.Color.White;
this.winTimeLabel.Location = new System.Drawing.Point(1305, 9);
this.winTimeLabel.Name = "winTimeLabel";
this.winTimeLabel.Size = new System.Drawing.Size(49, 13);
this.winTimeLabel.TabIndex = 0;
this.winTimeLabel.Text = "00:00:00";
//
// winTimeTimer
//
this.winTimeTimer.Enabled = true;
@ -432,6 +436,7 @@ namespace LaptopSimulator2015
//
this.minigamePanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.minigamePanel.BackColor = System.Drawing.Color.Black;
this.minigamePanel.Controls.Add(this.minigameClose);
this.minigamePanel.Location = new System.Drawing.Point(564, 421);
this.minigamePanel.Name = "minigamePanel";
this.minigamePanel.Size = new System.Drawing.Size(800, 450);
@ -439,6 +444,20 @@ namespace LaptopSimulator2015
this.minigamePanel.Visible = false;
this.minigamePanel.Paint += new System.Windows.Forms.PaintEventHandler(this.InvadersPanel_Paint);
//
// minigameClose
//
this.minigameClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.minigameClose.BackColor = System.Drawing.Color.Red;
this.minigameClose.Font = new System.Drawing.Font("Marlett", 12F);
this.minigameClose.Location = new System.Drawing.Point(760, 0);
this.minigameClose.Name = "minigameClose";
this.minigameClose.Size = new System.Drawing.Size(40, 20);
this.minigameClose.TabIndex = 4;
this.minigameClose.Text = "r";
this.minigameClose.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.minigameClose.Visible = false;
this.minigameClose.Click += new System.EventHandler(this.MinigameClose_Click);
//
// minigameClockT
//
this.minigameClockT.Interval = 17;
@ -464,9 +483,9 @@ namespace LaptopSimulator2015
// optionsWindowReset
//
this.optionsWindowReset.BackColor = System.Drawing.Color.Red;
this.optionsWindowReset.Location = new System.Drawing.Point(332, 64);
this.optionsWindowReset.Location = new System.Drawing.Point(355, 64);
this.optionsWindowReset.Name = "optionsWindowReset";
this.optionsWindowReset.Size = new System.Drawing.Size(75, 23);
this.optionsWindowReset.Size = new System.Drawing.Size(93, 23);
this.optionsWindowReset.TabIndex = 7;
this.optionsWindowReset.Text = "Reset";
this.optionsWindowReset.UseVisualStyleBackColor = false;
@ -495,9 +514,9 @@ namespace LaptopSimulator2015
//
// optionsWindowExit
//
this.optionsWindowExit.Location = new System.Drawing.Point(413, 64);
this.optionsWindowExit.Location = new System.Drawing.Point(454, 64);
this.optionsWindowExit.Name = "optionsWindowExit";
this.optionsWindowExit.Size = new System.Drawing.Size(75, 23);
this.optionsWindowExit.Size = new System.Drawing.Size(34, 23);
this.optionsWindowExit.TabIndex = 4;
this.optionsWindowExit.Text = "OK";
this.optionsWindowExit.UseVisualStyleBackColor = true;
@ -604,6 +623,7 @@ namespace LaptopSimulator2015
this.Text = "FakeDesktop";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FakeDesktop_FormClosing);
this.Load += new System.EventHandler(this.FakeDesktop_Load);
this.winMenuPanel.ResumeLayout(false);
this.winTaskbar.ResumeLayout(false);
this.winTaskbar.PerformLayout();
@ -618,6 +638,7 @@ namespace LaptopSimulator2015
this.levelWindow3.PerformLayout();
this.levelWindowHeader.ResumeLayout(false);
this.levelWindowHeader.PerformLayout();
this.minigamePanel.ResumeLayout(false);
this.optionsWindow.ResumeLayout(false);
this.optionsWindow.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.optionsWindowWam)).EndInit();
@ -675,5 +696,6 @@ namespace LaptopSimulator2015
private System.Windows.Forms.Label optionsWindowHeaderExit;
private System.Windows.Forms.Button optionsWindowReset;
private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.Label minigameClose;
}
}

View File

@ -18,7 +18,7 @@ namespace LaptopSimulator2015
public partial class FakeDesktop : Form
{
#region Base
List<Level> levels = new List<Level>();
List<Minigame> levels = new List<Minigame>();
SoundPlayer fans;
bool winShouldClose = false;
@ -45,6 +45,8 @@ namespace LaptopSimulator2015
optionsWindowLSD.Text = strings.optionsWindowLSD;
optionsWindowTitle.Text = strings.optionsWindowTitle;
optionsWindowWamLabel.Text = strings.optionsWindowWam;
optionsWindowReset.Text = strings.optionsWindowReset;
optionsWindowSubs.Text = strings.optionsWindowSubs;
levelWindow.Visible = false;
minigamePanel.Visible = false;
optionsWindow.Visible = false;
@ -57,10 +59,11 @@ namespace LaptopSimulator2015
subsLabel.Visible = optionsWindowSubs.Checked;
if (_mode == Mode.mainMenu)
winMenuStart.Select();
for (int i = 0; i < levels.Count; i++)
levels[i].desktopIcon.Visible = levels[i].LevelNumber <= Settings.level;
if (tmp__mode_uiv)
updateIconVisibility();
}
}
bool tmp__mode_uiv = false;
[DllImport("winmm.dll")]
public static extern int waveOutGetVolume(IntPtr hwo, out uint dwVolume);
@ -73,6 +76,8 @@ namespace LaptopSimulator2015
Directory.SetCurrentDirectory(Path.GetDirectoryName(Application.ExecutablePath));
if (!Directory.Exists("Levels"))
Directory.CreateDirectory("Levels");
if (!Directory.Exists("Goals"))
Directory.CreateDirectory("Goals");
InitializeComponent();
toolTip.SetToolTip(options_2, strings.optionsWindowTitle);
levelWindowContents.ItemSize = new Size(0, 1);
@ -95,48 +100,159 @@ namespace LaptopSimulator2015
fans.PlayLooping();
Control[] controls = getControls(ignore: new List<Control> { minigamePanel }).ToArray();
for (int i = 0; i < controls.Length; i++)
{
controls[i].Paint += Control_Paint;
}
levels = new List<Level>();
AppDomain ad = AppDomain.CurrentDomain;
ad.AssemblyResolve += AssemblyResolveHandler;
foreach (string s in Directory.GetFiles("Levels"))
if (Path.GetExtension(s) == ".dll")
ad.Load(s);
List<Type> tmp = ad.GetAssemblies().SelectMany(s => s.GetTypes()).Where(p => typeof(Level).IsAssignableFrom(p)).ToList();
tmp.Remove(typeof(Level));
for (int i = 0; i < tmp.Count; i++)
levels = Directory.GetFiles("Levels").Concat(Directory.GetFiles("Goals")).Where(s => Path.GetExtension(s) == ".dll").Select(s => Assembly.LoadFrom(s))
.SelectMany(s => s.GetTypes()).Where(p => typeof(Minigame).IsAssignableFrom(p) && p != typeof(Minigame) && p != typeof(Level) && p != typeof(Goal)).Distinct()
.Select(s => (Minigame)Activator.CreateInstance(s)).OrderBy(lv => lv.levelNumber).ToList();
for (int i = 0; i < levels.Count; i++)
{
levels.Add((Level)Activator.CreateInstance(tmp[i]));
levels[i].desktopIcon = new Panel();
Panel tmp1 = new Panel();
levels[i].desktopIcon.Size = new Size(50, 50);
levels[i].desktopIcon.BackColor = Color.FromArgb(128, 128, 255);
levels[i].desktopIcon.Name = "lvl" + i.ToString() + "_1";
levels[i].desktopIcon.Visible = levels[i].LevelNumber <= Settings.level;
levels[i].desktopIcon.Visible = levels[i].levelNumber <= Settings.level;
tmp1.BackColor = Color.Blue;
tmp1.BackgroundImageLayout = ImageLayout.Stretch;
tmp1.BackgroundImage = levels[i].installerIcon;
tmp1.BackgroundImage = levels[i].icon;
tmp1.Anchor = (AnchorStyles)15;
tmp1.Name = "lvl" + i.ToString() + "_2";
tmp1.Location = new Point(2, 2);
tmp1.Size = new Size(46, 46);
tmp1.Tag = i;
tmp1.DoubleClick += (sender, e) => { level_Start((int)((Panel)sender).Tag); };
toolTip.SetToolTip(tmp1, strings.lvPref + " " + (i + 1).ToString() + ": " + levels[i].installerHeader);
tmp1.DoubleClick += (sender, e) =>
{
levelInd = (int)((Panel)sender).Tag;
levelWindowIcon.BackgroundImage = levels[levelInd].icon;
levelWindowTitle.Text = levels[levelInd].name;
minigameClockT.Interval = levels[levelInd].gameClock;
winDesktop.Enabled = false;
if (typeof(Level).IsAssignableFrom(levels[levelInd].GetType()))
{
Misc.closeGameWindow = new Action(() => {
base.BackColor = Color.FromArgb(100, 0, 255);
levelWindow.Visible = false;
minigamePanel.Visible = false;
minigamePanel.Enabled = false;
minigameClockT.Enabled = false;
winDesktop.Enabled = true;
levelWindowContents.SelectedIndex = 0;
levelWindowProgress.Value = 0;
levelWindowProgressT.Enabled = false;
levelWindowC1.Enabled = true;
Thread.Sleep(100);
base.BackColor = Color.Blue;
});
levelWindowProgress.Maximum = ((Level)levels[levelInd]).installerProgressSteps;
levelWindowText1.Text = ((Level)levels[levelInd]).installerText;
levelWindow.Visible = true;
}
else
{
Goal goal = ((Goal)levels[levelInd]);
if (goal.playableAfter <= Settings.level)
{
Graphics g = minigamePanel.CreateGraphics();
levels[levelInd].initGame(g, minigamePanel, minigameClockT);
minigamePanel.Visible = true;
minigamePanel.Enabled = true;
minigameClockT.Enabled = true;
minigameClose.Visible = true;
g.Flush();
Misc.closeGameWindow = new Action(() => {
base.BackColor = Color.FromArgb(100, 0, 255);
minigamePanel.Visible = false;
minigamePanel.Enabled = false;
minigameClockT.Enabled = false;
winDesktop.Enabled = true;
minigameClose.Visible = false;
Thread.Sleep(100);
base.BackColor = Color.Blue;
});
minigamePanel.Show();
}
else
{
base.BackColor = Color.FromArgb(100, 0, 255);
if (levels[levelInd].levelNumber == Settings.level)
{
playDialog(goal.incompleteText);
incrementLevel();
}
Thread.Sleep(100);
base.BackColor = Color.Blue;
winDesktop.Enabled = true;
}
}
};
toolTip.SetToolTip(tmp1, strings.lvPref + " " + (i + 1).ToString() + ": " + levels[i].name);
levels[i].desktopIcon.Controls.Add(tmp1);
winDesktop.Controls.Add(levels[i].desktopIcon);
}
levels = levels.OrderBy(lv => lv.LevelNumber).ToList();
}
private void FakeDesktop_Load(object sender, EventArgs e)
{
mode = Mode.mainMenu;
Program.splash.Close();
Misc.closeGameWindow = new Action(closeLevelWindow);
GC.Collect();
tmp__mode_uiv = true;
}
void updateIconVisibility(bool ignoreSub = false)
{
for (int i = 0; i < levels.Count; i++)
{
if ((!ignoreSub) && ((typeof(Goal).IsAssignableFrom(levels[i].GetType()) && levels[i].desktopIcon.Visible != levels[i].levelNumber <= Settings.level) || (levels[i].levelNumber == 0 && Settings.level == 0)))
{
string[] at = ((Goal)levels[i]).availableText;
new Thread(() =>
{
Invoke((MethodInvoker)delegate () { winDesktop.Enabled = false; });
playDialog(at).Join();
Invoke((MethodInvoker)delegate ()
{
winDesktop.Enabled = true;
updateIconVisibility(true);
});
}).Start();
}
levels[i].desktopIcon.Visible = levels[i].levelNumber <= Settings.level;
}
}
Thread playDialog(string[] lines)
{
var tmp = new Thread(() =>
{
for (int i = 0; i < lines.Length; i++)
{
Invoke((MethodInvoker)delegate () { subsLabel.Text = lines[i]; });
Thread.Sleep(2000);
}
Invoke((MethodInvoker)delegate () { subsLabel.Text = ""; });
});
tmp.Start();
return tmp;
}
void incrementLevel()
{
int closest = int.MaxValue;
for (int i = 0; i < levels.Count; i++)
if (levels[i].levelNumber < closest & levels[i].levelNumber > levels[levelInd].levelNumber)
closest = levels[i].levelNumber;
if (closest != int.MaxValue)
Settings.level = closest;
Settings.Save();
updateIconVisibility();
for (int i = 0; i < levels.Count; i++)
if (typeof(Goal).IsAssignableFrom(levels[i].GetType()) && ((Goal)levels[i]).playableAfter == Settings.level)
playDialog(((Goal)levels[i]).completeText);
}
static Assembly AssemblyResolveHandler(object source, ResolveEventArgs e) => Assembly.LoadFrom(e.Name);
public List<Control> getControls(Control parent = null, List<Control> ignore = null)
{
@ -203,24 +319,12 @@ namespace LaptopSimulator2015
else
winMenuExit.Text = strings.winMenuExit2;
}
private void WinMenuStart_Click(object sender, EventArgs e) => mode = Mode.game;
private void WinTimeTimer_Tick(object sender, EventArgs e) => winTimeLabel.Text = DateTime.Now.ToString("hh:mm:ss", Settings.lang);
#endregion
#region Level
int levelInd = 0;
private void level_Start(int level)
{
levelInd = level;
levelWindowIcon.BackgroundImage = levels[level].installerIcon;
levelWindowTitle.Text = levels[level].installerHeader;
levelWindowText1.Text = levels[level].installerText;
minigameClockT.Interval = levels[level].gameClock;
levelWindowProgress.Maximum = levels[level].installerProgressSteps;
winDesktop.Enabled = false;
levelWindow.Visible = true;
}
bool levelWindowMoving = false;
Point levelWindowDiff = Point.Empty;
@ -274,17 +378,9 @@ namespace LaptopSimulator2015
break;
case 2:
LevelWindowHeaderExit_Click(sender, e);
if (levels[levelInd].LevelNumber >= Settings.level)
if (levels[levelInd].levelNumber >= Settings.level)
{
int closest = int.MaxValue;
for (int i = 0; i < levels.Count; i++)
if (levels[i].LevelNumber < closest & levels[i].LevelNumber > levels[levelInd].LevelNumber)
closest = levels[i].LevelNumber;
if (closest != int.MaxValue)
Settings.level = closest;
Settings.Save();
for (int i = 0; i < levels.Count; i++)
levels[i].desktopIcon.Visible = levels[i].LevelNumber <= Settings.level;
incrementLevel();
mode = Mode.game;
}
break;
@ -348,25 +444,10 @@ namespace LaptopSimulator2015
}
}
private void LevelWindowHeaderExit_Click(object sender, EventArgs e) => closeLevelWindow();
private void LevelWindowHeaderExit_Click(object sender, EventArgs e) => Misc.closeGameWindow.Invoke();
private void MinigameClose_Click(object sender, EventArgs e) => Misc.closeGameWindow.Invoke();
private void closeLevelWindow()
{
BackColor = Color.FromArgb(100, 0, 255);
levelWindow.Visible = false;
minigamePanel.Visible = false;
minigamePanel.Enabled = false;
minigameClockT.Enabled = false;
winDesktop.Enabled = true;
levelWindowContents.SelectedIndex = 0;
levelWindowProgress.Value = 0;
levelWindowProgressT.Enabled = false;
levelWindowC1.Enabled = true;
Thread.Sleep(100);
BackColor = Color.Blue;
}
#region Minigame
#region Minigame
uint minigameTime = 0;
private void InvadersPanel_Paint(object sender, PaintEventArgs e) => levels[levelInd].gameTick(e.Graphics, minigamePanel, minigameClockT, minigameTime);
@ -375,10 +456,10 @@ namespace LaptopSimulator2015
minigameTime++;
minigamePanel.Invalidate();
}
#endregion
#endregion
#endregion
#region Options
#endregion
#region Options
private void Options_2_DoubleClick(object sender, EventArgs e)
{
winDesktop.Enabled = false;

View File

@ -134,7 +134,13 @@
<PropertyGroup>
<PostBuildEvent>if not exist "$(TargetDir)Levels" mkdir "$(TargetDir)Levels"
if exist "$(SolutionDir)tmp" copy $(SolutionDir)tmp\* "$(TargetDir)Levels"
rmdir /s /q "$(SolutionDir)tmp"</PostBuildEvent>
rmdir /s /q "$(SolutionDir)tmp"
if not exist "$(TargetDir)Goals" mkdir "$(TargetDir)Goals"
if exist "$(SolutionDir)tmp1" copy $(SolutionDir)tmp1\* "$(TargetDir)Goals"
rmdir /s /q "$(SolutionDir)tmp1"
del /q "$(TargetDir)save.xml"</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>

View File

@ -24,7 +24,7 @@ namespace LaptopSimulator2015 {
xmldoc_temp.Add(new XElement("wam", 10));
xmldoc_temp.Add(new XElement("lsd", false));
xmldoc_temp.Add(new XElement("subs", true));
xmldoc_temp.Add(new XElement("level", 1));
xmldoc_temp.Add(new XElement("level", 0));
xmldoc_temp.Add(new XElement("lang", CultureInfo.CurrentCulture));
xmldoc_temp.Save(_xmlfile);
}

View File

@ -159,6 +159,24 @@ namespace LaptopSimulator2015 {
}
}
/// <summary>
/// Looks up a localized string similar to Reset.
/// </summary>
internal static string optionsWindowReset {
get {
return ResourceManager.GetString("optionsWindowReset", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Subtitles.
/// </summary>
internal static string optionsWindowSubs {
get {
return ResourceManager.GetString("optionsWindowSubs", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Options.
/// </summary>

View File

@ -150,6 +150,12 @@
<data name="optionsWindowLSDWarning" xml:space="preserve">
<value>Bist du dir sicher? (ALLES wird verbuggt werden!)</value>
</data>
<data name="optionsWindowReset" xml:space="preserve">
<value>Zurücksetzen</value>
</data>
<data name="optionsWindowSubs" xml:space="preserve">
<value>Untertitel</value>
</data>
<data name="optionsWindowTitle" xml:space="preserve">
<value>Optionen</value>
</data>

View File

@ -150,6 +150,12 @@
<data name="optionsWindowLSDWarning" xml:space="preserve">
<value>Are you SURE?\r\n(This will break EVERYTHING!)</value>
</data>
<data name="optionsWindowReset" xml:space="preserve">
<value>Reset</value>
</data>
<data name="optionsWindowSubs" xml:space="preserve">
<value>Subtitles</value>
</data>
<data name="optionsWindowTitle" xml:space="preserve">
<value>Options</value>
</data>

6
lv3g_t/App.config Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

93
lv3g_t/MainForm.Designer.cs generated Normal file
View File

@ -0,0 +1,93 @@
namespace lv3g_t
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.minigameClockT = new System.Windows.Forms.Timer(this.components);
this.button1 = new System.Windows.Forms.Button();
this.minigamePanel = new System.Windows.Forms.Panel();
this.minigamePanel.SuspendLayout();
this.SuspendLayout();
//
// minigameClockT
//
this.minigameClockT.Enabled = true;
this.minigameClockT.Interval = 300;
this.minigameClockT.Tick += new System.EventHandler(this.MinigameClockT_Tick);
//
// button1
//
this.button1.Location = new System.Drawing.Point(777, 0);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(23, 23);
this.button1.TabIndex = 0;
this.button1.TabStop = false;
this.button1.Text = "X";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.Button1_Click);
//
// minigamePanel
//
this.minigamePanel.BackColor = System.Drawing.Color.Black;
this.minigamePanel.Controls.Add(this.button1);
this.minigamePanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.minigamePanel.Location = new System.Drawing.Point(0, 0);
this.minigamePanel.Name = "minigamePanel";
this.minigamePanel.Size = new System.Drawing.Size(800, 450);
this.minigamePanel.TabIndex = 2;
this.minigamePanel.Paint += new System.Windows.Forms.PaintEventHandler(this.MinigamePanel_Paint);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.ControlBox = false;
this.Controls.Add(this.minigamePanel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "MainForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1";
this.minigamePanel.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Timer minigameClockT;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Panel minigamePanel;
}
}

467
lv3g_t/MainForm.cs Normal file
View File

@ -0,0 +1,467 @@
using Base;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace lv3g_t
{
public partial class MainForm : Form
{
#region FRMBD
uint minigameTime;
uint minigamePrevTime;
public MainForm()
{
InitializeComponent();
_initGame();
}
private void Button1_Click(object sender, EventArgs e) => Application.Exit();
private void MinigameClockT_Tick(object sender, EventArgs e)
{
minigameTime++;
minigamePanel.Invalidate();
}
private void _initGame()
{
minigameTime = 0;
minigamePrevTime = 0;
initGame();
}
#endregion
public static int[,] grid = new int[23, 10];
public static int[,] droppedtetrominoeLocationGrid = new int[23, 10];
public static bool isDropped = false;
static Tetrominoe tet;
static Tetrominoe nexttet;
public static int linesCleared = 0, score = 0, level = 1;
public static Random rnd;
private void initGame()
{
rnd = new Random();
grid = new int[23, 10];
droppedtetrominoeLocationGrid = new int[23, 10];
isDropped = false;
linesCleared = 0;
score = 0;
level = 1;
nexttet = new Tetrominoe();
tet = nexttet;
tet.Spawn();
nexttet = new Tetrominoe();
}
private void MinigamePanel_Paint(object sender, PaintEventArgs e)
{
BufferedGraphics buffer = BufferedGraphicsManager.Current.Allocate(e.Graphics, new Rectangle(0, 0, minigamePanel.Width, minigamePanel.Height));
Graphics g = buffer.Graphics;
try
{
g.Clear(Color.Black);
for (int y = 0; y < 23; ++y)
{
for (int x = 0; x < 10; x++)
{
if (grid[y, x] == 1 | droppedtetrominoeLocationGrid[y, x] == 1)
g.FillRectangle(Brushes.White, new Rectangle(x * 10, y * 10, 10, 10));
}
g.DrawLine(new Pen(Color.DarkGray), new Point(0, (y + 1) * 10), new Point(10 * 10, (y + 1) * 10));
}
for (int x = 0; x < 10; x++)
{
g.DrawLine(new Pen(Color.DarkGray), new Point((x + 1) * 10, 0), new Point((x + 1) * 10, 23 * 10));
}
Drawing.DrawSizedString(g, "Level " + level, 10, new PointF(150, 10), Brushes.White);
Drawing.DrawSizedString(g, "Score " + score, 10, new PointF(150, 30), Brushes.White);
Drawing.DrawSizedString(g, "LinesCleared " + linesCleared, 10, new PointF(150, 50), Brushes.White);
Random random = new Random();
if (minigameTime != minigamePrevTime)
{
minigamePrevTime = minigameTime;
tet.Drop();
if (isDropped == true)
{
tet = nexttet;
nexttet = new Tetrominoe();
tet.Spawn();
isDropped = false;
score += 10;
}
int j; for (j = 0; j < 10; j++)
{
if (droppedtetrominoeLocationGrid[0, j] == 1)
_initGame();
}
Input();
ClearBlock();
}
buffer.Render();
}
catch (Exception ex)
{
#if DEBUG
throw;
#else
Console.WriteLine(ex.ToString());
#endif
}
}
private static void ClearBlock()
{
int combo = 0;
for (int i = 0; i < 23; i++)
{
int j; for (j = 0; j < 10; j++)
{
if (droppedtetrominoeLocationGrid[i, j] == 0)
break;
}
if (j == 10)
{
linesCleared++;
combo++;
Console.Beep(400, 200);
for (j = 0; j < 10; j++)
{
droppedtetrominoeLocationGrid[i, j] = 0;
}
int[,] newdroppedtetrominoeLocationGrid = new int[23, 10];
for (int k = 1; k < i; k++)
{
for (int l = 0; l < 10; l++)
{
newdroppedtetrominoeLocationGrid[k + 1, l] = droppedtetrominoeLocationGrid[k, l];
}
}
for (int k = 1; k < i; k++)
{
for (int l = 0; l < 10; l++)
{
droppedtetrominoeLocationGrid[k, l] = 0;
}
}
for (int k = 0; k < 23; k++)
for (int l = 0; l < 10; l++)
if (newdroppedtetrominoeLocationGrid[k, l] == 1)
droppedtetrominoeLocationGrid[k, l] = 1;
}
}
score += (int)Math.Round(Math.Sqrt(Math.Max(combo * 50 - 50, 0)) * 5);
level = (int)Math.Round(Math.Sqrt(score * 0.01)) + 1;
}
private static void Input()
{
if (Base.Input.Left & !tet.isSomethingLeft())
{
for (int i = 0; i < 4; i++)
tet.location[i][1] -= 1;
tet.Update();
}
else if (Base.Input.Right & !tet.isSomethingRight())
{
for (int i = 0; i < 4; i++)
tet.location[i][1] += 1;
tet.Update();
}
if (Base.Input.Down)
tet.Drop();
if (Base.Input.Up)
for (; tet.isSomethingBelow() != true;)
tet.Drop();
if (Base.Input.Action)
{
tet.Rotate();
tet.Update();
}
}
public class Tetrominoe
{
public static int[,] I = new int[1, 4] { { 1, 1, 1, 1 } };
public static int[,] O = new int[2, 2] { { 1, 1 },
{ 1, 1 } };
public static int[,] T = new int[2, 3] { { 0, 1, 0 },
{ 1, 1, 1 } };
public static int[,] S = new int[2, 3] { { 0, 1, 1 },
{ 1, 1, 0 } };
public static int[,] Z = new int[2, 3] { { 1, 1, 0 },
{ 0, 1, 1 } };
public static int[,] J = new int[2, 3] { { 1, 0, 0 },
{ 1, 1, 1 } };
public static int[,] L = new int[2, 3] { { 0, 0, 1 },
{ 1, 1, 1 } };
public static List<int[,]> tetrominoes = new List<int[,]>() { I, O, T, S, Z, J, L };
private readonly int[,] shape;
public List<int[]> location = new List<int[]>();
public Tetrominoe()
{
shape = tetrominoes[rnd.Next(0, tetrominoes.Count)];
}
public void Spawn()
{
for (int i = 0; i < shape.GetLength(0); i++)
{
for (int j = 0; j < shape.GetLength(1); j++)
{
if (shape[i, j] == 1)
{
location.Add(new int[] { i, (10 - shape.GetLength(1)) / 2 + j });
}
}
}
Update();
}
public void Drop()
{
if (isSomethingBelow())
{
for (int i = 0; i < 4; i++)
{
droppedtetrominoeLocationGrid[location[i][0], location[i][1]] = 1;
}
isDropped = true;
Console.Beep(800, 200);
}
else
{
for (int numCount = 0; numCount < 4; numCount++)
{
location[numCount][0] += 1;
}
Update();
}
}
public void Rotate()
{
List<int[]> templocation = new List<int[]>();
for (int i = 0; i < shape.GetLength(0); i++)
{
for (int j = 0; j < shape.GetLength(1); j++)
{
if (shape[i, j] == 1)
{
templocation.Add(new int[] { i, (10 - shape.GetLength(1)) / 2 + j });
}
}
}
if (shape == tetrominoes[0])
{
for (int i = 0; i < location.Count; i++)
{
templocation[i] = TransformMatrix(location[i], location[2]);
}
}
else if (shape == tetrominoes[3])
{
for (int i = 0; i < location.Count; i++)
{
templocation[i] = TransformMatrix(location[i], location[3]);
}
}
else if (shape == tetrominoes[1])
return;
else
{
for (int i = 0; i < location.Count; i++)
{
templocation[i] = TransformMatrix(location[i], location[2]);
}
}
for (int count = 0; isOverlayLeft(templocation) != false | isOverlayRight(templocation) != false | isOverlayBelow(templocation) != false; count++)
{
if (isOverlayLeft(templocation) == true)
{
for (int i = 0; i < location.Count; i++)
{
templocation[i][1] += 1;
}
}
if (isOverlayRight(templocation) == true)
{
for (int i = 0; i < location.Count; i++)
{
templocation[i][1] -= 1;
}
}
if (isOverlayBelow(templocation) == true)
{
for (int i = 0; i < location.Count; i++)
{
templocation[i][0] -= 1;
}
}
if (count == 3)
{
return;
}
}
location = templocation;
}
public bool notFalse(bool? inp) => (inp ?? true);
public int[] TransformMatrix(int[] coord, int[] axis) => new int[] { axis[0] - axis[1] + coord[1], axis[0] + axis[1] - coord[0] };
public bool isSomethingBelow()
{
for (int i = 0; i < 4; i++)
{
if (location[i][0] + 1 >= 23)
return true;
if (location[i][0] + 1 < 23 & droppedtetrominoeLocationGrid[location[i][0] + 1, location[i][1]] == 1)
return true;
}
return false;
}
public bool? isOverlayBelow(List<int[]> location)
{
List<int> ycoords = new List<int>();
for (int i = 0; i < 4; i++)
{
ycoords.Add(location[i][0]);
if (location[i][0] >= 23)
return true;
if (location[i][0] < 0 | location[i][1] < 0 | location[i][1] > 9)
return null;
}
for (int i = 0; i < 4; i++)
{
if (ycoords.Max() - ycoords.Min() == 3)
{
if ((ycoords.Max() == location[i][0] | ycoords.Max() - 1 == location[i][0]) & (droppedtetrominoeLocationGrid[location[i][0], location[i][1]] == 1))
{
return true;
}
}
else
{
if ((ycoords.Max() == location[i][0]) & (droppedtetrominoeLocationGrid[location[i][0], location[i][1]] == 1))
{
return true;
}
}
}
return false;
}
public bool isSomethingLeft()
{
for (int i = 0; i < 4; i++)
{
if (location[i][1] == 0)
return true;
else if (droppedtetrominoeLocationGrid[location[i][0], location[i][1] - 1] == 1)
return true;
}
return false;
}
public bool? isOverlayLeft(List<int[]> location)
{
List<int> xcoords = new List<int>();
for (int i = 0; i < 4; i++)
{
xcoords.Add(location[i][1]);
if (location[i][1] < 0)
return true;
if (location[i][1] > 9)
return false;
if (location[i][0] >= 23 | location[i][0] < 0)
return null;
}
for (int i = 0; i < 4; i++)
{
if (xcoords.Max() - xcoords.Min() == 3)
{
if (xcoords.Min() == location[i][1] | xcoords.Min() + 1 == location[i][1])
{
if (droppedtetrominoeLocationGrid[location[i][0], location[i][1]] == 1)
{
return true;
}
}
}
else
{
if (xcoords.Min() == location[i][1])
{
if (droppedtetrominoeLocationGrid[location[i][0], location[i][1]] == 1)
{
return true;
}
}
}
}
return false;
}
public bool isSomethingRight()
{
for (int i = 0; i < 4; i++)
{
if (location[i][1] == 9)
return true;
else if (droppedtetrominoeLocationGrid[location[i][0], location[i][1] + 1] == 1)
return true;
}
return false;
}
public bool? isOverlayRight(List<int[]> location)
{
List<int> xcoords = new List<int>();
for (int i = 0; i < 4; i++)
{
xcoords.Add(location[i][1]);
if (location[i][1] > 9)
return true;
if (location[i][1] < 0)
return false;
if (location[i][0] >= 23 | location[i][0] < 0)
return null;
}
for (int i = 0; i < 4; i++)
{
if (xcoords.Max() - xcoords.Min() == 3)
{
if ((xcoords.Max() == location[i][1] | xcoords.Max() - 1 == location[i][1]) & droppedtetrominoeLocationGrid[location[i][0], location[i][1]] == 1)
{
return true;
}
}
else
{
if (xcoords.Max() == location[i][1] & droppedtetrominoeLocationGrid[location[i][0], location[i][1]] == 1)
{
return true;
}
}
}
return false;
}
public void Update()
{
for (int i = 0; i < 23; i++)
{
for (int j = 0; j < 10; j++)
{
grid[i, j] = 0;
}
}
for (int i = 0; i < 4; i++)
{
grid[location[i][0], location[i][1]] = 1;
}
}
}
}
}

123
lv3g_t/MainForm.resx Normal file
View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="minigameClockT.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

22
lv3g_t/Program.cs Normal file
View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace lv3g_t
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}

View File

@ -0,0 +1,36 @@
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("lv3g_t")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("lv3g_t")]
[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("e6bf80e0-8848-4a6f-b114-fec5055e1d9e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

68
lv3g_t/Properties/Resources.Designer.cs generated Normal file
View File

@ -0,0 +1,68 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace lv3g_t.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get {
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("lv3g_t.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

29
lv3g_t/Properties/Settings.Designer.cs generated Normal file
View File

@ -0,0 +1,29 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace lv3g_t.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get {
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

89
lv3g_t/lv3g_t.csproj Normal file
View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E6BF80E0-8848-4A6F-B114-FEC5055E1D9E}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>lv3g_t</RootNamespace>
<AssemblyName>lv3g_t</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Base\Base.csproj">
<Project>{9A9561A7-DD5F-43A5-A3F5-A95F35DA204D}</Project>
<Name>Base</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>