文字フォントとワンマン対応改造
This commit is contained in:
parent
e29b4f5da3
commit
d9fb24840a
BIN
assets/fonts/DelaGothicOne-Regular.ttf
Normal file
BIN
assets/fonts/DelaGothicOne-Regular.ttf
Normal file
Binary file not shown.
BIN
assets/fonts/西日本方向幕ロゴ.otf
Normal file
BIN
assets/fonts/西日本方向幕ロゴ.otf
Normal file
Binary file not shown.
@ -6,6 +6,7 @@ import { getType } from "../../../lib/eachTrainInfoCoreLib/getType";
|
|||||||
import { migrateTrainName } from "../../../lib/eachTrainInfoCoreLib/migrateTrainName";
|
import { migrateTrainName } from "../../../lib/eachTrainInfoCoreLib/migrateTrainName";
|
||||||
import { TrainIconStatus } from "./trainIconStatus";
|
import { TrainIconStatus } from "./trainIconStatus";
|
||||||
import { TrainViewIcon } from "./trainViewIcon";
|
import { TrainViewIcon } from "./trainViewIcon";
|
||||||
|
import { useFonts } from "expo-font";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
data: { trainNum: string; limited: string };
|
data: { trainNum: string; limited: string };
|
||||||
@ -34,6 +35,10 @@ export const HeaderText: FC<Props> = ({
|
|||||||
navigate,
|
navigate,
|
||||||
from,
|
from,
|
||||||
}) => {
|
}) => {
|
||||||
|
const [loaded, error] = useFonts({
|
||||||
|
"JR-Nishi": require("../../../assets/fonts/西日本方向幕ロゴ.otf"),
|
||||||
|
"Zou": require("../../../assets/fonts/DelaGothicOne-Regular.ttf"),
|
||||||
|
});
|
||||||
const [typeName, trainName] = useMemo(() => {
|
const [typeName, trainName] = useMemo(() => {
|
||||||
if (!data.limited) return "";
|
if (!data.limited) return "";
|
||||||
const limitedArray = data.limited.split(":");
|
const limitedArray = data.limited.split(":");
|
||||||
@ -59,10 +64,111 @@ export const HeaderText: FC<Props> = ({
|
|||||||
return (
|
return (
|
||||||
<View style={{ padding: 10, flexDirection: "row", alignItems: "center" }}>
|
<View style={{ padding: 10, flexDirection: "row", alignItems: "center" }}>
|
||||||
<TrainIconStatus {...{ data, navigate, from }} />
|
<TrainIconStatus {...{ data, navigate, from }} />
|
||||||
<Text style={textConfig}>
|
<View
|
||||||
{typeName}{" "}
|
style={{
|
||||||
|
//backgroundColor: "rgb(69, 69, 69)",
|
||||||
|
borderRadius: 5,
|
||||||
|
//borderWidth: 1,
|
||||||
|
flexDirection: "row",
|
||||||
|
alignItems: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{loaded ? (
|
||||||
|
<>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 20,
|
||||||
|
fontFamily: "JR-Nishi",
|
||||||
|
textShadowColor: "white",
|
||||||
|
textShadowOffset: { width: 0, height: 0 },
|
||||||
|
textShadowRadius: 0,
|
||||||
|
//margin: 2,
|
||||||
|
marginRight: 5,
|
||||||
|
//backgroundColor: "rgb(69, 69, 69)",
|
||||||
|
color: "white",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{(() => {
|
||||||
|
if (typeName) return typeName;
|
||||||
|
switch (true) {
|
||||||
|
case !!data.trainNum.match("T"):
|
||||||
|
case !!data.trainNum.match("R"):
|
||||||
|
case !!data.trainNum.match("E"):
|
||||||
|
case !!data.trainNum.match("L"):
|
||||||
|
case !!data.trainNum.match("A"):
|
||||||
|
case !!data.trainNum.match("B"):
|
||||||
|
return "回送";
|
||||||
|
case !!data.trainNum.match("D"):
|
||||||
|
case !!data.trainNum.match("M"):
|
||||||
|
return "普通";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
})()}
|
||||||
|
</Text>
|
||||||
|
{new RegExp(/^4[1-9]\d\d[DM]$/).test(data.trainNum) || new RegExp(/^5[1-7]\d\d[DM]$/).test(data.trainNum) || data.trainNum ==="3621D" ?
|
||||||
|
|
||||||
|
<View style={{ flexDirection: "column", marginRight: 7 }}>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 12,
|
||||||
|
textShadowColor: "white",
|
||||||
|
textShadowOffset: { width: 0, height: 0 },
|
||||||
|
textShadowRadius: 0,
|
||||||
|
margin: -2,
|
||||||
|
marginRight: 5,
|
||||||
|
color: "white",
|
||||||
|
fontFamily: "Zou",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
ワン
|
||||||
|
</Text>
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 12,
|
||||||
|
textShadowColor: "white",
|
||||||
|
textShadowOffset: { width: 0, height: 0 },
|
||||||
|
textShadowRadius: 0,
|
||||||
|
margin: -2,
|
||||||
|
color: "white",
|
||||||
|
fontFamily: "Zou",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{" "}マン
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
: null}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<Text style={textConfig}>{typeName}</Text>
|
||||||
|
)}
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
fontSize: 18,
|
||||||
|
textShadowColor: "white",
|
||||||
|
textShadowOffset: { width: 0, height: 0 },
|
||||||
|
textShadowRadius: 0,
|
||||||
|
//borderWidth: 1,
|
||||||
|
//borderColor: "white",
|
||||||
|
fontWeight: "bold",
|
||||||
|
//fontStyle: "italic",
|
||||||
|
// color: (() => {
|
||||||
|
// switch (typeName) {
|
||||||
|
// case "快速":
|
||||||
|
// return "rgb(7, 124, 192)";
|
||||||
|
// case "特急":
|
||||||
|
// return "rgb(211, 13, 6)";
|
||||||
|
// default:
|
||||||
|
// return "white";
|
||||||
|
// }
|
||||||
|
// })(),
|
||||||
|
color: "white",
|
||||||
|
}}
|
||||||
|
>
|
||||||
{trainName}
|
{trainName}
|
||||||
</Text>
|
</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
<Text style={textConfig}>
|
<Text style={textConfig}>
|
||||||
{showHeadStation.map((d) => `${headStation[d].id} + `)}
|
{showHeadStation.map((d) => `${headStation[d].id} + `)}
|
||||||
|
@ -692,6 +692,20 @@ export const customTrainDataDetector = (TrainNumber: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if (
|
||||||
|
new RegExp(/^4[1-9]\d\d[DM]$/).test(TrainNumber) ||
|
||||||
|
new RegExp(/^5[1-7]\d\d[DM]$/).test(TrainNumber) ||
|
||||||
|
TrainNumber === "3621D"
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
type: "OneMan",
|
||||||
|
trainName: "",
|
||||||
|
trainIcon: null,
|
||||||
|
infoUrl: null,
|
||||||
|
trainNumDistance: null,
|
||||||
|
info: null,
|
||||||
|
};
|
||||||
|
else
|
||||||
return {
|
return {
|
||||||
type: "Normal",
|
type: "Normal",
|
||||||
trainName: "",
|
trainName: "",
|
||||||
|
@ -73,7 +73,9 @@ export const EachData: FC<Props> = (props) => {
|
|||||||
|
|
||||||
const getTrainDataFromCurrentTrain = (trainNum: string) => {
|
const getTrainDataFromCurrentTrain = (trainNum: string) => {
|
||||||
const customTrainData = customTrainDataDetector(d.train);
|
const customTrainData = customTrainDataDetector(d.train);
|
||||||
if (customTrainData.type != "Normal") return customTrainData;
|
switch (customTrainData.type) {
|
||||||
|
case "Normal":
|
||||||
|
case "OneMan":
|
||||||
const currentTrainData = currentTrain.filter((a) => a.num == trainNum);
|
const currentTrainData = currentTrain.filter((a) => a.num == trainNum);
|
||||||
if (currentTrainData.length == 0) return customTrainData;
|
if (currentTrainData.length == 0) return customTrainData;
|
||||||
else if (currentTrainData[0].Type.includes("rapid:")) {
|
else if (currentTrainData[0].Type.includes("rapid:")) {
|
||||||
@ -88,8 +90,10 @@ export const EachData: FC<Props> = (props) => {
|
|||||||
return returnData;
|
return returnData;
|
||||||
}
|
}
|
||||||
return customTrainData;
|
return customTrainData;
|
||||||
|
default:
|
||||||
|
return customTrainData;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const [train, setTrain] = useState(getTrainDataFromCurrentTrain(d.train));
|
const [train, setTrain] = useState(getTrainDataFromCurrentTrain(d.train));
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setTrain(getTrainDataFromCurrentTrain(d.train));
|
setTrain(getTrainDataFromCurrentTrain(d.train));
|
||||||
|
6
howto.js
6
howto.js
@ -2,11 +2,17 @@ import React from "react";
|
|||||||
import { View } from "react-native";
|
import { View } from "react-native";
|
||||||
import { WebView } from "react-native-webview";
|
import { WebView } from "react-native-webview";
|
||||||
import { BigButton } from "./components/atom/BigButton";
|
import { BigButton } from "./components/atom/BigButton";
|
||||||
|
import { useNavigation } from "@react-navigation/native";
|
||||||
export default ({ navigation: { navigate }, route }) => {
|
export default ({ navigation: { navigate }, route }) => {
|
||||||
const { info, goTo, useShow } = route.params;
|
const { info, goTo, useShow } = route.params;
|
||||||
|
const { goBack } = useNavigation();
|
||||||
const onExit = () => {
|
const onExit = () => {
|
||||||
|
if(goTo != "NearTrainDiagramView") {
|
||||||
navigate(goTo || "Apps");
|
navigate(goTo || "Apps");
|
||||||
useShow && useShow();
|
useShow && useShow();
|
||||||
|
} else {
|
||||||
|
goBack();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<View style={styles}>
|
<View style={styles}>
|
||||||
|
@ -12,6 +12,7 @@ type trainTypeString =
|
|||||||
| "寝台特急"
|
| "寝台特急"
|
||||||
| "臨時"
|
| "臨時"
|
||||||
| "普通列車"
|
| "普通列車"
|
||||||
|
| "普通列車(ワンマン)"
|
||||||
| "その他";
|
| "その他";
|
||||||
type trainTypeDataString = "rapid" | "express" | "normal";
|
type trainTypeDataString = "rapid" | "express" | "normal";
|
||||||
type getTrainType = (d: nameString) => {
|
type getTrainType = (d: nameString) => {
|
||||||
@ -29,6 +30,8 @@ export const getTrainType: getTrainType = (nameString) => {
|
|||||||
return { color: "red", name: "寝台特急", data: "express" };
|
return { color: "red", name: "寝台特急", data: "express" };
|
||||||
case "SPCL":
|
case "SPCL":
|
||||||
return { color: "blue", name: "臨時", data: "normal" };
|
return { color: "blue", name: "臨時", data: "normal" };
|
||||||
|
case "OneMan":
|
||||||
|
return { color: "white", name: "普通列車(ワンマン)", data: "normal" };
|
||||||
case "Normal":
|
case "Normal":
|
||||||
return { color: "white", name: "普通列車", data: "normal" };
|
return { color: "white", name: "普通列車", data: "normal" };
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user