/// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            if (!par1GuiButton.Enabled)
            {
                return;
            }

            int i = GuiGameSettings.GuiScale;

            if (par1GuiButton.Id < 100 && (par1GuiButton is GuiSmallButton))
            {
                GuiGameSettings.SetOptionValue(((GuiSmallButton)par1GuiButton).ReturnOptions(), 1);
                par1GuiButton.DisplayString = GuiGameSettings.GetKeyBinding(Options.GetOptions(par1GuiButton.Id));
            }

            if (par1GuiButton.Id == 200)
            {
                Mc.GameSettings.SaveOptions();
                Mc.DisplayGuiScreen(ParentGuiScreen);
            }

            if (GuiGameSettings.GuiScale != i)
            {
                ScaledResolution scaledresolution = new ScaledResolution(Mc.GameSettings, Mc.DisplayWidth, Mc.DisplayHeight);
                int j = scaledresolution.GetScaledWidth();
                int k = scaledresolution.GetScaledHeight();
                SetWorldAndResolution(Mc, j, k);
            }
        }
        /// <summary>
        /// Gets the selected world.
        /// </summary>
        public virtual void SelectWorld(int par1)
        {
            Mc.DisplayGuiScreen(null);

            if (Selected)
            {
                return;
            }

            Selected = true;
            int i = SaveList[par1].GetGameType();

            if (i == 0)
            {
                Mc.PlayerController = new PlayerControllerSP(Mc);
            }
            else
            {
                Mc.PlayerController = new PlayerControllerCreative(Mc);
            }

            string s = GetSaveFileName(par1);

            if (s == null)
            {
                s = (new StringBuilder()).Append("World").Append(par1).ToString();
            }

            Mc.StartWorld(s, GetSaveName(par1), null);
            Mc.DisplayGuiScreen(null);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            if (!par1GuiButton.Enabled)
            {
                return;
            }

            if (par1GuiButton.Id == 0)
            {
                Mc.DisplayGuiScreen(ParentGui);
            }
            else if (par1GuiButton.Id == 1)
            {
                SelectedSlot = SlotGeneral;
            }
            else if (par1GuiButton.Id == 3)
            {
                SelectedSlot = SlotItem;
            }
            else if (par1GuiButton.Id == 2)
            {
                SelectedSlot = SlotBlock;
            }
            else
            {
                SelectedSlot.ActionPerformed(par1GuiButton);
            }
        }
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            if (par1GuiButton.Id == 0)
            {
                Mc.DisplayGuiScreen(new GuiOptions(this, Mc.GameSettings));
            }

            if (par1GuiButton.Id == 5)
            {
                Mc.DisplayGuiScreen(new GuiLanguage(this, Mc.GameSettings));
            }

            if (par1GuiButton.Id == 1)
            {
                Mc.DisplayGuiScreen(new GuiSelectWorld(this));
            }

            if (par1GuiButton.Id == 2)
            {
                Mc.DisplayGuiScreen(new GuiMultiplayer(this));
            }

            if (par1GuiButton.Id == 3)
            {
                Mc.DisplayGuiScreen(new GuiTexturePacks(this));
            }

            if (par1GuiButton.Id == 4)
            {
                Mc.Shutdown();
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Called from the main game loop to update the screen.
 /// </summary>
 public override void UpdateScreen()
 {
     if (!Mc.PlayerController.IsInCreativeMode())
     {
         Mc.DisplayGuiScreen(new GuiInventory(Mc.ThePlayer));
     }
 }
 /// <summary>
 /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
 /// </summary>
 protected override void ActionPerformed(GuiButton par1GuiButton)
 {
     if (par1GuiButton.Id == 0)
     {
         Mc.DisplayGuiScreen(new GuiMainMenu());
     }
 }
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            if (!par1GuiButton.Enabled)
            {
                return;
            }

            if (par1GuiButton.Id == 2)
            {
                string s = ServerList[SelectedServer].Name;

                if (s != null)
                {
                    DeleteClicked = true;
                    StringTranslate stringtranslate = StringTranslate.GetInstance();
                    string          s1       = stringtranslate.TranslateKey("selectServer.deleteQuestion");
                    string          s2       = new StringBuilder().Append("'").Append(s).Append("' ").Append(stringtranslate.TranslateKey("selectServer.deleteWarning")).ToString();
                    string          s3       = stringtranslate.TranslateKey("selectServer.deleteButton");
                    string          s4       = stringtranslate.TranslateKey("gui.cancel");
                    GuiYesNo        guiyesno = new GuiYesNo(this, s1, s2, s3, s4, SelectedServer);
                    Mc.DisplayGuiScreen(guiyesno);
                }
            }
            else if (par1GuiButton.Id == 1)
            {
                JoinServer(SelectedServer);
            }
            else if (par1GuiButton.Id == 4)
            {
                DirectClicked = true;
                Mc.DisplayGuiScreen(new GuiScreenServerList(this, TempServer = new ServerNBTStorage(StatCollector.TranslateToLocal("selectServer.defaultName"), "")));
            }
            else if (par1GuiButton.Id == 3)
            {
                AddClicked = true;
                Mc.DisplayGuiScreen(new GuiScreenAddServer(this, TempServer = new ServerNBTStorage(StatCollector.TranslateToLocal("selectServer.defaultName"), "")));
            }
            else if (par1GuiButton.Id == 7)
            {
                EditClicked = true;
                ServerNBTStorage servernbtstorage = (ServerNBTStorage)ServerList[SelectedServer];
                Mc.DisplayGuiScreen(new GuiScreenAddServer(this, TempServer = new ServerNBTStorage(servernbtstorage.Name, servernbtstorage.Host)));
            }
            else if (par1GuiButton.Id == 0)
            {
                Mc.DisplayGuiScreen(ParentScreen);
            }
            else if (par1GuiButton.Id == 8)
            {
                Mc.DisplayGuiScreen(new GuiMultiplayer(ParentScreen));
            }
            else
            {
                ServerSlotContainer.ActionPerformed(par1GuiButton);
            }
        }
Ejemplo n.º 8
0
        ///<summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        ///</summary>
        protected new void ActionPerformed(GuiButton par1GuiButton)
        {
            if (par1GuiButton.Id == 1)
            {
                Mc.DisplayGuiScreen(null);
                Mc.SetIngameFocus();
            }

            base.ActionPerformed(par1GuiButton);
        }
        public override void ConfirmClicked(bool par1, int par2)
        {
            if (DeleteClicked)
            {
                DeleteClicked = false;

                if (par1)
                {
                    ServerList.RemoveAt(par2);
                    SaveServerList();
                }

                Mc.DisplayGuiScreen(this);
            }
            else if (DirectClicked)
            {
                DirectClicked = false;

                if (par1)
                {
                    JoinServer(TempServer);
                }
                else
                {
                    Mc.DisplayGuiScreen(this);
                }
            }
            else if (AddClicked)
            {
                AddClicked = false;

                if (par1)
                {
                    ServerList.Add(TempServer);
                    SaveServerList();
                }

                Mc.DisplayGuiScreen(this);
            }
            else if (EditClicked)
            {
                EditClicked = false;

                if (par1)
                {
                    ServerNBTStorage servernbtstorage = ServerList[SelectedServer];
                    servernbtstorage.Name = TempServer.Name;
                    servernbtstorage.Host = TempServer.Host;
                    SaveServerList();
                }

                Mc.DisplayGuiScreen(this);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            if (par1GuiButton.Id == 0)
            {
                Mc.DisplayGuiScreen(new GuiAchievements(Mc.StatFileWriter));
            }

            if (par1GuiButton.Id == 1)
            {
                Mc.DisplayGuiScreen(new GuiStats(this, Mc.StatFileWriter));
            }
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Adds the buttons (and other controls) to the screen in question.
 /// </summary>
 public override void InitGui()
 {
     if (!Mc.PlayerController.IsInCreativeMode())
     {
         Mc.DisplayGuiScreen(new GuiInventory(Mc.ThePlayer));
     }
     else
     {
         base.InitGui();
         ControlList.Clear();
     }
 }
Ejemplo n.º 12
0
 ///<summary>
 /// Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
 ///</summary>
 protected new void KeyTyped(char par1, int par2)
 {
     if (par2 == Mc.GameSettings.KeyBindInventory.KeyCode)
     {
         Mc.DisplayGuiScreen(null);
         Mc.SetIngameFocus();
     }
     else
     {
         base.KeyTyped(par1, par2);
     }
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            if (!par1GuiButton.Enabled)
            {
                return;
            }

            if (par1GuiButton.Id == 0)
            {
                EntitySign.OnInventoryChanged();
                Mc.DisplayGuiScreen(null);
            }
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Respawns the player.
 /// </summary>
 private void RespawnPlayer()
 {
     if (Mc.TheWorld.IsRemote)
     {
         EntityClientPlayerMP entityclientplayermp = (EntityClientPlayerMP)Mc.ThePlayer;
         entityclientplayermp.SendQueue.AddToSendQueue(new Packet9Respawn(entityclientplayermp.Dimension, (sbyte)Mc.TheWorld.DifficultySetting, Mc.TheWorld.GetWorldInfo().GetTerrainType(), Mc.TheWorld.GetHeight(), 0));
     }
     else
     {
         Mc.DisplayGuiScreen(null);
         Mc.Respawn(Mc.TheWorld.IsRemote, 0, true);
     }
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            if (par1GuiButton.Id == 0)
            {
                Cancelled = true;

                if (ClientHandler != null)
                {
                    ClientHandler.Disconnect();
                }

                Mc.DisplayGuiScreen(new GuiMainMenu());
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
        /// </summary>
        protected override void KeyTyped(char par1, int par2)
        {
            if (par2 == 15)
            {
                CompletePlayerName();
            }
            else
            {
                Field_50060_d = false;
            }

            if (par2 == 1)
            {
                Mc.DisplayGuiScreen(null);
            }
            else if (par2 == 28)
            {
                string s = Field_50064_a.GetText().Trim();

                if (s.Length > 0 && !Mc.LineIsCommand(s))
                {
                    Mc.ThePlayer.SendChatMessage(s);
                }

                Mc.DisplayGuiScreen(null);
            }
            else if (par2 == 200)
            {
                Func_50058_a(-1);
            }
            else if (par2 == 208)
            {
                Func_50058_a(1);
            }
            else if (par2 == 201)
            {
                Mc.IngameGUI.Func_50011_a(19);
            }
            else if (par2 == 209)
            {
                Mc.IngameGUI.Func_50011_a(-19);
            }
            else
            {
                Field_50064_a.Func_50037_a(par1, par2);
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            for (int i = 0; i < Options.KeyBindings.Length; i++)
            {
                ControlList[i].DisplayString = Options.GetOptionDisplayString(i);
            }

            if (par1GuiButton.Id == 200)
            {
                Mc.DisplayGuiScreen(ParentScreen);
            }
            else
            {
                ButtonId = par1GuiButton.Id;
                par1GuiButton.DisplayString = (new StringBuilder()).Append("> ").Append(Options.GetOptionDisplayString(par1GuiButton.Id)).Append(" <").ToString();
            }
        }
        public override void ConfirmClicked(bool par1, int par2)
        {
            if (Deleting)
            {
                Deleting = false;

                if (par1)
                {
                    ISaveFormat isaveformat = Mc.GetSaveLoader();
                    isaveformat.FlushCache();
                    isaveformat.DeleteWorldDirectory(GetSaveFileName(par2));
                    LoadSaves();
                }

                Mc.DisplayGuiScreen(this);
            }
        }
        /// <summary>
        /// Adds the buttons (and other controls) to the screen in question.
        /// </summary>
        public override void InitGui()
        {
            ControlList.Clear();

            if (Mc.PlayerController.IsInCreativeMode())
            {
                Mc.DisplayGuiScreen(new GuiContainerCreative(Mc.ThePlayer));
            }
            else
            {
                base.InitGui();

                if (Mc.ThePlayer.GetActivePotionEffects().Count != 0)
                {
                    GuiLeft = 160 + (Width - XSize - 200) / 2;
                }
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            if (!par1GuiButton.Enabled)
            {
                return;
            }

            if (par1GuiButton.Id == 1)
            {
                Mc.DisplayGuiScreen(ParentGuiScreen);
            }
            else if (par1GuiButton.Id == 0)
            {
                ISaveFormat isaveformat = Mc.GetSaveLoader();
                isaveformat.RenameWorld(WorldName, TheGuiTextField.GetText().Trim());
                Mc.DisplayGuiScreen(ParentGuiScreen);
            }
        }
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            if (!par1GuiButton.Enabled)
            {
                return;
            }

            if (par1GuiButton.Id == 2)
            {
                string s = GetSaveName(SelectedWorld);

                if (s != null)
                {
                    Deleting = true;
                    StringTranslate stringtranslate = StringTranslate.GetInstance();
                    string          s1       = stringtranslate.TranslateKey("selectWorld.deleteQuestion");
                    string          s2       = (new StringBuilder()).Append("'").Append(s).Append("' ").Append(stringtranslate.TranslateKey("selectWorld.deleteWarning")).ToString();
                    string          s3       = stringtranslate.TranslateKey("selectWorld.deleteButton");
                    string          s4       = stringtranslate.TranslateKey("gui.cancel");
                    GuiYesNo        guiyesno = new GuiYesNo(this, s1, s2, s3, s4, SelectedWorld);
                    Mc.DisplayGuiScreen(guiyesno);
                }
            }
            else if (par1GuiButton.Id == 1)
            {
                SelectWorld(SelectedWorld);
            }
            else if (par1GuiButton.Id == 3)
            {
                Mc.DisplayGuiScreen(new GuiCreateWorld(this));
            }
            else if (par1GuiButton.Id == 6)
            {
                Mc.DisplayGuiScreen(new GuiRenameWorld(this, GetSaveFileName(SelectedWorld)));
            }
            else if (par1GuiButton.Id == 0)
            {
                Mc.DisplayGuiScreen(ParentScreen);
            }
            else
            {
                WorldSlotContainer.ActionPerformed(par1GuiButton);
            }
        }
Ejemplo n.º 22
0
        private void ConnectToServer()
        {
            try
            {
                ClientHandler = new NetClientHandler(Mc, IP, Port);

                if (Cancelled)
                {
                    return;
                }

                ClientHandler.AddToSendQueue(new Packet2Handshake(Mc.Session.Username, IP, Port));
            }/*
              * catch (UnknownHostException unknownhostexception)
              * {
              * if (Cancelled)
              * {
              *     return;
              * }
              *
              * Mc.DisplayGuiScreen(new GuiDisconnected("connect.failed", "disconnect.genericReason", new object[] { (new StringBuilder()).Append("Unknown host '").Append(IP).Append("'").ToString() }));
              * }*/
            catch (SocketException connectexception)
            {
                if (Cancelled)
                {
                    return;
                }

                Mc.DisplayGuiScreen(new GuiDisconnected("connect.failed", "disconnect.genericReason", new object[] { connectexception.Message }));
            }
            catch (Exception exception)
            {
                if (Cancelled)
                {
                    return;
                }

                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
                Mc.DisplayGuiScreen(new GuiDisconnected("connect.failed", "disconnect.genericReason", new object[] { exception.ToString() }));
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            if (!par1GuiButton.Enabled)
            {
                return;
            }

            if (par1GuiButton.Id == 5)
            {            /*
                          *     bool flag = false;
                          *
                          *     try
                          *     {
                          *             Type class1 = Type.GetType("java.awt.Desktop");
                          *             object obj = class1.GetMethod("getDesktop", new Type[0]).Invoke(null, new object[0]);
                          *             class1.GetMethod("browse", new Type[] { typeof(URI) }).Invoke(obj, new object[] { (new File(Minecraft.GetMinecraftDir(), "texturepacks")).toURI() });
                          *     }
                          *     catch (Exception throwable)
                          *     {
                          *             Console.WriteLine(throwable.ToString());
                          *             Console.Write(throwable.StackTrace);
                          *             flag = true;
                          *     }
                          *
                          *     if (flag)
                          *     {
                          *             Console.WriteLine("Opening via Sys class!");
                          *             Sys.openURL((new StringBuilder()).Append("file://").Append(FileLocation).ToString());
                          *     }*/
            }
            else if (par1GuiButton.Id == 6)
            {
                //Mc.RenderEngineOld.RefreshTextures();
                Mc.DisplayGuiScreen(GuiScreen);
            }
            else
            {
                GuiTexturePackSlot.ActionPerformed(par1GuiButton);
            }
        }
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            switch (par1GuiButton.Id)
            {
            case 2:
            case 3:
            default:
                break;

            case 0:
                Mc.DisplayGuiScreen(new GuiOptions(this, Mc.GameSettings));
                break;

            case 1:
                Mc.StatFileWriter.ReadStat(StatList.LeaveGameStat, 1);

                if (Mc.IsMultiplayerWorld())
                {
                    Mc.TheWorld.SendQuittingDisconnectingPacket();
                }

                Mc.ChangeWorld1(null);
                Mc.DisplayGuiScreen(new GuiMainMenu());
                break;

            case 4:
                Mc.DisplayGuiScreen(null);
                Mc.SetIngameFocus();
                break;

            case 5:
                Mc.DisplayGuiScreen(new GuiAchievements(Mc.StatFileWriter));
                break;

            case 6:
                Mc.DisplayGuiScreen(new GuiStats(this, Mc.StatFileWriter));
                break;
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            if (!par1GuiButton.Enabled)
            {
                return;
            }

            switch (par1GuiButton.Id)
            {
            case 6:
                Field_44006_d.SaveOptions();
                Mc.DisplayGuiScreen(ParentGui);
                break;

            default:
                LanguageList.ActionPerformed(par1GuiButton);
                break;

            case 5:
                break;
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Called when the mouse is clicked.
        /// </summary>
        protected override void MouseClicked(int par1, int par2, int par3)
        {
            if (par3 == 0)
            {
                ChatClickData chatclickdata = Mc.IngameGUI.Func_50012_a(0, 0);                //Mouse.getX(), Mouse.getY());

                if (chatclickdata != null)
                {
                    string uri = chatclickdata.Func_50089_b();

                    if (uri != null)
                    {
                        Field_50065_j = uri;
                        Mc.DisplayGuiScreen(new GuiChatConfirmLink(this, this, chatclickdata.Func_50088_a(), 0, chatclickdata));
                        return;
                    }
                }
            }

            Field_50064_a.MouseClicked(par1, par2, par3);
            base.MouseClicked(par1, par2, par3);
        }
        /// <summary>
        /// Join server by ServerNBTStorage
        /// </summary>
        private void JoinServer(ServerNBTStorage par1ServerNBTStorage)
        {
            string s = par1ServerNBTStorage.Host;

            string[] @as = StringHelperClass.StringSplit(s, ":", true);

            if (s.StartsWith("["))
            {
                int i = s.IndexOf("]");

                if (i > 0)
                {
                    string s1 = s.Substring(1, i - 1);
                    string s2 = s.Substring(i + 1).Trim();

                    if (s2.StartsWith(":") && s2.Length > 0)
                    {
                        s2     = s2.Substring(1);
                        @as    = new string[2];
                        @as[0] = s1;
                        @as[1] = s2;
                    }
                    else
                    {
                        @as    = new string[1];
                        @as[0] = s1;
                    }
                }
            }

            if (@as.Length > 2)
            {
                @as    = new string[1];
                @as[0] = s;
            }

            Mc.DisplayGuiScreen(new GuiConnecting(Mc, @as[0], @as.Length <= 1 ? 25565 : ParseIntWithDefault(@as[1], 25565)));
        }
Ejemplo n.º 28
0
        public override void ConfirmClicked(bool par1, int par2)
        {
            if (par2 == 0)
            {
                if (par1)
                {
                    try
                    {
                        Type   class1 = Type.GetType("java.awt.Desktop");
                        object obj    = class1.GetMethod("getDesktop", new Type[0]).Invoke(null, new object[0]);
                        //class1.GetMethod("browse", new Type[] { typeof(URI) }).Invoke(obj, new object[] { Field_50065_j });
                    }
                    catch (Exception throwable)
                    {
                        Console.WriteLine(throwable.ToString());
                        Console.Write(throwable.StackTrace);
                    }
                }

                Field_50065_j = null;
                Mc.DisplayGuiScreen(this);
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            if (!par1GuiButton.Enabled)
            {
                return;
            }

            if (par1GuiButton.Id < 100 && (par1GuiButton is GuiSmallButton))
            {
                Settings.SetOptionValue(((GuiSmallButton)par1GuiButton).ReturnOptions(), 1);
                par1GuiButton.DisplayString = Settings.GetKeyBinding(Options.GetOptions(par1GuiButton.Id));
            }

            if (par1GuiButton.Id == 101)
            {
                Mc.GameSettings.SaveOptions();
                Mc.DisplayGuiScreen(new GuiVideoSettings(this, Settings));
            }

            if (par1GuiButton.Id == 100)
            {
                Mc.GameSettings.SaveOptions();
                Mc.DisplayGuiScreen(new GuiControls(this, Settings));
            }

            if (par1GuiButton.Id == 102)
            {
                Mc.GameSettings.SaveOptions();
                Mc.DisplayGuiScreen(new GuiLanguage(this, Settings));
            }

            if (par1GuiButton.Id == 200)
            {
                Mc.GameSettings.SaveOptions();
                Mc.DisplayGuiScreen(ParentScreen);
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
        /// </summary>
        protected override void ActionPerformed(GuiButton par1GuiButton)
        {
            switch (par1GuiButton.Id)
            {
            default:
                break;

            case 1:
                if (Mc.TheWorld.GetWorldInfo().IsHardcoreModeEnabled())
                {
                    string s = Mc.TheWorld.GetSaveHandler().GetSaveDirectoryName();
                    Mc.ExitToMainMenu("Deleting world");
                    ISaveFormat isaveformat = Mc.GetSaveLoader();
                    isaveformat.FlushCache();
                    isaveformat.DeleteWorldDirectory(s);
                    Mc.DisplayGuiScreen(new GuiMainMenu());
                }
                else
                {
                    Mc.ThePlayer.RespawnPlayer();
                    Mc.DisplayGuiScreen(null);
                }

                break;

            case 2:
                if (Mc.IsMultiplayerWorld())
                {
                    Mc.TheWorld.SendQuittingDisconnectingPacket();
                }

                Mc.ChangeWorld1(null);
                Mc.DisplayGuiScreen(new GuiMainMenu());
                break;
            }
        }