event sending to unity
This commit is contained in:
@@ -4,8 +4,7 @@ import { useEffect } from "react";
|
||||
import { Outlet, useParams } from "react-router-dom";
|
||||
import useStore from "../store/store";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
const languages = ["ar", "en"];
|
||||
import { languages } from "../consts/languages";
|
||||
|
||||
const Layout = () => {
|
||||
const { loader, setOnFullscreen, modal, hintModal } = useStore();
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export const languages = ["ar", "en"];
|
||||
@@ -9,6 +9,7 @@ import { useUnity } from "../../hooks/useUnity";
|
||||
import { useVilla } from "../../hooks/useVilla";
|
||||
import ViewToggle from "../../components/ViewToggle";
|
||||
import ParameterDescription from "../../components/desktop/Appartment/ParameterDescription";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
const DesktopApartmentPage = () => {
|
||||
const {
|
||||
@@ -21,7 +22,7 @@ const DesktopApartmentPage = () => {
|
||||
} = useStore();
|
||||
|
||||
const { villa } = useVilla();
|
||||
|
||||
const [, i18n] = useTranslation();
|
||||
const { unityProvider, sendMessage, addEventListener, removeEventListener } =
|
||||
useUnity();
|
||||
|
||||
@@ -77,7 +78,8 @@ const DesktopApartmentPage = () => {
|
||||
|
||||
if (isContainerLoaded) {
|
||||
sendMessage("JsConnector", "SetCurrentVilla", villa.type);
|
||||
sendMessage("JsConnector", "SeCurrentLang", "en");
|
||||
const { language } = i18n;
|
||||
sendMessage("JsConnector", "SeCurrentLang", language);
|
||||
}
|
||||
}, [isContainerLoaded]);
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ import ButtonPanel from "../../components/mobile/Appartment/ButtonPanel";
|
||||
import { useUnity } from "../../hooks/useUnity";
|
||||
import { useVilla } from "../../hooks/useVilla";
|
||||
import ButtomPanelModal from "../../components/mobile/Appartment/ButtomPanelModal";
|
||||
|
||||
import NotSupportModal from "../../components/NotSupportModal";
|
||||
import PopupModal from "../../components/mobile/Appartment/PopupModal";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
const MobileApartmentPage = () => {
|
||||
const {
|
||||
@@ -29,6 +29,7 @@ const MobileApartmentPage = () => {
|
||||
useUnity();
|
||||
const [isContainerLoaded, setIsContainerLoaded] = useState(false);
|
||||
const isDeviceSupported = (+osVersion.split(".")[0] >= 17 && isIOS) || !isIOS;
|
||||
const [, i18n] = useTranslation();
|
||||
|
||||
const handleVillaLoadedStatus = (percent: ReactUnityEventParameter) => {
|
||||
const status = Number(percent);
|
||||
@@ -97,7 +98,8 @@ const MobileApartmentPage = () => {
|
||||
setSendMessageToUnity(sendMessage);
|
||||
if (isContainerLoaded) {
|
||||
sendMessage("JsConnector", "SetCurrentVilla", villa.type);
|
||||
sendMessage("JsConnector", "SeCurrentLang", "en");
|
||||
const { language } = i18n;
|
||||
sendMessage("JsConnector", "SeCurrentLang", language);
|
||||
}
|
||||
}, [isContainerLoaded]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user