Server Message System

Comprehensive documentation for the BlinkBox Server Message Addon

Introduction

The Server Message System is a robust in-game mail solution that enables administrators to send direct messages to players. It supports persistent storage, read status tracking, and optional HTML formatting for rich text content.

Key Features

Setup & Installation

Requirement: This addon relies on ULogin System Pro for database connectivity.

1. Database Setup

  1. Upload bl_Servermail.php to your web server in the same directory as your MFPS PHP files.
  2. The system will automatically create the required bl_server_messages table upon the first request if it doesn't exist.

2. Unity Setup

  1. Add the ServerMessageManager component to your scene (or rely on its auto-instantiation).
  2. Place the ServerMailboxUI prefab in your Lobby scene canvas.
  3. (Optional) Add the ServerMailAdminUI prefab to your Admin Panel canvas if not already present.

Admin Features

The system provides a dedicated interface for administrators to manage communications.

Sending Messages

From the Admin Panel, navigate to the Server Mail section:

Tip: You can initiate a message directly from the User List by clicking on a user's name and selecting "Send Message".

Player Features

Players have access to a full mailbox interface.

Inbox Management

Message Viewing

Clicking a message expands it to show the full content. If the message contains HTML, it will be rendered accordingly by TextMeshPro.

Architecture

ServerMessageManager

The core singleton that handles all networking and logic.

Data Structure

The MessageData class defines the structure of a message:

[System.Serializable]
public class MessageData
{
    public string id;
    public string title;
    public string bodyMessage;
    public string sender;
    public string receiver;
    public long timestamp;
    public bool isRead;
    public bool isDeleted;
}

Configuration

Settings can be adjusted on the ServerMessageManager component.

Setting Default Description
Request Timeout 10s Max time to wait for server response.
Max Retries 3 Number of attempts for failed requests.
Cache Duration 300s Time (in seconds) to keep messages in local cache (5 mins).
Refresh Interval 60s How often the UI auto-refreshes the inbox.

Logging Colors

You can customize the console log colors for different categories to make debugging easier.