mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-08 00:30:22 +08:00
Syncing latest changes between public/private.
This commit is contained in:
parent
0c6e559aa6
commit
794b660dc9
2
Makefile
2
Makefile
@ -339,8 +339,6 @@ pycharm-full: prereqs
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# Run all tests. (live execution verification)
|
# Run all tests. (live execution verification)
|
||||||
# Note: need to disable bytecode writing so we don't cause errors due to
|
|
||||||
# unexpected __pycache__ dirs popping up.
|
|
||||||
test: prereqs
|
test: prereqs
|
||||||
@tools/snippets pytest -v tests
|
@tools/snippets pytest -v tests
|
||||||
|
|
||||||
|
|||||||
@ -115,7 +115,7 @@ class AssetManager:
|
|||||||
|
|
||||||
def load_state(self) -> None:
|
def load_state(self) -> None:
|
||||||
"""Loads state from disk. Resets to default state if unable to."""
|
"""Loads state from disk. Resets to default state if unable to."""
|
||||||
print('AMAN LOADING STATE')
|
print('ASSET-MANAGER LOADING STATE')
|
||||||
try:
|
try:
|
||||||
state_path = self.state_path
|
state_path = self.state_path
|
||||||
if state_path.exists():
|
if state_path.exists():
|
||||||
@ -129,7 +129,7 @@ class AssetManager:
|
|||||||
def save_state(self) -> None:
|
def save_state(self) -> None:
|
||||||
"""Save state to disk (if possible)."""
|
"""Save state to disk (if possible)."""
|
||||||
|
|
||||||
print('AMAN SAVING STATE')
|
print('ASSET-MANAGER SAVING STATE')
|
||||||
try:
|
try:
|
||||||
with open(self.state_path, 'w') as outfile:
|
with open(self.state_path, 'w') as outfile:
|
||||||
outfile.write(self._state.to_json_str())
|
outfile.write(self._state.to_json_str())
|
||||||
@ -138,27 +138,35 @@ class AssetManager:
|
|||||||
|
|
||||||
|
|
||||||
class AssetGather:
|
class AssetGather:
|
||||||
"""Wrangles a gather of assets."""
|
"""Wrangles a gathering of assets."""
|
||||||
|
|
||||||
def __init__(self, manager: AssetManager) -> None:
|
def __init__(self, manager: AssetManager) -> None:
|
||||||
assert threading.get_ident() == manager.thread_ident
|
assert threading.get_ident() == manager.thread_ident
|
||||||
self._manager = weakref.ref(manager)
|
self._manager = weakref.ref(manager)
|
||||||
self._valid = True
|
# self._valid = True
|
||||||
print('AssetGather()')
|
print('AssetGather()')
|
||||||
# url = 'https://files.ballistica.net/bombsquad/promo/BSGamePlay.mov'
|
# url = 'https://files.ballistica.net/bombsquad/promo/BSGamePlay.mov'
|
||||||
url = 'http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz'
|
# url = 'http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz'
|
||||||
fetch_url(url,
|
# fetch_url(url,
|
||||||
filename=Path(manager.rootdir, 'testdl'),
|
# filename=Path(manager.rootdir, 'testdl'),
|
||||||
asset_gather=self)
|
# asset_gather=self)
|
||||||
print('fetch success')
|
# print('fetch success')
|
||||||
|
thread = threading.Thread(target=self._run)
|
||||||
|
thread.run()
|
||||||
|
|
||||||
@property
|
def _run(self) -> None:
|
||||||
def valid(self) -> bool:
|
"""Run the gather in a background thread."""
|
||||||
"""Whether this gather is still valid.
|
print('hello from gather bg')
|
||||||
|
|
||||||
A gather becomes in valid if its originating AssetManager dies.
|
# First, do some sort of.
|
||||||
"""
|
|
||||||
return True
|
# @property
|
||||||
|
# def valid(self) -> bool:
|
||||||
|
# """Whether this gather is still valid.
|
||||||
|
|
||||||
|
# A gather becomes in valid if its originating AssetManager dies.
|
||||||
|
# """
|
||||||
|
# return True
|
||||||
|
|
||||||
def __del__(self) -> None:
|
def __del__(self) -> None:
|
||||||
print('~AssetGather()')
|
print('~AssetGather()')
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
|
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
|
||||||
<h4><em>last updated on 2020-03-22 for Ballistica version 1.5.0 build 20001</em></h4>
|
<h4><em>last updated on 2020-03-26 for Ballistica version 1.5.0 build 20001</em></h4>
|
||||||
<p>This page documents the Python classes and functions in the 'ba' module,
|
<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>
|
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>
|
<hr>
|
||||||
|
|||||||
@ -45,7 +45,6 @@ def test_assetmanager() -> None:
|
|||||||
manager = AssetManager(rootdir=Path(tmpdir))
|
manager = AssetManager(rootdir=Path(tmpdir))
|
||||||
wref = weakref.ref(manager)
|
wref = weakref.ref(manager)
|
||||||
manager.start()
|
manager.start()
|
||||||
|
|
||||||
gather = manager.launch_gather(packages=['a@2'],
|
gather = manager.launch_gather(packages=['a@2'],
|
||||||
flavor=AssetPackageFlavor.DESKTOP,
|
flavor=AssetPackageFlavor.DESKTOP,
|
||||||
account_token='dummytoken')
|
account_token='dummytoken')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user