📄 form1.vb.svn-base
字号:
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents lstLog As System.Windows.Forms.ListBox
Friend WithEvents lblUserCount As System.Windows.Forms.Label
Friend WithEvents mnuMain As System.Windows.Forms.MainMenu
Friend WithEvents mnuFile As System.Windows.Forms.MenuItem
Friend WithEvents mnuSettings As System.Windows.Forms.MenuItem
Friend WithEvents mnuAbout As System.Windows.Forms.MenuItem
Friend WithEvents mnuServer As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Friend WithEvents mnuExit As System.Windows.Forms.MenuItem
Friend WithEvents mnuRestart As System.Windows.Forms.MenuItem
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1))
Me.lstLog = New System.Windows.Forms.ListBox
Me.lblUserCount = New System.Windows.Forms.Label
Me.mnuMain = New System.Windows.Forms.MainMenu(Me.components)
Me.mnuFile = New System.Windows.Forms.MenuItem
Me.mnuSettings = New System.Windows.Forms.MenuItem
Me.MenuItem1 = New System.Windows.Forms.MenuItem
Me.mnuExit = New System.Windows.Forms.MenuItem
Me.mnuServer = New System.Windows.Forms.MenuItem
Me.mnuSendGlobalMessage = New System.Windows.Forms.MenuItem
Me.mnuRestart = New System.Windows.Forms.MenuItem
Me.mnuAbout = New System.Windows.Forms.MenuItem
Me.lstPlayers = New System.Windows.Forms.ListBox
Me.SuspendLayout()
'
'lstLog
'
Me.lstLog.HorizontalScrollbar = True
Me.lstLog.Location = New System.Drawing.Point(8, 8)
Me.lstLog.Name = "lstLog"
Me.lstLog.ScrollAlwaysVisible = True
Me.lstLog.Size = New System.Drawing.Size(272, 212)
Me.lstLog.TabIndex = 0
'
'lblUserCount
'
Me.lblUserCount.Location = New System.Drawing.Point(8, 232)
Me.lblUserCount.Name = "lblUserCount"
Me.lblUserCount.Size = New System.Drawing.Size(104, 16)
Me.lblUserCount.TabIndex = 2
Me.lblUserCount.Text = "User Count: 0"
'
'mnuMain
'
Me.mnuMain.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuFile, Me.mnuServer, Me.mnuAbout})
'
'mnuFile
'
Me.mnuFile.Index = 0
Me.mnuFile.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuSettings, Me.MenuItem1, Me.mnuExit})
Me.mnuFile.Text = "&File"
'
'mnuSettings
'
Me.mnuSettings.Index = 0
Me.mnuSettings.Text = "&Settings"
'
'MenuItem1
'
Me.MenuItem1.Index = 1
Me.MenuItem1.Text = "-"
'
'mnuExit
'
Me.mnuExit.Index = 2
Me.mnuExit.Text = "&Exit"
'
'mnuServer
'
Me.mnuServer.Index = 1
Me.mnuServer.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuSendGlobalMessage, Me.mnuRestart})
Me.mnuServer.Text = "&Server"
'
'mnuSendGlobalMessage
'
Me.mnuSendGlobalMessage.Index = 0
Me.mnuSendGlobalMessage.Text = "&Send Global Message"
'
'mnuRestart
'
Me.mnuRestart.Index = 1
Me.mnuRestart.Text = "&Restart"
'
'mnuAbout
'
Me.mnuAbout.Index = 2
Me.mnuAbout.Text = "&About"
'
'lstPlayers
'
Me.lstPlayers.HorizontalScrollbar = True
Me.lstPlayers.Location = New System.Drawing.Point(295, 8)
Me.lstPlayers.Name = "lstPlayers"
Me.lstPlayers.ScrollAlwaysVisible = True
Me.lstPlayers.Size = New System.Drawing.Size(184, 212)
Me.lstPlayers.TabIndex = 3
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(488, 251)
Me.Controls.Add(Me.lstPlayers)
Me.Controls.Add(Me.lblUserCount)
Me.Controls.Add(Me.lstLog)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.Menu = Me.mnuMain
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Game Server"
Me.ResumeLayout(False)
End Sub
#End Region
Dim LoggedIn As Boolean = False
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If LoggedIn Or MyServer Then
GMCommands.GMShout("", "##### Server Shutting Down ##### [](*)")
Dim i, pC As Integer
pC = lstPlayers.Items.Count - 1
For i = 0 To pC
Dim pID As Integer
pID = PlayerList(lstPlayers.Items.Item(0))
Socket.DisconnectUser(pID)
Next i
SaveItemID()
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Pass As String
Me.CheckForIllegalCrossThreadCalls = False
FrmMain = Me
If MyServer Then
LoadServer.Start()
Me.Text = "Game Server - " & Config.ServerName & " - " & Config.GameIP
Exit Sub
End If
Me.Show()
AddLog("Server", "Enter the password and press enter.")
Pass = InputBox("Please enter the password to start the Game Server", "Game Server Login", "", 9999, 9999)
If Pass = gspw Then
LoggedIn = True
FrmMain.lstLog.Items.Clear()
LoadServer.Start()
Else
Me.Close()
Application.Exit()
End If
Me.Text = "Game Server - " & Config.ServerName & " - " & Config.GameIP
End Sub
Public Sub UpdateUserCount()
lblUserCount.Text = "User Count: " & UserCount.ToString
End Sub
Private Sub mnuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click
Close()
End Sub
Private Sub mnuSettings_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuSettings.Click
If SettingsFrm Is Nothing Then
SettingsFrm = New frmSettings
End If
SettingsFrm.ShowDialog()
End Sub
Private Sub mnuRestart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuRestart.Click
Log(":Server Restarted", "")
Close()
Shell("Game Server.exe", AppWinStyle.NormalFocus)
End Sub
Private Sub mnuSendGlobalMessage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuSendGlobalMessage.Click
Dim Message As String = ""
Message = InputBox("Please type the message you would like to be announced.", "Server Announcment")
If Not Message = "" Then
GMCommands.GMShout("Server", Message)
End If
End Sub
Friend WithEvents lstPlayers As System.Windows.Forms.ListBox
Friend WithEvents mnuSendGlobalMessage As System.Windows.Forms.MenuItem
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -