-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add per player difficulty and modifier options
- Loading branch information
1 parent
4c11e11
commit 0d6c8f4
Showing
10 changed files
with
478 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<vertical id='segmentVert' bg='panel-top' anchor-pos-y='-25' pref-width='60' min-height='10' vertical-fit='MinSize' pad='2' active='false'> | ||
<text-segments id='difficultyControl' select-cell='SetSelectedDifficulty' /> | ||
</vertical> |
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,7 @@ | ||
<horizontal> | ||
<vertical min-width='45' horizontal-fit='MinSize'> </vertical> | ||
<vertical min-width='45' horizontal-fit='MinSize'> | ||
<toggle-setting id='ppdt' value='per-player-diffs' apply-on-change='true' text='Per Player Difficulty' hover-hint='Allows each player to select their own difficulty!' bind-value='true'/> | ||
<toggle-setting id='ppmt' value='per-player-modifiers' apply-on-change='true' text='Per Player Modifiers' hover-hint="Allows each player to select their own modifiers!" bind-value='true'/> | ||
</vertical> | ||
</horizontal> |
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,81 @@ | ||
#pragma once | ||
|
||
#include "custom-types/shared/macros.hpp" | ||
#include "lapiz/shared/macros.hpp" | ||
|
||
#include "GlobalNamespace/GameServerLobbyFlowCoordinator.hpp" | ||
#include "GlobalNamespace/BeatmapLevelsModel.hpp" | ||
|
||
|
||
#include "System/Object.hpp" | ||
#include "System/IDisposable.hpp" | ||
#include "Zenject/IInitializable.hpp" | ||
|
||
#include "UnityEngine/UI/VerticalLayoutGroup.hpp" | ||
#include "UnityEngine/CanvasGroup.hpp" | ||
|
||
#include "HMUI/TextSegmentedControl.hpp" | ||
|
||
#include "bsml/shared/BSML/Components/Settings/ToggleSetting.hpp" | ||
|
||
#include "Beatmaps/Providers/MpBeatmapLevelProvider.hpp" | ||
#include "Networking/MpPacketSerializer.hpp" | ||
|
||
#include "Players/Packets/MpPerPlayerPacket.hpp" | ||
#include "Players/Packets/GetMpPerPlayerPacket.hpp" | ||
|
||
DECLARE_CLASS_CODEGEN_INTERFACES(MultiplayerCore::UI, MpPerPlayerUI, System::Object, std::vector<Il2CppClass*>({ classof(::Zenject::IInitializable*), classof(::System::IDisposable*)}), | ||
|
||
DECLARE_INSTANCE_FIELD(GlobalNamespace::GameServerLobbyFlowCoordinator*, _gameServerLobbyFlowCoordinator); | ||
DECLARE_INSTANCE_FIELD(GlobalNamespace::LobbySetupViewController*, _lobbyViewController); | ||
DECLARE_INSTANCE_FIELD(GlobalNamespace::ILobbyGameStateController*, _gameStateController); | ||
DECLARE_INSTANCE_FIELD(GlobalNamespace::BeatmapLevelsModel*, _beatmapLevelsModel); | ||
DECLARE_INSTANCE_FIELD(GlobalNamespace::IMultiplayerSessionManager*, _multiplayerSessionManager); | ||
DECLARE_INSTANCE_FIELD(MultiplayerCore::Beatmaps::Providers::MpBeatmapLevelProvider*, _beatmapLevelProvider); | ||
DECLARE_INSTANCE_FIELD(MultiplayerCore::Networking::MpPacketSerializer*, _packetSerializer); | ||
|
||
// Values | ||
DECLARE_INSTANCE_FIELD(GlobalNamespace::BeatmapKey, _currentBeatmapKey); | ||
DECLARE_INSTANCE_FIELD(ListW<StringW>, _allowedDifficulties); | ||
|
||
DECLARE_OVERRIDE_METHOD_MATCH(void, Initialize, &::Zenject::IInitializable::Initialize); | ||
DECLARE_OVERRIDE_METHOD_MATCH(void, Dispose, &::System::IDisposable::Dispose); | ||
|
||
DECLARE_INSTANCE_METHOD(void, DidActivate, bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling); | ||
DECLARE_INSTANCE_METHOD(void, DidDeactivate, bool removedFromHierarchy, bool screenSystemDisabling); | ||
DECLARE_INSTANCE_METHOD(void, SetLobbyState, GlobalNamespace::MultiplayerLobbyState state); | ||
DECLARE_INSTANCE_METHOD(void, LocalSelectedBeatmap, GlobalNamespace::LevelSelectionFlowCoordinator::State* state); | ||
DECLARE_INSTANCE_METHOD(void, UpdateDifficultyListWithBeatmapKey, GlobalNamespace::BeatmapKey beatmapKey); | ||
DECLARE_INSTANCE_METHOD(void, UpdateDifficultyList, ListW<StringW> difficulties); | ||
DECLARE_INSTANCE_METHOD(void, ClearLocalSelectedBeatmap); | ||
DECLARE_INSTANCE_METHOD(void, HandleMpPerPlayerPacket, MultiplayerCore::Players::Packets::MpPerPlayerPacket* packet, GlobalNamespace::IConnectedPlayer* player); | ||
DECLARE_INSTANCE_METHOD(void, HandleGetMpPerPlayerPacket, MultiplayerCore::Players::Packets::GetMpPerPlayerPacket* packet, GlobalNamespace::IConnectedPlayer* player); | ||
DECLARE_INSTANCE_METHOD(void, UpdateButtonsEnabled); | ||
|
||
DECLARE_INSTANCE_METHOD(void, SetSelectedDifficulty, HMUI::SegmentedControl* control, int index); | ||
|
||
DECLARE_CTOR(ctor, | ||
GlobalNamespace::GameServerLobbyFlowCoordinator* gameServerLobbyFlowCoordinator, | ||
GlobalNamespace::BeatmapLevelsModel* beatmapLevelsModel, | ||
GlobalNamespace::IMultiplayerSessionManager* sessionManager, | ||
MultiplayerCore::Beatmaps::Providers::MpBeatmapLevelProvider* beatmapLevelProvider, | ||
MultiplayerCore::Networking::MpPacketSerializer* packetSerializer | ||
); | ||
|
||
// UI Elements | ||
DECLARE_INSTANCE_FIELD(UnityEngine::UI::VerticalLayoutGroup*, segmentVert); | ||
DECLARE_INSTANCE_FIELD(HMUI::TextSegmentedControl*, difficultyControl); | ||
DECLARE_INSTANCE_FIELD(BSML::ToggleSetting*, ppdt); | ||
DECLARE_INSTANCE_FIELD(BSML::ToggleSetting*, ppmt); | ||
DECLARE_INSTANCE_FIELD(UnityEngine::CanvasGroup*, _difficultyCanvasGroup); | ||
|
||
// Event Listeners | ||
// Delegates | ||
DECLARE_INSTANCE_FIELD(HMUI::ViewController::DidActivateDelegate*, didActivateDelegate); | ||
DECLARE_INSTANCE_FIELD(HMUI::ViewController::DidDeactivateDelegate*, didDeactivateDelegate); | ||
DECLARE_INSTANCE_FIELD(System::Action_1<GlobalNamespace::MultiplayerLobbyState>*, setLobbyStateDelegate); | ||
DECLARE_INSTANCE_FIELD(System::Action_1<GlobalNamespace::LevelSelectionFlowCoordinator::State*>*, localSelectedBeatmapDelegate); | ||
DECLARE_INSTANCE_FIELD(System::Action_1<GlobalNamespace::BeatmapKey>*, updateDifficultyListDelegate); | ||
DECLARE_INSTANCE_FIELD(System::Action*, clearLocalSelectedBeatmapDelegate); | ||
DECLARE_INSTANCE_FIELD(System::Action*, updateButtonsEnabledDelegate); | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include "../../Networking/Abstractions/MpPacket.hpp" | ||
|
||
#include "custom-types/shared/macros.hpp" | ||
|
||
DECLARE_CLASS_CUSTOM(MultiplayerCore::Players::Packets, GetMpPerPlayerPacket, MultiplayerCore::Networking::Abstractions::MpPacket, | ||
DECLARE_DEFAULT_CTOR(); | ||
) |
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 @@ | ||
#include "../../Networking/Abstractions/MpPacket.hpp" | ||
|
||
#include "custom-types/shared/macros.hpp" | ||
|
||
DECLARE_CLASS_CUSTOM(MultiplayerCore::Players::Packets, MpPerPlayerPacket, MultiplayerCore::Networking::Abstractions::MpPacket, | ||
DECLARE_INSTANCE_FIELD(bool, PPDEnabled); | ||
DECLARE_INSTANCE_FIELD(bool, PPMEnabled); | ||
|
||
DECLARE_OVERRIDE_METHOD_MATCH(void, Serialize, &LiteNetLib::Utils::INetSerializable::Serialize, LiteNetLib::Utils::NetDataWriter* writer); | ||
DECLARE_OVERRIDE_METHOD_MATCH(void, Deserialize, &LiteNetLib::Utils::INetSerializable::Deserialize, LiteNetLib::Utils::NetDataReader* reader); | ||
public: | ||
DECLARE_DEFAULT_CTOR(); | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include "Players/Packets/GetMpPerPlayerPacket.hpp" | ||
|
||
// This packet has no data to serialize | ||
DEFINE_TYPE(MultiplayerCore::Players::Packets, GetMpPerPlayerPacket); |
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 @@ | ||
#include "Players/Packets/MpPerPlayerPacket.hpp" | ||
|
||
DEFINE_TYPE(MultiplayerCore::Players::Packets, MpPerPlayerPacket); | ||
|
||
namespace MultiplayerCore::Players::Packets { | ||
void MpPerPlayerPacket::Serialize(LiteNetLib::Utils::NetDataWriter* writer) { | ||
writer->Put(PPDEnabled); | ||
writer->Put(PPMEnabled); | ||
} | ||
|
||
void MpPerPlayerPacket::Deserialize(LiteNetLib::Utils::NetDataReader* reader) { | ||
PPDEnabled = reader->GetBool(); | ||
PPMEnabled = reader->GetBool(); | ||
} | ||
} |
Oops, something went wrong.