⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 octopus.frm

📁 VB版的小游戏
💻 FRM
📖 第 1 页 / 共 5 页
字号:

Private Sub Alarm_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    DoMouseUp Button, Shift, X, Y
End Sub

Private Sub Arm_DblClick()
    mBack_Click
End Sub

Private Sub Arm_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        DoMouseDown Button, Shift, X, Y
    Else
        Form1.PopupMenu mPopupMenu
    End If
End Sub

Private Sub Arm_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        DoMouseMove Button, Shift, X, Y
    End If
End Sub

Private Sub Arm_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    DoMouseUp Button, Shift, X, Y
End Sub

Private Sub BabyOctopus_DblClick()
    mBack_Click
End Sub

Private Sub BabyOctopus_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        DoMouseDown Button, Shift, X, Y
    Else
        Form1.PopupMenu mPopupMenu
    End If
End Sub

Private Sub BabyOctopus_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        DoMouseMove Button, Shift, X, Y
    End If
End Sub

Private Sub BabyOctopus_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    DoMouseUp Button, Shift, X, Y
End Sub

Private Sub Diver_DblClick(Index As Integer)
    mBack_Click
End Sub

Private Sub Diver_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        DoMouseDown Button, Shift, X, Y
    Else
        Form1.PopupMenu mPopupMenu
    End If
End Sub

Private Sub Diver_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        DoMouseMove Button, Shift, X, Y
    End If
End Sub

Private Sub Diver_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    DoMouseUp Button, Shift, X, Y
End Sub

Private Sub DiverStep_DblClick(Index As Integer)
    mBack_Click
End Sub

Private Sub DiverStep_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        DoMouseDown Button, Shift, X, Y
    Else
        Form1.PopupMenu mPopupMenu
    End If
End Sub

Private Sub DiverStep_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        DoMouseMove Button, Shift, X, Y
    End If
End Sub

Private Sub DiverStep_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    DoMouseUp Button, Shift, X, Y
End Sub

Private Sub Form_Load()
    Dim i As Byte
    
    Randomize Second(Time)
    SetWindowRgn hWnd, CreateRectRgn(3, 22, 336, 220), True
    ButtonNo = -1
    GameNo = 0
    ButtonPressed = False
    Bag = 0
    ClearMissCount = 0
    TempCount = 0
    SetAlarm = 0
    SetTime = 0
    ButtonPressedTime = 0
    BackCase.Left = FrontCase.Left
    BackCase.Top = FrontCase.Top
    StopAlarm = False
    Alarming = False
    
    For i = 0 To 4
        EndOfTentacle(i) = 0
        TentacleDirection(i) = 0
        TentacleCount(i) = 0
    Next
    
    MaxTentacleCount(0) = 3
    MaxTentacleCount(1) = 4
    MaxTentacleCount(2) = 5
    MaxTentacleCount(3) = 4
    MaxTentacleCount(4) = 3
    
    TentacleNo = 0
    DiverPosition = 0
    OnTheBoatCount = 10
    Caught = 0
    Score = 0
    Miss = 0
    Playing = False
    SecondCount = 0
    ScoreShown = False
    
    If GetSetting("Game & Watch Simulator", "Octopus", "Sound", "NotFound") = "NotFound" Then
        mSound.Checked = True
        SaveSetting "Game & Watch Simulator", "Octopus", "Sound", mSound.Checked
    Else
        mSound.Checked = GetSetting("Game & Watch Simulator", "Octopus", "Sound")
    End If
    
    If GetSetting("Game & Watch Simulator", "Octopus", "Left", "NotFound") = "NotFound" Then
        Left = -44
        SaveSetting "Game & Watch Simulator", "Octopus", "Left", Left
    Else
        Left = GetSetting("Game & Watch Simulator", "Octopus", "Left")
    End If
    
    If GetSetting("Game & Watch Simulator", "Octopus", "Top", "NotFound") = "NotFound" Then
        Top = -336
        SaveSetting "Game & Watch Simulator", "Octopus", "Top", Top
    Else
        Top = GetSetting("Game & Watch Simulator", "Octopus", "Top")
    End If

    If GetSetting("Game & Watch Simulator", "Octopus", "Seconds", "NotFound") <> "NotFound" Then
        DeleteSetting "Game & Watch Simulator", "Octopus", "Seconds"
    End If
    
    If GetSetting("Game & Watch Simulator", "Octopus", "Diver Speed", "NotFound") = "NotFound" Then
        SaveSetting "Game & Watch Simulator", "Octopus", "Diver Speed", 300
    End If
    
    If GetSetting("Game & Watch Simulator", "Octopus", "Game A Speed", "NotFound") = "NotFound" Then
        SaveSetting "Game & Watch Simulator", "Octopus", "Game A Speed", 220
    End If
    
    If GetSetting("Game & Watch Simulator", "Octopus", "Game B Speed", "NotFound") = "NotFound" Then
        SaveSetting "Game & Watch Simulator", "Octopus", "Game B Speed", 170
    End If
    
    If GetSetting("Game & Watch Simulator", "Octopus", "Game A High Score", "NotFound") = "NotFound" Then
        SaveSetting "Game & Watch Simulator", "Octopus", "Game A High Score", 0
    End If
    
    If GetSetting("Game & Watch Simulator", "Octopus", "Game B High Score", "NotFound") = "NotFound" Then
        SaveSetting "Game & Watch Simulator", "Octopus", "Game B High Score", 0
    End If
    
    If GetSetting("Game & Watch Simulator", "Octopus", "Alarm Time", "NotFound") = "NotFound" Then
        SaveSetting "Game & Watch Simulator", "Octopus", "Alarm Time", "120000 PM"
        SaveSetting "Game & Watch Simulator", "Octopus", "Alarm On", False
    End If

    'Always on top
    If GetSetting("Game & Watch Simulator", "Octopus", "Always on Top", "NotFound") = "NotFound" Then
        mAlwaysOnTop.Checked = False
        SaveSetting "Game & Watch Simulator", "Octopus", "Always on Top", mAlwaysOnTop.Checked
    Else
        mAlwaysOnTop.Checked = GetSetting("Game & Watch Simulator", "Octopus", "Always on Top")
    End If
    
    If mAlwaysOnTop.Checked Then
        SetWindowPos hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
    Else
        SetWindowPos hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
    End If
    
    If GetSetting("Game & Watch Simulator", "Octopus", "Auto Show", "NotFound") = "NotFound" Then
        mAutoShow.Checked = True
        SaveSetting "Game & Watch Simulator", "Octopus", "Auto Show", mAutoShow.Checked
        mInstructions_Click
        SetWindowPos Form4.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
    Else
        mAutoShow.Checked = GetSetting("Game & Watch Simulator", "Octopus", "Auto Show")
    End If
    
    GameAButton.Picture = Button0(0).Picture
    GameBButton.Picture = Button0(0).Picture
    TimeButton.Picture = Button0(0).Picture
    LeftButton.Picture = Button1(0).Picture
    RightButton.Picture = Button1(0).Picture
    AlarmButton.Picture = Button2(0).Picture
    ACLButton.Picture = Button2(0).Picture
    Logo.Picture = GWLogo(0).Picture
    
    'set system tray
    SystemTray.cbSize = Len(SystemTray)                                         'size of system tray notification
    SystemTray.hWnd = Me.hWnd                                                     'form handle
    SystemTray.uId = vbNull
    SystemTray.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE  'show icon and tip in system tray and return messages
    SystemTray.ucallbackMessage = WM_MOUSEMOVE                'return messages in mousemove event when user do something with that icon
    SystemTray.hIcon = Icon                                                              'specify an icon to show in system tray
    SystemTray.szTip = "Octopus" & vbNullChar                                'specify tip text
    Call Shell_NotifyIcon(NIM_ADD, SystemTray)                               'add an icon into system tray
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If ButtonNo = -1 And Not ButtonPressed And (Add3Score = 0 Or Not Playing) Then
        If KeyCode = vbKeyLeft Or KeyCode = vbKeyUp Then 'Left
            If LeftButton.Picture <> Button1(1).Picture Then
                LeftButton.Picture = Button1(1).Picture
                ButtonPressed = True
                ButtonPressedTime = 0
            
                If Playing And Caught = 0 Then
                    DoPressLeftButton
                ElseIf SetAlarm > 0 Or SetTime = 1 Then
                    DoSetTime True
                End If
            End If
        ElseIf KeyCode = vbKeyRight Or KeyCode = vbKeyDown Then 'Right
            If RightButton.Picture <> Button1(1).Picture Then
                RightButton.Picture = Button1(1).Picture
                ButtonPressed = True
                ButtonPressedTime = 0
            
                If Playing And Caught = 0 And ((ClearMissCount > 0 And DiverPosition > 0 And DiverPosition <= 5) Or (ClearMissCount = 0 And DiverPosition <= 5)) Then
                    DoPressRightButton
                ElseIf SetAlarm > 0 Or SetTime = 1 Then
                    DoSetTime False
                End If
            End If
        ElseIf KeyCode = vbKey1 Then 'Game A
            If GameAButton.Picture <> Button0(1).Picture Then
                GameAButton.Picture = Button0(1).Picture
                ButtonPressed = True
            
                If (Not Playing Or Miss = 4) And SetAlarm = 0 And SetTime = 0 Then
                    DoShowScore (GetSetting("Game & Watch Simulator", "Octopus", "Game A High Score"))
                    DoShowGameType (1)
                End If
            End If
        ElseIf KeyCode = vbKey2 Then 'Game B
            If GameBButton.Picture <> Button0(1).Picture Then
                GameBButton.Picture = Button0(1).Picture
                ButtonPressed = True
            
                If (Not Playing Or Miss = 4) And SetAlarm = 0 And SetTime = 0 Then
                    DoShowScore (GetSetting("Game & Watch Simulator", "Octopus", "Game B High Score"))
                    DoShowGameType (2)
                End If
            End If
        ElseIf KeyCode = vbKeyT Then 'Time
            If TimeButton.Picture <> Button0(1).Picture Then
                TimeButton.Picture = Button0(1).Picture
                ButtonPressed = True
                
                If Not Playing Or Miss = 4 Then
                    If SetAlarm = 0 Then
                        DoShowTime GetSetting("Game & Watch Simulator", "Octopus", "Alarm Time")
                        BabyOctopus.Visible = True
                    ElseIf SetTime = 0 Then
                        DoShowTime Format(Time, "hhmmss AMPM")
                        BabyOctopus.Visible = False
                    End If
                End If
            End If
        ElseIf KeyCode = vbKeyA Then 'Alarm
            If AlarmButton.Picture <> Button2(1).Picture Then
                AlarmButton.Picture = Button2(1).Picture
                ButtonPressed = True
                
                If (Not Playing Or Miss = 4) And SetTime = 0 Then
                    If SetAlarm = 0 Then
                        DoClearScreen
                        SetAlarm = 1
                        DoShowTime GetSetting("Game & Watch Simulator", "Octopus", "Alarm Time")
                        BabyOctopus.Visible = True
                        AlarmOn = GetSetting("Game & Watch Simulator", "Octopus", "Alarm On")
                    Else
                        AlarmOn = Not AlarmOn
                    End If
                
                    Note.Visible = AlarmOn
                End If
            End If
        ElseIf KeyCode = vbKeyR Then 'ACL
            If ACLButton.Picture <> Button2(1).Picture Then
                ACLButton.Picture = Button2(1).Picture
                ResetScreen.Visible = True
                ButtonPressed = True
            End If
        ElseIf KeyCode = vbKeyS Then 'Sound On/Off
            If Not ButtonPressed Then
                ButtonPressed = True
            End If
        End If
    End If
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyF1 Then
        mInstructions_Click
    ElseIf KeyCode = vbKeyB Then
        mBack_Click
    ElseIf KeyCode = vbKeyI Then
        mInstructions_Click
    ElseIf KeyCode = vbKeyO Then
        mOptions_Click
    ElseIf KeyCode = vbKeyReturn Then
        Form1.PopupMenu mPopupMenu
    ElseIf ButtonNo = -1 And ButtonPressed Then
        DoStopAlarm
        
        If LeftButton.Picture = Button1(1).Picture Then 'Left
            LeftButton.Picture = Button1(0).Picture
            ButtonPressedTime = 0
        ElseIf RightButton.Picture = Button1(1).Picture Then 'Right
             RightButton.Picture = Button1(0).Picture
             ButtonPressedTime = 0
        ElseIf GameAButton.Picture = Button0(1).Picture Then 'Game A
            GameAButton.Picture = Button0(0).Picture
            
            If (Not Playing Or Miss = 4) And SetAlarm = 0 And SetTime = 0 Then
                If Miss = 4 Then
                    DoClearCurrentGame
                End If
            
                GameNo = 1
                DoGameStart
            End If
        ElseIf GameBButton.Picture = Button0(1).Picture Then 'Game B
            GameBButton.Picture = Button0(0).Picture
            
            If (Not Playing Or Miss = 4) And SetAlarm = 0 And SetTime = 0 Then
                If Miss = 4 Then
                    DoClearCurrentGame
                End If
            
                GameNo = 2
                DoGameStart
            End If
        ElseIf TimeButton.Picture = Button0(1).Picture Then 'Time
            TimeButton.Picture = Button0(0).Picture
            SetAlarm = 0
            SetTime = 0
            
            If Not Playing Then
                BabyOctopus.Visible = False
                Timer1.Interval = 50
            End If

            If SetAlarm > 0 Then
                SaveSetting "Game & Watch Simulator", "Octopus", "Alarm Time", AlarmTime
                SetAlarm = 0
                DoClearScreen
                StopAlarm = False
            ElseIf SetTime > 0 Then
                Time = Mid(AlarmTime, 1, 2) + ":" + Mid(AlarmTime, 3, 2) + ":" + Mid(AlarmTime, 5, 5)
                SetTime = 0
                DoClearScreen
                StopAlarm = False
            End If
            
            If Miss = 4 Then
                DoClearCurrentGame
                DoStartAgain
            End If
        ElseIf AlarmButton.Picture = Button2(1).Picture Then 'Alarm
            AlarmButton.Picture = Button2(0).Picture
            If (Not Playing Or Miss = 4) And SetTime = 0 Then
                Timer1.Interval = 200
            
                If SetAlarm = 1 Then
                    AlarmTime = GetSetting("Game & Watch Simulator", "Octopus", "Alarm Time")
                    SetAlarm = 2
                ElseIf SetAlarm = 2 Then
                    SaveSetting "Game & Watch Simulator", "Octopus", "Alarm On", AlarmOn
                End If
            End If
        ElseIf ACLButton.Picture = Button2(1).Picture Then 'ACL
            ACLButton.Picture = Button2(0).Picture

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -