pandaxin8 / food-waste-game

Food waste sustainability awareness game built with Flutter
MIT License
1 stars 0 forks source link

Dialogue Management System Development #68

Closed pandaxin8 closed 4 months ago

pandaxin8 commented 4 months ago

Description: Develop a system for managing and displaying the narrative script in a player-friendly manner. This system should:

pandaxin8 commented 4 months ago

1. Data structure for narrative content

class StorySegment {
  final String id;
  final String text;
  final String character;
  final String? imagePath;
  final List<String>? choices;

  StorySegment({
    required this.id,
    required this.text,
    required this.character,
    this.imagePath,
    this.choices,
  });
  // ... Additional methods and properties as needed ...
}

2. UI Components

3. Narrative Progression Logic

class NarrativeController extends StatefulWidget {
  @override
  _NarrativeControllerState createState() => _NarrativeControllerState();
}

class _NarrativeControllerState extends State<NarrativeController> {
  int currentIndex = 0;
  List<StorySegment> storySegments = []; // Initialize with your story data

  void nextSegment() {
    if (currentIndex < storySegments.length - 1) {
      setState(() {
        currentIndex++;
      });
    } else {
      // End of narrative logic
    }
  }

  void skipStory() {
    // Logic to skip to the end or a specific part of the story
  }

  @override
  Widget build(BuildContext context) {
    return DialogueBox(
      segment: storySegments[currentIndex],
      onNext: nextSegment,
      onSkip: skipStory,
    );
  }
}

4. Responsive and Adaptive Design:

pandaxin8 commented 4 months ago

Update on Story Implementation

Successfully structured the intro narrative into Firestore documents, representing key story segments for the game's introduction. Each segment details the setting, character focus, narrative text, associated imagery, and player choices where applicable.

Key milestones

Next, we will proceed with implementing the dialogue management system to display these story segments in the game, allowing players to progress through the narrative at their own pace.

pandaxin8 commented 4 months ago