This commit is contained in:
Eric Froemling 2020-07-15 03:43:03 -07:00
parent d6d7152ae3
commit e752a7dbb3
9 changed files with 85 additions and 36 deletions

View File

@ -4135,16 +4135,16 @@
"assets/build/windows/x64/vc_redist.x64.exe": "https://files.ballistica.net/cache/ba1/ea/19/8b8787d81abcdce158ba608cd24f",
"assets/build/windows/x64/vcruntime140_1d.dll": "https://files.ballistica.net/cache/ba1/11/d8/ff6344b429b00c24d9a1930d4338",
"assets/build/windows/x64/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/20/33/0825e11e6518f87ece3009309933",
"build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/66/e8/cb2aca94bb37c54803235ca19a75",
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d2/da/661e79f9cbe9446a073e685f240d",
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/38/07/ed14ca1cdab132da23bfd1f69f5f",
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/c9/6a/0e233fc907a8461d7641f4740530",
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b0/4b/eaed2d4f9296da8950707cf64fff",
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/9c/37/835be7a8730d5b1acc009823a781",
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/03/5e/d126371e7d1d32948e04f0c77d77",
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/c2/57/a7bb77e0dd051cc68d7e4c6d0bde",
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/bc/35/11f66fbd7cd142e40ad4cc94022b",
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/c9/cb/0879d2f7acbdd8165f5a7af56264",
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/a2/9f/e82dd87f76005a97ececdfb2a1b2",
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/14/ca/9de4a3803d3ac23d24591a36e49f"
"build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/44/c5/099debe438f2bca2c3dc8d9f048e",
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c4/7a/f92d78baa6d8137a8150e37c40a8",
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/35/8b/1d44da11d466aa8e49390048bd3c",
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/13/b2/6f0da477dd7d4f54fe48647ce44b",
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d9/11/e50c98eb60cfbe1c5268e33af8b8",
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/3b/e5/ce291661086203e424dce2dcd692",
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/70/09/d12993418eade4f88e8290d92f2e",
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/93/8c/8d7097c9b662b6583a145ad34f56",
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/52/d4/96f341a77b48a1f4adcbc5ca1e40",
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/af/79/c1be9d5908663f693dc67a24fd5e",
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/9e/e6/2cc3bc3fe700d8750387032bf43d",
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/92/8f/99cddfd2549fadedbb6f483bb174"
}

View File

@ -1,3 +1,6 @@
### 1.5.22 (20139)
- Button and key names now display correctly again on Android (and are cleaned up on other platforms too).
### 1.5.21 (20138)
- Added a UI subsystem at ba.app.ui (containing globals/functionality that was previously directly under ba.app). And hopefully added a fix for rare state of two main menus appearing on-screen at once.
- Added options in the 'Advanced' section to disable camera shake and camera gyroscope motion.

View File

@ -256,6 +256,11 @@ class InputDevice:
allows_configuring: bool
Whether the input-device can be configured.
has_meaningful_button_names: bool
Whether button names returned by this instance match labels
on the actual device. (Can be used to determine whether to show
them in controls-overlays, etc.)
player: Optional[ba.SessionPlayer]
The player associated with this input device.
@ -288,6 +293,7 @@ class InputDevice:
"""
allows_configuring: bool
has_meaningful_button_names: bool
player: Optional[ba.SessionPlayer]
client_id: int
name: str
@ -316,16 +322,21 @@ class InputDevice:
def get_axis_name(self, axis_id: int) -> str:
"""get_axis_name(axis_id: int) -> str
Given an axis ID, returns the name of the axis on this device.
Given an axis ID, return the name of the axis on this device.
Can return an empty string if the value is not meaningful to humans.
"""
return str()
def get_button_name(self, button_id: int) -> str:
"""get_button_name(button_id: int) -> str
def get_button_name(self, button_id: int) -> ba.Lstr:
"""get_button_name(button_id: int) -> ba.Lstr
Given a button ID, returns the name of the key/button on this device.
Given a button ID, return a human-readable name for that key/button.
Can return an empty string if the value is not meaningful to humans.
"""
return str()
import ba # pylint: disable=cyclic-import
return ba.Lstr(value='')
def get_default_player_name(self) -> str:
"""get_default_player_name() -> str

View File

@ -28,6 +28,7 @@ from typing import TYPE_CHECKING, overload
import _ba
if TYPE_CHECKING:
import ba
from typing import Any, Dict, List, Optional, Tuple, Union, Sequence
@ -192,6 +193,13 @@ class Lstr:
def __repr__(self) -> str:
return '<ba.Lstr: ' + self._get_json() + '>'
@staticmethod
def from_json(json_string: str) -> ba.Lstr:
"""Given a json string, returns a ba.Lstr. Does no data validation."""
lstr = Lstr(value='')
lstr.args = json.loads(json_string)
return lstr
def setlanguage(language: Optional[str],
print_change: bool = True,
@ -203,6 +211,7 @@ def setlanguage(language: Optional[str],
Pass None to use OS default language.
"""
# pylint: disable=too-many-locals
# pylint: disable=too-many-statements
# pylint: disable=too-many-branches
cfg = _ba.app.config
cur_language = cfg.get('Lang', None)
@ -273,6 +282,7 @@ def setlanguage(language: Optional[str],
internal_vals.append((value, lfull[value]))
internal_vals.append(
('axisText', lfull['configGamepadWindow']['axisText']))
internal_vals.append(('buttonText', lfull['buttonText']))
lmerged = _ba.app.language_merged
assert lmerged is not None
random_names = [

View File

@ -103,9 +103,10 @@ class UI:
# on the old after a short bit of time and kill it if its still alive.
# That will be a bit ugly on screen but at least will un-break things.
def _delay_kill() -> None:
import time
if existing:
print(f'Killing old main_menu_window'
f' when called at: {frameline}')
f' when called at: {frameline} t={time.time():.3f}')
existing.delete()
_ba.timer(1.0, _delay_kill, timetype=TimeType.REAL)

View File

@ -243,6 +243,13 @@ class ControlsGuide(ba.Actor):
# Don't do anything until our delay has passed.
ba.timer(delay, ba.WeakCall(self._start_updating))
@staticmethod
def _meaningful_button_name(device: ba.InputDevice, button: int) -> str:
"""Return a flattened string button name; empty for non-meaningful."""
if not device.has_meaningful_button_names:
return ''
return device.get_button_name(button).evaluate()
def _start_updating(self) -> None:
# Ok, our delay has passed. Now lets periodically see if we can fade
@ -284,8 +291,8 @@ class ControlsGuide(ba.Actor):
for device in input_devices:
for name in ('buttonPunch', 'buttonJump', 'buttonBomb',
'buttonPickUp'):
if device.get_button_name(
get_device_value(device, name)) != '':
if self._meaningful_button_name(
device, get_device_value(device, name)) != '':
fade_in = True
break
if fade_in:
@ -368,20 +375,20 @@ class ControlsGuide(ba.Actor):
# Ignore empty values; things like the remote app or
# wiimotes can return these.
bname = device.get_button_name(
get_device_value(device, 'buttonPunch'))
bname = self._meaningful_button_name(
device, get_device_value(device, 'buttonPunch'))
if bname != '':
punch_button_names.add(bname)
bname = device.get_button_name(
get_device_value(device, 'buttonJump'))
bname = self._meaningful_button_name(
device, get_device_value(device, 'buttonJump'))
if bname != '':
jump_button_names.add(bname)
bname = device.get_button_name(
get_device_value(device, 'buttonBomb'))
bname = self._meaningful_button_name(
device, get_device_value(device, 'buttonBomb'))
if bname != '':
bomb_button_names.add(bname)
bname = device.get_button_name(
get_device_value(device, 'buttonPickUp'))
bname = self._meaningful_button_name(
device, get_device_value(device, 'buttonPickUp'))
if bname != '':
pickup_button_names.add(bname)

View File

@ -64,7 +64,7 @@ class ControlsSettingsWindow(ba.Window):
spacing = 50.0
button_width = 350.0
width = 460.0
height = 135.0
height = 85.0
space_height = spacing * 0.3

View File

@ -188,7 +188,7 @@ class GamepadSettingsWindow(ba.Window):
size=((160 if self._is_secondary else 180), 60),
autoselect=True,
label=ba.Lstr(resource='doneText')
if self._is_secondary else ba.Lstr(resource='makeItSoText'),
if self._is_secondary else ba.Lstr(resource='saveText'),
scale=0.9,
on_activate_call=self._save)
ba.containerwidget(edit=self._root_widget,

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2020-07-14 for Ballistica version 1.5.21 build 20138</em></h4>
<h4><em>last updated on 2020-07-15 for Ballistica version 1.5.22 build 20140</em></h4>
<p>This page documents the Python classes and functions in the 'ba' module,
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
<hr>
@ -2872,7 +2872,7 @@ Results for a completed game.</p>
<p>Category: <a href="#class_category_Gameplay_Classes">Gameplay Classes</a></p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_InputDevice__allows_configuring">allows_configuring</a>, <a href="#attr_ba_InputDevice__client_id">client_id</a>, <a href="#attr_ba_InputDevice__id">id</a>, <a href="#attr_ba_InputDevice__instance_number">instance_number</a>, <a href="#attr_ba_InputDevice__is_controller_app">is_controller_app</a>, <a href="#attr_ba_InputDevice__is_remote_client">is_remote_client</a>, <a href="#attr_ba_InputDevice__name">name</a>, <a href="#attr_ba_InputDevice__player">player</a>, <a href="#attr_ba_InputDevice__unique_identifier">unique_identifier</a></h5>
<h5><a href="#attr_ba_InputDevice__allows_configuring">allows_configuring</a>, <a href="#attr_ba_InputDevice__client_id">client_id</a>, <a href="#attr_ba_InputDevice__has_meaningful_button_names">has_meaningful_button_names</a>, <a href="#attr_ba_InputDevice__id">id</a>, <a href="#attr_ba_InputDevice__instance_number">instance_number</a>, <a href="#attr_ba_InputDevice__is_controller_app">is_controller_app</a>, <a href="#attr_ba_InputDevice__is_remote_client">is_remote_client</a>, <a href="#attr_ba_InputDevice__name">name</a>, <a href="#attr_ba_InputDevice__player">player</a>, <a href="#attr_ba_InputDevice__unique_identifier">unique_identifier</a></h5>
<dl>
<dt><h4><a name="attr_ba_InputDevice__allows_configuring">allows_configuring</a></h4></dt><dd>
<p><span> bool</span></p>
@ -2885,6 +2885,13 @@ Results for a completed game.</p>
This is only meaningful for remote client inputs; for
all local devices this will be -1.</p>
</dd>
<dt><h4><a name="attr_ba_InputDevice__has_meaningful_button_names">has_meaningful_button_names</a></h4></dt><dd>
<p><span> bool</span></p>
<p>Whether button names returned by this instance match labels
on the actual device. (Can be used to determine whether to show
them in controls-overlays, etc.)</p>
</dd>
<dt><h4><a name="attr_ba_InputDevice__id">id</a></h4></dt><dd>
<p><span> int</span></p>
@ -2946,13 +2953,17 @@ prefs, etc.</p>
<dt><h4><a name="method_ba_InputDevice__get_axis_name">get_axis_name()</a></dt></h4><dd>
<p><span>get_axis_name(axis_id: int) -&gt; str</span></p>
<p>Given an axis ID, returns the name of the axis on this device.</p>
<p>Given an axis ID, return the name of the axis on this device.</p>
<p>Can return an empty string if the value is not meaningful to humans.</p>
</dd>
<dt><h4><a name="method_ba_InputDevice__get_button_name">get_button_name()</a></dt></h4><dd>
<p><span>get_button_name(button_id: int) -&gt; str</span></p>
<p><span>get_button_name(button_id: int) -&gt; <a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Given a button ID, returns the name of the key/button on this device.</p>
<p>Given a button ID, return a human-readable name for that key/button.</p>
<p>Can return an empty string if the value is not meaningful to humans.</p>
</dd>
</dl>
@ -3273,7 +3284,7 @@ needs a chooser.</p>
</pre>
<h3>Methods:</h3>
<h5><a href="#method_ba_Lstr____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Lstr__evaluate">evaluate()</a>, <a href="#method_ba_Lstr__is_flat_value">is_flat_value()</a></h5>
<h5><a href="#method_ba_Lstr____init__">&lt;constructor&gt;</a>, <a href="#method_ba_Lstr__evaluate">evaluate()</a>, <a href="#method_ba_Lstr__from_json">from_json()</a>, <a href="#method_ba_Lstr__is_flat_value">is_flat_value()</a></h5>
<dl>
<dt><h4><a name="method_ba_Lstr____init__">&lt;constructor&gt;</a></dt></h4><dd>
<p><span>ba.Lstr(*args: Any, **keywds: Any)</span></p>
@ -3300,6 +3311,12 @@ the resource nor the fallback resource is found ('resource' mode only).</p>
<p>You should avoid doing this as much as possible and instead pass
and store Lstr values.</p>
</dd>
<dt><h4><a name="method_ba_Lstr__from_json">from_json()</a></dt></h4><dd>
<p><span>from_json(json_string: str) -&gt; <a href="#class_ba_Lstr">ba.Lstr</a></span></p>
<p>Given a json string, returns a <a href="#class_ba_Lstr">ba.Lstr</a>. Does no data validation.</p>
</dd>
<dt><h4><a name="method_ba_Lstr__is_flat_value">is_flat_value()</a></dt></h4><dd>
<p><span>is_flat_value(self) -&gt; bool</span></p>