mirror of
https://github.com/YouHaveTrouble/DiscipleOfLand.git
synced 2026-05-12 06:26:56 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c828496d1a | |||
| 9e5580836c | |||
| ea74bbea90 |
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "discipleofland",
|
"name": "discipleofland",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -249,7 +249,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"job": "botanist",
|
"job": "miner",
|
||||||
"type": "unspoiled",
|
"type": "unspoiled",
|
||||||
"position": {
|
"position": {
|
||||||
"zone": "kozamauka",
|
"zone": "kozamauka",
|
||||||
|
|||||||
+1
-1
@@ -91,7 +91,7 @@ export default defineComponent({
|
|||||||
this.eorzeaTime = new EorzeaTime();
|
this.eorzeaTime = new EorzeaTime();
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
this.eorzeaTime = new EorzeaTime();
|
this.eorzeaTime = new EorzeaTime();
|
||||||
}, 500);
|
}, 1000);
|
||||||
|
|
||||||
const itemData: Response | null = await fetch("/data/items.json")
|
const itemData: Response | null = await fetch("/data/items.json")
|
||||||
.catch((): null => {
|
.catch((): null => {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
>
|
>
|
||||||
<div class="timer">
|
<div class="timer">
|
||||||
{{
|
{{
|
||||||
prettyTimer(gatheringNode.getSecondsToNextActiveTime(eorzeaTime))
|
prettyTimer(secondsToNextActiveTime)
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
Active
|
Active
|
||||||
<div class="countdown">
|
<div class="countdown">
|
||||||
{{
|
{{
|
||||||
prettyTimer(gatheringNode.getSecondsToNextInactiveTime(eorzeaTime))
|
prettyTimer(secondsToNextInactiveTime)
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -69,6 +69,12 @@ import Zone from "@/entities/Zone";
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "GatheringNode",
|
name: "GatheringNode",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
secondsToNextInactiveTime: 0 as number,
|
||||||
|
secondsToNextActiveTime: 0 as number,
|
||||||
|
};
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
gatheringNode: {
|
gatheringNode: {
|
||||||
type: Object as PropType<Node>,
|
type: Object as PropType<Node>,
|
||||||
@@ -83,13 +89,27 @@ export default defineComponent({
|
|||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
eorzeaTime: {
|
||||||
|
handler() {
|
||||||
|
this.calculateTimers()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
prettyTimer(seconds: number): string {
|
prettyTimer(seconds: number): string {
|
||||||
const minutes = Math.floor(seconds / 60);
|
const minutes = Math.floor(seconds / 60);
|
||||||
const remainingSeconds = seconds % 60;
|
const remainingSeconds = seconds % 60;
|
||||||
return `${minutes}:${remainingSeconds < 10 ? '0' : ''}${remainingSeconds}`;
|
return `${minutes}:${remainingSeconds < 10 ? '0' : ''}${remainingSeconds}`;
|
||||||
|
},
|
||||||
|
calculateTimers() {
|
||||||
|
this.secondsToNextInactiveTime = this.gatheringNode.getSecondsToNextInactiveTime(this.eorzeaTime);
|
||||||
|
this.secondsToNextActiveTime = this.gatheringNode.getSecondsToNextActiveTime(this.eorzeaTime);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.calculateTimers();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -49,9 +49,7 @@ export default defineComponent(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
eorzeaTime: {
|
eorzeaTime: {
|
||||||
handler(newValue, oldValue) {
|
handler() {
|
||||||
if (oldValue === undefined) return;
|
|
||||||
if (newValue?.getMinutes() === oldValue?.getMinutes()) return;
|
|
||||||
this.sortListByTime();
|
this.sortListByTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export default class TimeRange {
|
|||||||
public isWithinTimeFrame(hour: number, minute: number): boolean {
|
public isWithinTimeFrame(hour: number, minute: number): boolean {
|
||||||
return (
|
return (
|
||||||
this.from[0] < hour || this.from[0] == hour && this.from[1] <= minute)
|
this.from[0] < hour || this.from[0] == hour && this.from[1] <= minute)
|
||||||
&& (hour < this.to[0] || hour == this.to[0] && minute <= this.to[1]
|
&& (hour < this.to[0] || hour == this.to[0] && minute < this.to[1]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user