Package com.iohao.net.extension.room.operation


package com.iohao.net.extension.room.operation
Extension Module - Board Games, Room-Based Games - Extension of Gameplay Operations within a Room.

Gameplay Operation Business - Design Patterns: Strategy Pattern + Flyweight Pattern

Strategy Pattern:
Define an interface and write two implementation classes that implement this interface,
allowing the use of one interface and then selecting the appropriate implementation class as needed.
Flyweight Pattern:
Maintains instances of the gameplay interface implementation class OperationHandler.

Centralizes the management of the state of many "virtual" objects, reducing the number of runtime
object instances and saving memory.
Usage Example - Configuring Gameplay Operations
// Create OperationFactory object (framework's built-in implementation)
OperationFactory factory = OperationFactory.of();

// Configure gameplay operation
factory.mappingUser(1, new ShootOperationHandler());

// If there are more operations, they can be configured continuously.
// Here we use pseudocode for a Mahjong example, configuring Chi, Peng, and Gang operations.
factory.mappingUser(10, new ChiOperationHandler());
factory.mappingUser(11, new PengOperationHandler());
factory.mappingUser(12, new GangOperationHandler());
Since:
21.8
Author:
渔民小镇
date:
2022-03-31