WIP: Stagger proclamations
Proclamations are now inserted 10 times, and in between each proclamation, the Universal Wellness proclamation is inserted. Now I need to optimize the loop & remove the Universal Wellbeing option from the Proclamations menu (hide it) because it's always enabled.
This commit is contained in:
@@ -74,6 +74,12 @@ import (
|
||||
"rhemawavetech.com/rhemawave/internal/shaderManager"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultProclamationID string = "f3d42354-3197-45e4-9b08-be447f14386d"
|
||||
proclamationPlayCount int = 10
|
||||
defaultProclamationPlayCount int = 10
|
||||
)
|
||||
|
||||
type Line struct {
|
||||
words []StringItem
|
||||
width int32
|
||||
@@ -330,13 +336,32 @@ func (p *ScrollerPage) loadProclamations() error {
|
||||
return err
|
||||
}
|
||||
|
||||
var defaultProclamation db.Proclamation
|
||||
err = p.Context.DbPtr.Where("ID = ?", defaultProclamationID).Find(&defaultProclamation).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Build word list from selected, available proclamations
|
||||
// For each proclamation in proclamations
|
||||
// until count reaches 10
|
||||
// add the words into the world list
|
||||
// update count
|
||||
// when the count reaches 10
|
||||
// insert the defaultProclamation
|
||||
// reset the count to 0
|
||||
var count int = 0
|
||||
for _, proclamation := range proclamations {
|
||||
if proclamation.Selected {
|
||||
// Split content into words and add to list
|
||||
for count < 10 {
|
||||
logger.Debug("Adding %s", proclamation.Name)
|
||||
words := strings.Fields(proclamation.Content)
|
||||
p.words = append(p.words, words...)
|
||||
count += 1
|
||||
}
|
||||
logger.Debug("Adding %s", defaultProclamation.Name)
|
||||
defaultWords := strings.Fields(defaultProclamation.Content)
|
||||
p.words = append(p.words, defaultWords...)
|
||||
count = 0
|
||||
}
|
||||
|
||||
if len(p.words) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user