Merge branch 'main' into translations-system
This commit is contained in:
@@ -83,8 +83,7 @@ class AssetsLibraryList extends AssetLibrary {
|
||||
if (l is IModsAssetLibrary) {
|
||||
var lib = cast(l, IModsAssetLibrary);
|
||||
for(e in lib.getFolders(folder))
|
||||
if(!content.contains(e))
|
||||
content.push(e);
|
||||
content.pushOnce(e);
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
||||
@@ -134,8 +134,7 @@ class ZipFolderLibrary extends AssetLibrary implements IModsAssetLibrary {
|
||||
var fileName = k.substr(_parsedAsset.length);
|
||||
if (fileName.contains("/")) {
|
||||
var s = fileName.split("/")[0];
|
||||
if (!content.contains(s))
|
||||
content.push(s);
|
||||
content.pushOnce(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -576,15 +576,8 @@ class Controls extends FlxActionSet
|
||||
{
|
||||
case null:
|
||||
// add all
|
||||
#if (haxe >= "4.0.0")
|
||||
for (gamepad in controls.gamepadsAdded)
|
||||
if (!gamepadsAdded.contains(gamepad))
|
||||
gamepadsAdded.push(gamepad);
|
||||
#else
|
||||
for (gamepad in controls.gamepadsAdded)
|
||||
if (gamepadsAdded.indexOf(gamepad) == -1)
|
||||
gamepadsAdded.push(gamepad);
|
||||
#end
|
||||
gamepadsAdded.pushOnce(gamepad);
|
||||
|
||||
mergeKeyboardScheme(controls.keyboardScheme);
|
||||
|
||||
@@ -652,7 +645,7 @@ class Controls extends FlxActionSet
|
||||
while (i-- > 0)
|
||||
{
|
||||
var input = action.inputs[i];
|
||||
if (input.device == KEYBOARD && keys.indexOf(cast input.inputID) != -1)
|
||||
if (input.device == KEYBOARD && keys.contains(cast input.inputID))
|
||||
action.remove(input);
|
||||
}
|
||||
}
|
||||
@@ -837,7 +830,7 @@ class Controls extends FlxActionSet
|
||||
while (i-- > 0)
|
||||
{
|
||||
var input = action.inputs[i];
|
||||
if (isGamepad(input, gamepadID) && buttons.indexOf(cast input.inputID) != -1)
|
||||
if (isGamepad(input, gamepadID) && buttons.contains(cast input.inputID))
|
||||
action.remove(input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -614,13 +614,14 @@ class CoolUtil
|
||||
* @return Index, or -1 if unsuccessful.
|
||||
*/
|
||||
public static inline function indexOfFromLast<T>(array:Array<T>, element:T):Int {
|
||||
var i = array.length - 1;
|
||||
/*var i = array.length - 1;
|
||||
while(i >= 0) {
|
||||
if (array[i] == element)
|
||||
break;
|
||||
i--;
|
||||
}
|
||||
return i;
|
||||
return i;*/
|
||||
return array.lastIndexOf(element);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -725,6 +726,22 @@ class CoolUtil
|
||||
});
|
||||
return array;
|
||||
}
|
||||
|
||||
public static inline function pushOnce<T>(array:Array<T>, element:T) {
|
||||
#if (haxe >= "4.0.0")
|
||||
if (!array.contains(element))
|
||||
array.push(element);
|
||||
#else
|
||||
if (array.indexOf(element) == -1)
|
||||
array.push(element);
|
||||
#end
|
||||
}
|
||||
|
||||
#if !(haxe >= "4.0.0")
|
||||
public static inline function contains<T>(array:Array<T>, element:T) {
|
||||
return array.indexOf(element) != -1;
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user