Files
novafarma/docs/CENTRAL_POPUP_GUIDE.md
2025-12-13 01:29:24 +01:00

3.8 KiB
Raw Permalink Blame History

📋 CENTRAL POPUP SYSTEM - Complete Guide

Date: December 13, 2025, 01:09


WHAT IT DOES

Central Popups

  • Appears in CENTER of screen
  • Always in front of player
  • Pauses game (optional)
  • Easy to read and interact
  • Beautiful animations

Types of Popups

  1. Quest - Quest dialogs (📜)
  2. Story - Story moments (📖)
  3. Info - Information ()
  4. Success - Success messages ()
  5. Warning - Warnings (⚠️)
  6. Error - Errors ()

🎮 HOW TO USE

Show Quest:

scene.centralPopup.showQuest(
    'First Harvest',
    'Plant and harvest your first crops!',
    ['Plant 5 seeds', 'Water them', 'Harvest when ready']
);

Show Story:

scene.centralPopup.showStory(
    'Welcome to NovaFarma',
    'You arrive at an abandoned farm. Time to rebuild!',
    'farm_image' // optional image
);

Show Notification:

scene.centralPopup.showNotification('Quest completed!', 'success');
scene.centralPopup.showNotification('Low health!', 'warning');

Custom Popup:

scene.centralPopup.showPopup({
    title: 'Custom Title',
    message: 'Your message here',
    type: 'info',
    icon: '🎉',
    buttons: [
        { text: 'Yes', callback: () => console.log('Yes!') },
        { text: 'No', action: 'close' }
    ],
    autoClose: false
});

🎨 FEATURES

Automatic Positioning

  • Always centered on screen
  • Responsive to screen size
  • Scrolls with camera

Beautiful Design

  • Rounded corners
  • Colored borders (based on type)
  • Smooth animations
  • Dark overlay behind

Interactive

  • Multiple buttons
  • Hover effects
  • Click handlers
  • Auto-close option

Game Integration

  • Pauses game (optional)
  • Sound effects
  • Queue system (multiple popups)
  • Priority levels

📊 POPUP TYPES & COLORS

Type Color Border Icon Use For
Quest Brown Gold 📜 Quests, missions
Story Dark Blue Purple 📖 Story moments
Info Dark Gray Gray Information
Success Dark Green Green Achievements
Warning Dark Red Red ⚠️ Warnings
Error Dark Red Red Errors

🔧 SETTINGS

Enable/Disable:

scene.centralPopup.settings.enabled = false;  // Disable

Auto-Close:

scene.centralPopup.settings.autoClose = true;
scene.centralPopup.settings.autoCloseDelay = 5000;  // 5 seconds

Pause Game:

scene.centralPopup.settings.pauseGameOnPopup = true;

Sound:

scene.centralPopup.settings.soundOnPopup = true;

💡 EXAMPLES

Quest Accept/Decline:

scene.centralPopup.showPopup({
    title: 'New Quest Available',
    message: 'Help the farmer harvest crops!',
    type: 'quest',
    icon: '📜',
    buttons: [
        { 
            text: 'Accept', 
            callback: () => {
                // Start quest
                scene.questSystem.startQuest('harvest_quest');
            }
        },
        { text: 'Decline', action: 'close' }
    ],
    autoClose: false
});

Story Cutscene:

scene.centralPopup.showStory(
    'Day 1',
    'The sun rises over your new farm. Time to get to work!',
    'sunrise_image'
);

Achievement:

scene.centralPopup.showNotification(
    'Achievement Unlocked: First Harvest!',
    'success'
);

🎉 RESULT

Perfect for:

  • Quest dialogs
  • Story moments
  • Important notifications
  • Achievements
  • Warnings
  • Any message that needs attention!

Always visible, always centered, always beautiful! 📋


Osveži igro s F5 da vidiš! 🔄

Created: December 13, 2025, 01:09