mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-01-09 17:19:47 +03:00
[FEATURE] Поддержка дизайном новых опц модов
This commit is contained in:
parent
4d7fca7b2a
commit
8e2e9d4aee
4 changed files with 18 additions and 13 deletions
|
@ -43,15 +43,16 @@ var options = {
|
|||
for(var j = 0; j < listSize; j++)
|
||||
{
|
||||
var mark = input.readBoolean();
|
||||
var modType = OptionalFile.readType(input);
|
||||
var modFile = input.readString(0);
|
||||
if(mark)
|
||||
{
|
||||
profile.markOptional(modFile);
|
||||
profile.markOptional(modFile,modType);
|
||||
LogHelper.debug("Load options %s marked",modFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
profile.unmarkOptional(modFile);
|
||||
profile.unmarkOptional(modFile,modType);
|
||||
LogHelper.debug("Load options %s unmarked",modFile);
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +70,8 @@ var options = {
|
|||
output.writeInt(profile.getSortIndex());
|
||||
list.forEach(function(modFile,j,arr2) {
|
||||
output.writeBoolean(modFile.mark);
|
||||
output.writeString(modFile.file, 0);
|
||||
modFile.writeType(output);
|
||||
output.writeString(modFile.name, 0);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
@ -101,11 +103,9 @@ var options = {
|
|||
list.forEach(function(modFile) {
|
||||
dModsIds.push(modFile.string);
|
||||
|
||||
var modName = modFile.file, modDescription = "", subLevel = 1;
|
||||
if(modFile.isAdminOnly && !loginData.permissions.canAdmin)
|
||||
var modName = modFile.name, modDescription = "", subLevel = 1;
|
||||
if(!modFile.isVisible || !((loginData.permissions & modFile.permissions) != 0))
|
||||
return;
|
||||
if(modFile.name != null)//Есть ли у модификации имя?
|
||||
modName = modFile.name;
|
||||
if(modFile.info != null) //Есть ли описание?
|
||||
modDescription = modFile.info;
|
||||
if(modFile.subTreeLevel != null && modFile.subTreeLevel > 1)//Это суб-модификация?
|
||||
|
@ -121,18 +121,17 @@ var options = {
|
|||
var isSelected = event.getSource().isSelected();
|
||||
if(isSelected)
|
||||
{
|
||||
profile.markOptional(modFile.file);
|
||||
LogHelper.debug("Selected mod %s", modFile.file);
|
||||
profile.markOptional(modFile);
|
||||
LogHelper.debug("Selected mod %s", modFile.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
profile.unmarkOptional(modFile.file);
|
||||
LogHelper.debug("Unselected mod %s", modFile.file);
|
||||
profile.unmarkOptional(modFile);
|
||||
LogHelper.debug("Unselected mod %s", modFile.name);
|
||||
}
|
||||
options.update();
|
||||
});
|
||||
checkBoxList.add(testMod);
|
||||
|
||||
if(modDescription != "") { //Добавляем описание?
|
||||
textDescr = new javafx.scene.text.Text(modDescription);
|
||||
if(subLevel > 1) {
|
||||
|
|
|
@ -44,6 +44,7 @@ var StreamObjectAdapter = StreamObjectAdapterClass.static;
|
|||
var SignedBytesHolder = SignedBytesHolderClass.static;
|
||||
var SignedObjectHolder = SignedObjectHolderClass.static;
|
||||
var EnumSerializer = EnumSerializerClass.static;
|
||||
var OptionalFile = OptionalFileClass.static;
|
||||
|
||||
// Helper class API imports
|
||||
var CommonHelper = CommonHelperClass.static;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
import ru.gravit.launcher.profiles.ClientProfile;
|
||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||
import ru.gravit.launcher.profiles.Texture;
|
||||
import ru.gravit.launcher.profiles.optional.OptionalFile;
|
||||
import ru.gravit.launcher.request.*;
|
||||
import ru.gravit.launcher.request.auth.AuthRequest;
|
||||
import ru.gravit.launcher.request.auth.CheckServerRequest;
|
||||
|
@ -95,6 +96,7 @@ public static void addLauncherClassBindings(Map<String, Object> bindings) {
|
|||
bindings.put("SignedBytesHolderClass", SignedBytesHolder.class);
|
||||
bindings.put("SignedObjectHolderClass", SignedObjectHolder.class);
|
||||
bindings.put("EnumSerializerClass", EnumSerializer.class);
|
||||
bindings.put("OptionalFileClass", OptionalFile.class);
|
||||
|
||||
// Set helper class bindings
|
||||
bindings.put("CommonHelperClass", CommonHelper.class);
|
||||
|
|
|
@ -92,9 +92,10 @@ public void writeType(HOutput output) throws IOException
|
|||
}
|
||||
}
|
||||
@LauncherAPI
|
||||
public void readType(HInput input) throws IOException
|
||||
public static OptionalType readType(HInput input) throws IOException
|
||||
{
|
||||
int t = input.readInt();
|
||||
OptionalType type;
|
||||
switch(t)
|
||||
{
|
||||
case 1:
|
||||
|
@ -111,7 +112,9 @@ public void readType(HInput input) throws IOException
|
|||
break;
|
||||
default:
|
||||
LogHelper.error("readType failed. Read int %d",t);
|
||||
type = OptionalType.FILE;
|
||||
break;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue