UIChatChannelPicker - jimdroberts/FishMMO GitHub Wiki
A UI control for picking chat channels and renaming chat tabs in the FishMMO client. Provides toggles for each chat channel, allows users to activate/deactivate channels for a tab, and supports renaming tabs. Integrates with the chat UI for dynamic channel and tab management.
-
public Toggle ChannelTogglePrefab
Prefab used to instantiate channel toggle buttons.
-
public List Toggles
List of all channel toggle buttons currently displayed.
-
public override void OnStarting()
Initializes channel toggles for each chat channel except Command.
-
public override void OnDestroying()
Unsubscribes from lose focus event.
-
public void Activate(HashSet activeChannels, string name, Vector3 position)
Sets up the toggles for the active channels for the selected tab, sets the input value to the name of the tab, and moves the picker to the specified position.
-
public void ChangeTabName()
Changes the name of the current chat tab to the value in the input field. Resets the input if renaming fails.
-
public void SetActiveChannel(Toggle toggle)
Sets the active state of a chat channel when its toggle is changed.
- Attach
UIChatChannelPicker
to a chat channel picker UI GameObject in the Unity Editor. - Assign the
ChannelTogglePrefab
field in the Inspector. - Integrate with the chat UI for channel and tab management.
// Example usage in a MonoBehaviour
public UIChatChannelPicker channelPicker;
void Start() {
channelPicker.OnStarting();
}
// To activate the picker for a tab
channelPicker.Activate(activeChannels, "General", new Vector3(100, 100, 0));
- Always assign the
ChannelTogglePrefab
in the Inspector to avoid null reference errors. - Use the toggles to let users customize which channels are active for each tab.
- Integrate with the chat UI to keep channel and tab states in sync.
- Use the input field for renaming tabs and validate names before applying changes.