Skip to content

Commit

Permalink
too lazy for good commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeymanboy committed Jun 19, 2019
1 parent 21ca2c7 commit fea2183
Show file tree
Hide file tree
Showing 12 changed files with 201 additions and 45 deletions.
7 changes: 4 additions & 3 deletions BeatSaberCampaignCreator/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
</configuration>

</configuration>
28 changes: 18 additions & 10 deletions BeatSaberCampaignCreator/BeatSaberCampaignCreator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
<OutputType>WinExe</OutputType>
<RootNamespace>BeatSaberCampaignCreator</RootNamespace>
<AssemblyName>BeatSaberCampaignCreator</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -33,18 +34,19 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>E:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="BeatSaberChallenges">
<HintPath>E:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins\BeatSaberChallenges.dll</HintPath>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="BeatSaberCustomUI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="BeatSaberCustomUI, Version=1.3.9.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>E:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins\BeatSaberCustomUI.dll</HintPath>
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins\BeatSaberCustomUI.dll</HintPath>
</Reference>
<Reference Include="Custom Campaigns">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins\Custom Campaigns.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>E:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Newtonsoft.Json.dll</HintPath>
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Ookii.Dialogs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0c15020868fd6249, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -111,6 +113,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
Expand All @@ -123,7 +126,12 @@
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="App.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
60 changes: 53 additions & 7 deletions BeatSaberCampaignCreator/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 25 additions & 7 deletions BeatSaberCampaignCreator/Form1.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using BeatSaberDailyChallenges;
using BeatSaberDailyChallenges.campaign;
using BeatSaberCustomCampaigns;
using BeatSaberCustomCampaigns.campaign;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
Expand All @@ -8,17 +8,18 @@
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static PlayerDataModelSaveData.GameplayModifiers;

namespace BeatSaberCampaignCreator
{
public partial class Form1 : Form
{
Ookii.Dialogs.Wpf.VistaFolderBrowserDialog folderBrowserDialog1;
Campaign campaign = null;
Bitmap backgroundBitmap = null;
string currentDirectory;
int currentChallenge = 0;
bool isLoading = false;
Expand Down Expand Up @@ -138,25 +139,28 @@ public void SetCampaignInfoData()
campaignDesc.Text = campaign.info.desc;
allUnlocked.Checked = campaign.info.allUnlocked;
numericUpDown1.Value = campaign.info.mapHeight;
backgroundAlpha.Value = (decimal)campaign.info.backgroundAlpha;
updatingCampaign = false;
}
public void UpdateCampaignInfo()
{
campaign.info.name = campaignName.Text;
campaign.info.desc = campaignDesc.Text;
campaign.info.allUnlocked = allUnlocked.Checked;
campaign.info.backgroundAlpha = (float)backgroundAlpha.Value;
}

//Header
private void newToolStripMenuItem_Click(object sender, EventArgs e)
{
if (folderBrowserDialog1.ShowDialog().Value)
{
Location = new Point(Location.X+1, Location.Y);
string path = folderBrowserDialog1.SelectedPath;
currentDirectory = path;
campaign = new Campaign();
campaign.info = new CampaignInfo();
campaign.challenges = new List<BeatSaberDailyChallenges.Challenge>();
campaign.challenges = new List<Challenge>();
listBox1.Items.Clear();
AddChallenge();
currentChallenge = 0;
Expand All @@ -171,11 +175,12 @@ private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
if (folderBrowserDialog1.ShowDialog().Value)
{
Location = new Point(Location.X + 1, Location.Y);
string path = folderBrowserDialog1.SelectedPath;
currentDirectory = path;
campaign = new Campaign();
campaign.info = JsonConvert.DeserializeObject<CampaignInfo>(File.ReadAllText(path + "/info.json"));
campaign.challenges = new List<BeatSaberDailyChallenges.Challenge>();
campaign.challenges = new List<Challenge>();
currentChallenge = 0;
int i = 0;
listBox1.Items.Clear();
Expand All @@ -190,6 +195,13 @@ private void openToolStripMenuItem_Click(object sender, EventArgs e)
SetRequirementToSelected();
PrepareMap();
tabControl1.Enabled = true;
if (File.Exists(path + "/map background.png"))
{
backgroundBitmap = new Bitmap(path + "/map background.png");
} else
{
backgroundBitmap = null;
}
}
}

Expand Down Expand Up @@ -375,10 +387,16 @@ public void UpdateMapHeight(int height)
}

Pen pen = new Pen(Brushes.Red, 8);

private void panel1_Paint(object sender, PaintEventArgs e)
{
//Draw arrows
Graphics g = e.Graphics;
if (backgroundBitmap != null)
{
int renderedHeight = mapArea.Width * backgroundBitmap.Height / backgroundBitmap.Width;
g.DrawImage(backgroundBitmap, 0, mapArea.Height-renderedHeight, mapArea.Width, renderedHeight);
}
pen.StartCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
foreach(NodeButton node in nodes)
{
Expand Down Expand Up @@ -495,7 +513,7 @@ private void clickNode(object sender, EventArgs e)
setState(MapState.MOVE);
break;
case MapState.EDIT:
new FormEditNode(((NodeButton)sender).mapPosition).ShowDialog();
new FormEditNode(((NodeButton)sender)).ShowDialog();
break;
}
}
Expand Down Expand Up @@ -591,11 +609,11 @@ private void moveGates_Click(object sender, EventArgs e)
if (!CanSwitchState()) return;
setState(MapState.MOVE_GATES);
}

private void Form1_Load(object sender, EventArgs e)
{

folderBrowserDialog1 = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog();
typeof(Panel).InvokeMember("DoubleBuffered", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, null, mapArea, new object[] { true });
}
//Unlockable stuff
int curUnlockableIndex;
Expand Down
5 changes: 5 additions & 0 deletions BeatSaberCampaignCreator/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ Unlock gates prevent the player from playing any
challenges ABOVE the unlock gate until they have
completed the number of challenges required for
that gate</value>
</data>
<data name="label9.Text" xml:space="preserve">
<value>If you don't use a custom download url then just put the song's version number from beatsaver
in song version #. If you do you need to make Song Version # something unique as this is how
the plugin finds the song as well as being the name of the folder it puts it in.</value>
</data>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>460, 17</value>
Expand Down
6 changes: 3 additions & 3 deletions BeatSaberCampaignCreator/FormEditGate.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion BeatSaberCampaignCreator/FormEditGate.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using BeatSaberDailyChallenges.campaign;
using BeatSaberCustomCampaigns.campaign;
using System;
using System.Collections.Generic;
using System.ComponentModel;
Expand Down
Loading

0 comments on commit fea2183

Please sign in to comment.