mirror of
https://github.com/misternebula/MenuFramework.git
synced 2025-12-11 20:15:15 +01:00
Initial commit
This commit is contained in:
commit
80cf8fa7b5
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
340
.gitignore
vendored
Normal file
340
.gitignore
vendored
Normal file
@ -0,0 +1,340 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- Backup*.rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Mister_Nebula
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
34
MenuFramework.sln
Normal file
34
MenuFramework.sln
Normal file
@ -0,0 +1,34 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30804.86
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MenuFramework", "MenuFramework\MenuFramework.csproj", "{D894866C-F6A2-4BBB-BB41-EC8164AC185F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{AD61351D-B3D3-49AC-AC38-6F601003A234} = {AD61351D-B3D3-49AC-AC38-6F601003A234}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestMod", "TestMod\TestMod.csproj", "{AD61351D-B3D3-49AC-AC38-6F601003A234}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D894866C-F6A2-4BBB-BB41-EC8164AC185F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D894866C-F6A2-4BBB-BB41-EC8164AC185F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D894866C-F6A2-4BBB-BB41-EC8164AC185F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D894866C-F6A2-4BBB-BB41-EC8164AC185F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AD61351D-B3D3-49AC-AC38-6F601003A234}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AD61351D-B3D3-49AC-AC38-6F601003A234}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AD61351D-B3D3-49AC-AC38-6F601003A234}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AD61351D-B3D3-49AC-AC38-6F601003A234}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {06130B75-122D-4120-BF8A-8830BB092D5F}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
24
MenuFramework/Main.cs
Normal file
24
MenuFramework/Main.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using OWML.Common;
|
||||
using OWML.ModHelper;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MenuFramework
|
||||
{
|
||||
public class Main : ModBehaviour
|
||||
{
|
||||
public static IModHelper Helper { get; private set; }
|
||||
|
||||
public override object GetApi() => new MenuAPI();
|
||||
|
||||
private readonly Dictionary<ButtonWithHotkeyImageElement, string> buttonDict = new Dictionary<ButtonWithHotkeyImageElement, string>();
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Helper = ModHelper;
|
||||
|
||||
gameObject.AddComponent<TitleButtonManager>();
|
||||
gameObject.AddComponent<PopupMenuManager>();
|
||||
gameObject.AddComponent<PauseButtonManager>();
|
||||
}
|
||||
}
|
||||
}
|
||||
40
MenuFramework/MenuAPI.cs
Normal file
40
MenuFramework/MenuAPI.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace MenuFramework
|
||||
{
|
||||
public class MenuAPI
|
||||
{
|
||||
// TITLE SCREEN
|
||||
public GameObject TitleScreen_MakeMenuOpenButton(string name, Menu menuToOpen)
|
||||
=> TitleButtonManager.Instance.MakeMenuOpenButton(name, menuToOpen);
|
||||
|
||||
public GameObject TitleScreen_MakeSceneLoadButton(string name, SubmitActionLoadScene.LoadableScenes sceneToLoad, PopupMenu confirmPopup = null)
|
||||
=> TitleButtonManager.Instance.MakeSceneLoadButton(name, sceneToLoad, confirmPopup);
|
||||
|
||||
public Button TitleScreen_MakeSimpleButton(string name)
|
||||
=> TitleButtonManager.Instance.MakeSimpleButton(name);
|
||||
|
||||
// PAUSE MENU
|
||||
public GameObject PauseMenu_MakeMenuOpenButton(string name, Menu menuToOpen, Menu customMenu = null)
|
||||
=> PauseButtonManager.Instance.MakeMenuOpenButton(name, menuToOpen, customMenu);
|
||||
|
||||
public GameObject PauseMenu_MakeSceneLoadButton(string name, SubmitActionLoadScene.LoadableScenes sceneToLoad, PopupMenu confirmPopup = null, Menu customMenu = null)
|
||||
=> PauseButtonManager.Instance.MakeSceneLoadButton(name, sceneToLoad, confirmPopup, customMenu);
|
||||
|
||||
public Button PauseMenu_MakeSimpleButton(string name, Menu customMenu = null)
|
||||
=> PauseButtonManager.Instance.MakeSimpleButton(name, customMenu);
|
||||
|
||||
public Menu PauseMenu_MakePauseListMenu(string title)
|
||||
=> PauseButtonManager.Instance.MakePauseListMenu(title);
|
||||
|
||||
// MISC
|
||||
public PopupMenu MakeTwoChoicePopup(string message, string confirmText, string cancelText)
|
||||
=> PopupMenuManager.Instance.CreateTwoChoicePopup(message, confirmText, cancelText);
|
||||
|
||||
public PopupInputMenu MakeInputFieldPopup(string message, string placeholderMessage, string confirmText, string cancelText)
|
||||
=> PopupMenuManager.Instance.CreateInputFieldPopup(message, placeholderMessage, confirmText, cancelText);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
121
MenuFramework/MenuFramework.csproj
Normal file
121
MenuFramework/MenuFramework.csproj
Normal file
@ -0,0 +1,121 @@
|
||||
<?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>{D894866C-F6A2-4BBB-BB41-EC8164AC185F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MenuFramework</RootNamespace>
|
||||
<AssemblyName>MenuFramework</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>
|
||||
<PropertyGroup>
|
||||
<RunPostBuildEvent>Always</RunPostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony, Version=1.2.0.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Lib.Harmony.1.2.0.1\lib\net35\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>D:\EpicGames\OuterWilds\OuterWilds_Data\Managed\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NAudio-Unity, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\NAudio-Unity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Json.Net.Unity3D.9.0.1\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Common, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Logging, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.ModHelper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Assets, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.ModHelper.Assets.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Events, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.ModHelper.Events.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Input, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.ModHelper.Input.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Interaction, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.ModHelper.Interaction.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Menus, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.ModHelper.Menus.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Utils, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.Utils.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>D:\EpicGames\OuterWilds\OuterWilds_Data\Managed\UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>D:\EpicGames\OuterWilds\OuterWilds_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.IMGUIModule">
|
||||
<HintPath>D:\EpicGames\OuterWilds\OuterWilds_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.TextRenderingModule">
|
||||
<HintPath>D:\EpicGames\OuterWilds\OuterWilds_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UI">
|
||||
<HintPath>D:\EpicGames\OuterWilds\OuterWilds_Data\Managed\UnityEngine.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UIModule">
|
||||
<HintPath>D:\EpicGames\OuterWilds\OuterWilds_Data\Managed\UnityEngine.UIModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="MenuAPI.cs" />
|
||||
<Compile Include="PauseButtonManager.cs" />
|
||||
<Compile Include="PopupMenuManager.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TitleButtonManager.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="manifest.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>xcopy /e /i /y "$(TargetDir)*" "$(OwmlDir)\Mods\$(ProjectName)"
|
||||
echo $(ProjectName)
|
||||
echo $(TargetDir)</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
178
MenuFramework/PauseButtonManager.cs
Normal file
178
MenuFramework/PauseButtonManager.cs
Normal file
@ -0,0 +1,178 @@
|
||||
using OWML.Utils;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace MenuFramework
|
||||
{
|
||||
internal class PauseButtonManager : MonoBehaviour
|
||||
{
|
||||
public static PauseButtonManager Instance { get; private set; }
|
||||
|
||||
private void Awake() => Instance = this;
|
||||
|
||||
public Menu MakePauseListMenu(string title)
|
||||
{
|
||||
if (LoadManager.GetCurrentScene() != OWScene.SolarSystem && LoadManager.GetCurrentScene() != OWScene.EyeOfTheUniverse)
|
||||
{
|
||||
Main.Helper.Console.WriteLine("Error - Cannot create pause menu in this scene!", OWML.Common.MessageType.Error);
|
||||
return null;
|
||||
}
|
||||
var originalPauseList = Resources.FindObjectsOfTypeAll<Menu>().First(x => x.name == "PauseMenuItems").gameObject;
|
||||
var pauseMenuItems = Instantiate(originalPauseList);
|
||||
pauseMenuItems.transform.parent = originalPauseList.transform.parent;
|
||||
pauseMenuItems.transform.localPosition = Vector3.zero;
|
||||
pauseMenuItems.transform.localScale = Vector3.one;
|
||||
pauseMenuItems.name = "CUSTOM_MENU";
|
||||
|
||||
var text = pauseMenuItems.GetComponentInChildren<Text>();
|
||||
Destroy(text.GetComponent<LocalizedText>());
|
||||
text.text = title;
|
||||
|
||||
var layout = pauseMenuItems.transform.Find("PauseMenuItemsLayout");
|
||||
foreach (Transform transform in layout)
|
||||
{
|
||||
Main.Helper.Console.WriteLine(transform.name);
|
||||
if (transform.GetComponent<Button>() != null)
|
||||
{
|
||||
transform.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
layout.name = "CUSTOM_LAYOUT";
|
||||
return pauseMenuItems.GetComponent<Menu>();
|
||||
}
|
||||
|
||||
public Button MakeSimpleButton(string name, Menu customMenu = null)
|
||||
{
|
||||
var button = CreateBase(name, customMenu);
|
||||
button.SetActive(true);
|
||||
return button.GetComponent<Button>();
|
||||
}
|
||||
|
||||
public GameObject MakeMenuOpenButton(string name, Menu menuToOpen, Menu customMenu = null)
|
||||
{
|
||||
if (LoadManager.GetCurrentScene() != OWScene.SolarSystem && LoadManager.GetCurrentScene() != OWScene.EyeOfTheUniverse)
|
||||
{
|
||||
Main.Helper.Console.WriteLine("Error - Cannot create pause button in this scene!", OWML.Common.MessageType.Error);
|
||||
return null;
|
||||
}
|
||||
var menuRootObject = CreateBase(name, customMenu);
|
||||
|
||||
var submitActionMenu = menuRootObject.AddComponent<SubmitActionMenu>();
|
||||
submitActionMenu.SetValue("_menuToOpen", menuToOpen);
|
||||
|
||||
menuRootObject.SetActive(true);
|
||||
return menuRootObject;
|
||||
}
|
||||
|
||||
public GameObject MakeSceneLoadButton(string name, SubmitActionLoadScene.LoadableScenes sceneToLoad, PopupMenu confirmPopup = null, Menu customMenu = null)
|
||||
{
|
||||
if (LoadManager.GetCurrentScene() != OWScene.SolarSystem && LoadManager.GetCurrentScene() != OWScene.EyeOfTheUniverse)
|
||||
{
|
||||
Main.Helper.Console.WriteLine("Error - Cannot create pause button in this scene!", OWML.Common.MessageType.Error);
|
||||
return null;
|
||||
}
|
||||
var menuRootObject = CreateBase(name, customMenu);
|
||||
|
||||
var submitActionLoadScene = menuRootObject.AddComponent<SubmitActionLoadScene>();
|
||||
submitActionLoadScene.SetSceneToLoad(sceneToLoad);
|
||||
submitActionLoadScene.EnableConfirm(confirmPopup != null);
|
||||
submitActionLoadScene.SetValue("_confirmPopup", confirmPopup);
|
||||
submitActionLoadScene.SetValue("_loadingText", menuRootObject.GetComponentInChildren<Text>());
|
||||
|
||||
menuRootObject.SetActive(true);
|
||||
return menuRootObject;
|
||||
}
|
||||
|
||||
private GameObject CreateBase(string name, Menu customMenu = null)
|
||||
{
|
||||
Main.Helper.Console.WriteLine($"Create base {name}");
|
||||
if (customMenu == null)
|
||||
{
|
||||
customMenu = Resources.FindObjectsOfTypeAll<Menu>().First(x => x.name == "PauseMenuItems");
|
||||
Main.Helper.Console.WriteLine($"- Defaulting to {customMenu.name}");
|
||||
}
|
||||
var pauseButton = new GameObject($"Button-{name}");
|
||||
var mainMenuLayoutGroup = customMenu.transform.GetChild(1).GetComponent<VerticalLayoutGroup>();
|
||||
Main.Helper.Console.WriteLine($"- got layout as {mainMenuLayoutGroup.name}");
|
||||
pauseButton.transform.parent = mainMenuLayoutGroup.transform;
|
||||
pauseButton.transform.localPosition = Vector3.zero;
|
||||
pauseButton.transform.localScale = Vector3.one;
|
||||
pauseButton.transform.SetSiblingIndex(pauseButton.transform.GetSiblingIndex() - 2);
|
||||
pauseButton.SetActive(false);
|
||||
|
||||
var rect = pauseButton.AddComponent<RectTransform>();
|
||||
rect.position = Vector3.zero;
|
||||
|
||||
var button = pauseButton.AddComponent<Button>();
|
||||
button.interactable = true;
|
||||
button.transition = Selectable.Transition.None;
|
||||
button.navigation = new Navigation
|
||||
{
|
||||
mode = Navigation.Mode.Vertical
|
||||
};
|
||||
|
||||
var layoutElement = pauseButton.AddComponent<LayoutElement>();
|
||||
layoutElement.minHeight = 60f;
|
||||
|
||||
var canvasGroup = pauseButton.AddComponent<CanvasGroup>();
|
||||
canvasGroup.alpha = 1f;
|
||||
canvasGroup.interactable = true;
|
||||
canvasGroup.blocksRaycasts = true;
|
||||
canvasGroup.ignoreParentGroups = false;
|
||||
|
||||
pauseButton.AddComponent<SelectableAudioPlayer>();
|
||||
|
||||
var verticalLayoutGroup = pauseButton.AddComponent<VerticalLayoutGroup>();
|
||||
verticalLayoutGroup.spacing = 0;
|
||||
verticalLayoutGroup.childAlignment = TextAnchor.MiddleCenter;
|
||||
verticalLayoutGroup.childForceExpandHeight = false;
|
||||
verticalLayoutGroup.childForceExpandWidth = false;
|
||||
verticalLayoutGroup.childControlHeight = true;
|
||||
verticalLayoutGroup.childControlWidth = true;
|
||||
|
||||
CreateButtonVisuals(pauseButton, name);
|
||||
|
||||
return pauseButton;
|
||||
}
|
||||
|
||||
private void CreateButtonVisuals(GameObject button, string name)
|
||||
{
|
||||
// TODO : cache this
|
||||
var newLayoutGroup = Instantiate(Resources.FindObjectsOfTypeAll<HorizontalLayoutGroup>().First(x => x.name == "HorizontalLayoutGroup" && x.transform.parent.name == "Button-Options").gameObject);
|
||||
newLayoutGroup.SetActive(true);
|
||||
newLayoutGroup.transform.parent = button.transform;
|
||||
newLayoutGroup.transform.localPosition = Vector3.zero;
|
||||
var text = newLayoutGroup.transform.Find("Text");
|
||||
Destroy(text.GetComponent<LocalizedText>());
|
||||
text.GetComponent<Text>().text = name;
|
||||
|
||||
var leftArrow = newLayoutGroup.transform.Find("LeftArrow").GetComponent<Image>();
|
||||
var rightArrow = newLayoutGroup.transform.Find("RightArrow").GetComponent<Image>();
|
||||
|
||||
var uiStyleApplier = button.AddComponent<UIStyleApplier>();
|
||||
uiStyleApplier.SetValue("_textItems", new Text[1] { text.GetComponent<Text>() });
|
||||
uiStyleApplier.SetValue("_foregroundGraphics",
|
||||
new Graphic[3] {
|
||||
text.GetComponent<Text>(),
|
||||
leftArrow,
|
||||
rightArrow
|
||||
});
|
||||
uiStyleApplier.SetValue("_backgroundGraphics", new Graphic[0]);
|
||||
uiStyleApplier.SetValue("_onOffGraphicList",
|
||||
new UIStyleApplier.OnOffGraphic[2]
|
||||
{
|
||||
new UIStyleApplier.OnOffGraphic()
|
||||
{
|
||||
graphic = leftArrow,
|
||||
visibleHighlighted = true
|
||||
},
|
||||
new UIStyleApplier.OnOffGraphic()
|
||||
{
|
||||
graphic = rightArrow,
|
||||
visibleHighlighted = true
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
53
MenuFramework/PopupMenuManager.cs
Normal file
53
MenuFramework/PopupMenuManager.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MenuFramework
|
||||
{
|
||||
internal class PopupMenuManager : MonoBehaviour
|
||||
{
|
||||
public static PopupMenuManager Instance { get; private set; }
|
||||
|
||||
private GameObject _twoChoicePopupBase;
|
||||
private GameObject _inputPopupBase;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
|
||||
_inputPopupBase = Instantiate(Resources.FindObjectsOfTypeAll<PopupMenu>().First(x => x.name == "InputField-Popup" && x.transform.parent.name == "PopupCanvas").gameObject);
|
||||
DontDestroyOnLoad(_inputPopupBase);
|
||||
_inputPopupBase.SetActive(false);
|
||||
|
||||
_twoChoicePopupBase = Instantiate(Resources.FindObjectsOfTypeAll<PopupMenu>().First(x => x.name == "TwoButton-Popup" && x.transform.parent.name == "PopupCanvas").gameObject);
|
||||
DontDestroyOnLoad(_twoChoicePopupBase);
|
||||
_twoChoicePopupBase.SetActive(false);
|
||||
}
|
||||
|
||||
public PopupMenu CreateTwoChoicePopup(string message, string confirmText, string cancelText)
|
||||
{
|
||||
var newPopup = Instantiate(_twoChoicePopupBase);
|
||||
newPopup.transform.parent = GameObject.Find("PopupCanvas").transform;
|
||||
newPopup.transform.localPosition = Vector3.zero;
|
||||
newPopup.transform.localScale = Vector3.one;
|
||||
newPopup.GetComponentsInChildren<LocalizedText>().ToList().ForEach(x => Destroy(x));
|
||||
|
||||
var popup = newPopup.GetComponent<PopupMenu>();
|
||||
popup.SetUpPopup(message, InputLibrary.menuConfirm, InputLibrary.cancel, new ScreenPrompt(confirmText), new ScreenPrompt(cancelText), true, true);
|
||||
return popup;
|
||||
}
|
||||
|
||||
public PopupInputMenu CreateInputFieldPopup(string message, string placeholderMessage, string confirmText, string cancelText)
|
||||
{
|
||||
var newPopup = Instantiate(_inputPopupBase);
|
||||
newPopup.transform.parent = GameObject.Find("PopupCanvas").transform;
|
||||
newPopup.transform.localPosition = Vector3.zero;
|
||||
newPopup.transform.localScale = Vector3.one;
|
||||
newPopup.GetComponentsInChildren<LocalizedText>().ToList().ForEach(x => Destroy(x));
|
||||
|
||||
var popup = newPopup.GetComponent<PopupInputMenu>();
|
||||
popup.SetUpPopup(message, InputLibrary.menuConfirm, InputLibrary.cancel, new ScreenPrompt(confirmText), new ScreenPrompt(cancelText), true, true);
|
||||
popup.SetInputFieldPlaceholderText(placeholderMessage);
|
||||
return popup;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
MenuFramework/Properties/AssemblyInfo.cs
Normal file
35
MenuFramework/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
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("MenuFramework")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("HP Inc.")]
|
||||
[assembly: AssemblyProduct("MenuFramework")]
|
||||
[assembly: AssemblyCopyright("Copyright © HP Inc. 2021")]
|
||||
[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("d894866c-f6a2-4bbb-bb41-ec8164ac185f")]
|
||||
|
||||
// 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")]
|
||||
153
MenuFramework/TitleButtonManager.cs
Normal file
153
MenuFramework/TitleButtonManager.cs
Normal file
@ -0,0 +1,153 @@
|
||||
using OWML.Utils;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace MenuFramework
|
||||
{
|
||||
internal class TitleButtonManager : MonoBehaviour
|
||||
{
|
||||
public static TitleButtonManager Instance { get; private set; }
|
||||
|
||||
private void Awake() => Instance = this;
|
||||
|
||||
public Button MakeSimpleButton(string name)
|
||||
{
|
||||
var button = CreateBase(name);
|
||||
button.SetActive(true);
|
||||
return button.GetComponent<Button>();
|
||||
}
|
||||
|
||||
public GameObject MakeMenuOpenButton(string name, Menu menuToOpen)
|
||||
{
|
||||
if (LoadManager.GetCurrentScene() != OWScene.TitleScreen)
|
||||
{
|
||||
Main.Helper.Console.WriteLine("Error - Cannot create title button in this scene!", OWML.Common.MessageType.Error);
|
||||
return null;
|
||||
}
|
||||
var menuRootObject = CreateBase(name);
|
||||
|
||||
var submitActionMenu = menuRootObject.AddComponent<SubmitActionMenu>();
|
||||
submitActionMenu.SetValue("_menuToOpen", menuToOpen);
|
||||
|
||||
menuRootObject.SetActive(true);
|
||||
return menuRootObject;
|
||||
}
|
||||
|
||||
public GameObject MakeSceneLoadButton(string name, SubmitActionLoadScene.LoadableScenes sceneToLoad, PopupMenu confirmPopup = null)
|
||||
{
|
||||
if (LoadManager.GetCurrentScene() != OWScene.TitleScreen)
|
||||
{
|
||||
Main.Helper.Console.WriteLine("Error - Cannot create title button in this scene!", OWML.Common.MessageType.Error);
|
||||
return null;
|
||||
}
|
||||
var menuRootObject = CreateBase(name);
|
||||
|
||||
var submitActionLoadScene = menuRootObject.AddComponent<SubmitActionLoadScene>();
|
||||
submitActionLoadScene.SetSceneToLoad(sceneToLoad);
|
||||
submitActionLoadScene.EnableConfirm(confirmPopup != null);
|
||||
submitActionLoadScene.SetValue("_confirmPopup", confirmPopup);
|
||||
submitActionLoadScene.SetValue("_loadingText", menuRootObject.GetComponentInChildren<Text>());
|
||||
|
||||
menuRootObject.SetActive(true);
|
||||
return menuRootObject;
|
||||
}
|
||||
|
||||
private GameObject CreateBase(string name)
|
||||
{
|
||||
var titleButton = new GameObject($"Button-{name}");
|
||||
var mainMenuLayoutGroup = GameObject.Find("MainMenuLayoutGroup");
|
||||
titleButton.transform.parent = mainMenuLayoutGroup.transform;
|
||||
titleButton.transform.localPosition = Vector3.zero;
|
||||
titleButton.transform.localScale = Vector3.one;
|
||||
titleButton.transform.SetSiblingIndex(titleButton.transform.GetSiblingIndex() - 2);
|
||||
titleButton.SetActive(false);
|
||||
|
||||
var rect = titleButton.AddComponent<RectTransform>();
|
||||
rect.position = Vector3.zero;
|
||||
|
||||
var button = titleButton.AddComponent<Button>();
|
||||
button.interactable = true;
|
||||
button.transition = Selectable.Transition.None;
|
||||
button.navigation = new Navigation
|
||||
{
|
||||
mode = Navigation.Mode.Vertical
|
||||
};
|
||||
|
||||
var layoutElement = titleButton.AddComponent<LayoutElement>();
|
||||
layoutElement.minHeight = 60f;
|
||||
|
||||
var canvasGroup = titleButton.AddComponent<CanvasGroup>();
|
||||
canvasGroup.alpha = 0f;
|
||||
canvasGroup.interactable = true;
|
||||
canvasGroup.blocksRaycasts = true;
|
||||
canvasGroup.ignoreParentGroups = false;
|
||||
|
||||
var animController = GameObject.Find("TitleMenuManagers").GetComponent<TitleAnimationController>();
|
||||
var array = animController.GetValue<CanvasGroupFadeController[]>("_buttonFadeControllers");
|
||||
var newLength = array.Length + 1;
|
||||
Array.Resize(ref array, newLength);
|
||||
array[newLength - 1] = new CanvasGroupFadeController
|
||||
{
|
||||
group = canvasGroup
|
||||
};
|
||||
animController.SetValue("_buttonFadeControllers", array);
|
||||
|
||||
titleButton.AddComponent<SelectableAudioPlayer>();
|
||||
|
||||
var verticalLayoutGroup = titleButton.AddComponent<VerticalLayoutGroup>();
|
||||
verticalLayoutGroup.spacing = 0;
|
||||
verticalLayoutGroup.childAlignment = TextAnchor.MiddleCenter;
|
||||
verticalLayoutGroup.childForceExpandHeight = false;
|
||||
verticalLayoutGroup.childForceExpandWidth = false;
|
||||
verticalLayoutGroup.childControlHeight = true;
|
||||
verticalLayoutGroup.childControlWidth = true;
|
||||
|
||||
var image = titleButton.AddComponent<Image>();
|
||||
image.raycastTarget = true;
|
||||
image.color = new Color(255, 255, 255, 0);
|
||||
|
||||
CreateButtonVisuals(titleButton, name);
|
||||
|
||||
return titleButton;
|
||||
}
|
||||
|
||||
private void CreateButtonVisuals(GameObject button, string name)
|
||||
{
|
||||
var newLayoutGroup = Instantiate(GameObject.Find("Button-Options/LayoutGroup"));
|
||||
newLayoutGroup.SetActive(true);
|
||||
newLayoutGroup.transform.parent = button.transform;
|
||||
newLayoutGroup.transform.localPosition = Vector3.zero;
|
||||
var text = newLayoutGroup.transform.Find("Text");
|
||||
Destroy(text.GetComponent<LocalizedText>());
|
||||
text.GetComponent<Text>().text = name;
|
||||
|
||||
var leftArrow = newLayoutGroup.transform.Find("LeftArrow").GetComponent<Image>();
|
||||
var rightArrow = newLayoutGroup.transform.Find("RightArrow").GetComponent<Image>();
|
||||
|
||||
var uiStyleApplier = button.AddComponent<UIStyleApplier>();
|
||||
uiStyleApplier.SetValue("_textItems", new Text[1] { text.GetComponent<Text>() });
|
||||
uiStyleApplier.SetValue("_foregroundGraphics",
|
||||
new Graphic[3] {
|
||||
text.GetComponent<Text>(),
|
||||
leftArrow,
|
||||
rightArrow
|
||||
});
|
||||
uiStyleApplier.SetValue("_backgroundGraphics", new Graphic[0]);
|
||||
uiStyleApplier.SetValue("_onOffGraphicList",
|
||||
new UIStyleApplier.OnOffGraphic[2]
|
||||
{
|
||||
new UIStyleApplier.OnOffGraphic()
|
||||
{
|
||||
graphic = leftArrow,
|
||||
visibleHighlighted = true
|
||||
},
|
||||
new UIStyleApplier.OnOffGraphic()
|
||||
{
|
||||
graphic = rightArrow,
|
||||
visibleHighlighted = true
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
9
MenuFramework/manifest.json
Normal file
9
MenuFramework/manifest.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"filename": "MenuFramework.dll",
|
||||
"author": "_nebula",
|
||||
"name": "Menu Framework",
|
||||
"description": "Custom menu framework/wrapper.",
|
||||
"uniqueName": "_nebula.MenuFramework",
|
||||
"version": "0.1.0",
|
||||
"owmlVersion": "1.1.8"
|
||||
}
|
||||
6
MenuFramework/packages.config
Normal file
6
MenuFramework/packages.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Json.Net.Unity3D" version="9.0.1" targetFramework="net35" />
|
||||
<package id="Lib.Harmony" version="1.2.0.1" targetFramework="net35" />
|
||||
<package id="OWML" version="1.1.8" targetFramework="net35" />
|
||||
</packages>
|
||||
58
TestMod/Class1.cs
Normal file
58
TestMod/Class1.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using OWML.ModHelper;
|
||||
|
||||
namespace TestMod
|
||||
{
|
||||
public class Class1 : ModBehaviour
|
||||
{
|
||||
public IMenuAPI MenuApi;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
LoadManager.OnCompleteSceneLoad += OnSceneLoaded;
|
||||
MenuApi = ModHelper.Interaction.GetModApi<IMenuAPI>("_nebula.MenuFramework");
|
||||
MakeTitleMenus();
|
||||
}
|
||||
|
||||
private void MakePauseMenus()
|
||||
{
|
||||
var customMenu = MenuApi.PauseMenu_MakePauseListMenu("TELEPORT");
|
||||
|
||||
MenuApi.PauseMenu_MakeMenuOpenButton("TELEPORT TO...", customMenu);
|
||||
var shipButton = MenuApi.PauseMenu_MakeSimpleButton("SHIP", customMenu);
|
||||
|
||||
shipButton.onClick.AddListener(WarpToShip);
|
||||
}
|
||||
|
||||
private void WarpToShip()
|
||||
{
|
||||
var playerSpawner = Locator.GetPlayerBody().GetComponent<PlayerSpawner>();
|
||||
playerSpawner.DebugWarp(playerSpawner.GetSpawnPoint(SpawnLocation.Ship));
|
||||
}
|
||||
|
||||
private void MakeTitleMenus()
|
||||
{
|
||||
var twoChoicePopup = MenuApi.MakeTwoChoicePopup("Do thing?", "Yes", "No");
|
||||
var inputPopup = MenuApi.MakeInputFieldPopup("Enter message :", "Put message here!", "Confirm", "Cancel");
|
||||
inputPopup.GetComponent<PopupInputMenu>().OnPopupConfirm += () => ModHelper.Console.WriteLine(inputPopup.GetComponent<PopupInputMenu>().GetInputText());
|
||||
|
||||
MenuApi.TitleScreen_MakeMenuOpenButton("two choice", twoChoicePopup.GetComponent<Menu>());
|
||||
MenuApi.TitleScreen_MakeMenuOpenButton("input", inputPopup.GetComponent<Menu>());
|
||||
MenuApi.TitleScreen_MakeSceneLoadButton("confirm load eye", SubmitActionLoadScene.LoadableScenes.EYE, twoChoicePopup.GetComponent<PopupMenu>());
|
||||
MenuApi.TitleScreen_MakeSceneLoadButton("load eye", SubmitActionLoadScene.LoadableScenes.EYE);
|
||||
}
|
||||
|
||||
private void OnSceneLoaded(OWScene from, OWScene to)
|
||||
{
|
||||
switch (to)
|
||||
{
|
||||
case OWScene.EyeOfTheUniverse:
|
||||
case OWScene.SolarSystem:
|
||||
MakePauseMenus();
|
||||
break;
|
||||
case OWScene.TitleScreen:
|
||||
MakeTitleMenus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
TestMod/IMenuAPI.cs
Normal file
21
TestMod/IMenuAPI.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace TestMod
|
||||
{
|
||||
public interface IMenuAPI
|
||||
{
|
||||
// Title screen
|
||||
GameObject TitleScreen_MakeMenuOpenButton(string name, Menu menuToOpen);
|
||||
GameObject TitleScreen_MakeSceneLoadButton(string name, SubmitActionLoadScene.LoadableScenes sceneToLoad, PopupMenu confirmPopup = null);
|
||||
Button TitleScreen_MakeSimpleButton(string name);
|
||||
// Pause menu
|
||||
GameObject PauseMenu_MakeMenuOpenButton(string name, Menu menuToOpen, Menu customMenu = null);
|
||||
GameObject PauseMenu_MakeSceneLoadButton(string name, SubmitActionLoadScene.LoadableScenes sceneToLoad, PopupMenu confirmPopup = null, Menu customMenu = null);
|
||||
Button PauseMenu_MakeSimpleButton(string name, Menu customMenu = null);
|
||||
Menu PauseMenu_MakePauseListMenu(string title);
|
||||
// Misc
|
||||
PopupMenu MakeTwoChoicePopup(string message, string confirmText, string cancelText);
|
||||
PopupInputMenu MakeInputFieldPopup(string message, string placeholderMessage, string confirmText, string cancelText);
|
||||
}
|
||||
}
|
||||
35
TestMod/Properties/AssemblyInfo.cs
Normal file
35
TestMod/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
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("TestMod")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("HP Inc.")]
|
||||
[assembly: AssemblyProduct("TestMod")]
|
||||
[assembly: AssemblyCopyright("Copyright © HP Inc. 2021")]
|
||||
[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("ad61351d-b3d3-49ac-ac38-6f601003a234")]
|
||||
|
||||
// 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")]
|
||||
117
TestMod/TestMod.csproj
Normal file
117
TestMod/TestMod.csproj
Normal file
@ -0,0 +1,117 @@
|
||||
<?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>{AD61351D-B3D3-49AC-AC38-6F601003A234}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TestMod</RootNamespace>
|
||||
<AssemblyName>TestMod</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>
|
||||
<PropertyGroup>
|
||||
<RunPostBuildEvent>Always</RunPostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony, Version=1.2.0.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Lib.Harmony.1.2.0.1\lib\net35\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>D:\EpicGames\OuterWilds\OuterWilds_Data\Managed\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NAudio-Unity, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\NAudio-Unity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Json.Net.Unity3D.9.0.1\lib\net35\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Common, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Logging, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.ModHelper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Assets, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.ModHelper.Assets.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Events, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.ModHelper.Events.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Input, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.ModHelper.Input.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Interaction, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.ModHelper.Interaction.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.ModHelper.Menus, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.ModHelper.Menus.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OWML.Utils, Version=1.1.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OWML.1.1.8\lib\net35\OWML.Utils.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>D:\EpicGames\OuterWilds\OuterWilds_Data\Managed\UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>D:\EpicGames\OuterWilds\OuterWilds_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UI">
|
||||
<HintPath>D:\EpicGames\OuterWilds\OuterWilds_Data\Managed\UnityEngine.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UIElementsModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>D:\EpicGames\OuterWilds\OuterWilds_Data\Managed\UnityEngine.UIElementsModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UIModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>D:\EpicGames\OuterWilds\OuterWilds_Data\Managed\UnityEngine.UIModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Class1.cs" />
|
||||
<Compile Include="IMenuAPI.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="manifest.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>xcopy /e /i /y "$(TargetDir)*" "$(OwmlDir)\Mods\$(ProjectName)"
|
||||
echo $(ProjectName)
|
||||
echo $(TargetDir)</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
10
TestMod/manifest.json
Normal file
10
TestMod/manifest.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"filename": "TestMod.dll",
|
||||
"author": "_nebula",
|
||||
"name": "Menu Framework Test Mod",
|
||||
"description": "Test mod for the custom menu framework/wrapper.",
|
||||
"uniqueName": "_nebula.TestMod",
|
||||
"version": "0.1.0",
|
||||
"owmlVersion": "1.1.8",
|
||||
"dependencies": [ "_nebula.MenuFramework" ]
|
||||
}
|
||||
6
TestMod/packages.config
Normal file
6
TestMod/packages.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Json.Net.Unity3D" version="9.0.1" targetFramework="net35" />
|
||||
<package id="Lib.Harmony" version="1.2.0.1" targetFramework="net35" />
|
||||
<package id="OWML" version="1.1.8" targetFramework="net35" />
|
||||
</packages>
|
||||
Loading…
x
Reference in New Issue
Block a user