Others
Quest Item
It can be used to show in-game missions. It is automatically minimized after a certain amount of time, based on the ‘Minimize After’ parameter.
Quest Item Scripting
using UnityEngine;
using Michsky.UI.Beam; // Namespace
public class SampleClass : MonoBehaviour
{
[SerializeField] private QuestItem questItem;
void YourMethod()
{
// Set new quest text
questItem.questText = "Mission or Quest Text";
questItem.UpdateUI();
// Animate quest
questItem.AnimateQuest();
questItem.ExpandQuest();
questItem.MinimizeQuest();
}
}
Server Browser Item
Pre-made UI element designed for managing or showcasing a specific server. Features essential server options such as server name, ping, current players, max players, favorite state, and locked state.
Server Browser Item Scripting
using System.Collections.Generic;
using UnityEngine;
using Michsky.UI.Beam; // Namespace
public class SampleClass : MonoBehaviour
{
[SerializeField] private ServerBrowserItem serverItem;
void YourMethod()
{
// Initialize server restrictions
serverItem.maxPlayers = 4;
// Set server information
serverItem.SetName("Server Name");
serverItem.SetPlayers(2);
serverItem.SetPing(20);
// Change server states
serverItem.SetFavorite(false);
serverItem.SetLocked(false);
// Update 'Connect' button state
serverItem.UpdateButtonState();
// Animate, expand or minimize
serverItem.Animate();
serverItem.Expand();
serverItem.Minimize();
}
#region Server Creating Sample
class MyServerClass
{
public string serverName;
public int maxPlayers;
public int currentPlayers;
public int ping;
public bool isFavorite;
public bool isLocked;
}
List<MyServerClass> availableServers = new List<MyServerClass>();
void CreateServerItems()
{
for (int i = 0; i < availableServers.Count; i++)
{
// serverItem has to be a prefab - think of it as a preset
GameObject go = Instantiate(serverItem.gameObject, new Vector3(0, 0, 0), Quaternion.identity);
// You can set a parent for server items
Transform serverItemParent = transform;
go.transform.SetParent(serverItemParent, false);
// Initialize server item
ServerBrowserItem sbi = go.GetComponent<ServerBrowserItem>();
sbi.maxPlayers = availableServers[i].maxPlayers;
sbi.SetName(availableServers[i].serverName);
sbi.SetPlayers(availableServers[i].currentPlayers);
sbi.SetPing(availableServers[i].ping);
sbi.SetFavorite(availableServers[i].isFavorite);
sbi.SetLocked(availableServers[i].isLocked);
}
}
#endregion
}
How can we help?
A premium WordPress theme with an integrated Knowledge Base,
providing 24/7 community-based support.