使用 pandoc 从 .md 转换为 .tex 后 Latex 不工作

问题描述 投票:0回答:1

我一直在 .md 文件中编写我的文档,因为它比在 Latex 中编写更舒适、更容易。一旦我将 ReadMe.md 转换为 documentation.tex,我的乳胶文件就无法运行。你有什么办法可以帮助我。我会为您提供转换后的代码。

希望它现在是最小的可重现示例。 我使用带有代码的终端:pandoc file.md -o file.tex 我也加了。

我的.tex

\documentclass{article}
\usepackage{hyperref}
\usepackage{framed}

\begin{document}
\hypertarget{adam-melnicak}{%
\section{Adam Melnicak}\label{adam-melnicak}}

\hypertarget{travelhelper}{%
\section{Travelhelper}\label{travelhelper}}

\hypertarget{application-description}{%
\subsection{Application description}\label{application-description}}

Travelhelper, your ultimate application for room-booking. Rather than
spending a lot of time on unclear booking us come to room-booking app
and find the best accommodation for you.

\hypertarget{how-does-it-work}{%
\subsection{How does it work}\label{how-does-it-work}}

In the beginning you can see loginning in scene, where user can choose
if he wants to directly log in or register before loginning in, if he is
not yet. Then the main menu shows to the user after successfull
loginning in the app. The user can see 4 buttons there: Info, Booking,
Profile, Log out. After pressing Info button another scene with
informations about the application shows up to the user with our app
logo. After pressing booking button easy user interface is shown where
user can choose room type and depending on the chosen type of the room
(Standard room, Luxury room or Suite room) price of the accommodation is
shown.

\hypertarget{what-i-will-add}{%
\subsection{What I will add}\label{what-i-will-add}}

I'm planning to add Profile scene where informations about the user are
shown and he can change his password and so on\ldots{}


\hypertarget{classes-and-methods}{%
\section{Classes and methods}\label{classes-and-methods}}

\hypertarget{main}{%
\subsection{Main}\label{main}}

This code runs the application

\begin{Shaded}
\begin{Highlighting}[]
    \KeywordTok{public} \DataTypeTok{static} \DataTypeTok{void} \FunctionTok{main}\OperatorTok{(}\BuiltInTok{String}\OperatorTok{[]}\NormalTok{ args}\OperatorTok{)} \OperatorTok{\{}
        \FunctionTok{launch}\OperatorTok{(}\NormalTok{args}\OperatorTok{);}
    \OperatorTok{\}}    
\end{Highlighting}
\end{Shaded}

Also, there is one method which loads.fxml, scene responsible for
loginning in the application and other functionalities such as setting
the title to the Login form, width and height of the scene and loading
the scene.

\hypertarget{maincontroller}{%
\subsection{MainController}\label{maincontroller}}

There are three methods such as switchToInfoScene, switchToRoomsScene,
switchToProfileScene and method responsible for handling log out button.

\begin{Shaded}
\begin{Highlighting}[]
    \KeywordTok{public} \DataTypeTok{void} \FunctionTok{logout}\OperatorTok{(}\BuiltInTok{ActionEvent}\NormalTok{ event}\OperatorTok{)} \OperatorTok{\{}

\NormalTok{        Alert alert }\OperatorTok{=} \KeywordTok{new} \FunctionTok{Alert}\OperatorTok{(}\NormalTok{Alert}\OperatorTok{.}\FunctionTok{AlertType}\OperatorTok{.}\FunctionTok{CONFIRMATION}\OperatorTok{);}
\NormalTok{        alert}\OperatorTok{.}\FunctionTok{setTitle}\OperatorTok{(}\StringTok{"Logout"}\OperatorTok{);}
\NormalTok{        alert}\OperatorTok{.}\FunctionTok{setHeaderText}\OperatorTok{(}\StringTok{"You\textquotesingle{}re about to logout"}\OperatorTok{);}
\NormalTok{        alert}\OperatorTok{.}\FunctionTok{setContentText}\OperatorTok{(}\StringTok{"Do you really want to quit? "}\OperatorTok{);}

        \ControlFlowTok{if} \OperatorTok{(}\NormalTok{alert}\OperatorTok{.}\FunctionTok{showAndWait}\OperatorTok{().}\FunctionTok{get}\OperatorTok{()} \OperatorTok{==}\NormalTok{ ButtonType}\OperatorTok{.}\FunctionTok{OK}\OperatorTok{)} \OperatorTok{\{}
\NormalTok{            stage }\OperatorTok{=} \OperatorTok{(}\NormalTok{Stage}\OperatorTok{)}\NormalTok{ scenePane}\OperatorTok{.}\FunctionTok{getScene}\OperatorTok{().}\FunctionTok{getWindow}\OperatorTok{();}
            \BuiltInTok{System}\OperatorTok{.}\FunctionTok{out}\OperatorTok{.}\FunctionTok{println}\OperatorTok{(}\StringTok{"You successfully logged out"}\OperatorTok{);}
\NormalTok{            stage}\OperatorTok{.}\FunctionTok{close}\OperatorTok{();}
        \OperatorTok{\}}
    \OperatorTok{\}}
\end{Highlighting}
\end{Shaded}

We set the title to ``Logout'', header to the: ``You're about to
logout'' and content text to: ``Do you really want to quit?''

If the log out button is pressed user can click ``Cancel'' button he
returns back to the main menu, but if he clicks ``OK'' the application
will close.

\begin{Shaded}
\begin{Highlighting}[]
  \ControlFlowTok{if} \OperatorTok{(}\NormalTok{alert}\OperatorTok{.}\FunctionTok{showAndWait}\OperatorTok{().}\FunctionTok{get}\OperatorTok{()} \OperatorTok{==}\NormalTok{ ButtonType}\OperatorTok{.}\FunctionTok{OK}\OperatorTok{)} \OperatorTok{\{}\KeywordTok{...}\OperatorTok{\}}
\end{Highlighting}
\end{Shaded}

This is the check for OK button, so it closes after clicking it.

\hypertarget{logincontroller}{%
\subsection{LoginController}\label{logincontroller}}

In this class is another method called handleLoginButtonAction, which
gets username and password of the user. If user is not null and users
password is right then main scene is loaded. Icon of the application is
our logo, which is shown in the beginning of the documentation and title
is the name of our app. If the mentioned conditions are not followed
then error is thrown with the title set to: ``Login Failed'' and context
is set to: ``Incorrect username or password. Please try again.'' and
waits until users decision.

\hypertarget{registercontroller}{%
\subsection{RegisterController}\label{registercontroller}}

In this class is method called handeRegisterButtonAction, where user can
set the name, username and password.

\begin{Shaded}
\begin{Highlighting}[]
  \ControlFlowTok{if} \OperatorTok{(}\NormalTok{username}\OperatorTok{.}\FunctionTok{isEmpty}\OperatorTok{()} \OperatorTok{||}\NormalTok{ password}\OperatorTok{.}\FunctionTok{isEmpty}\OperatorTok{()} \OperatorTok{||}\NormalTok{ name}\OperatorTok{.}\FunctionTok{isEmpty}\OperatorTok{())} \OperatorTok{\{}\KeywordTok{...}\OperatorTok{\}}
\end{Highlighting}
\end{Shaded}

if either one of the fields is not fieled then it's going to throw an
error.

\begin{Shaded}
\begin{Highlighting}[]
  \ControlFlowTok{if} \OperatorTok{(}\NormalTok{LoginController}\OperatorTok{.}\FunctionTok{registeredUsers}\OperatorTok{.}\FunctionTok{containsKey}\OperatorTok{(}\NormalTok{username}\OperatorTok{))} \OperatorTok{\{}\KeywordTok{...}\OperatorTok{\}}
\end{Highlighting}
\end{Shaded}

This line of code checks that if the other user does not already use
this username.

If everything is OK, then new user is created and it sets the titel to:
``Registration is successful'' and writes out: ``You have successfully
registered. You can now log in.'' And also it opens login form.

\hypertarget{infocontroller-and-profilecontroller}{%
\subsection{InfoController and
ProfileController}\label{infocontroller-and-profilecontroller}}

Both of those classes include switchToMainScene, which are responsible
for switching to main menu after clicking ``back to menu'' button. In
the InfoController there are informations about my game.

\hypertarget{room-class-and-iherited-subclasses-polymorphism-is-included-there-as-well}{%
\subsection{Room class and iherited subclasses (polymorphism is included
there as
well)}\label{room-class-and-iherited-subclasses-polymorphism-is-included-there-as-well}}

In the room class I created constructor and two methods: getPrice() and
getType() method, which are overriden in those three inherited classes:
standard room, luxury room and suite room.

\hypertarget{roomscontroller}{%
\subsection{RoomsController}\label{roomscontroller}}

In this class we are handling mentioned classes depending on the chosen
room type.

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{  priceLabel}\OperatorTok{.}\FunctionTok{setText}\OperatorTok{(}\BuiltInTok{String}\OperatorTok{.}\FunctionTok{format}\OperatorTok{(}\StringTok{"}\SpecialCharTok{\%.2f}\StringTok{"}\OperatorTok{,}\NormalTok{ room}\OperatorTok{.}\FunctionTok{getPrice}\OperatorTok{())} \OperatorTok{+} \StringTok{" €"}\OperatorTok{);}
\end{Highlighting}
\end{Shaded}

This line of code is responsible for calculating the price for selected
room type and printining it out in this scene.

\hypertarget{table-of-contents}{%
\subsection{Table of Contents}\label{table-of-contents}}

\end{document}

我的.md

## Table of Contents

* [Project documentation](Documentation/000_project_documentation)
  * [JavaDoc documentation](Documentation/000_project_documentation)
* [UML diagrams](Documentation/001_uml_diagrams)
* [Versions](Documentation/002_versions)
* [Technical details](Documentation/003_tech_details)
* [Simulation and demonstration](Documentation/004_simulation_and_demonstration)  
  * [Video demonstration](Documentation/004_simulation_and_demonstration)


# Travelhelper 

## Application description

Travelhelper, your ultimate application for room-booking. Rather than spending a lot of time on unclear booking us come to room-booking app and find the best accommodation for you.

## How does it work

In the beginning you can see loginning in scene, where user can choose if he wants to directly log in or register before loginning in, if he is not yet. Then the main menu shows to the user after successfull loginning in the app. The user can see 4 buttons there: Info, Booking, Profile, Log out. After pressing Info button another scene with informations about the application shows up to the user with our app logo. After pressing booking button easy user interface is shown where user can choose room type and depending on the chosen type of the room (Standard room, Luxury room or Suite room) price of the accommodation is shown. 

## What I will add 

I'm planning to add Profile scene where informations about the user are shown and he can change his password and so on...

# Classes and methods 

## Main 

This code runs the application
```java
    public static void main(String[] args) {
        launch(args);
    }    
```

Also, there is one method which loads.fxml, scene responsible for loginning in the application and other functionalities such as setting the title to the Login form, width and height of the scene and loading the scene. 

## MainController

There are three methods such as switchToInfoScene, switchToRoomsScene, switchToProfileScene and method responsible for handling log out button. 

```java
    public void logout(ActionEvent event) {

        Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
        alert.setTitle("Logout");
        alert.setHeaderText("You're about to logout");
        alert.setContentText("Do you really want to quit? ");

        if (alert.showAndWait().get() == ButtonType.OK) {
            stage = (Stage) scenePane.getScene().getWindow();
            System.out.println("You successfully logged out");
            stage.close();
        }
    }
```

We set the title to "Logout", header to the: "You're about to logout" and content text to: "Do you really want to quit?"

If the log out button is pressed user can click "Cancel" button he returns back to the main menu, but if he clicks "OK" the application will close. 

```java
  if (alert.showAndWait().get() == ButtonType.OK) {...}
```

This is the check for OK button, so it closes after clicking it.

## LoginController

In this class is another method called handleLoginButtonAction, which gets username and password of the user. If user is not null and users password is right then main scene is loaded. Icon of the application is our logo, which is shown in the beginning of the documentation and title is the name of our app. If the mentioned conditions are not followed then error is thrown with the title set to: "Login Failed" and context is set to: "Incorrect username or password. Please try again." and waits until users decision.


## RegisterController

In this class is method called handeRegisterButtonAction, where user can set the name, username and password. 

```java
  if (username.isEmpty() || password.isEmpty() || name.isEmpty()) {...}
```

if either one of the fields is not fieled then it's going to throw an error.

```java
  if (LoginController.registeredUsers.containsKey(username)) {...}
```

This line of code checks that if the other user does not already use this username. 

If everything is OK, then new user is created and it sets the titel to: "Registration is successful" and writes out: "You have successfully registered. You can now log in." And also it opens login form.

## InfoController and ProfileController

Both of those classes include switchToMainScene, which are responsible for switching to main menu after clicking "back to menu" button. In the InfoController there are informations about my game.

## Room class and iherited subclasses (polymorphism is included there as well)

In the room class I created constructor and two methods: getPrice() and getType() method, which are overriden in those three inherited classes: standard room, luxury room and suite room. 

## RoomsController

In this class we are handling mentioned classes depending on the chosen room type. 

```java
  priceLabel.setText(String.format("%.2f", room.getPrice()) + " €");
```

This line of code is responsible for calculating the price for selected room type and printining it out in this scene.
pdf latex pdflatex miktex
1个回答
0
投票

使用

pandoc file.md -o file.tex 
,您只需生成文档正文。它缺少 tex 文件所需的大量软件包和特殊定义 pandoc。

您可以使用

-s
选项生成独立文档:

pandoc file.md -s -o file.tex 

这将导致

% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{amsmath,amssymb}
\usepackage{iftex}
\ifPDFTeX
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math} % this also loads fontspec
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\usepackage{lmodern}
\ifPDFTeX\else
  % xetex/luatex font selection
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\newenvironment{Shaded}{}{}
\newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{#1}}}
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}}
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{#1}}
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}}
\newcommand{\BuiltInTok}[1]{\textcolor[rgb]{0.00,0.50,0.00}{#1}}
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}}
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{#1}}}
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}}
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{#1}}
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}}
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{#1}}
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}}
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{#1}}}
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{#1}}}
\newcommand{\ExtensionTok}[1]{#1}
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}}
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{#1}}
\newcommand{\ImportTok}[1]{\textcolor[rgb]{0.00,0.50,0.00}{\textbf{#1}}}
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}}
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}}
\newcommand{\NormalTok}[1]{#1}
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{#1}}
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{#1}}
\newcommand{\RegionMarkerTok}[1]{#1}
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}}
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{#1}}
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}}
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}}
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}}
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\ifLuaTeX
  \usepackage{selnolig}  % disable illegal ligatures
\fi
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same}
\hypersetup{
  hidelinks,
  pdfcreator={LaTeX via pandoc}}

\author{}
\date{}

\begin{document}

\hypertarget{table-of-contents}{%
\subsection{Table of Contents}\label{table-of-contents}}

\begin{itemize}
\tightlist
\item
  \href{Documentation/000_project_documentation}{Project documentation}

  \begin{itemize}
  \tightlist
  \item
    \href{Documentation/000_project_documentation}{JavaDoc
    documentation}
  \end{itemize}
\item
  \href{Documentation/001_uml_diagrams}{UML diagrams}
\item
  \href{Documentation/002_versions}{Versions}
\item
  \href{Documentation/003_tech_details}{Technical details}
\item
  \href{Documentation/004_simulation_and_demonstration}{Simulation and
  demonstration}

  \begin{itemize}
  \tightlist
  \item
    \href{Documentation/004_simulation_and_demonstration}{Video
    demonstration}
  \end{itemize}
\end{itemize}

\hypertarget{travelhelper}{%
\section{Travelhelper}\label{travelhelper}}

\hypertarget{application-description}{%
\subsection{Application description}\label{application-description}}

Travelhelper, your ultimate application for room-booking. Rather than
spending a lot of time on unclear booking us come to room-booking app
and find the best accommodation for you.

\hypertarget{how-does-it-work}{%
\subsection{How does it work}\label{how-does-it-work}}

In the beginning you can see loginning in scene, where user can choose
if he wants to directly log in or register before loginning in, if he is
not yet. Then the main menu shows to the user after successfull
loginning in the app. The user can see 4 buttons there: Info, Booking,
Profile, Log out. After pressing Info button another scene with
informations about the application shows up to the user with our app
logo. After pressing booking button easy user interface is shown where
user can choose room type and depending on the chosen type of the room
(Standard room, Luxury room or Suite room) price of the accommodation is
shown.

\hypertarget{what-i-will-add}{%
\subsection{What I will add}\label{what-i-will-add}}

I'm planning to add Profile scene where informations about the user are
shown and he can change his password and so on\ldots{}

\hypertarget{classes-and-methods}{%
\section{Classes and methods}\label{classes-and-methods}}

\hypertarget{main}{%
\subsection{Main}\label{main}}

This code runs the application

\begin{Shaded}
\begin{Highlighting}[]
    \KeywordTok{public} \DataTypeTok{static} \DataTypeTok{void} \FunctionTok{main}\OperatorTok{(}\BuiltInTok{String}\OperatorTok{[]}\NormalTok{ args}\OperatorTok{)} \OperatorTok{\{}
        \FunctionTok{launch}\OperatorTok{(}\NormalTok{args}\OperatorTok{);}
    \OperatorTok{\}}    
\end{Highlighting}
\end{Shaded}

Also, there is one method which loads.fxml, scene responsible for
loginning in the application and other functionalities such as setting
the title to the Login form, width and height of the scene and loading
the scene.

\hypertarget{maincontroller}{%
\subsection{MainController}\label{maincontroller}}

There are three methods such as switchToInfoScene, switchToRoomsScene,
switchToProfileScene and method responsible for handling log out button.

\begin{Shaded}
\begin{Highlighting}[]
    \KeywordTok{public} \DataTypeTok{void} \FunctionTok{logout}\OperatorTok{(}\BuiltInTok{ActionEvent}\NormalTok{ event}\OperatorTok{)} \OperatorTok{\{}

\NormalTok{        Alert alert }\OperatorTok{=} \KeywordTok{new} \FunctionTok{Alert}\OperatorTok{(}\NormalTok{Alert}\OperatorTok{.}\FunctionTok{AlertType}\OperatorTok{.}\FunctionTok{CONFIRMATION}\OperatorTok{);}
\NormalTok{        alert}\OperatorTok{.}\FunctionTok{setTitle}\OperatorTok{(}\StringTok{"Logout"}\OperatorTok{);}
\NormalTok{        alert}\OperatorTok{.}\FunctionTok{setHeaderText}\OperatorTok{(}\StringTok{"You\textquotesingle{}re about to logout"}\OperatorTok{);}
\NormalTok{        alert}\OperatorTok{.}\FunctionTok{setContentText}\OperatorTok{(}\StringTok{"Do you really want to quit? "}\OperatorTok{);}

        \ControlFlowTok{if} \OperatorTok{(}\NormalTok{alert}\OperatorTok{.}\FunctionTok{showAndWait}\OperatorTok{().}\FunctionTok{get}\OperatorTok{()} \OperatorTok{==}\NormalTok{ ButtonType}\OperatorTok{.}\FunctionTok{OK}\OperatorTok{)} \OperatorTok{\{}
\NormalTok{            stage }\OperatorTok{=} \OperatorTok{(}\NormalTok{Stage}\OperatorTok{)}\NormalTok{ scenePane}\OperatorTok{.}\FunctionTok{getScene}\OperatorTok{().}\FunctionTok{getWindow}\OperatorTok{();}
            \BuiltInTok{System}\OperatorTok{.}\FunctionTok{out}\OperatorTok{.}\FunctionTok{println}\OperatorTok{(}\StringTok{"You successfully logged out"}\OperatorTok{);}
\NormalTok{            stage}\OperatorTok{.}\FunctionTok{close}\OperatorTok{();}
        \OperatorTok{\}}
    \OperatorTok{\}}
\end{Highlighting}
\end{Shaded}

We set the title to ``Logout'', header to the: ``You're about to
logout'' and content text to: ``Do you really want to quit?''

If the log out button is pressed user can click ``Cancel'' button he
returns back to the main menu, but if he clicks ``OK'' the application
will close.

\begin{Shaded}
\begin{Highlighting}[]
  \ControlFlowTok{if} \OperatorTok{(}\NormalTok{alert}\OperatorTok{.}\FunctionTok{showAndWait}\OperatorTok{().}\FunctionTok{get}\OperatorTok{()} \OperatorTok{==}\NormalTok{ ButtonType}\OperatorTok{.}\FunctionTok{OK}\OperatorTok{)} \OperatorTok{\{}\KeywordTok{...}\OperatorTok{\}}
\end{Highlighting}
\end{Shaded}

This is the check for OK button, so it closes after clicking it.

\hypertarget{logincontroller}{%
\subsection{LoginController}\label{logincontroller}}

In this class is another method called handleLoginButtonAction, which
gets username and password of the user. If user is not null and users
password is right then main scene is loaded. Icon of the application is
our logo, which is shown in the beginning of the documentation and title
is the name of our app. If the mentioned conditions are not followed
then error is thrown with the title set to: ``Login Failed'' and context
is set to: ``Incorrect username or password. Please try again.'' and
waits until users decision.

\hypertarget{registercontroller}{%
\subsection{RegisterController}\label{registercontroller}}

In this class is method called handeRegisterButtonAction, where user can
set the name, username and password.

\begin{Shaded}
\begin{Highlighting}[]
  \ControlFlowTok{if} \OperatorTok{(}\NormalTok{username}\OperatorTok{.}\FunctionTok{isEmpty}\OperatorTok{()} \OperatorTok{||}\NormalTok{ password}\OperatorTok{.}\FunctionTok{isEmpty}\OperatorTok{()} \OperatorTok{||}\NormalTok{ name}\OperatorTok{.}\FunctionTok{isEmpty}\OperatorTok{())} \OperatorTok{\{}\KeywordTok{...}\OperatorTok{\}}
\end{Highlighting}
\end{Shaded}

if either one of the fields is not fieled then it's going to throw an
error.

\begin{Shaded}
\begin{Highlighting}[]
  \ControlFlowTok{if} \OperatorTok{(}\NormalTok{LoginController}\OperatorTok{.}\FunctionTok{registeredUsers}\OperatorTok{.}\FunctionTok{containsKey}\OperatorTok{(}\NormalTok{username}\OperatorTok{))} \OperatorTok{\{}\KeywordTok{...}\OperatorTok{\}}
\end{Highlighting}
\end{Shaded}

This line of code checks that if the other user does not already use
this username.

If everything is OK, then new user is created and it sets the titel to:
``Registration is successful'' and writes out: ``You have successfully
registered. You can now log in.'' And also it opens login form.

\hypertarget{infocontroller-and-profilecontroller}{%
\subsection{InfoController and
ProfileController}\label{infocontroller-and-profilecontroller}}

Both of those classes include switchToMainScene, which are responsible
for switching to main menu after clicking ``back to menu'' button. In
the InfoController there are informations about my game.

\hypertarget{room-class-and-iherited-subclasses-polymorphism-is-included-there-as-well}{%
\subsection{Room class and iherited subclasses (polymorphism is included
there as
well)}\label{room-class-and-iherited-subclasses-polymorphism-is-included-there-as-well}}

In the room class I created constructor and two methods: getPrice() and
getType() method, which are overriden in those three inherited classes:
standard room, luxury room and suite room.

\hypertarget{roomscontroller}{%
\subsection{RoomsController}\label{roomscontroller}}

In this class we are handling mentioned classes depending on the chosen
room type.

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{  priceLabel}\OperatorTok{.}\FunctionTok{setText}\OperatorTok{(}\BuiltInTok{String}\OperatorTok{.}\FunctionTok{format}\OperatorTok{(}\StringTok{"}\SpecialCharTok{\%.2f}\StringTok{"}\OperatorTok{,}\NormalTok{ room}\OperatorTok{.}\FunctionTok{getPrice}\OperatorTok{())} \OperatorTok{+} \StringTok{" €"}\OperatorTok{);}
\end{Highlighting}
\end{Shaded}

This line of code is responsible for calculating the price for selected
room type and printining it out in this scene.

\end{document}
© www.soinside.com 2019 - 2024. All rights reserved.