Gorilla Tag 的 PC 庫,處理各種與房間相關的事情(以及更多?)
如果您不想手動安裝,可以使用 Monke Mod Manager 安裝此模組
如果您的遊戲未使用 BepinEx 進行修改,請先這樣做!只需轉到最新的 BepinEx 版本並將 BepinEx_x64_VERSION.zip 直接解壓縮到遊戲資料夾中,然後執行一次遊戲即可正確安裝 BepinEx。
接下來,前往該模組的最新版本並將其直接解壓縮到您的遊戲資料夾中。確保將其直接提取到遊戲資料夾中,而不是提取到子資料夾中!
隨著 Utilla 1.5.0 的發布,模組只能在模組遊戲模式下運行,而不是在任何私人大廳中運行。 Utilla 提供了易於使用的屬性,使這種轉換盡可能輕鬆。請參閱此提交以獲取更新 mod 以使用新系統的範例。
處理玩家是否在模組房間中是確保您的模組不會被用來作弊的一個非常重要的部分。 Utilla 透過提供在加入修改後的大廳時觸發的屬性來簡化此操作。
[ModdedGamemode]
必須套用於您的 mod 的插件類別才能使用其他屬性。 [ModdedGamemodeJoin]
和[ModdedGamemodeLeave]
可以應用於此類中的任何 void 方法,並帶有包含完整遊戲模式字串的可選字串參數。當加入或離開已修改的房間時,將分別呼叫這些方法。
using System ;
using BepInEx ;
using Utilla ;
namespace ExamplePlugin
{
[ BepInPlugin ( " org.legoandmars.gorillatag.exampleplugin " , " Example Plugin " , " 1.0.0 " ) ]
[ BepInDependency ( " org.legoandmars.gorillatag.utilla " , " 1.5.0 " ) ] // Make sure to add Utilla 1.5.0 as a dependency!
[ ModdedGamemode ] // Enable callbacks in default modded gamemodes
public class ExamplePlugin : BaseUnityPlugin
{
bool inAllowedRoom = false ;
private void Update ( )
{
if ( inAllowedRoom )
{
// Do mod stuff
}
}
[ ModdedGamemodeJoin ]
private void RoomJoined ( string gamemode )
{
// The room is modded. Enable mod stuff.
inAllowedRoom = true ;
}
[ ModdedGamemodeLeave ]
private void RoomLeft ( string gamemode )
{
// The room was left. Disable mod stuff.
inAllowedRoom = false ;
}
}
}
Utilla 1.5.0 為 Gorilla Tag 帶來了自訂遊戲模式的支援。 mod可以透過[ModdedGamemode]
屬性註冊自訂遊戲模式,並且會出現在遊戲中預設遊戲模式的旁邊。
[ BepInPlugin ( " org.legoandmars.gorillatag.exampleplugin " , " Example Plugin " , " 1.0.0 " ) ]
[ BepInDependency ( " org.legoandmars.gorillatag.utilla " , " 1.5.0 " ) ] // Make sure to add Utilla 1.5.0 as a dependency!
[ ModdedGamemode ( " mygamemodeid " , " MY GAMEMODE " , Models . BaseGamemode . Casual ) ] // Enable callbacks in a new casual gamemode called "MY GAMEMODE"
public class ExamplePlugin : BaseUnityPlugin { }
此外,透過建立繼承GorillaGameManager
的類,可以使用完全自訂的遊戲管理器。建立自訂遊戲模式需要對 Gorilla Tag 的網路程式碼有深入的了解。目前,匹配不適用於完全自訂的遊戲模式,但仍可以透過房間代碼使用它們。
[ BepInPlugin ( " org.legoandmars.gorillatag.exampleplugin " , " Example Plugin " , " 1.0.0 " ) ]
[ BepInDependency ( " org.legoandmars.gorillatag.utilla " , " 1.5.0 " ) ] // Make sure to add Utilla 1.5.0 as a dependency!
[ ModdedGamemode ( " mygamemodeid " , " MY GAMEMODE " , typeof ( MyGameManager ) ) ] // Enable callbacks in a new custom gamemode using MyGameManager
public class ExamplePlugin : BaseUnityPlugin { }
public class MyGameManager : GorillaGameManager
{
// The game calls this when this is the gamemode for the room.
public override void StartPlaying ( )
{
// Base needs to run for base GorillaGamanger functionality to run.
base . StartPlaying ( ) ;
}
// Called by game when you leave a room or gamemode is changed.
public override void StopPlaying ( )
{
// Base needs to run for the game mode stop base GorillaGameManager functionality from running.
base . StopPlaying ( ) ;
}
// Called by the game when you leave a room after StopPlaying, use this for all important clean up and resetting the state of your game mode.
public override void Reset ( )
{
}
// Gamemode names must not have spaces and must not contain "CASUAL", "INFECTION", "HUNT", or "BATTLE".
// Names that contain the name of other custom gamemodes will confilict.
public override string GameModeName ( )
{
return " CUSTOM " ;
}
// GameModeType is an enum which is really an int, so any int value will work.
// Make sure to use a unique value not taken by other game modes.
public override GameModeType GameType ( )
{
return ( GameModeType ) 765 ;
}
public override int MyMatIndex ( Player forPlayer )
{
return 3 ;
}
}
Utilla 提供在任何房間加入時廣播的事件。不建議他們啟用和停用您的 mod,因為使用如上所述的屬性。 Utilla 提供了兩個房間加入和離開的事件, Utilla.Events.RoomJoined
和Utilla.Events.RoomLeft
using System ;
using BepInEx ;
using Utilla ;
namespace ExamplePlugin
{
[ BepInPlugin ( " org.legoandmars.gorillatag.exampleplugin " , " Example Plugin " , " 1.0.0 " ) ]
[ BepInDependency ( " org.legoandmars.gorillatag.utilla " , " 1.5.0 " ) ] // Make sure to add Utilla as a dependency!
public class ExamplePlugin : BaseUnityPlugin
{
void Awake ( )
{
Utilla . Events . RoomJoined += RoomJoined ;
Utilla . Events . RoomLeft += RoomLeft ;
}
private void RoomJoined ( object sender , Events . RoomJoinedArgs e )
{
UnityEngine . Debug . Log ( $" Private room: { e . isPrivate } , Gamemode: { e . Gamemode } " ) ;
}
private void RoomLeft ( object sender , Events . RoomJoinedArgs e )
{
UnityEngine . Debug . Log ( $" Private room: { e . isPrivate } , Gamemode: { e . Gamemode } " ) ;
}
}
}
Utilla 提供了一個在 Gorilla Tag 初始化後觸發的事件,如果您在單例物件(例如GorillaLocomotion.Player.Instance
上遇到空參考錯誤,請使用此事件
using System ;
using BepInEx ;
using Utilla ;
namespace ExamplePlugin
{
[ BepInPlugin ( " org.legoandmars.gorillatag.exampleplugin " , " Example Plugin " , " 1.0.0 " ) ]
[ BepInDependency ( " org.legoandmars.gorillatag.utilla " , " 1.5.0 " ) ] // Make sure to add Utilla as a dependency!
public class ExamplePlugin : BaseUnityPlugin
{
void Awake ( )
{
Utilla . Events . GameInitialized += GameInitialized ;
}
private void GameInitialized ( object sender , EventArgs e )
{
// Player instance has been created
UnityEngine . Debug . Log ( GorillaLocomotion . Player . Instance . jumpMultiplier ) ;
}
}
}
如果您想使用您的 mod 加入自訂私人大廳,Utilla 也實現了相應的方法。
Utilla . Utils . RoomUtils . JoinPrivateLobby ( ) // Joins a private lobby with a random 6 character code
Utilla . Utils . RoomUtils . JoinPrivateLobby ( " TestLobby " ) // Joins a private lobby with the code TestLobby
Utilla . Utils . RoomUtils . JoinPrivateLobby ( " TestLobby " , true ) // Joins a private casual lobby with the code TestLobby
如果您想在您的 mod 中使用自訂佇列,Utilla 也實作了該方法。
Utilla . Utils . RoomUtils . JoinModdedLobby ( " TestQueue " ) // Joins a random room in the queue TestQueue
Utilla . Utils . RoomUtils . JoinModdedLobby ( " TestQueue " , true ) // Joins a random casual room in the queue TestQueue
該專案是使用 .NET Standard 使用 C# 建構的。
作為參考,請在與專案解決方案相同的資料夾中建立一個 Libs 資料夾。在此資料夾內,您需要複製:
0Harmony.dll
BepInEx.dll
BepInEx.Harmony.dll
來自Gorilla TagBepInExplugins
,以及
Assembly-CSharp.dll
PhotonRealtime.dll
PhotonUnityNetworking.dll
UnityEngine.dll
UnityEngine.CoreModule.dll
來自Gorilla TagGorilla Tag_DataManaged
。
本產品不隸屬於 Gorilla Tag 或 Another Axiom LLC,也未獲得 Another Axiom LLC 的認可或贊助。本文所包含的部分資料屬於 Another Axiom LLC 的財產。 ©2021 Another Axiom LLC。