Falta scopear socket i models'???
This commit is contained in:
parent
c9decfa21a
commit
6f29f54f60
@ -143,6 +143,8 @@ class ClientModule {
|
||||
#_color;
|
||||
#_icon;
|
||||
#_buttons;
|
||||
#_init;
|
||||
#_exit;
|
||||
|
||||
#_character_sheet;
|
||||
#_item_sheet;
|
||||
@ -183,6 +185,10 @@ class ClientModule {
|
||||
*/
|
||||
set icon(icon){ this.#_icon = icon; }
|
||||
|
||||
set init(init){ this.#_init = init; }
|
||||
|
||||
set exit(exit){ this.#_exit = exit; }
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {ClientView} window
|
||||
@ -228,6 +234,8 @@ class ClientModule {
|
||||
item_sheet: this.#_item_sheet,
|
||||
create_item_prompt: this.#_item_prompt,
|
||||
},
|
||||
init: this.#_init,
|
||||
exit: () => {},
|
||||
buttons: this.#_buttons
|
||||
}
|
||||
}
|
||||
|
@ -1,41 +0,0 @@
|
||||
import Server from '@/services/Server'
|
||||
import { GetCampaign } from "./Dragonroll";
|
||||
import { socket } from './Socket';
|
||||
import { reactive } from 'vue';
|
||||
|
||||
let data = reactive({});
|
||||
|
||||
function InitData(){
|
||||
data.value = {
|
||||
concepts: [],
|
||||
};
|
||||
}
|
||||
|
||||
function FetchConcepts(){
|
||||
Server().get('/concept/list?campaign=' + GetCampaign()._id).then(response => {
|
||||
data.value.concepts = response.data.data;
|
||||
}).catch((err) => console.log(err));
|
||||
}
|
||||
|
||||
function FetchData(){
|
||||
FetchConcepts();
|
||||
}
|
||||
|
||||
|
||||
socket.on('update-concepts', () => {
|
||||
FetchConcepts();
|
||||
});
|
||||
|
||||
let GetConcepts = () => data.value.concepts;
|
||||
let GetConcept = (id) => Server().get('/concept/get?campaign=' + GetCampaign()._id + "&id=" + id)
|
||||
|
||||
|
||||
export {
|
||||
InitData,
|
||||
FetchData,
|
||||
|
||||
FetchConcepts,
|
||||
|
||||
GetConcepts,
|
||||
GetConcept,
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
import { ref } from "vue";
|
||||
import { FetchData, InitData } from "./Data";
|
||||
import { GetCampaignModule } from "./Campaign";
|
||||
|
||||
const inGameRef = ref(false);
|
||||
let InGameRef = () => inGameRef;
|
||||
|
||||
function LaunchGame(){
|
||||
inGameRef.value = true;
|
||||
InitData();
|
||||
FetchData();
|
||||
GetCampaignModule().init();
|
||||
}
|
||||
|
||||
function ExitGame(){
|
||||
inGameRef.value = false;
|
||||
GetCampaignModule().exit();
|
||||
}
|
||||
|
||||
export {
|
||||
|
@ -2,7 +2,7 @@
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import { AddContextMenu } from '@/services/ContextMenu';
|
||||
import { AddTooltip } from '@/services/Tooltip';
|
||||
import { marked } from "https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js";
|
||||
import { marked } from "marked";
|
||||
|
||||
const props = defineProps(['element', 'context', 'tooltip', 'icon']);
|
||||
|
||||
|
@ -1,14 +1,16 @@
|
||||
import { Api } from './main.js'
|
||||
|
||||
import Server from '@/services/Server'
|
||||
import { reactive } from 'vue';
|
||||
|
||||
import { GetCampaign } from "./Dragonroll";
|
||||
import { socket } from './Socket';
|
||||
import { GetCampaign } from "@/services/Dragonroll";
|
||||
import { socket } from '@/services/Socket';
|
||||
|
||||
let data = reactive({});
|
||||
|
||||
function InitData(){
|
||||
data.value = {
|
||||
concepts: [],
|
||||
concepts: []
|
||||
};
|
||||
}
|
||||
|
||||
@ -22,7 +24,6 @@ function FetchData(){
|
||||
FetchConcepts();
|
||||
}
|
||||
|
||||
|
||||
socket.on('update-concepts', () => {
|
||||
FetchConcepts();
|
||||
});
|
||||
|
@ -1,6 +1,11 @@
|
||||
import { FetchData, InitData } from "./data";
|
||||
|
||||
// Entrypoint
|
||||
function Main(Api){
|
||||
let Api;
|
||||
|
||||
function Main(api){
|
||||
Api = api
|
||||
|
||||
console.log("Hello World!");
|
||||
|
||||
let dndModule = Api.createModule('dnd-5e');
|
||||
@ -53,7 +58,13 @@ function Main(Api){
|
||||
// Api.windows.registerWindow('item_sheet', Api.createView('ItemSheet'));
|
||||
// Api.windows.registerWindow('create_item_prompt', Api.createView('CreateItemPrompt'));
|
||||
|
||||
dndModule.init = () => {
|
||||
console.log("INIT")
|
||||
InitData();
|
||||
FetchData();
|
||||
}
|
||||
|
||||
Api.registerModule(dndModule);
|
||||
}
|
||||
|
||||
export { Main };
|
||||
export { Main, Api };
|
@ -4,12 +4,11 @@ import WindowHandle from '@/views/partials/WindowHandle.vue';
|
||||
import { onMounted, ref, shallowRef, watch } from 'vue';
|
||||
import { ClearWindow, CreateWindow, ResetPosition, SetMinSize, SetResizable, SetSize, SetupHandle } from '@/services/Windows';
|
||||
import ConceptList from '@/views/partials/ConceptList.vue';
|
||||
import { FetchConcepts, GetConcepts } from '@/services/Data';
|
||||
import Tabs from '@/views/partials/Tabs.vue';
|
||||
import { GetCampaignModuleName } from '@/services/Campaign';
|
||||
import FixedBottomButtons from '@/views/partials/FixedBottomButtons.vue';
|
||||
|
||||
import './../main.js'
|
||||
import { FetchConcepts, GetConcepts } from './../data.js'
|
||||
|
||||
const handle = ref(null);
|
||||
|
||||
|
@ -2,12 +2,13 @@
|
||||
import WindowHandle from '@/views/partials/WindowHandle.vue';
|
||||
import Server from '@/services/Server';
|
||||
|
||||
import { GetConcept } from './../data.js';
|
||||
|
||||
import { onMounted, ref, shallowRef } from 'vue';
|
||||
import { SetupHandle, SetSize, ResetPosition, CreateWindow, SetMinSize, SetResizable } from '@/services/Windows';
|
||||
import IconSelector from '@/views/partials/IconSelector.vue';
|
||||
import { AddContextMenu, HideContextMenu, ShowContextMenu } from '@/services/ContextMenu';
|
||||
import { GetCampaign } from '@/services/Dragonroll';
|
||||
import { GetConcept } from '@/services/Data';
|
||||
import Tabs from '@/views/partials/Tabs.vue';
|
||||
import MarkdownEditor from '@/views/partials/MarkdownEditor.vue';
|
||||
import Tags from '@/views/partials/Tags.vue';
|
||||
@ -15,6 +16,7 @@ import NumberInput from '@/views/partials/NumberInput.vue';
|
||||
const props = defineProps(['data']);
|
||||
const data = props.data;
|
||||
|
||||
|
||||
const handle = ref(null);
|
||||
const item_type = ref("");
|
||||
const rarity = ref(null);
|
||||
|
Loading…
Reference in New Issue
Block a user