Skip to content

Commit

Permalink
Updated common ground view.
Browse files Browse the repository at this point in the history
  • Loading branch information
rawbee committed Oct 26, 2017
1 parent 25f49ce commit b3ecc2f
Show file tree
Hide file tree
Showing 7 changed files with 1,193 additions and 1,137 deletions.
42 changes: 30 additions & 12 deletions css/main-window.css
Expand Up @@ -183,15 +183,22 @@ body {
align-items: center;
justify-content: center;
margin-top: 10vh;
font-weight: normal;
}

.character-trainer-view-character-selector {
font-size: 1.5em;
font-weight: bold;
font-weight: normal;
text-align: right;
border: none;
background: transparent;
outline: 0;
color: white;
-webkit-appearance: none;
background: url(../images/menu-indicator.svg) no-repeat;
background-size: 15px;
background-position: 100%;
padding-right: 25px;
direction: rtl;
}

#character-trainer-view-header-text {
Expand Down Expand Up @@ -289,7 +296,6 @@ body {
margin: 10px 0px;
background-color: #AAA;
padding: 20px;
border-radius: 8px;
position: relative;
display: flex;
flex-direction: row;
Expand Down Expand Up @@ -356,20 +362,23 @@ body {

.common-ground-view-container {
display: flex;
flex-direction: row;
justify-content: space-between;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 20px 0px;
border-bottom-style: solid;
border-bottom-width: 1px;
width: 75vw;
}

/** Generics */
.common-ground-view-name {
font-size: 1.5em;
font-weight: bold;
}

.favorite-button-container {
width: 20px;
height: 20px;
cursor: pointer;
z-index: 999;
.common-ground-view-scores {
margin-top: 10px;
font-size: 0.6em;
}

/** Character Selector **/
Expand All @@ -382,6 +391,16 @@ body {
cursor: pointer;
}

/** Generics */

.favorite-button-container {
width: 20px;
height: 20px;
cursor: pointer;
z-index: 999;
}


.character-selector-button-selected {
background-color: #CCC;
}
Expand All @@ -390,7 +409,6 @@ body {
background-color: #EEE;
}

/** deprecated **/
.favorites-filter-button {
padding: 20px 0px;
cursor: pointer;
Expand Down
2,232 changes: 1,124 additions & 1,108 deletions images/icons.ai

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions images/menu-indicator.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 12 additions & 7 deletions js/views/character-comparison-conflict-view.js
@@ -1,5 +1,6 @@
const utils = require('../utils.js')
const CharacterComparisonBaseView = require('./character-comparison-base-view.js')
const FavoriteButton = require('./favorite-button.js')
const { semiRandomShuffle } = require('../utils.js')
const NUM_COMPARISON_ITEMS = 30
const RANDOM_SHUFFLE_FACTOR = 4
Expand Down Expand Up @@ -76,10 +77,10 @@ module.exports = class CharacterComparisonConflictView extends CharacterComparis
for(let valueIndex = 0; valueIndex < NUM_COMPARISON_ITEMS; valueIndex++) {
let conflictContainer = document.createElement("div")
conflictContainer.classList.add("comparison-view-conflict-container")
let favButton = document.createElement('div')
favButton.innerHTML = `add favorite`
conflictContainer.appendChild(favButton)

var self = this
let favButton = new FavoriteButton()
conflictContainer.appendChild(favButton.getView())

// we use this in the add favorite event.
let favoriteData = {}
Expand Down Expand Up @@ -109,13 +110,17 @@ module.exports = class CharacterComparisonConflictView extends CharacterComparis
|| utils.checkObjectPath(favoritesPaths[1].concat(favoritesPaths[0]), this.valueComparisonFavorites)
}
if(isFavorite) {
favButton.innerHTML = `favorited`
favButton.setChecked(true)
favButton.setEnabled(false)
} else {
var self = this
favButton.addEventListener('mouseup', function(event) {
event.target.innerHTML = `favorited`
favButton.setHandler(function(event) {
self.emit('add-comparison-favorite', favoriteData)
favButton.setChecked(true)
favButton.setEnabled(false)
})
favButton.setChecked(false)
favButton.setEnabled(true)
}

result.appendChild(conflictContainer)
Expand Down
16 changes: 12 additions & 4 deletions js/views/common-ground-view.js
Expand Up @@ -109,15 +109,19 @@ module.exports = class CommonGroundView extends CharacterComparisonBaseView {
name.innerHTML = this.valuesMap[character1Value.valueID].name
valueContainer.appendChild(name)

let scoresContainer = document.createElement("div")
scoresContainer.classList.add("common-ground-view-scores")
valueContainer.appendChild(scoresContainer)

let character1Container = document.createElement("div")
character1Container.classList.add("common-ground-view-character-container")
character1Container.innerHTML = `${this.selectedCharacters[0].name}: ${character1Value.score}`
valueContainer.appendChild(character1Container)
scoresContainer.appendChild(character1Container)

let character2Container = document.createElement("div")
character2Container.classList.add("common-ground-view-character-container")
character2Container.innerHTML = `${this.selectedCharacters[1].name}: ${character2Value.score}`
valueContainer.appendChild(character2Container)
scoresContainer.appendChild(character2Container)

valuesContainer.appendChild(valueContainer)
}
Expand Down Expand Up @@ -179,15 +183,19 @@ module.exports = class CommonGroundView extends CharacterComparisonBaseView {
name.innerHTML = this.valuesMap[character1Value.valueID].name
valueContainer.appendChild(name)

let scoresContainer = document.createElement("div")
scoresContainer.classList.add("common-ground-view-scores")
valueContainer.appendChild(scoresContainer)

let character1Container = document.createElement("div")
character1Container.classList.add("common-ground-view-character-container")
character1Container.innerHTML = `${this.selectedCharacters[0].name}: ${character1Value.score}`
valueContainer.appendChild(character1Container)
scoresContainer.appendChild(character1Container)

let character2Container = document.createElement("div")
character2Container.classList.add("common-ground-view-character-container")
character2Container.innerHTML = `${this.selectedCharacters[1].name}: ${character2Value.score}`
valueContainer.appendChild(character2Container)
scoresContainer.appendChild(character2Container)

valuesContainer.appendChild(valueContainer)
}
Expand Down
18 changes: 12 additions & 6 deletions js/views/internal-conflict-view.js
@@ -1,5 +1,6 @@
const utils = require('../utils.js')
const MainBaseView = require('./main-base-view.js')
const FavoriteButton = require('./favorite-button.js')
const { semiRandomShuffle } = require('../utils.js')
const NUM_COMPARISON_ITEMS = 60
const RANDOM_SHUFFLE_FACTOR = 4
Expand Down Expand Up @@ -76,24 +77,29 @@ module.exports = class InternalConflictView extends MainBaseView {
let conflictContainer = document.createElement("div")
conflictContainer.classList.add("comparison-view-conflict-container")

let favButton = document.createElement('div')
favButton.innerHTML = `add favorite`
conflictContainer.appendChild(favButton)
let favButton = new FavoriteButton()
conflictContainer.appendChild(favButton.getView())

let favoriteData = {}
favoriteData[`character1ID`] = value1.characterID
favoriteData[`value1ID`] = value1.valueID
favoriteData[`character2ID`] = value2.characterID
favoriteData[`value2ID`] = value2.valueID
let isFavorite = utils.checkObjectPath([value1.characterID, value1.valueID, value2.characterID, value2.valueID], this.valueComparisonFavorites)
|| utils.checkObjectPath([value2.characterID, value2.valueID, value1.characterID, value1.valueID], this.valueComparisonFavorites)

if(isFavorite) {
favButton.innerHTML = `favorited`
favButton.setChecked(true)
favButton.setEnabled(false)
} else {
var self = this
favButton.addEventListener('mouseup', function(event) {
event.target.innerHTML = `favorited`
favButton.setHandler(function(event) {
self.emit('add-comparison-favorite', favoriteData)
favButton.setChecked(true)
favButton.setEnabled(false)
})
favButton.setChecked(false)
favButton.setEnabled(true)
}

let getValueView = (value)=>{
Expand Down
2 changes: 2 additions & 0 deletions js/views/main-window.js
Expand Up @@ -319,6 +319,8 @@ function handleBattleUpdate(battleOutcome) {
.then(()=> {})
.catch(console.error)
})

backgroundView.nextBackground()
}

/**
Expand Down

0 comments on commit b3ecc2f

Please sign in to comment.