Skip to content

Commit

Permalink
Merge pull request #33 from Appbird/topic/resolve-#32
Browse files Browse the repository at this point in the history
#32 resolve
  • Loading branch information
Appbird authored Sep 5, 2021
2 parents a013c2f + b1314d7 commit e11d215
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/ts/client/view/parts/OfferFormView/OfferFormView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { HTMLConverter } from "../../../../utility/ViewUtility";
import { EditorPlayersWithAttributesPart } from "../SetNewRegulation/Editor/EditorPlayersWithAttributesPart";
import { choiceString } from "../../../../utility/aboutLang";
import { DecideButtonPart } from "../DecideButtonPart";
import { ILabelledDocument } from "../../../../type/list/ILabelledDocument";
type RecordInputData = {
link:string;
score:number;
Expand Down Expand Up @@ -76,6 +77,8 @@ export class OfferFormView implements IView {
this.runnerID = runnerID
this.isAbilityIDsWithAttributes = abilityAttributeItems !== undefined && abilityAttributeItems.length !== 0
this.difficultyItems = difficultyItems
if (abilityAttributeItems) for (const unit of abilityAttributeItems) unit.flagsInAttribute.sort(sort(language))

const htmlCon = new HTMLConverter(language)
const link = new EditorRecordLinkPart({
container: appendNewEditorElement(this.container),
Expand Down Expand Up @@ -266,3 +269,14 @@ export class OfferFormView implements IView {

}


function sort(language:LanguageInApplication){
return (a:ILabelledDocument,b:ILabelledDocument) => {
const A = choiceString(a,language)
const B = choiceString(b,language)
if (A > B) return 1
if (A < B) return -1
return 0
}

}
1 change: 1 addition & 0 deletions src/ts/client/view/state/offerForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export class S_OfferForm
})).result
} } )
)

abilityAttributeItems = (abilityAttributeItems.length === 0) ? undefined : abilityAttributeItems
const view = new OfferFormView(
this.articleDOM.appendChild(document.createElement("div")),
Expand Down
13 changes: 13 additions & 0 deletions src/ts/client/view/state/searchConditionSelector.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { LanguageInApplication } from "../../../type/LanguageInApplication";
import { IGameModeItemWithoutCollections } from "../../../type/list/IGameModeItem";
import { IGameSystemInfoWithoutCollections } from "../../../type/list/IGameSystemInfo";
import { ILabelledDocument } from "../../../type/list/ILabelledDocument";
import { choiceString } from "../../../utility/aboutLang";
import { IAppUsedToReadAndChangePage } from "../../interface/AppInterfaces";
import { appendElement } from "../../utility/aboutElement";
Expand Down Expand Up @@ -28,6 +30,7 @@ export class S_SearchConditionSelector
"",
"c-icooon u-background--menu"
);
const language = this.app.state.language
const gameSystemID = this.app.state.gameSystemIDDisplayed
const gameModeID = this.app.state.gameModeIDDisplayed
const gameModeInfo = this.app.state.gameSystemEnvDisplayed.gameMode
Expand All @@ -54,6 +57,7 @@ export class S_SearchConditionSelector
})).result
} } )
)
for (const unit of setsOfFlagsOfAbilityAttributeItem) unit.flagsInAttribute.sort(sort(this.app.state.language))
new SearchConditionSelectorView(this.articleDOM.appendChild(document.createElement("div")),{
difficulties,abilities,hashTags,gameSystemID,gameModeID,setsOfFlagsOfAbilityAttributeItem,
superiorScore:(gameModeInfo.scoreType === "time") ? "LowerFirst":"HigherFirst",language:this.app.state.language,maxPlayerNumber:gameModeInfo.maxNumberOfPlayer,
Expand All @@ -69,5 +73,14 @@ export class S_SearchConditionSelector
}
}

function sort(language:LanguageInApplication){
return (a:ILabelledDocument,b:ILabelledDocument) => {
const A = choiceString(a,language)
const B = choiceString(b,language)
if (A > B) return 1
if (A < B) return -1
return 0
}

}

0 comments on commit e11d215

Please sign in to comment.