More work on the texture selector, minor changes to splash

This commit is contained in:
Sidi Liang 2020-06-13 10:00:06 +08:00
parent 2f807d7e29
commit 59f665ce34
No known key found for this signature in database
GPG Key ID: 79F0A6B20B72F42F
29 changed files with 67 additions and 75 deletions

View File

@ -2,16 +2,6 @@
<path>followme.ac</path>
<nasal>
<load>
var livery_update = aircraft.livery_update.new("Aircraft/followme_e-tron/Models/Messages", 1, nil);
</load>
<unload>
livery_update.stop();
</unload>
</nasal>
<sound>
<path>Aircraft/followme_e-tron/Sounds/followme-sound_mp.xml</path>
</sound>
@ -53,8 +43,8 @@
<animation>
<type>material</type>
<object-name>sign</object-name>
<property-base>sim/model/livery</property-base>
<texture-prop>texture</texture-prop>
<property-base>/sim/multiplay/generic</property-base>
<texture-prop>string[18]</texture-prop>
<texture>blanco.png</texture>
</animation>

View File

@ -7,7 +7,7 @@
#format) to that folder and it will show up in the dialog.
var path = props.getNode("/",1).getValue("sim/aircraft-dir") ~ '/Models/plate/texture';
var plateSelector = TextureSelector.new(path, ".png", 1, 1, "sim/gui/dialogs/vehicle_config/dialog", "group[4]/combo/");
var plateSelector = TextureSelector.new("Plate-Selector", path, ".png", 1, 1, "sim/gui/dialogs/vehicle_config/dialog", "group[4]/combo/");
var Plate = {
new: func() {

View File

@ -7,10 +7,10 @@ io.include("library.nas");
props.getNode("/sim/gui/dialogs/vehicle_config/dialog",1);
var configDialog = gui.Dialog.new("/sim/gui/dialogs/vehicle_config/dialog", "Aircraft/followme_e-tron/gui/dialogs/config-dialog.xml");
aircraft.livery.init("Aircraft/followme_e-tron/Models/Messages");
var displayPath = props.getNode("sim/aircraft-dir").getValue()~"/Models/Messages/";
var displaySelector = TextureSelector.new(name: "Message-Selector", path: displayPath, fileType: ".xml", textureProp: "texture", enableMultiplayer: 1, multiplayerProperty:"/sim/multiplay/generic/string[18]", defaultValue: "Blanco");
var liveryPath = props.getNode("sim/aircraft-dir").getValue()~"/Models/Liveries/";
var liverySelector = followme.TextureSelector.new(path: liveryPath, fileType: ".xml", textureProp: "texture-fuse", enableMultiplayer: 1, defaultValue: "Yellow(Default)");
aircraft.livery.select("Blanco");
var liverySelector = TextureSelector.new(name: "Livery-Selector", path: liveryPath, fileType: ".xml", textureProp: "texture-fuse", enableMultiplayer: 1, defaultValue: "Yellow(Default)");
var tyreSmoke_0 = aircraft.tyresmoke.new(0, auto = 1, diff_norm = 0.4, check_vspeed = 0);
var tyreSmoke_1 = aircraft.tyresmoke.new(1, auto = 1, diff_norm = 0.4, check_vspeed = 0);

View File

@ -4,14 +4,14 @@
#//Quick start:
#//Aircraft liveries with dedicated selection dialog: (The same applies to any texture defined in PropertyList XML):
#// var liveryPath = props.getNode("sim/aircraft-dir").getValue()~"/Models/Liveries/";
#// var liverySelector = followme.TextureSelector.new(path: liveryPath, fileType: ".xml", textureProp: "texture-fuse", enableMultiplayer: 1, defaultValue: "Yellow(Default)");
#// var liverySelector = TextureSelector.new(path: liveryPath, fileType: ".xml", textureProp: "texture-fuse", enableMultiplayer: 1, defaultValue: "Yellow(Default)");
#//Pure texture, custom dialog(without multiplayer):
#// var path = props.getNode("/",1).getValue("sim/aircraft-dir") ~ '/Models/plate/texture';
#// var plateSelector = TextureSelector.new(path, ".png", 1, 1, "sim/gui/dialogs/vehicle_config/dialog", "group[4]/combo/");
var TextureSelector = { #//Tmp Note: path MUST end with "/"
new: func(path, fileType = nil, enableNone = 0, customDialog = 0, customDialogBase = "",
new: func(name, path, fileType = nil, enableNone = 0, customDialog = 0, customDialogBase = "",
customDialogPosition = "", texturePropertyBase = "sim/model/livery/", textureProp = "livery", textureNameProp = "name",
textureDataNode = nil, enableMultiplayer = 0, multiplayerProperty = "/sim/multiplay/generic/string[19]", defaultValue = ""){
@ -19,10 +19,13 @@ var TextureSelector = { #//Tmp Note: path MUST end with "/"
if(customDialog == 1){
m.dialogNode = props.getNode(customDialogBase, 1);
}else{
m.dialog = TextureSelectorDialog.new(defaultV: defaultValue);
m.dialogBaseNode = props.getNode("/sim/gui/dialogs/TextureSelector", 1).getNode(name, 1).getNode("dialog", 1);
m.dialog = TextureSelectorDialog.new(dialogBase : m.dialogBaseNode, defaultV: defaultValue, name: name);
m.dialogLis = setlistener(m.dialogBaseNode.getNode("opened", 1), func m.dialogTriggered());
}
if(textureDataNode == nil) textureDataNode = props.getNode("/TextureSelector/liveries/", 1);
m.name = name;
m.path = path;
m.fileType = fileType;
m.enableNone = enableNone;
@ -110,6 +113,22 @@ var TextureSelector = { #//Tmp Note: path MUST end with "/"
}
}
},
dialogTriggered: func(){
if(me.dialogBaseNode.getNode("opened", 1).getValue() == 1){
print("Dialog opened");
me.updateList();
me.resultLis = setlistener(me.dialog.result, func(){
var selected = me.dialog.result.getValue();
if(selected != "none"){
me.setTextureByNameXML(selected);
}else{
#fileNode.setValue(nameNode.getValue());
}
});
}else{
removelistener(me.resultLis);
}
},
setTextureByNameXML: func(name){
allTextures = me.textureDataNode.getChildren(me.textureProp);
foreach(var texture; allTextures){
@ -127,31 +146,22 @@ var TextureSelector = { #//Tmp Note: path MUST end with "/"
};
var TextureSelectorDialog = {
new: func(dialogBase = "/sim/gui/dialogs/TextureSelector/dialog", dialogFile = "Aircraft/followme_e-tron/gui/dialogs/livery-select.xml", defaultV = ""){
var m = gui.Dialog.new(dialogBase, dialogFile);
new: func(dialogBase, dialogFile = "Aircraft/followme_e-tron/gui/dialogs/livery-select.xml", defaultV = "", name = "Texture selection"){
var m = gui.Dialog.new(dialogBase, dialogFile, name);
m.parents = [TextureSelectorDialog, gui.Dialog];
var dNode = props.getNode(dialogBase, 1);
m.dialogNode = dNode;
m.dialogNode = dialogBase;
m.dialogFile = dialogFile;
m.title = "Livery Selection";
m.title = name;
m.list = m.dialogNode.getNode("list", 1);
m.result = props.getNode(m.list.getPath() ~ "/result", 1);
m.defaultValue = defaultV;
m.nasal = m.dialogNode.getNode("nasal", 1);
m.openScript = m.nasal.getNode("open", 1);
m.closeScript = m.nasal.getNode("close", 1);
m.openScript.setValue('print("livery-select dialog opened");
followme.liverySelector.updateList();
#print(cmdarg().getPath());
var lis = setlistener(followme.liverySelector.dialog.result, func(){
var selected = followme.liverySelector.dialog.result.getValue();
if(selected != "none"){
followme.liverySelector.setTextureByNameXML(selected);
}else{
#fileNode.setValue(nameNode.getValue());
}
});');
m.closeScript.setValue('\n followme.playAudio("repair.wav");');
m.openScript.setValue('print("' ~ m.title ~ ' dialog opened");
props.getNode(cmdarg().getPath()).getNode("opened"), 1).setValue(1);');
m.closeScript.setValue('followme.playAudio("repair.wav");
props.getNode(cmdarg().getPath()).getNode("opened", 1).setValue(0);');
m.reload();
#Reload when the GUI is reloaded
m.reload_listener = setlistener("/sim/signals/reinit-gui", func(n) m.reload());
@ -161,18 +171,10 @@ var TextureSelectorDialog = {
reload: func(){
me.list.getNode("property").setValue(me.result.getPath());
me.result.setValue(me.result.getValue() or me.defaultValue);
me.openScript.setValue('print("livery-select dialog opened");
followme.liverySelector.updateList();
#print(cmdarg().getPath());
var lis = setlistener(followme.liverySelector.dialog.result, func(){
var selected = followme.liverySelector.dialog.result.getValue();
if(selected != "none"){
followme.liverySelector.setTextureByNameXML(selected);
}else{
#fileNode.setValue(nameNode.getValue());
}
});');
me.closeScript.setValue('followme.playAudio("repair.wav");');
me.openScript.setValue('print("' ~ me.title ~ ' dialog opened");
props.getNode(cmdarg().getPath()~"/opened", 1).setValue(1);');
me.closeScript.setValue('followme.playAudio("repair.wav");
props.getNode(cmdarg().getPath()).getNode("opened", 1).setValue(0);');
me.dialogNode.getNode("group/text/label").setValue(me.title);
me.dialogNode.getNode("group/button/binding/script").setValue('gui.Dialog.instance["' ~ me.dialogNode.getNode("name").getValue() ~ '"].close()');
}

View File

Before

Width:  |  Height:  |  Size: 349 KiB

After

Width:  |  Height:  |  Size: 349 KiB

View File

Before

Width:  |  Height:  |  Size: 139 KiB

After

Width:  |  Height:  |  Size: 139 KiB

View File

Before

Width:  |  Height:  |  Size: 162 KiB

After

Width:  |  Height:  |  Size: 162 KiB

View File

Before

Width:  |  Height:  |  Size: 737 KiB

After

Width:  |  Height:  |  Size: 737 KiB

View File

Before

Width:  |  Height:  |  Size: 135 KiB

After

Width:  |  Height:  |  Size: 135 KiB

View File

Before

Width:  |  Height:  |  Size: 213 KiB

After

Width:  |  Height:  |  Size: 213 KiB

View File

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 129 KiB

View File

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 92 KiB

View File

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

View File

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 116 KiB

View File

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

Before

Width:  |  Height:  |  Size: 739 KiB

After

Width:  |  Height:  |  Size: 739 KiB

View File

Before

Width:  |  Height:  |  Size: 272 KiB

After

Width:  |  Height:  |  Size: 272 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

Before

Width:  |  Height:  |  Size: 266 KiB

After

Width:  |  Height:  |  Size: 266 KiB

View File

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 151 KiB

View File

Before

Width:  |  Height:  |  Size: 265 KiB

After

Width:  |  Height:  |  Size: 265 KiB

View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View File

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 166 KiB

View File

Before

Width:  |  Height:  |  Size: 832 KiB

After

Width:  |  Height:  |  Size: 832 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

Before

Width:  |  Height:  |  Size: 848 KiB

After

Width:  |  Height:  |  Size: 848 KiB

View File

@ -28,121 +28,121 @@
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>Splash/01.png</path>
<path>Splash/Legacy/01.png</path>
</preview>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>Splash/02.jpg</path>
<path>Splash/Legacy/02.jpg</path>
</preview>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>Splash/03.jpg</path>
<path>Splash/Legacy/03.jpg</path>
</preview>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>Splash/04.png</path>
<path>Splash/Legacy/04.png</path>
</preview>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>Splash/05.jpg</path>
<path>Splash/Legacy/05.jpg</path>
</preview>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>Splash/06.jpg</path>
<path>Splash/Legacy/06.jpg</path>
</preview>
<preview>
<type>interior</type>
<splash type="bool">true</splash>
<path>Splash/07.jpg</path>
<path>Splash/Legacy/07.jpg</path>
</preview>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>Splash/08.jpg</path>
<path>Splash/Legacy/08.jpg</path>
</preview>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>Splash/09.jpg</path>
<path>Splash/Legacy/09.jpg</path>
</preview>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>Splash/10.jpg</path>
<path>Splash/Legacy/10.jpg</path>
</preview>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>Splash/11.jpg</path>
<path>Splash/Legacy/11.jpg</path>
</preview>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>Splash/12.png</path>
<path>Splash/Legacy/12.png</path>
</preview>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>Splash/13.jpg</path>
<path>Splash/Legacy/13.jpg</path>
</preview>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>Splash/14.jpg</path>
<path>Splash/Legacy/14.jpg</path>
</preview>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>Splash/15.jpg</path>
<path>Splash/Legacy/15.jpg</path>
</preview>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>Splash/16.jpg</path>
<path>Splash/Legacy/16.jpg</path>
</preview>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>Splash/17.jpg</path>
<path>Splash/Legacy/17.jpg</path>
</preview>
<preview>
<type>interior</type>
<splash type="bool">true</splash>
<path>Splash/18.jpg</path>
<path>Splash/Legacy/18.jpg</path>
</preview>
<preview>
<type>interior</type>
<splash type="bool">true</splash>
<path>Splash/19.jpg</path>
<path>Splash/Legacy/19.jpg</path>
</preview>
<preview>
<type>exterior</type>
<splash type="bool">true</splash>
<path>Splash/20.jpg</path>
<path>Splash/Legacy/20.jpg</path>
</preview>
<!-- Start sunrise splash -->
@ -472,10 +472,10 @@
</item>
<item>
<label>Select Message</label>
<binding>
<command>nasal</command>
<script>aircraft.livery.dialog.toggle()</script>
</binding>
<binding>
<command>nasal</command>
<script>followme.displaySelector.dialog.open()</script>
</binding>
</item>
<item>
<label>Start Engine</label>

View File

@ -204,9 +204,9 @@
<legend>Select Message</legend>
<pref-width>120</pref-width>
<pref-height>28</pref-height>
<binding>
<command>nasal</command>
<script>aircraft.livery.dialog.toggle()</script>
<binding>
<command>nasal</command>
<script>followme.displaySelector.dialog.open()</script>
</binding>
</button>
</group>