Skip to content

Commit

Permalink
Reorganize everything.
Browse files Browse the repository at this point in the history
  • Loading branch information
Damnae committed Sep 4, 2023
1 parent da0c510 commit 7fbd14b
Show file tree
Hide file tree
Showing 167 changed files with 898 additions and 890 deletions.
14 changes: 11 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
<script setup lang="ts">
import LoadingTitle from '@/views/LoadingTitle.vue';
import Footer from '@/views/Footer.vue'
import { ref, onErrorCaptured, } from 'vue';
import LoadingTitle from '@/components/LoadingTitle.vue';
import Footer from '@/views/Footer.vue'
const errorMessage = ref('')
onErrorCaptured((error, _instance, info) =>
{
errorMessage.value = `❌ Error in ${info}, ${error}`
})
</script>

<template>
<div class="main-layout">
<div class="main-content-layout">

<RouterView v-slot="{ Component }">
<RouterView v-if="!errorMessage" v-slot="{ Component }">
<template v-if="Component">
<Suspense :timeout="100">

Expand All @@ -19,6 +26,7 @@ import Footer from '@/views/Footer.vue'
</Suspense>
</template>
</RouterView>
<LoadingTitle v-else :message="errorMessage" />

</div>
<div class="main-footer-layout">
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/common.ts → src/common/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function cleanupMarkup(value?:string) : string
.replace(/\\n/gi, " ")
}

export function cleanGamecoreName(value: string)
export function cleanupTaskName(value: string)
{
var parts = value.split('.');
if (parts.length === 3)
Expand All @@ -72,7 +72,7 @@ export function cleanupFilename(path:string) : string
return ''
}

export function gamecoreToComponentName(value: string)
export function taskTypeToComponentName(value: string)
{
var parts = value.split('.');
if (parts.length === 3)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/components/NavTree.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { Ref, inject, ref, computed, useSlots, provide, } from 'vue';
import LoadingNav from '@/views/LoadingNav.vue';
import LoadingNav from '@/components/LoadingNav.vue';
const slots = useSlots()
const props = defineProps<{startsOpen?:boolean, forceOpen?:boolean}>()
Expand Down
31 changes: 31 additions & 0 deletions src/gamecore/AnyTask.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<script setup lang="ts">
import { defineAsyncComponent, } from 'vue'
import { GamecoreTask, } from '@/sources/gamecore';
import { taskTypeToComponentName, } from '@/common/common';
const props = defineProps<{node:GamecoreTask}>()
const taskName = taskTypeToComponentName(props.node.$type)
const taskComponent = defineAsyncComponent({
loader: async () =>
{
try { return await import(`./tasks/${taskName}.vue`) }
catch (error:any)
{
if (!error.toString().includes('Unknown variable dynamic import'))
console.error(error)
return await import(`./MissingTask.vue`)
}
},
})
const inversibleNode = props.node as unknown as
{
Inverse:boolean
}
</script>

<template>
<component :is="taskComponent" :node="node" :class="inversibleNode.Inverse ? 'inverted' : ''" />
</template>

<style scoped>
</style>
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<script setup lang="ts">
import { inject, Ref, } from 'vue';
import { GamecoreContext,
import { ExpressionContext,
DynamicExpression, evaluateDynamicExpression,
} from '@/scripts/sources/gamecore';
} from '@/sources/gamecore';
defineProps<{expression?:DynamicExpression}>()
const gamecoreContext = inject('gamecoreContext') as Ref<GamecoreContext>
const expressionContext = inject('expressionContext') as Ref<ExpressionContext>
</script>

<template>
{{ evaluateDynamicExpression(expression, gamecoreContext) }}
{{ evaluateDynamicExpression(expression, expressionContext) }}
</template>

<style scoped>
Expand Down
16 changes: 16 additions & 0 deletions src/gamecore/MissingTask.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script setup lang="ts">
import { GamecoreTask, } from '@/sources/gamecore';
import { cleanupTaskName, } from '@/common/common';
import BlockLayout from '@/components/BlockLayout.vue';
defineProps<{node:GamecoreTask}>()
</script>

<template>
<BlockLayout :source="node">
<span class="notimplemented">{{ cleanupTaskName(node.$type) }}</span>
</BlockLayout>
</template>

<style scoped>
</style>
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<script setup lang="ts">
import { inject } from 'vue';
import { getHash } from '@/scripts/translate';
import { GamecoreNode,
import { getHash } from '@/common/translate';
import { GamecoreTask,
GamecoreTargetType, evaluateTargetType,
DynamicExpression,
} from '@/scripts/sources/gamecore';
import BlockLayout from '@/views/gamecore/BlockLayout.vue';
} from '@/sources/gamecore';
import BlockLayout from '@/components/BlockLayout.vue';
import EvaluateExpression from '../EvaluateExpression.vue';
import useHashStore from '@/scripts/hashstore';
import AnyBlock from '../AnyBlock.vue';
import useHashStore from '@/common/hashstore';
import AnyTask from '../AnyTask.vue';
const props = defineProps<{node:GamecoreNode}>()
const props = defineProps<{node:GamecoreTask}>()
const node = props.node as unknown as
{
TargetType?:GamecoreTargetType
Expand All @@ -24,9 +24,9 @@ import AnyBlock from '../AnyBlock.vue';
{
[key:string]:DynamicExpression
}
SuccessTaskList?:GamecoreNode[]
FailTaskList?:GamecoreNode[]
ResistedTaskList?:GamecoreNode[]
SuccessTaskList?:GamecoreTask[]
FailTaskList?:GamecoreTask[]
ResistedTaskList?:GamecoreTask[]
}
if (node.DynamicValues)
Expand All @@ -43,7 +43,7 @@ import AnyBlock from '../AnyBlock.vue';
<template>
<BlockLayout :source="node">

Add
Apply
<template v-if="node.LayerAddWhenStack">
<em><EvaluateExpression :expression="node.LayerAddWhenStack" /></em> stacks of
</template>
Expand Down Expand Up @@ -78,15 +78,15 @@ import AnyBlock from '../AnyBlock.vue';
<div class="subblock">
<template v-if="node.SuccessTaskList">
<span class="flow">On Success</span>
<AnyBlock v-for="n in node.SuccessTaskList" :node="n" />
<AnyTask v-for="n in node.SuccessTaskList" :node="n" />
</template>
<template v-if="node.FailTaskList">
<span class="flow">On Failure</span>
<AnyBlock v-for="n in node.FailTaskList" :node="n" />
<AnyTask v-for="n in node.FailTaskList" :node="n" />
</template>
<template v-if="node.ResistedTaskList">
<span class="flow">On Resist</span>
<AnyBlock v-for="n in node.ResistedTaskList" :node="n" />
<AnyTask v-for="n in node.ResistedTaskList" :node="n" />
</template>
</div>
</template>
Expand Down
24 changes: 24 additions & 0 deletions src/gamecore/tasks/ByAnd.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<script setup lang="ts">
import { GamecoreTask,
} from '@/sources/gamecore';
import BlockLayout from '@/components/BlockLayout.vue';
import AnyTask from '../AnyTask.vue';
const props = defineProps<{node:GamecoreTask}>()
const node = props.node as unknown as
{
PredicateList:GamecoreTask[]
}
</script>

<template>
<BlockLayout :source="node">
<span class="flow">All</span>
<template #content>
<AnyTask v-for="predicate in node.PredicateList" :node="predicate" />
</template>
</BlockLayout>
</template>

<style scoped>
</style>
24 changes: 24 additions & 0 deletions src/gamecore/tasks/ByAny.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<script setup lang="ts">
import { GamecoreTask,
} from '@/sources/gamecore';
import BlockLayout from '@/components/BlockLayout.vue';
import AnyTask from '../AnyTask.vue';
const props = defineProps<{node:GamecoreTask}>()
const node = props.node as unknown as
{
PredicateList:GamecoreTask[]
}
</script>

<template>
<BlockLayout :source="node">
<span class="flow">Any</span>
<template #content>
<AnyTask v-for="predicate in node.PredicateList" :node="predicate" />
</template>
</BlockLayout>
</template>

<style scoped>
</style>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script setup lang="ts">
import { GamecoreNode,
} from '@/scripts/sources/gamecore';
import BlockLayout from '@/views/gamecore/BlockLayout.vue';
import { GamecoreTask,
} from '@/sources/gamecore';
import BlockLayout from '@/components/BlockLayout.vue';
const props = defineProps<{node:GamecoreNode}>()
const props = defineProps<{node:GamecoreTask}>()
const node = props.node as unknown as
{
AttackTypes:string[]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script setup lang="ts">
import { GamecoreNode,
import { GamecoreTask,
GamecoreTargetType, evaluateTargetType,
} from '@/scripts/sources/gamecore';
import BlockLayout from '@/views/gamecore/BlockLayout.vue';
} from '@/sources/gamecore';
import BlockLayout from '@/components/BlockLayout.vue';
const props = defineProps<{node:GamecoreNode}>()
const props = defineProps<{node:GamecoreTask}>()
const node = props.node as unknown as
{
TargetType?:GamecoreTargetType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script setup lang="ts">
import { GamecoreNode,
import { GamecoreTask,
GamecoreTargetType, evaluateTargetType,
} from '@/scripts/sources/gamecore';
import BlockLayout from '@/views/gamecore/BlockLayout.vue';
} from '@/sources/gamecore';
import BlockLayout from '@/components/BlockLayout.vue';
const props = defineProps<{node:GamecoreNode}>()
const props = defineProps<{node:GamecoreTask}>()
const node = props.node as unknown as
{
TargetType?:GamecoreTargetType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script setup lang="ts">
import { GamecoreNode,
import { GamecoreTask,
DynamicExpression,
GamecoreTargetType, evaluateTargetType,
} from '@/scripts/sources/gamecore';
import BlockLayout from '@/views/gamecore/BlockLayout.vue';
} from '@/sources/gamecore';
import BlockLayout from '@/components/BlockLayout.vue';
import EvaluateExpression from '../EvaluateExpression.vue';
const props = defineProps<{node:GamecoreNode}>()
const props = defineProps<{node:GamecoreTask}>()
const node = props.node as unknown as
{
TargetType?:GamecoreTargetType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script setup lang="ts">
import { GamecoreNode,
import { GamecoreTask,
DynamicExpression,
} from '@/scripts/sources/gamecore';
import BlockLayout from '@/views/gamecore/BlockLayout.vue';
} from '@/sources/gamecore';
import BlockLayout from '@/components/BlockLayout.vue';
import EvaluateExpression from '../EvaluateExpression.vue';
const props = defineProps<{node:GamecoreNode}>()
const props = defineProps<{node:GamecoreTask}>()
const node = props.node as unknown as
{
CompareType:string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script setup lang="ts">
import { GamecoreNode,
import { GamecoreTask,
DynamicExpression,
GamecoreTargetType, evaluateTargetType,
} from '@/scripts/sources/gamecore';
import BlockLayout from '@/views/gamecore/BlockLayout.vue';
} from '@/sources/gamecore';
import BlockLayout from '@/components/BlockLayout.vue';
import EvaluateExpression from '../EvaluateExpression.vue';
const props = defineProps<{node:GamecoreNode}>()
const props = defineProps<{node:GamecoreTask}>()
const node = props.node as unknown as
{
TargetType?:GamecoreTargetType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<script setup lang="ts">
import { GamecoreNode,
import { GamecoreTask,
GamecoreTargetType, evaluateTargetType,
DynamicExpression,
} from '@/scripts/sources/gamecore';
import useHashStore from '@/scripts/hashstore';
import BlockLayout from '@/views/gamecore/BlockLayout.vue';
} from '@/sources/gamecore';
import useHashStore from '@/common/hashstore';
import BlockLayout from '@/components/BlockLayout.vue';
import EvaluateExpression from '../EvaluateExpression.vue';
const props = defineProps<{node:GamecoreNode}>()
const props = defineProps<{node:GamecoreTask}>()
const node = props.node as unknown as
{
TargetType?:GamecoreTargetType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script setup lang="ts">
import { GamecoreNode,
import { GamecoreTask,
DynamicExpression,
GamecoreTargetType, evaluateTargetType,
} from '@/scripts/sources/gamecore';
import BlockLayout from '@/views/gamecore/BlockLayout.vue';
} from '@/sources/gamecore';
import BlockLayout from '@/components/BlockLayout.vue';
import EvaluateExpression from '../EvaluateExpression.vue';
const props = defineProps<{node:GamecoreNode}>()
const props = defineProps<{node:GamecoreTask}>()
const node = props.node as unknown as
{
TargetType?:GamecoreTargetType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script setup lang="ts">
import { GamecoreNode,
import { GamecoreTask,
DynamicExpression,
GamecoreTargetType, evaluateTargetType,
} from '@/scripts/sources/gamecore';
import BlockLayout from '@/views/gamecore/BlockLayout.vue';
} from '@/sources/gamecore';
import BlockLayout from '@/components/BlockLayout.vue';
import EvaluateExpression from '../EvaluateExpression.vue';
const props = defineProps<{node:GamecoreNode}>()
const props = defineProps<{node:GamecoreTask}>()
const node = props.node as unknown as
{
TargetType?:GamecoreTargetType
Expand Down
Loading

0 comments on commit 7fbd14b

Please sign in to comment.