-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e2bc1d
commit 090b248
Showing
9 changed files
with
405 additions
and
3 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?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>{06F79FB4-D84F-4C73-B804-D3D4A4813BE3}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>CustomQuests</RootNamespace> | ||
<AssemblyName>CustomQuests</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</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="0Harmony12"> | ||
<HintPath>H:\tmp\ga\MTAP\Portia_Data\Managed\UnityModManager\0Harmony12.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Assembly-CSharp"> | ||
<HintPath>H:\tmp\ga\MTAP\Portia_Data\Managed\Assembly-CSharp.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Assembly-CSharp-firstpass"> | ||
<HintPath>H:\tmp\ga\MTAP\Portia_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.AnimationModule"> | ||
<HintPath>H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.AnimationModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.AudioModule"> | ||
<HintPath>H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.AudioModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.CoreModule"> | ||
<HintPath>H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.CoreModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.IMGUIModule"> | ||
<HintPath>H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.ParticleSystemModule"> | ||
<HintPath>H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.ParticleSystemModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UI"> | ||
<HintPath>H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.UI.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UIModule"> | ||
<HintPath>H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.UIModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UnityWebRequestAudioModule"> | ||
<HintPath>H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.UnityWebRequestAudioModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UnityWebRequestModule"> | ||
<HintPath>H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.UnityWebRequestModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UnityWebRequestWWWModule"> | ||
<HintPath>H:\tmp\ga\MTAP\Portia_Data\Managed\UnityEngine.UnityWebRequestWWWModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityModManager"> | ||
<HintPath>H:\tmp\ga\MTAP\Portia_Data\Managed\UnityModManager\UnityModManager.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Main.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Settings.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
using Harmony12; | ||
using SimpleJSON; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Reflection; | ||
using UnityEngine; | ||
using UnityModManagerNet; | ||
|
||
namespace CustomQuests | ||
{ | ||
public partial class Main | ||
{ | ||
private static bool isDebug = false; | ||
|
||
public static void Dbgl(string str = "", bool pref = true) | ||
{ | ||
if (isDebug) | ||
Debug.Log((pref ? "CustomQuests " : "") + str); | ||
} | ||
public static bool enabled; | ||
public static Settings settings { get; private set; } | ||
|
||
public static Dictionary<int, string> nameDesc = new Dictionary<int, string>(); | ||
public static Dictionary<int, int> sourceStrings = new Dictionary<int, int>(); | ||
|
||
// Send a response to the mod manager about the launch status, success or not. | ||
private static bool Load(UnityModManager.ModEntry modEntry) | ||
{ | ||
settings = UnityModManager.ModSettings.Load<Settings>(modEntry); | ||
modEntry.OnToggle = OnToggle; | ||
modEntry.OnGUI = OnGUI; | ||
modEntry.OnSaveGUI = OnSaveGUI; | ||
|
||
var harmony = HarmonyInstance.Create(modEntry.Info.Id); | ||
harmony.PatchAll(Assembly.GetExecutingAssembly()); | ||
|
||
LoadItems(); | ||
|
||
//LoadItemFile(); | ||
|
||
return true; | ||
} | ||
|
||
private static void LoadItems() | ||
{ | ||
// weapons items | ||
string path = $"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}\\assets\\"; | ||
if (Directory.Exists(path)) | ||
{ | ||
string[] files = Directory.GetFiles(path, "*.json"); | ||
foreach (string file in files) | ||
{ | ||
try | ||
{ | ||
JSONNode jsonRoot = JSONNode.Parse(File.ReadAllText(file)); | ||
if (jsonRoot != null) | ||
{ | ||
for (int i = 0; i < jsonRoot.Count; i++) | ||
{ | ||
JSONNode jsonNode = jsonRoot[i]; | ||
storeItems.Add(new StoreItem(jsonNode["ID"].AsInt, productIds++, jsonNode["count"].AsInt, jsonNode["currency"].AsInt, jsonNode["requireMission"], jsonNode["storeId"].AsInt, jsonNode["chance"].AsFloat)); | ||
} | ||
} | ||
} | ||
catch (Exception arg) | ||
{ | ||
Debug.LogError("exception reading json file:" + arg); | ||
} | ||
} | ||
} | ||
} | ||
|
||
private static void OnSaveGUI(UnityModManager.ModEntry modEntry) | ||
{ | ||
settings.Save(modEntry); | ||
} | ||
|
||
private static void OnGUI(UnityModManager.ModEntry modEntry) | ||
{ | ||
} | ||
|
||
// Called when the mod is turned to on/off. | ||
static bool OnToggle(UnityModManager.ModEntry modEntry, bool value /* active or inactive */) | ||
{ | ||
enabled = value; | ||
return true; // Permit or not. | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Collections.Generic; | ||
using UnityModManagerNet; | ||
|
||
namespace CustomQuests | ||
{ | ||
public class Settings : UnityModManager.ModSettings | ||
{ | ||
public override void Save(UnityModManager.ModEntry modEntry) | ||
{ | ||
Save(this, modEntry); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.