Esempio n. 1
0
        public static void printScreenGoldAndSilver()
        {
            GameRoom      gm;
            Player        player;
            GameWorldInfo gwinfo;

            //Item item;

            gm     = GameDataFactory.curr_gwinfo.GetGameRoombyNumber(GameState.currentRoom);
            gwinfo = GameDataFactory.curr_gwinfo;
            player = GameDataFactory.curr_gwinfo.The_Player;

            PlayUILeftPanel.UpdateSilverItem(GameState.CountSilverInInventory());
            PlayUILeftPanel.UpdateGoldItem(GameState.CountGoldInInventory());
            PlayUITopItem.UpdateSilverLevel(GameState.CountSilverInInventory());
            PlayUITopItem.UpdateGoldLevel(GameState.CountGoldInInventory());
            PlayUILeftPanel.UpdateHealthPotiontem(GameState.CountHealthPotionInInventory());
            PlayUITopItem.UpdateScore(GameState.score);
            PlayUILeftPanel.UpdateTotalItem(GameState.TotalItemInInventory());

            PlayUITopItem.UpdateHealthPotion(GameState.CountHealthPotionInInventory());
            PlayUIRightPanel.UpdateHealthLevel(player.GetHealthLevel());
            PlayUITopItem.UpdateHealthLevel(player.GetHealthLevel());
        }
Esempio n. 2
0
        public static void printInitScreen()
        {
            GameRoom      gm;
            Player        player;
            GameWorldInfo gwinfo;
            Item          item;

            gm     = GameDataFactory.curr_gwinfo.GetGameRoombyNumber(GameState.currentRoom);
            gwinfo = GameDataFactory.curr_gwinfo;
            player = GameDataFactory.curr_gwinfo.The_Player;

            //****************************************************************************
            PlayUIBottomItem.UpdateInstruction(
                PlayUIBottomItem.QUIT_INSTRUNCTION
                //PlayUIBottomItem.UP_INSTRUNCTION   ^
                //PlayUIBottomItem.DOWN_INSTRUNCTION   ^
                //PlayUIBottomItem.RIGHT_INSTRUNCTION   ^
                //PlayUIBottomItem.LEFT_INSTRUNCTION
                );

            PlayUIBottomItem.UpdateMenuOption(
                // PlayUIBottomItem.QUIT_INSTRUNCTION ^
                PlayUIBottomItem.UP_INSTRUNCTION ^
                PlayUIBottomItem.DOWN_INSTRUNCTION ^
                PlayUIBottomItem.RIGHT_INSTRUNCTION ^
                PlayUIBottomItem.LEFT_INSTRUNCTION
                );

            PlayUIBottomItem.updateMessageBox(
                ConfigManager.GetStringResource(2) + "\n" + ConfigManager.GetStringResource(3));


            PlayUITopItem.UpdateGameLevel(GameState.gameLevel);
            PlayUITopItem.UpdateExperienceLevel(GameState.experience);
            PlayUITopItem.UpdateNoOfRoom(gwinfo.NumberOfRooms);

            PlayUITopItem.UpdateHealthLevel(player.GetHealthLevel());

            PlayUITopItem.UpdateSilverLevel(GameState.CountSilverInInventory());
            PlayUITopItem.UpdateGoldLevel(GameState.CountGoldInInventory());
            PlayUITopItem.UpdateHealthPotion(GameState.CountHealthPotionInInventory());

            item = GameState.GetFirstArmourInInventory();
            if (item != null)
            {
                PlayUITopItem.UpdateArmourType(item.descriptions);
            }
            else
            {
                PlayUITopItem.UpdateArmourType("No");
            }

            item = GameState.GetFirstSwordInInventory();
            if (item != null)
            {
                PlayUITopItem.UpdateWeaponType(item.descriptions);
            }
            else
            {
                PlayUITopItem.UpdateWeaponType("No");
            }

            PlayUITopItem.UpdateScore(GameState.score);
            //************************************************************************************
        }
        public static bool HandleChest(Object item)
        {
            ConsoleKeyInfo keyInfo;
            bool           toProcessing  = true;
            bool           toProcessing1 = true;
            bool           toPickup      = false;
            GameWorldInfo  gwinfo;
            GameRoom       gm;

            ScreenManager.WaitForBufferClear();  //Clear Buffer

            gm     = GameDataFactory.curr_gwinfo.GetGameRoombyNumber(GameState.currentRoom);
            gwinfo = GameDataFactory.curr_gwinfo;


            if (GameState.CounKeyInInventory() <= 0)
            {
                //*********************************************************
                PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(21) + ((Item)item).descriptions + "\r\n" +
                                                  ConfigManager.GetStringResource(32));
                PlayUIBottomItem.UpdateInstruction(PlayUIBottomItem.CONTINUE_INSTRUNCTION);
                PlayUIBottomItem.UpdateMenuOption(PlayUIBottomItem.CLEAR);
                //********************************************************

                while (toProcessing)
                {
                    keyInfo = Console.ReadKey(true);

                    switch (Char.ToUpper(keyInfo.KeyChar))
                    {
                    case 'C':
                        toProcessing = false;
                        PlayUIBottomItem.UpdateInstruction(PlayUIBottomItem.QUIT_INSTRUNCTION);
                        PlayUIBottomItem.UpdateMenuOption(
                            PlayUIBottomItem.UP_INSTRUNCTION ^
                            PlayUIBottomItem.DOWN_INSTRUNCTION ^
                            PlayUIBottomItem.RIGHT_INSTRUNCTION ^
                            PlayUIBottomItem.LEFT_INSTRUNCTION
                            );
                        ((IAvailable)item).SetNotAvailable(ConfigManager.ItemNotAvailableTime);
                        return(toPickup);
                    }
                }
            }
            else
            {
                PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(21) + ((Item)item).descriptions + "\r\n" +
                                                  ConfigManager.GetStringResource(35));
                PlayUIBottomItem.UpdateInstruction(
                    PlayUIBottomItem.YES_INSTRUNCTION | PlayUIBottomItem.NO_INSTRUNCTION);
                PlayUIBottomItem.UpdateMenuOption(PlayUIBottomItem.CLEAR);
            }


            while (toProcessing)
            {
                keyInfo = Console.ReadKey(true);

                switch (Char.ToUpper(keyInfo.KeyChar))
                {
                case 'N':
                    toProcessing = false;
                    //***************************
                    PlayUIBottomItem.UpdateInstruction(PlayUIBottomItem.QUIT_INSTRUNCTION);
                    PlayUIBottomItem.UpdateMenuOption(
                        PlayUIBottomItem.UP_INSTRUNCTION ^
                        PlayUIBottomItem.DOWN_INSTRUNCTION ^
                        PlayUIBottomItem.RIGHT_INSTRUNCTION ^
                        PlayUIBottomItem.LEFT_INSTRUNCTION
                        );
                    //******************************
                    ((IAvailable)item).SetNotAvailable(ConfigManager.ItemNotAvailableTime);
                    break;

                case 'Y':
                    toProcessing = false;
                    toPickup     = true;
                    gm.ItemsHashTable.Remove(((Item)item).InstanceKey);     //Remove from room
                    ((ITakable)item).Take();

                    //Pocess item inside treasure chest
                    foreach (Item itemobj in ((Chest)item).Goldlist.itemList)
                    {
                        gwinfo.GetGameRoombyNumber(GameState.currentRoom).TotalGoldItem--;
                        gwinfo.GetGameRoombyNumber(GameState.currentRoom).TotalItem--;
                        GameState.inventory.Add(itemobj);
                    }

                    GameState.UpdateScore();

                    foreach (Item itemobj in ((Chest)item).Silverlist.itemList)
                    {
                        gwinfo.GetGameRoombyNumber(GameState.currentRoom).TotalSilverItem--;
                        gwinfo.GetGameRoombyNumber(GameState.currentRoom).TotalItem--;
                        GameState.inventory.Add(itemobj);
                    }

                    GameState.UpdateScore();

                    foreach (Item itemobj in ((Chest)item).HealthPotionlist.itemList)
                    {
                        gwinfo.GetGameRoombyNumber(GameState.currentRoom).TotalHealthPotionItem--;
                        gwinfo.GetGameRoombyNumber(GameState.currentRoom).TotalItem--;
                        gwinfo.UpdatePlyerHealth(((HealthPotion)itemobj).lifeLine);
                        GameState.inventory.Add(itemobj);
                    }

                    //Remove 1 Key
                    GameState.RemoveKeyFromInventory();

                    //************************************************************
                    PlayUIBottomItem.updateMessageBox(
                        ConfigManager.GetStringResource(37) + ((Item)item).descriptions + "\r\n" +
                        ConfigManager.GetStringResource(29) + ((Chest)item).Goldlist.GetCount() + "\n" +
                        ConfigManager.GetStringResource(30) + ((Chest)item).Silverlist.GetCount() + "\n" +
                        ConfigManager.GetStringResource(31) + ((Chest)item).HealthPotionlist.GetCount());
                    PlayUIBottomItem.UpdateInstruction(PlayUIBottomItem.CONTINUE_INSTRUNCTION);
                    PlayUIBottomItem.UpdateMenuOption(PlayUIBottomItem.CLEAR);

                    PlayUILeftPanel.UpdateSilverItem(GameState.CountSilverInInventory());
                    PlayUILeftPanel.UpdateGoldItem(GameState.CountGoldInInventory());
                    PlayUILeftPanel.UpdateHealthPotiontem(GameState.CountHealthPotionInInventory());
                    PlayUILeftPanel.UpdateKeyItem(GameState.CounKeyInInventory());
                    PlayUILeftPanel.UpdateTotalItem(GameState.TotalItemInInventory());

                    PlayUITopItem.UpdateHealthPotion(GameState.CountHealthPotionInInventory());
                    PlayUITopItem.UpdateHealthLevel(gwinfo.The_Player.GetHealthLevel());
                    PlayUITopItem.UpdateSilverLevel(GameState.CountSilverInInventory());
                    PlayUITopItem.UpdateGoldLevel(GameState.CountGoldInInventory());

                    PlayUIRightPanel.UpdateHealthLevel(gwinfo.The_Player.GetHealthLevel());

                    PlayUIRightPanel.PaintLegendOption(GameState.currentRoom);
                    //*************************************************************

                    while (toProcessing1)
                    {
                        keyInfo = Console.ReadKey(true);

                        switch (Char.ToUpper(keyInfo.KeyChar))
                        {
                        case 'C':
                            toProcessing1 = false;
                            break;
                        }
                    }

                    //*********************************************************
                    PlayUIBottomItem.UpdateInstruction(PlayUIBottomItem.QUIT_INSTRUNCTION);
                    PlayUIBottomItem.UpdateMenuOption(
                        PlayUIBottomItem.UP_INSTRUNCTION ^
                        PlayUIBottomItem.DOWN_INSTRUNCTION ^
                        PlayUIBottomItem.RIGHT_INSTRUNCTION ^
                        PlayUIBottomItem.LEFT_INSTRUNCTION
                        );
                    //****************************************************************


                    break;
                }
            }

            return(toPickup);
        }