Esempio n. 1
0
        public bool HandleKeyPress(char choice)
        {
            if (menu.HandleKeyPress(choice))
            {
                return(true);
            }
            else if (choice == ( char )32)
            {
                if (menu.GetCurrent() == LEAVE)
                {
                    GameController.Instance().SetDialog(null);
                }
                else if (menu.GetCurrent() == GRANT)
                {
                    (( ServerPC )InteractablesRepository.Instance().Get("server_pc")).Hacked = true;
                    win  = true;
                    menu = new Menu(new List <string>()
                    {
                        NEXT
                    });
                }
                else if (menu.GetCurrent() == NEXT)
                {
                    GameController.Instance().GameOver();
                }

                return(true);
            }

            return(false);
        }
        public bool HandleKeyPress(char choice)
        {
            if (menu.HandleKeyPress(choice))
            {
                return(true);
            }
            else if (choice == ( char )32)
            {
                if (menu.GetCurrent() == LEAVE)
                {
                    GameController.Instance().SetDialog(null);
                }
                else if (menu.GetCurrent() == TAKE_CARD && containsSDCard)
                {
                    menu.RemoveOption(TAKE_CARD);

                    bool taken = GameController.Instance().GetEquipment().AddBySlug("sd_card");
                    if (taken == true)
                    {
                        ((SDCardHolder)InteractablesRepository.Instance().Get("sd_card_holder")).ContainsSDCard = false;
                        containsSDCard = false;
                        sdCardTaken    = true;
                        MainQuest.OnSDCardFound();
                    }
                }

                return(true);
            }

            return(false);
        }
 public static void InjectRepository(InteractablesRepository injection)
 {
     if (injection != null)
     {
         instance = injection;
     }
 }
        public bool Load(string name)
        {
            try {
                if (name == null || name == "")
                {
                    throw new ArgumentNullException();
                }

                if (!Directory.Exists(@".saves/" + name))
                {
                    throw new DirectoryNotFoundException();
                }

                IFormatter formatter = new BinaryFormatter();
                Stream     stream    = null;

                stream   = new FileStream(@".saves/" + name + "/state.save", FileMode.Open, FileAccess.Read);
                instance = ( GameController )formatter.Deserialize(stream);
                stream.Close();

                stream = new FileStream(@".saves/" + name + "/actions.save", FileMode.Open, FileAccess.Read);
                InteractablesRepository.InjectRepository(( InteractablesRepository )formatter.Deserialize(stream));
                stream.Close();
            } catch {
                return(false);
            }

            return(true);
        }
        public bool HandleKeyPress(char choice)
        {
            if (menu.HandleKeyPress(choice))
            {
                return(true);
            }
            else if (choice == ( char )32)
            {
                if (menu.GetCurrent() == LEAVE)
                {
                    GameController.Instance().SetDialog(null);
                }
                else if (menu.GetCurrent() == FINISH)
                {
                    state = 1;
                    menu  = new Menu(new List <string>()
                    {
                        NEXT
                    });
                }
                else if (menu.GetCurrent() == NEXT)
                {
                    GameController.Instance().SetDialog(null);
                    ((Thermostat)InteractablesRepository.Instance().Get("thermostat")).Hacked = true;
                    MainQuest.OnRaspberryPiMounted();
                }

                return(true);
            }

            return(false);
        }
        public bool Save(string name)
        {
            try {
                if (name == null || name == "")
                {
                    throw new ArgumentNullException();
                }

                if (Directory.Exists(@".saves/" + name))
                {
                    Directory.Delete(@".saves/" + name);
                }
                Directory.CreateDirectory(@".saves/" + name);

                Stream     stream    = null;
                IFormatter formatter = new BinaryFormatter();

                stream = new FileStream(@".saves/" + name + "/state.save", FileMode.Create, FileAccess.Write);
                formatter.Serialize(stream, this);
                stream.Close();

                stream = new FileStream(@".saves/" + name + "/actions.save", FileMode.Create, FileAccess.Write);
                formatter.Serialize(stream, InteractablesRepository.Instance());
                stream.Close();
            } catch {
                return(false);
            }

            return(true);
        }
Esempio n. 7
0
        public void Draw()
        {
            Console.Write(Speakers.DOOR);
            if (state == 0)
            {
                Console.WriteLine("Na drzwiach jest nalepka \"SERWEROWNIA\". Drzwi są zabezpieczone przez kontroler elektroniczny, z klawiaturą.. co robisz?");
            }
            else if (state == 1)
            {
                int throttle = ((ServersDoor)InteractablesRepository.Instance().Get("servers_door")).Throttle;
                Console.WriteLine("Na wyświetlaczu zaczynają migać różne kody, być może któryś z nich otwiera drzwi. Jest też informacja: \"ZOSTAŁO: " + throttle.ToString() + " PRÓB\".. co robisz?");
            }
            else if (state == 2)
            {
                int throttle = ((ServersDoor)InteractablesRepository.Instance().Get("servers_door")).Throttle;
                Console.WriteLine("Na kontrolerze zaświeciła się czerwona dioda, a wyświetlacz pokazał: \"ZOSTAŁO: " + throttle.ToString() + " PRÓB\".. co robisz?");
            }
            else if (state == 3)
            {
                Console.WriteLine("Na kontrolerze zaświeciła się zielona dioda, a drzwi otworzyły się.. co robisz?");
            }
            else if (state == 10)
            {
                Console.WriteLine("Gdy przekroczyłeś trzecią próbę w całym budynku rozległ się głośny alarm. Natychmiast przybiegła ochrona i brutalnie przygwoździła Cię do ziemi.");
            }
            Console.WriteLine();

            menu.Draw();
        }
Esempio n. 8
0
        public bool HandleKeyPress(char choice)
        {
            if (menu.HandleKeyPress(choice))
            {
                return(true);
            }
            else if (choice == ( char )32)
            {
                if (menu.GetCurrent() == LEAVE)
                {
                    GameController.Instance().SetDialog(null);
                }
                else if (menu.GetCurrent() == TAKE_PICKLOCK && containsPicklock)
                {
                    menu.RemoveOption(TAKE_PICKLOCK);

                    bool taken = GameController.Instance().GetEquipment().AddBySlug("picklock");
                    if (taken == true)
                    {
                        ((TrashCan)InteractablesRepository.Instance().Get("trash_can")).ContainsPicklock = false;
                        containsPicklock = false;
                        picklockTaken    = true;
                    }
                }

                return(true);
            }

            return(false);
        }
 public static InteractablesRepository Instance()
 {
     if (instance == null)
     {
         instance = new InteractablesRepository();
     }
     return(instance);
 }
Esempio n. 10
0
        public bool HandleKeyPress(char choice)
        {
            if (menu.HandleKeyPress(choice))
            {
                return(true);
            }
            else if (choice == ( char )32)
            {
                if (menu.GetCurrent() == LEAVE)
                {
                    GameController.Instance().SetDialog(null);
                }
                else if (menu.GetCurrent() == TAKE_PI && containsRaspberry)
                {
                    menu.RemoveOption(TAKE_PI);

                    bool taken = GameController.Instance().GetEquipment().Add(ItemsRepository.Instance().Get("raspberry_pi_blank"));
                    if (taken == true)
                    {
                        ((Chest)InteractablesRepository.Instance().Get("chest")).ContainsRaspberry = false;
                        containsRaspberry = false;
                        raspberryTaken    = true;

                        menu = new Menu(new List <string>()
                        {
                            LEAVE
                        });

                        MainQuest.OnRaspberryFound();
                    }
                }
                else if (menu.GetCurrent() == TAKE_DUCK && containsDuck)
                {
                    containsDuck = false;
                    menu.RemoveOption(TAKE_DUCK);

                    bool taken = GameController.Instance().GetEquipment().Add(ItemsRepository.Instance().Get("rubber_duck"));
                    if (taken == true)
                    {
                        ((Chest)InteractablesRepository.Instance().Get("chest")).ContainsDuck = false;
                    }
                }

                return(true);
            }

            return(false);
        }
Esempio n. 11
0
        public bool HandleKeyPress(char choice)
        {
            if (menu.HandleKeyPress(choice))
            {
                return(true);
            }
            else if (choice == ( char )32)
            {
                if (menu.GetCurrent() == LEAVE)
                {
                    GameController.Instance().SetDialog(null);
                }
                else if (menu.GetCurrent() == PULL_OUT_PANEL || menu.GetCurrent() == TEAR_OUT_PANEL)
                {
                    state = 1;
                    menu  = new Menu(new List <string>()
                    {
                        PUT_PI, LEAVE
                    });
                }
                else if (menu.GetCurrent() == PUT_PI)
                {
                    state = 2;
                    menu  = new Menu(new List <string>()
                    {
                        HIDE_PANEL, PUT_PANEL_BACK
                    });
                    GameController.Instance().GetEquipment().RemoveBySlug("raspberry_pi_rootkit");
                    ((Thermostat)InteractablesRepository.Instance().Get("thermostat")).Started = true;
                }
                else if (menu.GetCurrent() == PUT_PANEL_BACK)
                {
                    GameController.Instance().SetDialog(new TyrellDialog(true));
                }
                else if (menu.GetCurrent() == HIDE_PANEL)
                {
                    GameController.Instance().SetDialog(new TyrellDialog(false));
                }

                return(true);
            }

            return(false);
        }
Esempio n. 12
0
        public bool HandleKeyPress(char choice)
        {
            if (menu.HandleKeyPress(choice))
            {
                return(true);
            }
            else if (choice == ( char )32)
            {
                if (menu.GetCurrent() == LEAVE)
                {
                    GameController.Instance().SetDialog(null);
                }
                else if (menu.GetCurrent() == NEXT)
                {
                    if (state++ >= 4)
                    {
                        menu = new Menu(new List <string>()
                        {
                            UNDERSTAND, MISUNDERSTAND
                        });
                    }
                }
                else if (menu.GetCurrent() == UNDERSTAND)
                {
                    ((MrRobotParking)InteractablesRepository.Instance().Get("mr_robot_parking")).PlanExplained = true;

                    GameController.Instance().SetDialog(null);
                    MainQuest.OnTryGetInStillMountain();
                }
                else if (menu.GetCurrent() == MISUNDERSTAND)
                {
                    state = 1;
                    menu  = new Menu(new List <string>()
                    {
                        NEXT
                    });
                }

                return(true);
            }

            return(false);
        }
Esempio n. 13
0
        public bool HandleKeyPress(char choice)
        {
            if (menu.HandleKeyPress(choice))
            {
                return(true);
            }
            else if (choice == ( char )32)
            {
                if (menu.GetCurrent() == LEAVE)
                {
                    GameController.Instance().SetDialog(null);
                }
                else if (menu.GetCurrent() == OPEN)
                {
                    state = 1;
                    CodesMenu();
                }
                else if (menu.GetCurrent() == CORRECT || menu.GetCurrent() == TRY_CARD)
                {
                    state = 3;
                    menu  = new Menu(new List <string>()
                    {
                        COME_IN, LEAVE
                    });

                    ServersDoor door = (ServersDoor)InteractablesRepository.Instance().Get("servers_door");
                    door.Open = true;
                }
                else if (menu.GetCurrent() == COME_IN)
                {
                    GameController.Instance().SetPlayer(new Point(27, 14));
                    GameController.Instance().SetRoom(RoomsRepository.Instance().Get("servers"));
                    GameController.Instance().SetDialog(null);
                }
                else if (menu.GetCurrent() == FAILED)
                {
                    GameController.Instance().GameOver();
                }
                else
                {
                    ServersDoor door = (ServersDoor)InteractablesRepository.Instance().Get("servers_door");
                    door.Throttle -= 1;

                    if (door.Throttle > 0)
                    {
                        state = 2;
                        CodesMenu();
                    }
                    else
                    {
                        menu = new Menu(new List <string>()
                        {
                            FAILED
                        });
                        state = 10;
                    }
                }

                return(true);
            }

            return(false);
        }
Esempio n. 14
0
        public bool HandleKeyPress(char choice)
        {
            if (menu.HandleKeyPress(choice))
            {
                return(true);
            }
            else if (choice == ( char )32)
            {
                if (menu.GetCurrent() == LEAVE || menu.GetCurrent() == NOTHING || menu.GetCurrent() == NOT_YET || menu.GetCurrent() == FOLLOW_BILL)
                {
                    state = 0;
                    GameController.Instance().SetDialog(null);
                }
                else if (menu.GetCurrent() == VISIT)
                {
                    menu = new Menu(new List <string>()
                    {
                        LIAM_SEPIOL, SAM_SEPIOL, SAM_ESMAIL
                    });
                    state++;
                }
                else if (menu.GetCurrent() == SAM_SEPIOL)
                {
                    menu = new Menu(new List <string>()
                    {
                        YES, NOT_YET
                    });
                    state++;
                }
                else if (menu.GetCurrent() == SAM_ESMAIL || menu.GetCurrent() == LIAM_SEPIOL)
                {
                    ((Bill)InteractablesRepository.Instance().Get("bill")).CheatAttemptPossible = false;
                    menu = new Menu(new List <string>()
                    {
                        LEAVE
                    });
                    state = 100;
                    MainQuest.OnBillFailed();
                }
                else if (menu.GetCurrent() == YES)
                {
                    ((Bill)InteractablesRepository.Instance().Get("bill")).CheatAttemptPossible = false;
                    menu = new Menu(new List <string>()
                    {
                        NEXT
                    });
                    state++;
                }
                else if (menu.GetCurrent() == NEXT)
                {
                    state++;
                    if (state == 7)
                    {
                        menu = new Menu(new List <string>()
                        {
                            ASK, ESCAPE
                        });
                    }
                }
                else if (menu.GetCurrent() == ASK)
                {
                    menu = new Menu(new List <string>()
                    {
                        END_TOUR, DESTROY_BILL
                    });
                    state = 20;
                }
                else if (menu.GetCurrent() == ESCAPE)
                {
                    menu = new Menu(new List <string>()
                    {
                        FOLLOW_BILL
                    });
                    state = 101;
                    MainQuest.OnBillFailed();
                }
                else if (menu.GetCurrent() == END_TOUR)
                {
                    menu = new Menu(new List <string>()
                    {
                        FOLLOW_BILL
                    });
                    state = 102;
                    MainQuest.OnBillFailed();
                }
                else if (menu.GetCurrent() == DESTROY_BILL)
                {
                    menu = new Menu(new List <string>()
                    {
                        LOOK_ON_BILL
                    });
                    state++;
                }
                else if (menu.GetCurrent() == LOOK_ON_BILL)
                {
                    menu = new Menu(new List <string>()
                    {
                        BREAK_IN
                    });
                    state = 103;
                }
                else if (menu.GetCurrent() == BREAK_IN)
                {
                    MainQuest.OnBillDestroyed();
                    GameController.Instance().SetDialog(null);
                }

                return(true);
            }

            return(false);
        }
        public bool HandleKeyPress(char choice)
        {
            if (menu.HandleKeyPress(choice))
            {
                return(true);
            }
            else if (choice == ( char )32)
            {
                if (menu.GetCurrent() == LEAVE || menu.GetCurrent() == NOTHING)
                {
                    GameController.Instance().SetDialog(null);
                }
                else if (menu.GetCurrent() == FAILED_BILL)
                {
                    menu = new Menu(new List <string>()
                    {
                        NEXT
                    });
                    state++;
                }
                else if (menu.GetCurrent() == NEXT)
                {
                    if (state == 1)
                    {
                        if (GameController.Instance().GetEquipment().ContainsBySlug("picklock"))
                        {
                            menu = new Menu(new List <string>()
                            {
                                PICKLOCK
                            });
                        }
                        else
                        {
                            menu = new Menu(new List <string>()
                            {
                                NO_PICKLOCK
                            });
                        }
                    }
                    state++;
                }
                else if (menu.GetCurrent() == FAILED)
                {
                    GameController.Instance().GameOver();
                }
                else if (menu.GetCurrent() == PICKLOCK)
                {
                    (( MrRobotParking )InteractablesRepository.Instance().Get("mr_robot_parking")).NewPlanExplained = true;

                    menu = new Menu(new List <string>()
                    {
                        LEAVE
                    });
                    state++;
                }
                else if (menu.GetCurrent() == NO_PICKLOCK)
                {
                    menu = new Menu(new List <string>()
                    {
                        FAILED
                    });
                    state = 10;
                }

                return(true);
            }

            return(false);
        }
 public static void OnBillFailed()
 {
     GameController.Instance().SetQuestMessage("Nie udało się przejść przez Billa. Porozmawiaj z Mr. Robotem.");
     (( MrRobotParking )InteractablesRepository.Instance().Get("mr_robot_parking")).BillFailed = true;
 }