ohzi-core 10.6.7 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.module.js +1 -1
- package/build/index.module.js.map +1 -1
- package/package.json +9 -11
- package/src/BaseApplication.js +3 -0
- package/src/Browser.js +4 -4
- package/src/Graphics.js +17 -19
- package/src/Initializer.js +1 -7
- package/src/OS.js +2 -2
- package/src/RenderLoop.js +16 -13
- package/src/action_sequencer/ActionEvent.js +1 -2
- package/src/action_sequencer/ActionSequencer.js +3 -7
- package/src/gpu_particles/ParticleAttribute.js +2 -7
- package/src/index.js +41 -141
- package/src/render_mode/NormalAORender.js +7 -8
- package/src/resource_loader/AsyncTextureLoader.js +5 -3
- package/src/resource_loader/BasisLoader.js +0 -4
- package/src/view_components/ApplicationView.js +2 -29
- package/src/view_components/ApplicationViewController.js +95 -0
- package/src/view_components/TransitionManager.js +60 -0
- package/src/view_components/VCManager.js +9 -0
- package/src/view_components/ViewComponent.js +9 -36
- package/src/view_components/ViewComponentController.js +73 -0
- package/src/view_components/ViewComponentControllerManager.js +59 -0
- package/src/view_components/ViewComponentManager.js +3 -13
- package/src/view_components/ViewControllerManager.js +91 -0
- package/src/view_components/ViewManager.js +11 -104
- package/src/view_components/ViewState.js +0 -7
- package/src/view_components/WorkerToMain.js +25 -0
- package/src/view_components/transition/ActionSequencerBuilder.js +3 -3
- package/src/view_components/transition/TransitionTable.js +9 -2
- package/types/BaseApplication.d.ts +1 -0
- package/types/Browser.d.ts +1 -1
- package/types/CameraManager.d.ts +2 -4
- package/types/Graphics.d.ts +8 -3
- package/types/Initializer.d.ts +1 -1
- package/types/RenderLoop.d.ts +1 -2
- package/types/SceneManager.d.ts +1 -3
- package/types/action_sequencer/ActionSequencer.d.ts +2 -2
- package/types/blitter_index.d.ts +6 -0
- package/types/index.d.ts +75 -73
- package/types/render_mode/NormalAORender.d.ts +1 -0
- package/types/resource_loader/AsyncTextureLoader.d.ts +1 -0
- package/types/utilities/FrustumPointFitter.d.ts +1 -3
- package/types/utilities/OMath.d.ts +9 -9
- package/types/view_components/ApplicationView.d.ts +1 -3
- package/types/view_components/ApplicationViewController.d.ts +11 -0
- package/types/view_components/TransitionManager.d.ts +17 -0
- package/types/view_components/VCManager.d.ts +5 -0
- package/types/view_components/ViewComponent.d.ts +1 -5
- package/types/view_components/ViewComponentController.d.ts +14 -0
- package/types/view_components/ViewComponentControllerManager.d.ts +12 -0
- package/types/view_components/ViewComponentManager.d.ts +0 -1
- package/types/view_components/ViewControllerManager.d.ts +12 -0
- package/types/view_components/ViewManager.d.ts +4 -22
- package/types/view_components/ViewState.d.ts +0 -1
- package/types/view_components/WorkerToMain.d.ts +8 -0
- package/types/view_components/transition/ActionSequencerBuilder.d.ts +1 -1
- package/types/view_components/transition/TransitionTable.d.ts +2 -0
- package/src/Configuration.js +0 -23
- package/src/Screen.js +0 -55
- package/src/render_mode/TransparencyMixRender.js +0 -147
- package/src/view_components/ViewContext.js +0 -15
- package/types/Configuration.d.ts +0 -8
- package/types/view_components/ViewContext.d.ts +0 -6
|
@@ -9,6 +9,8 @@ class AsyncTextureLoader extends AbstractLoader
|
|
|
9
9
|
{
|
|
10
10
|
super(resource_id, url, size);
|
|
11
11
|
|
|
12
|
+
this.original_url = '';
|
|
13
|
+
|
|
12
14
|
this.colorSpaceConversion = colorSpaceConversion;
|
|
13
15
|
this.premultiplyAlpha = premultiplyAlpha;
|
|
14
16
|
this.flipY = flipY;
|
|
@@ -51,7 +53,7 @@ class AsyncTextureLoader extends AbstractLoader
|
|
|
51
53
|
|
|
52
54
|
image.onerror = () =>
|
|
53
55
|
{
|
|
54
|
-
console.error('
|
|
56
|
+
console.error('The source image could not be decoded.', this.original_url);
|
|
55
57
|
};
|
|
56
58
|
}
|
|
57
59
|
else
|
|
@@ -93,9 +95,9 @@ class AsyncTextureLoader extends AbstractLoader
|
|
|
93
95
|
|
|
94
96
|
this.__update_downloaded_bytes(1, 1);
|
|
95
97
|
this.__loading_ended();
|
|
96
|
-
}).catch(
|
|
98
|
+
}).catch((e) =>
|
|
97
99
|
{
|
|
98
|
-
console.error(e);
|
|
100
|
+
console.error(e, this.original_url);
|
|
99
101
|
});
|
|
100
102
|
}
|
|
101
103
|
else
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { AbstractLoader } from './AbstractLoader';
|
|
2
2
|
|
|
3
|
-
// import { sRGBEncoding } from 'three';
|
|
4
|
-
|
|
5
3
|
class BasisLoader extends AbstractLoader
|
|
6
4
|
{
|
|
7
5
|
constructor(resource_id, url, loader, size)
|
|
@@ -17,8 +15,6 @@ class BasisLoader extends AbstractLoader
|
|
|
17
15
|
{
|
|
18
16
|
this.loader.load(this.url, (basis) =>
|
|
19
17
|
{
|
|
20
|
-
// basis.encoding = sRGBEncoding;
|
|
21
|
-
|
|
22
18
|
resource_container.set_resource(this.resource_id, this.url, basis);
|
|
23
19
|
|
|
24
20
|
this.__update_downloaded_bytes(1, 1);
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ResourceContainer } from '../ResourceContainer';
|
|
2
|
-
import { HTMLUtilities } from '../utilities/HTMLUtilities';
|
|
3
1
|
import { ViewManager } from './ViewManager';
|
|
4
2
|
import { ViewState } from './ViewState';
|
|
5
3
|
|
|
@@ -12,22 +10,7 @@ class ApplicationView extends ViewState
|
|
|
12
10
|
this.container = container;
|
|
13
11
|
this.url = url;
|
|
14
12
|
|
|
15
|
-
let transition_data = ResourceContainer.get(`${name}_data`);
|
|
16
|
-
|
|
17
|
-
transition_data = transition_data || {
|
|
18
|
-
animation_tracks: [],
|
|
19
|
-
triggers: []
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const transitions = [
|
|
23
|
-
{
|
|
24
|
-
to: name,
|
|
25
|
-
data: transition_data
|
|
26
|
-
}
|
|
27
|
-
];
|
|
28
|
-
|
|
29
13
|
ViewManager.register_view(this);
|
|
30
|
-
ViewManager.add_transitions(transitions);
|
|
31
14
|
}
|
|
32
15
|
|
|
33
16
|
show()
|
|
@@ -58,19 +41,9 @@ class ApplicationView extends ViewState
|
|
|
58
41
|
this.container.classList.remove('before_exit');
|
|
59
42
|
}
|
|
60
43
|
|
|
61
|
-
|
|
62
|
-
{
|
|
63
|
-
HTMLUtilities.load_images(this.container);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
load_html_videos()
|
|
67
|
-
{
|
|
68
|
-
HTMLUtilities.load_videos(this.container);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
set_opacity(current_state_data)
|
|
44
|
+
set_opacity(opacity)
|
|
72
45
|
{
|
|
73
|
-
this.container.style.opacity =
|
|
46
|
+
this.container.style.opacity = opacity;
|
|
74
47
|
}
|
|
75
48
|
}
|
|
76
49
|
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { TransitionManager } from './TransitionManager';
|
|
2
|
+
import { VCManager } from './VCManager';
|
|
3
|
+
import { ViewState } from './ViewState';
|
|
4
|
+
import { WorkerToMain } from './WorkerToMain';
|
|
5
|
+
|
|
6
|
+
class ApplicationViewController extends ViewState
|
|
7
|
+
{
|
|
8
|
+
constructor({ name, url, transition_data })
|
|
9
|
+
{
|
|
10
|
+
super(name);
|
|
11
|
+
|
|
12
|
+
this.url = url;
|
|
13
|
+
|
|
14
|
+
transition_data = transition_data || {
|
|
15
|
+
animation_tracks: [],
|
|
16
|
+
triggers: []
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const transitions = [
|
|
20
|
+
{
|
|
21
|
+
to: name,
|
|
22
|
+
data: transition_data
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
this.current_opacity = 0;
|
|
27
|
+
|
|
28
|
+
VCManager.register_view_controller(this);
|
|
29
|
+
TransitionManager.add_transitions(transitions);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
show()
|
|
33
|
+
{
|
|
34
|
+
WorkerToMain.push(`${this.name}_view.show`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
before_enter()
|
|
38
|
+
{
|
|
39
|
+
WorkerToMain.push(`${this.name}_view.before_enter`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
on_enter()
|
|
43
|
+
{
|
|
44
|
+
WorkerToMain.push(`${this.name}_view.on_enter`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
before_exit()
|
|
48
|
+
{
|
|
49
|
+
WorkerToMain.push(`${this.name}_view.before_exit`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
on_exit()
|
|
53
|
+
{
|
|
54
|
+
WorkerToMain.push(`${this.name}_view.on_exit`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
hide()
|
|
58
|
+
{
|
|
59
|
+
WorkerToMain.push(`${this.name}_view.hide`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
update()
|
|
63
|
+
{
|
|
64
|
+
WorkerToMain.push(`${this.name}_view.update`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
fixed_update()
|
|
68
|
+
{
|
|
69
|
+
// TODO: Evaluate if a fixed update is necessary on the main thread
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
update_enter_transition(global_view_data, transition_progress, action_sequencer)
|
|
73
|
+
{
|
|
74
|
+
WorkerToMain.push(`${this.name}_view.update_enter_transition`, [global_view_data, transition_progress]);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
update_exit_transition(global_view_data, transition_progress, action_sequencer)
|
|
78
|
+
{
|
|
79
|
+
WorkerToMain.push(`${this.name}_view.update_exit_transition`, [global_view_data, transition_progress]);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
set_opacity(current_state_data)
|
|
83
|
+
{
|
|
84
|
+
const opacity = current_state_data[`${this.name}_opacity`];
|
|
85
|
+
|
|
86
|
+
if (this.current_opacity > opacity || this.current_opacity < opacity)
|
|
87
|
+
{
|
|
88
|
+
this.current_opacity = opacity;
|
|
89
|
+
|
|
90
|
+
WorkerToMain.push(`${this.name}_view.set_opacity`, [opacity]);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { ApplicationViewController };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { TransitionTable } from './transition/TransitionTable';
|
|
2
|
+
import { ViewStateTransitionHandler } from './transition/ViewStateTransitionHandler';
|
|
3
|
+
|
|
4
|
+
class TransitionManager
|
|
5
|
+
{
|
|
6
|
+
constructor()
|
|
7
|
+
{
|
|
8
|
+
this.transition_table = new TransitionTable();
|
|
9
|
+
this.transition_handler = new ViewStateTransitionHandler(this.transition_table);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get action_sequencer()
|
|
13
|
+
{
|
|
14
|
+
return this.transition_handler.action_sequencer;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get current_state_data()
|
|
18
|
+
{
|
|
19
|
+
return this.transition_handler.current_state_data;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
before_update()
|
|
23
|
+
{
|
|
24
|
+
this.transition_handler.before_update();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
update()
|
|
28
|
+
{
|
|
29
|
+
this.transition_handler.update();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
fixed_update()
|
|
33
|
+
{
|
|
34
|
+
this.transition_handler.fixed_update();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
add_transitions(transitions)
|
|
38
|
+
{
|
|
39
|
+
this.transition_table.add_transitions(transitions);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
set_transitions(transitions)
|
|
43
|
+
{
|
|
44
|
+
this.transition_table.set_transitions(transitions);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
set_default_state_data(default_state_data)
|
|
48
|
+
{
|
|
49
|
+
this.transition_table.set_default_state_data(default_state_data);
|
|
50
|
+
this.transition_handler.set_default_state_data(default_state_data);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
set_transitions_velocity(transitions_velocity)
|
|
54
|
+
{
|
|
55
|
+
this.transition_table.set_transitions_velocity(transitions_velocity);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const transition_manager = new TransitionManager();
|
|
60
|
+
export { transition_manager as TransitionManager };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { HTMLUtilities } from '../utilities/HTMLUtilities';
|
|
2
1
|
import { ViewComponentManager } from './ViewComponentManager';
|
|
3
2
|
|
|
4
3
|
class ViewComponent
|
|
@@ -7,7 +6,8 @@ class ViewComponent
|
|
|
7
6
|
{
|
|
8
7
|
this.name = name;
|
|
9
8
|
this.container = container;
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
// this.hidden = true;
|
|
11
11
|
|
|
12
12
|
ViewComponentManager.register_component(this);
|
|
13
13
|
}
|
|
@@ -19,9 +19,10 @@ class ViewComponent
|
|
|
19
19
|
on_enter()
|
|
20
20
|
{
|
|
21
21
|
this.container.classList.remove('hidden');
|
|
22
|
-
ViewComponentManager.enable_component(this);
|
|
23
22
|
|
|
24
|
-
this.hidden = false;
|
|
23
|
+
// this.hidden = false;
|
|
24
|
+
|
|
25
|
+
ViewComponentManager.enable_component(this);
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
update()
|
|
@@ -31,43 +32,15 @@ class ViewComponent
|
|
|
31
32
|
on_exit()
|
|
32
33
|
{
|
|
33
34
|
this.container.classList.add('hidden');
|
|
34
|
-
ViewComponentManager.disable_component(this);
|
|
35
|
-
|
|
36
|
-
this.hidden = true;
|
|
37
|
-
}
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
this.container.style.opacity = current_state_data[`${this.name}_opacity`];
|
|
42
|
-
this.toggle_hidden();
|
|
43
|
-
}
|
|
36
|
+
// this.hidden = true;
|
|
44
37
|
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
if (this.container.style.opacity > 0.001)
|
|
48
|
-
{
|
|
49
|
-
if (this.hidden)
|
|
50
|
-
{
|
|
51
|
-
this.on_enter();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
else
|
|
55
|
-
{
|
|
56
|
-
if (!this.hidden)
|
|
57
|
-
{
|
|
58
|
-
this.on_exit();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
load_html_images()
|
|
64
|
-
{
|
|
65
|
-
HTMLUtilities.load_images(this.container);
|
|
38
|
+
ViewComponentManager.disable_component(this);
|
|
66
39
|
}
|
|
67
40
|
|
|
68
|
-
|
|
41
|
+
set_opacity(opacity)
|
|
69
42
|
{
|
|
70
|
-
|
|
43
|
+
this.container.style.opacity = opacity;
|
|
71
44
|
}
|
|
72
45
|
}
|
|
73
46
|
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ViewComponentControllerManager } from './ViewComponentControllerManager';
|
|
2
|
+
import { WorkerToMain } from './WorkerToMain';
|
|
3
|
+
|
|
4
|
+
class ViewComponentController
|
|
5
|
+
{
|
|
6
|
+
constructor({ name })
|
|
7
|
+
{
|
|
8
|
+
this.name = name;
|
|
9
|
+
|
|
10
|
+
this.current_opacity = 0;
|
|
11
|
+
this.hidden = true;
|
|
12
|
+
|
|
13
|
+
ViewComponentControllerManager.register_component_controller(this);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
start()
|
|
17
|
+
{
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
on_enter()
|
|
21
|
+
{
|
|
22
|
+
ViewComponentControllerManager.enable_component_controller(this);
|
|
23
|
+
WorkerToMain.push(`${this.name}_component.on_enter`);
|
|
24
|
+
|
|
25
|
+
this.hidden = false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
update()
|
|
29
|
+
{
|
|
30
|
+
WorkerToMain.push(`${this.name}_component.update`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
on_exit()
|
|
34
|
+
{
|
|
35
|
+
ViewComponentControllerManager.disable_component_controller(this);
|
|
36
|
+
WorkerToMain.push(`${this.name}_component.on_exit`);
|
|
37
|
+
|
|
38
|
+
this.hidden = true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
set_opacity(current_state_data)
|
|
42
|
+
{
|
|
43
|
+
const opacity = current_state_data[`${this.name}_opacity`];
|
|
44
|
+
|
|
45
|
+
if (this.current_opacity > opacity || this.current_opacity < opacity)
|
|
46
|
+
{
|
|
47
|
+
this.current_opacity = opacity;
|
|
48
|
+
|
|
49
|
+
WorkerToMain.push(`${this.name}_component.set_opacity`, [opacity]);
|
|
50
|
+
this.toggle_hidden();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
toggle_hidden()
|
|
55
|
+
{
|
|
56
|
+
if (this.current_opacity > 0.0001)
|
|
57
|
+
{
|
|
58
|
+
if (this.hidden)
|
|
59
|
+
{
|
|
60
|
+
this.on_enter();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else
|
|
64
|
+
{
|
|
65
|
+
if (!this.hidden)
|
|
66
|
+
{
|
|
67
|
+
this.on_exit();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { ViewComponentController };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { TransitionManager } from './TransitionManager';
|
|
2
|
+
|
|
3
|
+
class ViewComponentControllerManager
|
|
4
|
+
{
|
|
5
|
+
constructor()
|
|
6
|
+
{
|
|
7
|
+
this.component_controllers = [];
|
|
8
|
+
this.enabled_component_controllers = new Set();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
update()
|
|
12
|
+
{
|
|
13
|
+
this.__set_component_controllers_opacities();
|
|
14
|
+
|
|
15
|
+
for (const component_controller of this.enabled_component_controllers)
|
|
16
|
+
{
|
|
17
|
+
component_controller.update(TransitionManager.current_state_data);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
register_component_controller(component_controller)
|
|
22
|
+
{
|
|
23
|
+
this.component_controllers.push(component_controller);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
enable_component_controller(component_controller)
|
|
27
|
+
{
|
|
28
|
+
this.enabled_component_controllers.add(component_controller);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
disable_component_controller(component_controller)
|
|
32
|
+
{
|
|
33
|
+
this.enabled_component_controllers.delete(component_controller);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get(component_name)
|
|
37
|
+
{
|
|
38
|
+
for (let i = 0; i < this.component_controllers.length; i++)
|
|
39
|
+
{
|
|
40
|
+
if (this.component_controllers[i].name === component_name)
|
|
41
|
+
{
|
|
42
|
+
return this.component_controllers[i];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
console.error('[ViewComponentControllerManager.get] no component_controller found for: ', component_name);
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
__set_component_controllers_opacities()
|
|
50
|
+
{
|
|
51
|
+
for (let i = 0; i < this.component_controllers.length; i++)
|
|
52
|
+
{
|
|
53
|
+
this.component_controllers[i].set_opacity(TransitionManager.current_state_data);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const view_component_contorller_manager = new ViewComponentControllerManager();
|
|
59
|
+
export { view_component_contorller_manager as ViewComponentControllerManager };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TransitionManager } from './TransitionManager';
|
|
2
2
|
|
|
3
3
|
class ViewComponentManager
|
|
4
4
|
{
|
|
@@ -14,7 +14,7 @@ class ViewComponentManager
|
|
|
14
14
|
|
|
15
15
|
for (const component of this.enabled_components)
|
|
16
16
|
{
|
|
17
|
-
component.update(
|
|
17
|
+
component.update(TransitionManager.current_state_data);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -25,24 +25,14 @@ class ViewComponentManager
|
|
|
25
25
|
|
|
26
26
|
enable_component(component)
|
|
27
27
|
{
|
|
28
|
-
// const component_to_enable = this.get_component_by_name(component_name);
|
|
29
|
-
|
|
30
28
|
this.enabled_components.add(component);
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
disable_component(component)
|
|
34
32
|
{
|
|
35
|
-
// const component_to_disable = this.get_component_by_name(component_name);
|
|
36
|
-
|
|
37
33
|
this.enabled_components.delete(component);
|
|
38
34
|
}
|
|
39
35
|
|
|
40
|
-
get_component_by_name(component_name)
|
|
41
|
-
{
|
|
42
|
-
console.warn('DEPRECATED. Use ViewComponentManager.get instead');
|
|
43
|
-
this.get(component_name);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
36
|
get(component_name)
|
|
47
37
|
{
|
|
48
38
|
for (let i = 0; i < this.components.length; i++)
|
|
@@ -60,7 +50,7 @@ class ViewComponentManager
|
|
|
60
50
|
{
|
|
61
51
|
for (let i = 0; i < this.components.length; i++)
|
|
62
52
|
{
|
|
63
|
-
this.components[i].set_opacity(
|
|
53
|
+
this.components[i].set_opacity(TransitionManager.current_state_data);
|
|
64
54
|
}
|
|
65
55
|
}
|
|
66
56
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { TransitionManager } from './TransitionManager';
|
|
2
|
+
|
|
3
|
+
class ViewControllerManager
|
|
4
|
+
{
|
|
5
|
+
constructor()
|
|
6
|
+
{
|
|
7
|
+
this.view_controllers = [];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
go_to_view_controller(view_controller_name, skip = false)
|
|
11
|
+
{
|
|
12
|
+
const v = this.get(view_controller_name);
|
|
13
|
+
TransitionManager.transition_handler.go_to_state(v, skip);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
update()
|
|
17
|
+
{
|
|
18
|
+
this.__set_view_controllers_opacities();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
register_view_controller(view_controller)
|
|
22
|
+
{
|
|
23
|
+
this.view_controllers.push(view_controller);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
set_view_controller(view_controller_name)
|
|
27
|
+
{
|
|
28
|
+
const view_controller = this.get(view_controller_name);
|
|
29
|
+
|
|
30
|
+
TransitionManager.transition_handler.set_state(view_controller);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
get_current_view_controller()
|
|
34
|
+
{
|
|
35
|
+
return TransitionManager.transition_handler.current_state;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get(view_controller_name)
|
|
39
|
+
{
|
|
40
|
+
for (let i = 0; i < this.view_controllers.length; i++)
|
|
41
|
+
{
|
|
42
|
+
if (this.view_controllers[i].name === view_controller_name)
|
|
43
|
+
{
|
|
44
|
+
return this.view_controllers[i];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
console.error('[ViewControllerManager.get] no view controller found for: ', view_controller_name);
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// get_by_url(url)
|
|
52
|
+
// {
|
|
53
|
+
// for (let i = 0; i < this.view_controllers.length; i++)
|
|
54
|
+
// {
|
|
55
|
+
// if (this.view_controllers[i].url === url)
|
|
56
|
+
// {
|
|
57
|
+
// return this.view_controllers[i];
|
|
58
|
+
// }
|
|
59
|
+
// }
|
|
60
|
+
// console.error('[ViewControllerManager.get_by_url] no view controller found for: ', url);
|
|
61
|
+
// return undefined;
|
|
62
|
+
// }
|
|
63
|
+
|
|
64
|
+
__set_view_controllers_opacities()
|
|
65
|
+
{
|
|
66
|
+
for (let i = 0; i < this.view_controllers.length; i++)
|
|
67
|
+
{
|
|
68
|
+
this.view_controllers[i].set_opacity(TransitionManager.transition_handler.current_state_data);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
__capitalize(string)
|
|
73
|
+
{
|
|
74
|
+
let aux_string = string.toUpperCase().replace('/', '');
|
|
75
|
+
aux_string = this.__snake_to_whitespace(aux_string);
|
|
76
|
+
|
|
77
|
+
return aux_string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
__snake_to_whitespace(string)
|
|
81
|
+
{
|
|
82
|
+
return string.replace(
|
|
83
|
+
/([-_][A-Z])/g,
|
|
84
|
+
(group) => group
|
|
85
|
+
.replace('-', ' ')
|
|
86
|
+
.replace('_', ' ')
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export { ViewControllerManager };
|