3800eb6449
- Inizio lavori su disposizione per spostare ventose.
100 lines
3.6 KiB
VB.net
100 lines
3.6 KiB
VB.net
'----------------------------------------------------------------------------
|
|
' EgalTech 2016-2016
|
|
'----------------------------------------------------------------------------
|
|
' File : GunStock.vb Data : 08.10.16 Versione : 1.6v4
|
|
' Contenuto : Classe GunStock (interfaccia per script Calci di Fucile).
|
|
'
|
|
'
|
|
'
|
|
' Modifiche : 08.10.16 DS Creazione modulo.
|
|
'
|
|
'
|
|
'----------------------------------------------------------------------------
|
|
|
|
Imports System.Collections.ObjectModel
|
|
Imports Microsoft.VisualBasic
|
|
Imports EgtUILib
|
|
|
|
Module GunStock
|
|
|
|
Function ExecGunStock(ByRef scene As Scene, sFilePath As String) As Boolean
|
|
' Scelta file MOD
|
|
Dim sFile As String
|
|
' Se sFilePath non vuoto apro questo file
|
|
If Not String.IsNullOrEmpty(sFilePath) Then
|
|
sFile = sFilePath
|
|
Else
|
|
' Direttorio corrente per file MOD
|
|
Dim sDir As String = String.Empty
|
|
GetPrivateProfileString(S_GUNSTOCK, K_MODDIR, "", sDir)
|
|
' Apertura dialogo di scelta file MOD
|
|
Dim OpenFileDialog As New EgtWPFLib5.EgtOpenFileDialog
|
|
OpenFileDialog.Title = "Open MOD file"
|
|
OpenFileDialog.Extension = ".mod"
|
|
OpenFileDialog.Directory = sDir
|
|
If Not OpenFileDialog.ShowDialog Then
|
|
Return True
|
|
End If
|
|
sFile = OpenFileDialog.FileName
|
|
End If
|
|
System.IO.Path.GetDirectoryName(sFile)
|
|
WritePrivateProfileString(S_GUNSTOCK, K_MODDIR, System.IO.Path.GetDirectoryName(sFile))
|
|
|
|
|
|
|
|
'' Prove
|
|
'Dim GunStockWnd As New GunStockWndView
|
|
'Dim GunStockWndViewModel As New GunStockWndViewModel
|
|
'GunStockWnd.DataContext = GunStockWndViewModel
|
|
'GunStockWnd.Owner = Application.Current.MainWindow
|
|
'' Creo lista dei valori
|
|
'GunStockWndViewModel.AddParam("Nome1", 13, 7, 9)
|
|
'GunStockWndViewModel.AddParam("Nome2", 25, 14, 32)
|
|
'If Not GunStockWnd.ShowDialog() Then
|
|
' Return False
|
|
'End If
|
|
'' Lettura nome
|
|
'Dim sFileName As String = GunStockWndViewModel.FileName
|
|
'' Lettura dei valori delle variabili(due diverse possibilità)
|
|
'Dim Value1 As Double = 0
|
|
'StringToDouble(GunStockWndViewModel.ParamList(0).Value, Value1)
|
|
'Dim Value2 As Double = 0
|
|
'GunStockWndViewModel.GetParam("Nome1", Value2)
|
|
|
|
|
|
|
|
' Generazione calcio di fucile
|
|
' Cursore attesa
|
|
scene.Cursor = System.Windows.Forms.Cursors.WaitCursor
|
|
' Creazione porta
|
|
Dim bOk As Boolean = CreateGunStock(sFile, False, False)
|
|
' Scrivo il nome del file aperto in una variabile globale per averlo in caso di errore
|
|
IniFile.m_MODFilePath = sFile
|
|
' Aggiorno la visualizzazione
|
|
EgtZoom(ZM.ALL)
|
|
' Cursore standard
|
|
scene.Cursor = System.Windows.Forms.Cursors.Default
|
|
|
|
Return bOk
|
|
End Function
|
|
|
|
Function CreateGunStock(ByRef sModFile As String, bNcGen As Boolean, bBatch As Boolean) As Boolean
|
|
' Carico il file
|
|
Dim sExecPath As String = String.Empty
|
|
GetPrivateProfileString(S_GUNSTOCK, K_MODEXEC, "", sExecPath)
|
|
If Not EgtLuaExecFile(sExecPath) Then Return False
|
|
' Lancio la creazione
|
|
EgtLuaSetGlobStringVar("GGD.FILE", sModFile)
|
|
Dim sFunction As String = String.Empty
|
|
GetPrivateProfileString(S_GUNSTOCK, K_MODFUNCTION, "", sFunction)
|
|
Dim bOk As Boolean = EgtLuaExecLine(sFunction)
|
|
Dim nErr As Integer = 999
|
|
If Not EgtLuaGetGlobIntVar("GGD.ERR", nErr) Or nErr <> 0 Then bOk = False
|
|
EgtOutLog("Gunstock Err=" & nErr.ToString())
|
|
' Cancello variabile globale
|
|
EgtLuaResetGlobVar("GGD")
|
|
Return bOk
|
|
End Function
|
|
|
|
End Module
|