Skip to content

Commit

Permalink
Merge branch 'develop' into betrayal-beach
Browse files Browse the repository at this point in the history
  • Loading branch information
anttimaki authored Sep 4, 2024
2 parents 3a7a0cc + 0aabade commit 68e0e26
Show file tree
Hide file tree
Showing 43 changed files with 1,569 additions and 816 deletions.
7 changes: 0 additions & 7 deletions docs/Adding a game.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,6 @@
- EG: RoR2, NASB, TABS, etc.
- Pattern is lowercase although likely isn't necessary.

### Update SettingsDexieStore
You'll find a line similar to:
```ts
this.version(33).stores(store);
```
Bump this by one each time a game is added to GameManager.

### Creating new installation rules
- See all files under `/src/r2mm/installing/default_installation_rules/`
- `game_rules` stores all game specific rules.
Expand Down
3 changes: 3 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import LinkProvider from './providers/components/LinkProvider';
import LinkImpl from './r2mm/component_override/LinkImpl';
import FsProvider from './providers/generic/file/FsProvider';
import NodeFs from './providers/generic/file/NodeFs';
import { DataFolderProvider } from './providers/ror2/system/DataFolderProvider';
import { DataFolderProviderImpl } from './r2mm/system/DataFolderProviderImpl';
import InteractionProvider from './providers/ror2/system/InteractionProvider';
import InteractionProviderImpl from './r2mm/system/InteractionProviderImpl';
import ZipProvider from './providers/generic/zip/ZipProvider';
Expand Down Expand Up @@ -117,6 +119,7 @@ export default class App extends mixins(UtilityMixin) {
LoggerProvider.provide(() => new Logger());
LinkProvider.provide(() => new LinkImpl());
InteractionProvider.provide(() => new InteractionProviderImpl());
DataFolderProvider.provide(() => new DataFolderProviderImpl());
PlatformInterceptorProvider.provide(() => new PlatformInterceptorImpl());
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/game_selection/ArcusChroma.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/game_selection/NineSols.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/game_selection/ScrewDrivers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions src/components/mixins/ProfilesMixin.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<script lang='ts'>
import Vue from 'vue';
import Component from 'vue-class-component';
import sanitize from "sanitize-filename";
@Component
export default class ProfilesMixin extends Vue {
get profileList(): string[] {
return this.$store.state.profiles.profileList;
}
get activeProfileName(): string {
return this.$store.getters['profile/activeProfileName'];
}
set activeProfileName(value: string) {
this.$store.dispatch('profiles/setSelectedProfile', {profileName: value, prewarmCache: false});
}
doesProfileExist(nameToCheck: string): boolean {
if ((nameToCheck.match(new RegExp('^([a-zA-Z0-9])(\\s|[a-zA-Z0-9]|_|-|[.])*$'))) === null) {
return true;
}
const safe: string = this.makeProfileNameSafe(nameToCheck);
return (this.profileList.some(function (profile: string) {
return profile.toLowerCase() === safe.toLowerCase()
}));
}
makeProfileNameSafe(nameToSanitize: string): string {
return sanitize(nameToSanitize);
}
}
</script>
74 changes: 74 additions & 0 deletions src/components/profiles-modals/CreateProfileModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<script lang="ts">
import { Component } from 'vue-property-decorator';
import { ModalCard } from "../all";
import R2Error from "../../model/errors/R2Error";
import ProfilesMixin from "../../components/mixins/ProfilesMixin.vue";
@Component({
components: {ModalCard}
})
export default class CreateProfileModal extends ProfilesMixin {
private newProfileName = '';
get isOpen(): boolean {
return this.$store.state.modals.isCreateProfileModalOpen;
}
closeModal() {
this.newProfileName = '';
this.$store.commit('closeCreateProfileModal');
}
// User confirmed creation of a new profile with a name that didn't exist before.
async createProfile() {
const safeName = this.makeProfileNameSafe(this.newProfileName);
if (safeName !== '') {
try {
await this.$store.dispatch('profiles/addProfile', safeName);
this.closeModal();
} catch (e) {
const err = R2Error.fromThrownValue(e, 'Error whilst creating a profile');
this.$store.commit('error/handleError', err);
}
}
}
}
</script>
<template>
<ModalCard v-if="isOpen" :is-active="isOpen" @close-modal="closeModal">

<template v-slot:header>
<p class="modal-card-title">Create a profile</p>
</template>

<template v-slot:body>
<p>This profile will store its own mods independently from other profiles.</p>
<br/>
<input
class="input"
v-model="newProfileName"
@keyup.enter="!doesProfileExist(newProfileName) && createProfile(newProfileName)"
id="create-profile-modal-new-profile-name"
ref="nameInput"
/>
<br/><br/>
<span class="tag is-dark" v-if="newProfileName === '' || makeProfileNameSafe(newProfileName) === ''">
Profile name required
</span>
<span class="tag is-success" v-else-if="!doesProfileExist(newProfileName)">
"{{makeProfileNameSafe(newProfileName)}}" is available
</span>
<span class="tag is-danger" v-else-if="doesProfileExist(newProfileName)">
"{{makeProfileNameSafe(newProfileName)}}" is either already in use, or contains invalid characters
</span>
</template>

<template v-slot:footer>
<button id="modal-create-profile-invalid" class="button is-danger" v-if="doesProfileExist(newProfileName)" disabled>Create</button>
<button id="modal-create-profile" class="button is-info" @click="createProfile(newProfileName)" v-else>Create</button>
</template>

</ModalCard>
</template>
9 changes: 3 additions & 6 deletions src/components/profiles-modals/DeleteProfileModal.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
<script lang="ts">
import { Vue, Component } from 'vue-property-decorator';
import { Component } from 'vue-property-decorator';
import { ModalCard } from "../all";
import R2Error from "../../model/errors/R2Error";
import ProfilesMixin from "../../components/mixins/ProfilesMixin.vue";
@Component({
components: {ModalCard}
})
export default class DeleteProfileModal extends Vue {
export default class DeleteProfileModal extends ProfilesMixin {
get isOpen(): boolean {
return this.$store.state.modals.isDeleteProfileModalOpen;
}
get profileList(): string[] {
return this.$store.state.profiles.profileList;
}
closeDeleteProfileModal() {
this.$store.commit('closeDeleteProfileModal');
}
Expand Down
Loading

0 comments on commit 68e0e26

Please sign in to comment.