This repository has been archived by the owner on Jan 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
14 changed files
with
212 additions
and
67 deletions.
There are no files selected for viewing
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
15 changes: 15 additions & 0 deletions
15
Distance.AdventureMaker/Harmony/Assembly-CSharp/MainMenuLogic/Awake.cs
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,15 @@ | ||
using Distance.AdventureMaker.Scripts.MainMenu; | ||
using HarmonyLib; | ||
|
||
namespace Distance.AdventureMaker.Harmony | ||
{ | ||
[HarmonyPatch(typeof(MainMenuLogic), "Awake")] | ||
internal static class MainMenuLogic__Awake | ||
{ | ||
[HarmonyPostfix] | ||
internal static void Postfix(MainMenuLogic __instance) | ||
{ | ||
var controller = __instance.gameObject.AddComponent<MainMenuButtonController>(); | ||
} | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
Distance.AdventureMaker/Harmony/Assembly-CSharp/MainMenuLogic/Start.cs
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
File renamed without changes.
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
44 changes: 44 additions & 0 deletions
44
Distance.AdventureMaker/Scripts/MainMenu/Buttons/ContentPacksButton.cs
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,44 @@ | ||
using Centrifuge.Distance.Game; | ||
|
||
namespace Distance.AdventureMaker.Scripts.MainMenu | ||
{ | ||
public class ContentPacksButton : MainMenuButton | ||
{ | ||
protected override string ButtonName => "Community Content Packs"; | ||
|
||
protected override string ButtonText => "CONTENT PACKS"; | ||
|
||
protected override int ItemPosition => 5; | ||
|
||
protected override void OnButtonClick() | ||
{ | ||
MessageBox.Create("This feature isn't currently implemented.", ButtonText).Show(); | ||
//SetVisible(false); | ||
|
||
return; | ||
/* | ||
var controller = MenuLogic.gameObject.GetComponent<MainMenuButtonController>(); | ||
if (!controller) return; | ||
controller.Campaign.Visible = false; | ||
controller.Arcade.Visible = false; | ||
controller.Multiplayer.Visible = false; | ||
controller.LevelEditor.Visible = false; | ||
controller.Workshop.Visible = false; | ||
controller.ContentPacks.Visible = false; | ||
controller.Garage.Visible = false; | ||
controller.ReportBug.Visible = true; | ||
controller.Options.Visible = false; | ||
controller.Quit.Visible = true; | ||
var title = MenuLogic.transform.Find("UI Root/Panel - Main/DistanceTitle").GetComponent<UILabel>(); | ||
title.text = "N O"; | ||
var version = MenuLogic.transform.Find("UI Root/Panel - Main/VersionNumber").GetComponent<UILabel>(); | ||
version.text = ""; | ||
*/ | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Distance.AdventureMaker/Scripts/MainMenu/Buttons/DefaultMainMenuButton.cs
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,29 @@ | ||
namespace Distance.AdventureMaker.Scripts.MainMenu | ||
{ | ||
public class DefaultMainMenuButton : MainMenuButton | ||
{ | ||
protected override string ButtonText => Button.GetComponentInChildren<UILabel>().text; | ||
|
||
protected override string ButtonName => Button.name; | ||
|
||
protected override int ItemPosition => Button.transform.GetSiblingIndex(); | ||
|
||
public override void Setup(MainMenuLogic menuLogic) | ||
{ | ||
if (menuLogic_) return; | ||
|
||
menuLogic_ = menuLogic; | ||
|
||
Table = FindTable(); | ||
Button = gameObject; | ||
} | ||
|
||
protected override void OnButtonClick() | ||
{ | ||
foreach (UIExButton button in Button.GetComponentsInChildren<UIExButton>()) | ||
{ | ||
button.OnClick(); | ||
} | ||
} | ||
} | ||
} |
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
19 changes: 0 additions & 19 deletions
19
Distance.AdventureMaker/Scripts/MainMenu/CampaignsMenuButton.cs
This file was deleted.
Oops, something went wrong.
67 changes: 67 additions & 0 deletions
67
Distance.AdventureMaker/Scripts/MainMenu/MainMenuButtonController.cs
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,67 @@ | ||
using UnityEngine; | ||
|
||
namespace Distance.AdventureMaker.Scripts.MainMenu | ||
{ | ||
public class MainMenuButtonController : MonoBehaviour | ||
{ | ||
private MainMenuLogic menuLogic_; | ||
|
||
public MainMenuLogic MenuLogic => menuLogic_; | ||
|
||
public MainMenuButton Campaign { get; protected set; } | ||
|
||
public MainMenuButton Arcade { get; protected set; } | ||
|
||
public MainMenuButton Multiplayer { get; protected set; } | ||
|
||
public MainMenuButton LevelEditor { get; protected set; } | ||
|
||
public MainMenuButton Workshop { get; protected set; } | ||
|
||
public MainMenuButton ContentPacks { get; protected set; } | ||
|
||
public MainMenuButton Garage { get; protected set; } | ||
|
||
public MainMenuButton ReportBug { get; protected set; } | ||
|
||
public MainMenuButton Options { get; protected set; } | ||
|
||
public MainMenuButton Quit { get; protected set; } | ||
|
||
public void Awake() | ||
{ | ||
menuLogic_ = GetComponent<MainMenuLogic>(); | ||
if (!menuLogic_) | ||
{ | ||
DestroyImmediate(this); | ||
return; | ||
} | ||
|
||
Campaign = GetOrAddButtonScript("Campaign"); | ||
Arcade = GetOrAddButtonScript("Arcade"); | ||
Multiplayer = GetOrAddButtonScript("Multiplayer"); | ||
LevelEditor = GetOrAddButtonScript("Level Editor"); | ||
Workshop = GetOrAddButtonScript("Steam Workshop"); | ||
|
||
ContentPacks = GetOrAddButtonScript<ContentPacksButton>(); | ||
|
||
Garage = GetOrAddButtonScript("Garage"); | ||
ReportBug = GetOrAddButtonScript("Report Bug"); | ||
Options = GetOrAddButtonScript("Options"); | ||
Quit = GetOrAddButtonScript("Quit"); | ||
} | ||
|
||
private MainMenuButton GetOrAddButtonScript(string buttonName) | ||
{ | ||
GameObject button = menuLogic_.mainButtons_.transform.Find($"MainButtons/{buttonName}").gameObject; | ||
var script = button.GetOrAddComponent<DefaultMainMenuButton>(); | ||
script.Setup(menuLogic_); | ||
return script; | ||
} | ||
|
||
private MainMenuButton GetOrAddButtonScript<T>() where T : MainMenuButton | ||
{ | ||
return menuLogic_.GetOrAddComponent<T>(); | ||
} | ||
} | ||
} |