コード例 #1
0
ファイル: TopBarGump.cs プロジェクト: saddamsial/MobileUO
        public override void OnButtonClick(int buttonID)
        {
            switch ((Buttons)buttonID)
            {
            case Buttons.Map:
                MiniMapGump miniMapGump = UIManager.GetGump <MiniMapGump>();

                if (miniMapGump == null)
                {
                    UIManager.Add(new MiniMapGump());
                }
                else
                {
                    miniMapGump.SetInScreen();
                    miniMapGump.BringOnTop();
                }

                break;

            case Buttons.Paperdoll:
                PaperDollGump paperdollGump = UIManager.GetGump <PaperDollGump>(World.Player);

                if (paperdollGump == null)
                {
                    GameActions.OpenPaperdoll(World.Player);
                }
                else
                {
                    paperdollGump.SetInScreen();
                    paperdollGump.BringOnTop();
                }

                break;

            case Buttons.Inventory:
                Item backpack = World.Player.FindItemByLayer(Layer.Backpack);
                if (backpack == null)
                {
                    return;
                }

                ContainerGump backpackGump = UIManager.GetGump <ContainerGump>(backpack);

                if (backpackGump == null)
                {
                    GameActions.DoubleClick(backpack);
                }
                else
                {
                    backpackGump.SetInScreen();
                    backpackGump.BringOnTop();
                }

                break;

            case Buttons.Journal:
                JournalGump journalGump = UIManager.GetGump <JournalGump>();

                if (journalGump == null)
                {
                    UIManager.Add(new JournalGump
                    {
                        X = 64, Y = 64
                    });
                }
                else
                {
                    journalGump.SetInScreen();
                    journalGump.BringOnTop();
                }

                break;

            case Buttons.Chat:
                if (UOChatManager.ChatIsEnabled == CHAT_STATUS.ENABLED)
                {
                    UOChatGump chatGump = UIManager.GetGump <UOChatGump>();

                    if (chatGump == null)
                    {
                        UIManager.Add(new UOChatGump());
                    }
                    else
                    {
                        chatGump.SetInScreen();
                        chatGump.BringOnTop();
                    }
                }
                else if (UOChatManager.ChatIsEnabled == CHAT_STATUS.ENABLED_USER_REQUEST)
                {
                    UOChatGumpChooseName chatGump = UIManager.GetGump <UOChatGumpChooseName>();

                    if (chatGump == null)
                    {
                        UIManager.Add(new UOChatGumpChooseName());
                    }
                    else
                    {
                        chatGump.SetInScreen();
                        chatGump.BringOnTop();
                    }
                }

                break;

            case Buttons.GlobalChat:
                Log.Warn("Chat button pushed! Not implemented yet!");
                GameActions.Print("GlobalChat not implemented yet.", 0x23, MessageType.System);
                break;

            case Buttons.UOStore:
                if (Client.Version >= ClientVersion.CV_706400)
                {
                    NetClient.Socket.Send(new POpenUOStore());
                }
                break;

            case Buttons.Help:
                GameActions.RequestHelp();

                break;

            case Buttons.Debug:

                DebugGump debugGump = UIManager.GetGump <DebugGump>();

                if (debugGump == null)
                {
                    debugGump = new DebugGump(100, 100);
                    UIManager.Add(debugGump);
                }
                else
                {
                    debugGump.IsVisible = !debugGump.IsVisible;
                    debugGump.SetInScreen();
                }

                break;

            case Buttons.NetStats:
                NetworkStatsGump netstatsgump = UIManager.GetGump <NetworkStatsGump>();

                if (netstatsgump == null)
                {
                    netstatsgump = new NetworkStatsGump(100, 100);
                    UIManager.Add(netstatsgump);
                }
                else
                {
                    netstatsgump.IsVisible = !netstatsgump.IsVisible;
                    netstatsgump.SetInScreen();
                }

                break;

            case Buttons.WorldMap:

                WorldMapGump worldMap = UIManager.GetGump <WorldMapGump>();

                if (worldMap == null || worldMap.IsDisposed)
                {
                    worldMap = new WorldMapGump();
                    UIManager.Add(worldMap);
                }
                else
                {
                    worldMap.BringOnTop();
                    worldMap.SetInScreen();
                }
                break;
            }
        }
コード例 #2
0
ファイル: TopBarGump.cs プロジェクト: Juzzver/MobileUO
        public override void OnButtonClick(int buttonID)
        {
            switch ((Buttons)buttonID)
            {
            case Buttons.Map:
                MiniMapGump miniMapGump = UIManager.GetGump <MiniMapGump>();

                if (miniMapGump == null)
                {
                    UIManager.Add(new MiniMapGump());
                }
                else
                {
                    miniMapGump.SetInScreen();
                    miniMapGump.BringOnTop();
                }

                break;

            case Buttons.Paperdoll:
                PaperDollGump paperdollGump = UIManager.GetGump <PaperDollGump>(World.Player);

                if (paperdollGump == null)
                {
                    GameActions.OpenPaperdoll(World.Player);
                }
                else
                {
                    paperdollGump.SetInScreen();
                    paperdollGump.BringOnTop();
                }

                break;

            case Buttons.Inventory:
                Item backpack = World.Player.Equipment[(int)Layer.Backpack];

                ContainerGump backpackGump = UIManager.GetGump <ContainerGump>(backpack);

                if (backpackGump == null)
                {
                    GameActions.DoubleClick(backpack);
                }
                else
                {
                    backpackGump.SetInScreen();
                    backpackGump.BringOnTop();
                }

                break;

            case Buttons.Journal:
                JournalGump journalGump = UIManager.GetGump <JournalGump>();

                if (journalGump == null)
                {
                    UIManager.Add(new JournalGump
                    {
                        X = 64, Y = 64
                    });
                }
                else
                {
                    journalGump.SetInScreen();
                    journalGump.BringOnTop();
                }

                break;

            case Buttons.Chat:
                if (UOChatManager.ChatIsEnabled)
                {
                    UOChatGump chatGump = UIManager.GetGump <UOChatGump>();

                    if (chatGump == null)
                    {
                        UIManager.Add(new UOChatGump());
                    }
                    else
                    {
                        chatGump.SetInScreen();
                        chatGump.BringOnTop();
                    }
                }
                break;

            case Buttons.GlobalChat:
                Log.Warn("Chat button pushed! Not implemented yet!");
                GameActions.Print("GlobalChat not implemented yet.", 0x23, MessageType.System);
                break;

            case Buttons.UOStore:
                if (Client.Version >= ClientVersion.CV_706400)
                {
                    NetClient.Socket.Send(new POpenUOStore());
                }
                break;

            case Buttons.Help:
                GameActions.RequestHelp();

                break;

            case Buttons.Debug:

                DebugGump debugGump = UIManager.GetGump <DebugGump>();

                if (debugGump == null)
                {
                    debugGump = new DebugGump
                    {
                        X = ProfileManager.Current.DebugGumpPosition.X,
                        Y = ProfileManager.Current.DebugGumpPosition.Y
                    };

                    UIManager.Add(debugGump);
                }
                else
                {
                    debugGump.IsVisible = !debugGump.IsVisible;
                    debugGump.SetInScreen();
                }

                //Engine.DropFpsMinMaxValues();

                break;

            case Buttons.WorldMap:

                WorldMapGump worldMap = UIManager.GetGump <WorldMapGump>();

                if (worldMap == null || worldMap.IsDisposed)
                {
                    worldMap = new WorldMapGump();
                    UIManager.Add(worldMap);
                }
                else
                {
                    worldMap.BringOnTop();
                    worldMap.SetInScreen();
                }
                break;
            }
        }