예제 #1
0
 public static void printScreenQuit01()
 {
     //*******************************************************************************
     PlayUIBottomItem.UpdateInstruction(PlayUIBottomItem.YES_INSTRUNCTION ^ PlayUIBottomItem.NO_INSTRUNCTION);
     PlayUIBottomItem.UpdateMenuOption(PlayUIBottomItem.CLEAR);
     PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(4) + "\n" + ConfigManager.GetStringResource(5));
     //*******************************************************************************
 }
예제 #2
0
        private static bool HandleExitWorld(int col, int row)
        {
            ConsoleKeyInfo keyInfo;
            bool           toProcessing = true;
            bool           returnStat   = true;

            ScreenManager.WaitForBufferClear();  //Clear Buffer


            //************************************************************
            PlayUIBottomItem.UpdateInstruction(PlayUIBottomItem.YES_INSTRUNCTION ^ PlayUIBottomItem.NO_INSTRUNCTION);
            PlayUIBottomItem.UpdateMenuOption(PlayUIBottomItem.CLEAR);
            PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(10));
            //*****************************************************************

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



                switch (Char.ToUpper(keyInfo.KeyChar))
                {
                case 'N':
                    GameState.subGameMode = GameState.GAME_SUBMODE.WORLD_PROCESSING;
                    toProcessing          = false;

                    //************************************
                    PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(11));
                    //************************************



                    break;

                case 'Y':
                    toProcessing = false;
                    backFromQuit = false;
                    returnStat   = false;   // Quitting
                    GameStateManager.SetNextState(GameStateTable.GAMESTATE_ENUM.GsGameOver);

                    //*****************************************************
                    PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(12));
                    PlayUIBottomItem.UpdateInstruction(PlayUIBottomItem.CLEAR);
                    ///*******************************************************


                    Utility.Wait(2000);

                    break;
                }
            }

            return(returnStat);
        }
예제 #3
0
 private static void HandleGameOver()
 {
     PlayUIBottomItem.UpdateInstruction(PlayUIBottomItem.CLEAR);
     PlayUIBottomItem.UpdateMenuOption(PlayUIBottomItem.CLEAR);
     PlayUIBottomItem.updateMessageBox(
         ConfigManager.GetStringResource(40) + "\r\n" +
         ConfigManager.GetStringResource(41) + "\r\n" +
         ConfigManager.GetStringResource(42)
         );
     Console.ReadKey(true);
 }
예제 #4
0
 private static void HandleVictory()
 {
     PlayUIBottomItem.UpdateInstruction(PlayUIBottomItem.CLEAR);
     PlayUIBottomItem.UpdateMenuOption(PlayUIBottomItem.CLEAR);
     PlayUIBottomItem.updateMessageBox(
         ConfigManager.GetStringResource(43) + "\r\n" +
         ConfigManager.GetStringResource(44) + "\r\n" +
         ConfigManager.GetStringResource(45) + GameState.score + "\r\n" +
         ConfigManager.GetStringResource(41) + "\r\n" +
         ConfigManager.GetStringResource(42)
         );
     Console.ReadKey(true);
 }
예제 #5
0
        private static void HandleWin()
        {
            PlayUIBottomItem.UpdateInstruction(
                PlayUIBottomItem.QUIT_INSTRUNCTION);

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

            PlayUIBottomItem.updateMessageBox(
                ConfigManager.GetStringResource(46) + "\r\n" +
                ConfigManager.GetStringResource(25) + "\r\n"
                );
        }
예제 #6
0
 public void UpdatePlyerHealth(int val)
 {
     if (The_Player.GetHealthLevel() + val <= 100)
     {
         The_Player.SetHealthLevel(The_Player.GetHealthLevel() + val);
         //*******************************************
         PlayUIBottomItem.updateMessageBox(
             ConfigManager.GetStringResource(17) + "\r\n" +
             ConfigManager.GetStringResource(18) + val + "\r\n" +
             ConfigManager.GetStringResource(20) + val);
         //*******************************************
     }
     else
     {
         //*******************************************
         PlayUIBottomItem.updateMessageBox(
             ConfigManager.GetStringResource(17) + "\r\n" +
             ConfigManager.GetStringResource(18) + val + "\r\n" +
             ConfigManager.GetStringResource(19));
         //*******************************************
     }
 }
예제 #7
0
        public static void setBattleOn(Object obj)
        {
            lock (obj)
            {
                BattleOn = true;
                LastWin  = false;
            }

            //*******************************************
            PlayUIBottomItem.UpdateInstruction(
                PlayUIBottomItem.ATTACK_INSTRUNCTION
                );

            PlayUIBottomItem.UpdateMenuOption(PlayUIBottomItem.CLEAR);
            if (obj is Enemy)
            {
                PlayUIBottomItem.updateMessageBox(
                    ConfigManager.GetStringResource(38) + ((Enemy)obj).InstanceName + "\r\n" +
                    ConfigManager.GetStringResource(39) + ((Enemy)obj).InstanceName);
            }
            //*******************************************
        }
예제 #8
0
        public static void Init()
        {
            gwinfo = GameDataFactory.CreateInitialWorldData();
            GameState.currentGameMode = GameState.GAME_MODE.WORLD;

            PlayUIWorldMap.Init(gwinfo.WorldMapInfo.MapInfo);

            PlayUITopItem.Init();
            PlayUIBottomItem.Init();
            PlayUILeftPanel.Init();
            PlayUIRightPanel.Init();

            //****************************************************************************
            ScreenManager.printInitScreen();
            //************************************************************************************

            ScreenManager.ClearScreen();

            PlayUITopItem.Update();
            PlayUIWorldMap.Update();
            PlayUIBottomItem.Update();
        }
예제 #9
0
 public static void upDateRoomLocation()
 {
     PlayUITopItem.UpdateRoom(GameState.currentRoom);
     PlayUIBottomItem.updateMessageBox(
         ConfigManager.GetStringResource(13) + GameState.currentRoom);
 }
예제 #10
0
 public static void moveBlockInstruction()
 {
     PlayUIBottomItem.updateMessageBox(
         ConfigManager.GetStringResource(49) + "\r\n" + ConfigManager.GetStringResource(48));
 }
예제 #11
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 HandleSword(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(28) + ((IWeapon)item).capableHit + "%" + "\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(28) + ((IWeapon)item).capableHit + "%" + "\r\n" +
                                                  ConfigManager.GetStringResource(22) + "\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.RemoveSwordFromInventory();
                    GameState.inventory.Add((Item)item);
                    ((ITakable)item).Take();
                    //*************************************
                    PlayUITopItem.UpdateWeaponType(((Item)item).descriptions);
                    PlayUILeftPanel.UpdateSwordItem(GameState.CountSwordInInventory());
                    PlayUILeftPanel.UpdateWeaponTypeVal(((Item)item).descriptions);
                    PlayUILeftPanel.UpdateWeaponrPowerLevel(
                        Utility.getPercentageVal(((IWeapon)item).capableHit, 400));
                    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);
        }
        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);
        }
예제 #14
0
        // Main Attack Function.
        private static void HandleBattle(int col, int row, int room)
        {
            ConsoleKeyInfo keyInfo;
            bool           toProcessing = true;
            Item           weapon       = null;



            //while (!Console.KeyAvailable && GameState.isBattleOn() && toProcessing)
            while (GameState.isBattleOn() && toProcessing)
            {
                if (Console.KeyAvailable)
                {
                    keyInfo = Console.ReadKey(true);


                    switch (Char.ToUpper(keyInfo.KeyChar))
                    {
                    case 'A':

                        if (GameState.GetFirstSwordInInventory() == null)
                        {
                            PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(51) + "\r\n" +
                                                              ConfigManager.GetStringResource(52));
                            toProcessing = false;
                            break;
                        }


                        weapon = GameState.GetFirstSwordInInventory();
                        if (weapon is IronSword || weapon is WoodenSword)
                        {
                            ((ILivingOrganism)GameState.enemyobj).getHit(((IWeapon)weapon).hitPower);
                            //Reduce SWord Power.
                            ((IWeapon)weapon).doHit();
                            PlayUIRightPanel.UpdateEnemyHealthLevel(((ILivingOrganism)GameState.enemyobj).HealthLevel);

                            if (((ILivingOrganism)GameState.enemyobj).HealthLevel == 0)
                            {
                                //Enmey Health gone.
                                //Stop the Enemy
                                ((ILivingOrganism)GameState.enemyobj).Sleep();

                                ((GameRoom)gwinfo.GetGameRoombyNumber(GameState.currentRoom)).ItemsHashTable.Remove(GameState.enemyobj.InstanceKey);

                                if (GameState.enemyobj is Monster)
                                {
                                    ((GameRoom)gwinfo.GetGameRoombyNumber(GameState.currentRoom)).MonsterList.Remove((Monster)GameState.enemyobj);
                                    gwinfo.NumberOfMonster--;
                                }
                                else if (GameState.enemyobj is Globin)
                                {
                                    ((GameRoom)gwinfo.GetGameRoombyNumber(GameState.currentRoom)).GlobinList.Remove((Globin)GameState.enemyobj);
                                    gwinfo.NumberOfGlobin--;
                                }

                                if (GameState.enemyobj is ITakable)
                                {
                                    ((ITakable)GameState.enemyobj).Take();
                                }


                                GameState.setBatteOff();
                                GameState.LastWin = true;
                                GameState.ReleaseEnemies(GameState.currentRoom);

                                //********************************************
                                PlayUIRightPanel.UpdateEnemyTitle("");
                                PlayUIRightPanel.UpdateEnemyHealthLevel(0);
                                PlayUILeftPanel.UpdateTotalEnemyItem(
                                    ((GameRoom)gwinfo.GetGameRoombyNumber(GameState.currentRoom)).GlobinList.Count +
                                    ((GameRoom)gwinfo.GetGameRoombyNumber(GameState.currentRoom)).MonsterList.Count);
                                PlayUILeftPanel.UpdateTotalGlobinWItem(gwinfo.NumberOfGlobin);
                                PlayUILeftPanel.UpdateTotalMonsterItem(gwinfo.NumberOfMonster);
                                PlayUITopItem.UpdateHealthLevel(gwinfo.The_Player.GetHealthLevel());
                                PlayUIRightPanel.PaintLegendOption(GameState.currentRoom);


                                //*********************************************
                            }

                            if (((IWeapon)weapon).capableHit > 0)
                            {
                                PlayUILeftPanel.UpdateWeaponTypeVal(weapon.descriptions);
                                PlayUILeftPanel.UpdateWeaponrPowerLevel(
                                    Utility.getPercentageVal(((IWeapon)weapon).capableHit, 400));

                                PlayUILeftPanel.UpdateSwordItem(GameState.CountSwordInInventory());
                            }
                            else
                            {
                                GameState.RemoveSwordFromInventory();

                                PlayUILeftPanel.UpdateWeaponTypeVal("Not Found");
                                PlayUILeftPanel.UpdateWeaponrPowerLevel(0);
                                PlayUILeftPanel.UpdateSwordItem(GameState.CountSwordInInventory());
                                PlayUITopItem.UpdateWeaponType("No");
                            }
                        }
                        toProcessing = false;
                        break;

                        /*
                         * case 'Q':
                         *  //DEBUG
                         *  ScreenManager.WriteDebugLine("Quit Attack @@@@@@@@@@@@@@@@@@@@@@@@@@@@");
                         *  toProcessing = false;
                         *  GameState.setBatteOff();
                         *  //DEBUG
                         *  break;
                         */
                    }
                }
            }
        }
예제 #15
0
        }//End Fucnction

        private static void LookAround(int col, int row, int roomnumber)
        {
            //Object item = null;
            RoomMapSearchResult searchresult;
            List <Object>       objectlist1 = null;
            List <Object>       objectlist2 = null;

            //Serach surrounding 1 character away in all directon.
            searchresult = gwinfo.SearchRoom(roomnumber, col, row, (int)RoomMapSearchResult.SEARCH_TYPE.ALL_DIRECTION);


            objectlist1 = new List <Object>(searchresult.AutoCollectedList);
            objectlist2 = new List <Object>(searchresult.CollectedList);

            if (searchresult.ItemFound > 0)
            {
                //Pick up auto collectable item first
                //foreach (Object item in searchresult.AutoCollectedList)
                foreach (Object item in objectlist1)
                {
                    if (item is Gold)
                    {
                        gwinfo.GetGameRoombyNumber(roomnumber).TotalGoldItem--;
                        gwinfo.GetGameRoombyNumber(roomnumber).TotalItem--;

                        //*******************************************
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(15));
                        //*******************************************
                    }
                    else if (item is Silver)
                    {
                        gwinfo.GetGameRoombyNumber(roomnumber).TotalSilverItem--;
                        gwinfo.GetGameRoombyNumber(roomnumber).TotalItem--;

                        //*******************************************
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(16));
                        //*******************************************
                    }
                    else if (item is HealthPotion)
                    {
                        gwinfo.GetGameRoombyNumber(roomnumber).TotalHealthPotionItem--;
                        gwinfo.GetGameRoombyNumber(roomnumber).TotalItem--;
                        gwinfo.UpdatePlyerHealth(((HealthPotion)item).lifeLine);
                    }

                    GameState.inventory.Add((Item)item);
                }

                //foreach (Object item in searchresult.AutoCollectedList)
                foreach (Object item in objectlist2)
                {
                    if (item is Key)
                    {
                        //Susepend all Enemy
                        SuspendEnemies(GameState.currentRoom);
                        GameItemHandler.HandleKey(item);

                        //************************************
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(25));
                        //************************************

                        ReleaseEnemies(GameState.currentRoom);
                    }
                    else if (item is IronArmour)
                    {
                        SuspendEnemies(GameState.currentRoom);
                        GameItemHandler.HandleArmour(item);

                        //************************************
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(25));
                        //************************************

                        ReleaseEnemies(GameState.currentRoom);
                    }
                    else if (item is WoodenArmour)
                    {
                        SuspendEnemies(GameState.currentRoom);
                        GameItemHandler.HandleArmour(item);

                        //************************************
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(25));
                        //************************************

                        ReleaseEnemies(GameState.currentRoom);
                    }
                    else if (item is IronSword)
                    {
                        SuspendEnemies(GameState.currentRoom);
                        GameItemHandler.HandleSword(item);

                        //************************************
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(25));
                        //************************************

                        ReleaseEnemies(GameState.currentRoom);
                    }
                    else if (item is WoodenSword)
                    {
                        SuspendEnemies(GameState.currentRoom);
                        GameItemHandler.HandleSword(item);

                        //************************************
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(25));
                        //************************************

                        ReleaseEnemies(GameState.currentRoom);
                    }
                    else if (item is Chest)
                    {
                        SuspendEnemies(GameState.currentRoom);
                        GameItemHandler.HandleChest(item);

                        //************************************
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(25));
                        //************************************

                        ReleaseEnemies(GameState.currentRoom);
                    }
                }

                GameState.UpdateScore();
                searchresult = null;

                //*************************************
                ScreenManager.printScreenGoldAndSilver();
                PlayUIRightPanel.PaintLegendOption(GameState.currentRoom);
                //*************************************
            }
        }
예제 #16
0
        //Main Loop for World Mode
        private static void processWorldNMapInput()
        {
            ConsoleKeyInfo keyInfo;

            WorldMap.MAPTYPE maptype;
            bool             toContinue = true;

            GameState.currentRoom = gwinfo.GetCurrentRoom(
                col - PlayUIWorldMap.mapBoxColPos,
                row - PlayUIWorldMap.mapBoxRowPos);

            gwinfo.The_Player.Update();

            //GameState.subGameMode = GameState.GAME_SUBMODE.WORLD_QUIT;
            GameState.subGameMode = GameState.GAME_SUBMODE.WORLD_PROCESSING;

            //while ((keyInfo = Console.ReadKey(true)).Key != ConsoleKey.Escape
            while (toContinue)
            {
                keyInfo = Console.ReadKey(true);

                switch (keyInfo.Key)
                {
                case ConsoleKey.UpArrow:

                    maptype = gwinfo.WorldMapInfo.ItemAtPostion(
                        col - PlayUIWorldMap.mapBoxColPos, row - 1 - PlayUIWorldMap.mapBoxRowPos);

                    if (maptype == WorldMap.MAPTYPE.SPACE)
                    {
                        LastDirection = DIRECTION.DIR_W_NORTH;
                        gwinfo.The_Player.MoveNorth();
                        row--;
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(6));
                    }
                    else if (maptype == WorldMap.MAPTYPE.EXIT)
                    {
                        // User At Exit of the World Map
                        toContinue = HandleExitWorld(col - PlayUIWorldMap.mapBoxColPos,
                                                     row - PlayUIWorldMap.mapBoxRowPos);
                    }
                    break;

                case ConsoleKey.RightArrow:
                    maptype = gwinfo.WorldMapInfo.ItemAtPostion(
                        col + 1 - PlayUIWorldMap.mapBoxColPos, row - PlayUIWorldMap.mapBoxRowPos);

                    if (maptype == WorldMap.MAPTYPE.SPACE)
                    {
                        LastDirection = DIRECTION.DIR_W_EAST;
                        gwinfo.The_Player.MoveEast();
                        col++;
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(8));
                    }
                    else if (maptype == WorldMap.MAPTYPE.EXIT)
                    {
                        // User At Exit of the World Map
                        toContinue = HandleExitWorld(col - PlayUIWorldMap.mapBoxColPos,
                                                     row - PlayUIWorldMap.mapBoxRowPos);
                    }
                    break;

                case ConsoleKey.DownArrow:
                    maptype = gwinfo.WorldMapInfo.ItemAtPostion(
                        col - PlayUIWorldMap.mapBoxColPos, row + 1 - PlayUIWorldMap.mapBoxRowPos);

                    if (maptype == WorldMap.MAPTYPE.SPACE)
                    {
                        LastDirection = DIRECTION.DIR_W_SOUTH;
                        gwinfo.The_Player.MoveSouth();
                        row++;
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(7));
                    }
                    else if (maptype == WorldMap.MAPTYPE.EXIT)
                    {
                        // User At Exit of the World Map
                        toContinue = HandleExitWorld(col - PlayUIWorldMap.mapBoxColPos,
                                                     row - PlayUIWorldMap.mapBoxRowPos);
                    }
                    break;

                case ConsoleKey.LeftArrow:
                    maptype = gwinfo.WorldMapInfo.ItemAtPostion(
                        col - 1 - PlayUIWorldMap.mapBoxColPos, row - PlayUIWorldMap.mapBoxRowPos);
                    if (maptype == WorldMap.MAPTYPE.SPACE)
                    {
                        LastDirection = DIRECTION.DIR_W_WEST;
                        gwinfo.The_Player.MoveWest();
                        col--;
                        PlayUIBottomItem.updateMessageBox(ConfigManager.GetStringResource(9));
                    }
                    else if (maptype == WorldMap.MAPTYPE.EXIT)
                    {
                        // User At Exit of the World Map
                        toContinue = HandleExitWorld(col - PlayUIWorldMap.mapBoxColPos,
                                                     row - PlayUIWorldMap.mapBoxRowPos);
                    }
                    break;

                case ConsoleKey.Escape:
                    GameState.subGameMode = GameState.GAME_SUBMODE.WORLD_QUIT;
                    toContinue            = false;
                    break;
                }

                GameState.currentRoom = gwinfo.GetCurrentRoom(
                    col - PlayUIWorldMap.mapBoxColPos,
                    row - PlayUIWorldMap.mapBoxRowPos);

                if (GameState.currentRoom != -1)
                {
                    /*
                     * PlayUITopItem.RoomLabel.textItem = PlayUITopItem.RoomLableStr + "Room " + GameState.currentRoom;
                     * PlayUITopItem.RoomLabel.draw();
                     */

                    GameState.currentGameMode = GameState.GAME_MODE.ROOM;
                    GameState.subGameMode     = GameState.GAME_SUBMODE.ROOM_PROCESSING;

                    return;
                }
                else
                {
                    //ReleaseEnemies(GameState.currentRoom);

                    /*
                     * PlayUITopItem.RoomLabel.textItem = PlayUITopItem.RoomLableStr + "Passage Way";
                     * PlayUITopItem.RoomLabel.draw();
                     */
                }
            }
        }