Initial commit

test
pengtaihao 2023-08-24 14:33:32 +08:00 committed by pth
commit 5bcd55c00d
12 changed files with 495 additions and 0 deletions

41
.gitignore vendored Normal file
View File

@ -0,0 +1,41 @@
# ---> core
*.swp
*.*~
project.lock.json
.DS_Store
*.pyc
nupkg/
# Visual Studio Code
.vscode
# Rider
.idea
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
msbuild.log
msbuild.err
msbuild.wrn
# Visual Studio 2015
.vs/
Properties

70
Cheat.csproj Normal file
View File

@ -0,0 +1,70 @@
<?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>{5A642931-00E1-4A5C-A6BA-4ECB4A66A2EA}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Cheat</RootNamespace>
<AssemblyName>Cheat</AssemblyName>
<TargetFrameworkVersion>v4.7.1</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.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\UnityDLL\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\UnityDLL\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>..\UnityDLL\UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CheatAdvView.cs" />
<Compile Include="CheatListView.cs" />
<Compile Include="CheatOpeningView.cs" />
<Compile Include="CheatStoryTypeView.cs" />
<Compile Include="CheatUtil.cs" />
<Compile Include="EventQuestView.Cheat.cs" />
<Compile Include="FreeAdvView.Cheat.cs" />
<Compile Include="MainAdvView.Cheat.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Hotfix\Hotfix.csproj">
<Project>{9e492ea5-4b91-4385-a199-4c2e340a7008}</Project>
<Name>Hotfix</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

25
Cheat.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cheat", "Cheat.csproj", "{13FEA5D7-430C-4B36-9626-7A4FD1233A1A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{13FEA5D7-430C-4B36-9626-7A4FD1233A1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{13FEA5D7-430C-4B36-9626-7A4FD1233A1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13FEA5D7-430C-4B36-9626-7A4FD1233A1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13FEA5D7-430C-4B36-9626-7A4FD1233A1A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E1886CDA-C6A3-4F72-B9F7-85C7DBC5255F}
EndGlobalSection
EndGlobal

49
CheatAdvView.cs Normal file
View File

@ -0,0 +1,49 @@

using System.Collections.Generic;
using UnityEngine;
namespace Mly.Hotfix
{
public interface ICheatOpenStage
{
CheatAdvView CheatView { get; set; }
void CheatOpenStagesTo(int id);
}
public interface ICheatOpenAllStages
{
void CheatOpenAllStages();
}
public class CheatAdvView : CheatListView<LocalAdvMap>
{
public ICheatOpenStage View;
public LocalAdvChap Chap;
protected override IList<LocalAdvMap> List => Chap?.AdvMapList;
protected override string GetItemText(LocalAdvMap item)
{
return item.Name1;
}
protected override void OnClickItem(LocalAdvMap item)
{
View.CheatOpenStagesTo(item.Id);
}
protected override void UpdateList()
{
base.UpdateList();
if (View is ICheatOpenAllStages v)
{
if (GUI.Button(CheatUtil.GetNextRect(), $"All", CheatUtil.GetGUIButtonStyle()))
{
v.CheatOpenAllStages();
}
CheatUtil.PointToNext();
}
}
}
}

61
CheatListView.cs Normal file
View File

@ -0,0 +1,61 @@
using System.Collections.Generic;
using UnityEngine;
namespace Mly.Hotfix
{
public abstract class CheatListView<T> : MonoBehaviour
{
/// <summary>
/// 按钮列表
/// </summary>
protected abstract IList<T> List { get; }
protected virtual GUIStyle ItemStyle => CheatUtil.GetGUIButtonStyle();
private bool collapse;
protected virtual void Awake()
{
CheatUtil.AutoScaling();
}
protected virtual void OnGUI()
{
UpdateView();
}
protected virtual void UpdateView()
{
if (List == null)
return;
CheatUtil.PointToStart();
if (collapse)
UpdateList();
if (GUI.Button(CheatUtil.GetNextRect(), collapse ? "收起" : "展开", ItemStyle))
collapse = !collapse;
}
protected virtual void UpdateList()
{
CheatUtil.DrawCheatList(List, (item, rect) =>
{
if (GUI.Button(rect, GetItemText(item), ItemStyle))
OnClickItem(item);
});
}
/// <summary>
/// 按钮文字
/// </summary>
protected abstract string GetItemText(T item);
/// <summary>
/// 按钮点击
/// </summary>
protected abstract void OnClickItem(T item);
}
}

30
CheatOpeningView.cs Normal file
View File

@ -0,0 +1,30 @@

using UnityEngine;
namespace Mly.Hotfix
{
public class CheatOpeningView: MonoBehaviour
{
public bool SkipPrologue;
void Awake()
{
SkipPrologue = PlayerPrefs.GetInt("Cheat_SkipPrologue", 0) == 1;
}
public void OnGUI()
{
var style = CheatUtil.GetGUIButtonStyle();
style.normal.textColor = Color.white;
style.fontSize = 30;
var val = GUI.Toggle(new Rect(10, 100, 300, 100), SkipPrologue, SkipPrologue ? "跳过序章中" : "点击跳过序章", style);
if (val != SkipPrologue)
{
SkipPrologue = val;
PlayerPrefs.SetInt("Cheat_SkipPrologue", SkipPrologue ? 1 : 0);
}
}
}
}

41
CheatStoryTypeView.cs Normal file
View File

@ -0,0 +1,41 @@

using UnityEngine;
namespace Mly.Hotfix
{
public class CheatStoryTypeView : MonoBehaviour
{
public bool SkipStory;
public bool UnLockAllStory;
private GUIStyle _GUIStyle;
public void Awake()
{
SkipStory = PlayerPrefs.GetInt("SkipStory", 0) == 1;
UnLockAllStory = PlayerPrefs.GetInt("UnLockAllStory", 0) == 1;
}
public void OnGUI()
{
var style = CheatUtil.GetGUIButtonStyle();
style.normal.textColor = Color.white;
style.fontSize = 30;
var val = GUI.Toggle(new Rect(10, 100, 300, 100), SkipStory, SkipStory ? "跳过剧情中" : "点击跳过剧情", style);
var val2 = GUI.Toggle(new Rect(10, 300, 300, 100), UnLockAllStory, UnLockAllStory ? "解锁全部剧情中" : "点击解锁全部剧情", style);
if (val != SkipStory)
{
SkipStory = val;
PlayerPrefs.SetInt("SkipStory", SkipStory ? 1 : 0);
}
if (val2 != UnLockAllStory)
{
UnLockAllStory = val2;
PlayerPrefs.SetInt("UnLockAllStory", UnLockAllStory ? 1 : 0);
}
}
}
}

108
CheatUtil.cs Normal file
View File

@ -0,0 +1,108 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Mly.Hotfix
{
public static class CheatUtil
{
public static float StartX = 100;
public static float StartY = 100;
public static float SpaceX = 10;
public static float SpaceY = 10;
public static float W = 110;
public static float H = 30;
public static int Columns = 5;
public static int X;
public static int Y;
private static float startX;
private static float startY;
private static float spaceX;
private static float spaceY;
public static void AutoScaling()
{
var wa = Screen.width / 1280f;
var ha = Screen.height / 720f;
startX = StartX * wa;
startY = StartY * ha;
spaceX = SpaceX * wa;
spaceY = SpaceY * ha;
}
public static void PointToStart()
{
X = Y = 0;
}
public static void PointToNext()
{
if (++X >= Columns)
{
X = 0;
++Y;
}
}
public static void PointToNewLine()
{
if (X > 0)
{
++Y;
}
X = 0;
}
public static Rect GetNextRect()
{
return new Rect(startX + X * (W + spaceX), startY + Y * (H + spaceY), W, H);
}
public static void DrawCheatList<T>(IList<T> list, Action<T, Rect> action)
{
for (int i = 0; i < list.Count; i++)
{
var item = list[i];
action?.Invoke(item, GetNextRect());
PointToNext();
}
PointToNewLine();
}
public static GUIStyle GetGUIButtonStyle()
{
return GetGUIStyle(GUI.skin.button);
}
public static GUIStyle GetGUIStyle(GUIStyle style)
{
return new GUIStyle(style);
}
public static CheatAdvView AddCheatView(ICheatOpenStage view, GameObject go)
{
var cheat = go.AddComponent<CheatAdvView>();
cheat.View = view;
return cheat;
}
public static void Init()
{
CheatInteractor.ActionMap.Add(typeof(EventQuestView), vc =>
{
var cheatV = vc.GameObject.AddComponent<CheatAdvView>();
//cheatV.View = vc;
});
}
}
}

19
EventQuestView.Cheat.cs Normal file
View File

@ -0,0 +1,19 @@
namespace Mly.Hotfix
{
//public partial class EventQuestView : ICheatOpenStage
//{
// public CheatAdvView CheatView { get; set; }
//}
//public partial class EventQuestView
//{
// public void SetCheatChap(LocalAdvChap chap)
// {
// if (CheatView != null)
// {
// CheatView.Chap = chap;
// }
// }
//}
}

23
FreeAdvView.Cheat.cs Normal file
View File

@ -0,0 +1,23 @@
namespace Mly.Hotfix
{
//public partial class FreeAdvView : ICheatOpenStage
//{
// public CheatAdvView CheatView { get; set; }
//}
//public partial class FreeAdvView
//{
// private void InitCheatView()
// {
// CheatView = CheatUtil.AddCheatView(this, GameObject);
// }
// private void SetCheatChap(LocalAdvChap chap)
// {
// if (CheatView != null)
// {
// CheatView.Chap = chap;
// }
// }
//}
}

26
MainAdvView.Cheat.cs Normal file
View File

@ -0,0 +1,26 @@
namespace Mly.Hotfix
{
//public partial class MainAdvView : ICheatOpenStage, ICheatOpenAllStages
//{
// public CheatAdvView CheatView { get; set; }
//}
//public partial class MainAdvView
//{
// private void InitCheatView()
// {
// CheatView = CheatUtil.AddCheatView(this, GameObject);
// }
// private void SetCheatChap()
// {
// if (CheatView != null)
// {
// CheatView.Chap = normal ? normalSSV.AdvChap : hardSSV.AdvChap;
// }
// }
//}
}

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# mly2023cheat