示例#1
0
        public static void printInitScreen4Room()
        {
            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.UpdateArmourItem(GameState.CountArmourInInventory());
            PlayUILeftPanel.UpdateSwordItem(GameState.CountSwordInInventory());
            PlayUILeftPanel.UpdateTotalItem(GameState.TotalItemInInventory());
            PlayUILeftPanel.UpdateSilverItem(GameState.CountSilverInInventory());
            PlayUILeftPanel.UpdateGoldItem(GameState.CountGoldInInventory());
            PlayUILeftPanel.UpdateKeyItem(GameState.CounKeyInInventory());
            PlayUILeftPanel.UpdateHealthPotiontem(GameState.CountHealthPotionInInventory());
            PlayUILeftPanel.UpdateTotalEnemyItem(
                gm.GlobinList.Count + gm.MonsterList.Count);
            PlayUILeftPanel.UpdateTotalGlobinWItem(gwinfo.NumberOfGlobin);
            PlayUILeftPanel.UpdateTotalMonsterItem(gwinfo.NumberOfMonster);

            item = GameState.GetFirstArmourInInventory();
            if (item != null && item is IShield)
            {
                PlayUILeftPanel.UpdateArmourTypeVal(item.descriptions);
                PlayUILeftPanel.UpdateArmourPowerLevel(((IShield)item).shieldPower);
            }
            else
            {
                PlayUILeftPanel.UpdateArmourTypeVal("Not Found");
                PlayUILeftPanel.UpdateArmourPowerLevel(0);
            }

            item = GameState.GetFirstSwordInInventory();
            if (item != null && item is IWeapon)
            {
                PlayUILeftPanel.UpdateWeaponTypeVal(item.descriptions);
                PlayUILeftPanel.UpdateWeaponrPowerLevel(
                    Utility.getPercentageVal(((IWeapon)item).capableHit, 400));
            }
            else
            {
                PlayUILeftPanel.UpdateWeaponTypeVal("Not Found");
                PlayUILeftPanel.UpdateWeaponrPowerLevel(0);
            }

            PlayUIRightPanel.UpdateHealthLevel(player.HealthLevel);
        }
        public static bool HandleArmour(Object item)
        {
            ConsoleKeyInfo keyInfo;
            bool           toProcessing = true;
            bool           toPickup     = false;

            GameRoom gm;

            ScreenManager.WaitForBufferClear();  //Clear Buffer

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


            if (GameState.CountSwordInInventory() > 0)
            {
                //************************************
                PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(21) + ((Item)item).descriptions + "\r\n" +
                                                  ConfigManager.GetStringResource(26) + GameState.GetFirstSwordInInventory().descriptions + "?\r\n" +
                                                  ConfigManager.GetStringResource(27) + ((IShield)item).shieldPower + "%" + "\r\n" +
                                                  ConfigManager.GetStringResource(23));

                PlayUIBottomItem.UpdateInstruction(
                    PlayUIBottomItem.YES_INSTRUNCTION | PlayUIBottomItem.NO_INSTRUNCTION);
                PlayUIBottomItem.UpdateMenuOption(PlayUIBottomItem.CLEAR);
                //***********************************
            }
            else
            {
                //************************************
                PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(21) + ((Item)item).descriptions + "\r\n" +
                                                  ConfigManager.GetStringResource(22) + "\r\n" + ConfigManager.GetStringResource(27) + ((IShield)item).shieldPower + "%" + "\r\n" +
                                                  ConfigManager.GetStringResource(23));

                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
                    GameState.RemoveArmourFromInventory();
                    GameState.inventory.Add((Item)item);
                    ((ITakable)item).Take();
                    //*************************************
                    PlayUITopItem.UpdateArmourType(((Item)item).descriptions);
                    PlayUILeftPanel.UpdateArmourItem(GameState.CountArmourInInventory());
                    PlayUILeftPanel.UpdateArmourTypeVal(((Item)item).descriptions);
                    PlayUILeftPanel.UpdateArmourPowerLevel(((IShield)item).shieldPower);

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

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

            return(toPickup);
        }