예제 #1
0
        protected override void OnCreate()
        {
            Back.SetBackTexture("Menu_CharacterCreation.tga");

            Name = AddTextBox("Name:", "Wähle den Namen deines Charakters.", 150, 15, 200, 45, MoveCursor);
            Name.AllowSymbols = false;

            Character = AddCharacter("", -60, 50, 533, 400);
            Character.SetVisual("HUMANS.MDS");
            Character.SetAdditionalVisuals(HumBodyMeshs.HUM_BODY_BABE0.ToString(), (int)HumBodyTexs.G1Hero, HumHeadMeshs.HUM_HEAD_BABE.ToString(), (int)HumHeadTexs.FaceBabe_B_RedLocks);
            AddButton("Akzeptieren", "Charakteränderungen speichern.", 160, 425, CreateNewCharacter);



            const int offsetX = 415;
            const int offsetY = 27;
            const int dist    = 50;

            bodymesh  = AddChoice("Geschlecht", "Wähle das Geschlecht deines Charakters.", offsetX, offsetY + dist * 0, c_BodyMesh, false, MoveCursor, ChangedVisual);
            bodytex   = AddChoice("Haut", "Wähle die Haut deines Charakters.", offsetX, offsetY + dist * 1, c_BodyTex_M, false, MoveCursor, ChangedVisual);
            headmesh  = AddChoice("Kopf", "Wähle die Kopfform deines Charakters.", offsetX, offsetY + dist * 2, c_HeadMeshes_M, true, MoveCursor, ChangedVisual);
            headtex   = AddChoice("Gesicht", "Wähle das Gesicht deines Charakters.", offsetX, offsetY + dist * 3, c_Faces_M_N, true, MoveCursor, ChangedVisual);
            fatness   = AddChoice("Statur", "Wähle die Statur deines Charakters.", offsetX, offsetY + dist * 4, c_Fatness, false, MoveCursor, ChangedVisual);
            bodywidth = AddChoice("Breite", "Wähle die Körperbreite deines Charakters.", offsetX, offsetY + dist * 6, c_BodyWidth, false, MoveCursor, ChangedVisual);
            voice     = AddChoice("Stimme", "Wähle die Stimme deines Charakters.", offsetX, offsetY + dist * 7, c_Voices_M, true, PlayVoice, PlayVoice);


            ChangedVisual();
        }
예제 #2
0
        protected MainMenuChoice AddChoice(string title, string help, int x, int y, Dictionary <int, string> choices, bool sorted, Action OnActivate, Action OnChange)
        {
            var c = new MainMenuChoice(title, help, pos[0] + x, pos[1] + y, choices, sorted, OnActivate, OnChange);

            Items.Add(c);
            return(c);
        }
예제 #3
0
        private void MainMenu(MainMenuChoice mainMenuChoice)
        {
            bool isPermitted = this.CheckRoleAccess(loggedUser.Role, mainMenuChoice);

            if (isPermitted)
            {
                switch (mainMenuChoice)
                {
                case MainMenuChoice.AddClient:
                    Console.WriteLine("Adding client ...... ");
                    this.commandProcessor.AddClient();
                    break;

                case MainMenuChoice.AddCourier:
                    Console.WriteLine("Adding courier ...... ");
                    this.commandProcessor.AddCourier();
                    break;

                case MainMenuChoice.PlaceOrder:
                    Console.WriteLine("Placing order ...... ");
                    this.commandProcessor.AddOrder();
                    break;

                case MainMenuChoice.AllClients:
                    Console.WriteLine("Listing clients ...... ");
                    Console.WriteLine(this.commandProcessor.ShowAllClients());
                    break;

                case MainMenuChoice.AllOrders:

                    Console.WriteLine("Listing orders ...... ");
                    Console.WriteLine(this.commandProcessor.ShowAllOrders());

                    break;

                case MainMenuChoice.AllLocations:
                    Console.WriteLine("Listing locations ...... ");
                    Console.WriteLine(this.commandProcessor.ShowAllLocations());
                    break;

                case MainMenuChoice.Logout:

                    this.loggedUser = null;
                    state           = MenuState.Login;

                    break;
                }
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("You have no permission to accesss this operation!\n");
                Console.ResetColor();
            }
        }
예제 #4
0
        private bool CheckRoleAccess(UserRole role, MainMenuChoice mainMenuChoice)
        {
            bool isPresent = false;

            switch (role)
            {
            case UserRole.Administrator:

                isPresent = LookupRoles.Administrator.Contains(mainMenuChoice);
                break;

            case UserRole.Operator:

                isPresent = LookupRoles.Operator.Contains(mainMenuChoice);
                break;

            case UserRole.Normal:

                isPresent = LookupRoles.Normal.Contains(mainMenuChoice);
                break;
            }

            return(isPresent);
        }
예제 #5
0
        public void RunMainController()
        {
            bool isMainControllerActive = true;

            while (isMainControllerActive)
            {
                mainMenuView.PrintMenu();
                int.TryParse(mainMenuView.GetUserInput("Your choice: "), out int userChoice);
                MainMenuChoice mainMenu = (MainMenuChoice)userChoice;

                switch (mainMenu)
                {
                case MainMenuChoice.Add:
                {
                    PreapareBookDeatalis(out long ISBN, out string first_name, out string surname, out string publisher, out string title, out int year, out double price);

                    createBook.AddAuthor(first_name, surname);
                    createBook.AddPublisher(publisher);
                    createBook.AddBook(ISBN, title, year, price, first_name, surname, publisher);
                    break;
                }

                case MainMenuChoice.Edit:
                {
                    PrepareEdit(out int ISBN, out EditOptions editOptions);
                    switch (editOptions)
                    {
                    case EditOptions.FirstName:
                        ChangeFirstName(ISBN);
                        break;

                    case EditOptions.Title:
                        ChangeTitle(ISBN);
                        break;

                    case EditOptions.Surname:
                        ChangeSurname(ISBN);
                        break;

                    case EditOptions.Price:
                        ChangeAPrice(ISBN);
                        break;
                    }
                    break;
                }

                case MainMenuChoice.Delete:
                {
                    int.TryParse(mainMenuView.GetUserInput("Type a ISBN: "), out int ISBN);
                    IDelateBook delateBook = (IDelateBook)editBook;
                    delateBook.RemoveBook(ISBN);
                    break;
                }

                case MainMenuChoice.SeeAllBooksByAuthor:
                    string      author = this.mainMenuView.GetUserInput("Type author: ");
                    List <Book> books  = readBook.GetBooksByAuthor(author);
                    mainMenuView.PrintBooks(books);
                    break;

                case MainMenuChoice.Sort:
                    List <Book> bookAscendigByTitle = readBook.GetBooksAscendigByTitle();
                    this.mainMenuView.PrintBooks(bookAscendigByTitle);
                    break;

                case MainMenuChoice.BooksCreatedByAuthor:
                    string      authors             = mainMenuView.GetAuthors();
                    List <Book> bookCreatedByAuthor = readBook.GetBooksByAuthors(authors);
                    this.mainMenuView.PrintBooks(bookCreatedByAuthor);
                    break;

                case MainMenuChoice.BooksFromLastXYears:
                    int         xYears = int.Parse(mainMenuView.GetUserInput("Type number of years: "));
                    List <Book> booksFromLastTenYears = readBook.GetBooksFromLastXYears(xYears);
                    mainMenuView.PrintBooks(booksFromLastTenYears);
                    break;

                case MainMenuChoice.ValueOfLibrary:
                    decimal valueOfLibrary = editBook.GetLibraryValue();
                    mainMenuView.PrintMessage($"Total value of yours Library is: {valueOfLibrary}");
                    break;

                case MainMenuChoice.Exit:
                    isMainControllerActive = false;
                    break;

                default:
                    mainMenuView.PrintMessage("No option. Please try again");
                    break;
                }
            }
        }