-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTodoListApp.cs
More file actions
37 lines (31 loc) · 1.1 KB
/
Copy pathTodoListApp.cs
File metadata and controls
37 lines (31 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using Samples.SimpleTodoList.Widgets;
using UniMob.UI;
using UnityEngine;
namespace Samples.SimpleTodoList
{
public class TodoListApp : UniMobUIApp
{
[SerializeField] private GameObject todoListViewPrefab = default;
[SerializeField] private GameObject todoViewPrefab = default;
private TodoList _todoList;
protected override void Initialize()
{
_todoList = new TodoList(Lifetime);
_todoList.AddTodo("Get Coffee");
_todoList.AddTodo("Write simpler code");
_todoList.Todos[0].Finished = true;
StateProvider.Register<TodoListWidget>(() => new TodoListState(
view: WidgetViewReference.FromPrefab(todoListViewPrefab),
todoList: _todoList
));
StateProvider.Register<TodoWidget>(() => new TodoState(
view: WidgetViewReference.FromPrefab(todoViewPrefab),
todoList: _todoList
));
}
protected override Widget Build(BuildContext context)
{
return new TodoListWidget();
}
}
}