-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcsharp.json
167 lines (166 loc) · 4.05 KB
/
csharp.json
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
{
// Place your snippets for csharp here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"MVCController": {
"prefix": "controller",
"body": [
"using Zenject;",
"",
"public interface I${1:Controller}Controller",
"{",
"void Initialize();",
"void SetVisable(bool v);",
"void Tick();",
"void Dispose();",
"}",
"",
"public class ${1:Controller}Controller : I${1:Controller}Controller",
"{",
" I${1:Controller}Model model;",
"",
" [Inject]",
" public void Construct(I${1:Model}Model model) => this.model = model;",
"",
" public void Initialize()",
" {",
" throw new System.NotImplementedException();",
" }",
"",
" public void SetVisable(bool v) => model.IsEnabled = v;",
"",
" public void Tick()",
" {",
" throw new System.NotImplementedException();",
" }",
"",
" public void Dispose()",
" {",
" throw new System.NotImplementedException();",
" }",
"}"
],
"description": "Zenject Controller template"
},
"MVCView": {
"prefix": "view",
"body": [
"using UnityEngine;",
"using Zenject;",
"",
"public class ${1:View}View : MonoBehaviour",
"{",
" I${1:Model}Model model;",
"",
" [Inject]",
" public void Construct(I${1:Model}Model model)",
" {",
" this.model = model;",
" }",
"",
" public void Start()",
" {",
" if (model != null)",
" {",
" model.OnIsEnabledChanged += OnIsEnabledChanged;",
" model.OnIsDirtyChanged += OnIsDirtyChanged;",
" }",
" }",
"",
" public void OnDestroy()",
" {",
" if (model != null)",
" {",
" model.OnIsEnabledChanged -= OnIsEnabledChanged;",
" model.OnIsDirtyChanged -= OnIsDirtyChanged;",
" }",
" }",
"",
" void OnIsEnabledChanged(bool newIsEnabled)",
" {",
" gameObject.SetActive(newIsEnabled);",
" }",
"",
" void OnIsDirtyChanged(bool newIsDirty)",
" {",
" throw new System.NotImplementedException();",
" }",
"}"
],
"description": "Zenject View template"
},
"MVCModel": {
"prefix": "model",
"body": [
"using System;",
"",
" public interface I${1:Model}Model",
" {",
" bool IsEnabled { get; set; }",
" bool IsDirty { get; set; }",
" Action<bool> OnIsEnabledChanged { get; set; }",
" Action<bool> OnIsDirtyChanged { get; set; }",
" void Save();",
" void Load();",
" }",
"",
"public class ${1:Model}Model : I${1:Model}Model",
"{",
"private bool isEnabled;",
"public bool IsEnabled",
"{",
" get { return isEnabled; }",
" set",
" {",
" if (isEnabled != value)",
" {",
" isEnabled = value;",
" OnIsEnabledChanged?.Invoke(isEnabled);",
" }",
" }",
"}",
"",
"private bool isDirty;",
"public bool IsDirty",
"{",
" get { return isDirty; }",
" set",
" {",
" if (isDirty != value)",
" {",
" isDirty = value;",
" OnIsDirtyChanged?.Invoke(isDirty);",
" }",
" }",
"}",
"",
"public Action<bool> OnIsEnabledChanged {get;set;}",
"public Action<bool> OnIsDirtyChanged{get;set;}",
"",
"public void Save()",
"{",
" if (IsDirty)",
" {",
" IsDirty = false;",
" }",
"}",
"",
"public void Load()",
"{",
" throw new NotImplementedException();",
"}"
"}"
],
"description": "Zenject Model template"
}
}