質問編集履歴

3

誤って追加したソースを削除

2017/10/23 23:11

投稿

suvera
suvera

スコア106

test CHANGED
File without changes
test CHANGED
@@ -21,123 +21,3 @@
21
21
  Unity 2017
22
22
 
23
23
  C#
24
-
25
-
26
-
27
- # スクリプトの一部
28
-
29
-
30
-
31
- MonoBehaviour継承クラス
32
-
33
- ```MapManagerClass
34
-
35
- public List<List<int>> map;
36
-
37
-
38
-
39
- void Start() {
40
-
41
- Debug.Log(map);
42
-
43
- }
44
-
45
- public void SetMap(List<List<BlockStatus>> newMap) {
46
-
47
- map = newMap;
48
-
49
- }
50
-
51
- ```
52
-
53
-
54
-
55
- Editorスクリプト
56
-
57
- ```
58
-
59
- void OnGUI() {
60
-
61
- mapManager = EditorGUILayout.ObjectField("MapManagerコンポーネント を持ったオブジェクト", mapManager, typeof(MapManager), true) as MapManager;
62
-
63
-
64
-
65
- if (mapManager == null)
66
-
67
- return;
68
-
69
-
70
-
71
- List<List<int>> map = mapManager.map;
72
-
73
- int mapSize = 0;
74
-
75
- Debug.Log(map);
76
-
77
- if (map != null) {
78
-
79
- mapSize = map.Count;
80
-
81
- }
82
-
83
- else {
84
-
85
- mapManager.map = new List<List<int>>();
86
-
87
- map = mapManager.map;
88
-
89
- }
90
-
91
-
92
-
93
- foldoutMapList = EditorGUILayout.Foldout(foldoutMapList, "map");
94
-
95
- if (this.foldoutMapList) {
96
-
97
- mapSize = EditorGUILayout.IntField("Size", mapSize);
98
-
99
- mapSize = Mathf.Clamp(mapSize, 1, 5);
100
-
101
- EditorGUILayout.BeginHorizontal(GUI.skin.box);
102
-
103
- {
104
-
105
- for (int index = 0; index < mapSize; index++) {
106
-
107
- EditorGUILayout.BeginVertical(GUI.skin.box);
108
-
109
- {
110
-
111
- if (index < map.Count) {
112
-
113
- EditorGUILayout.LabelField(index.ToString());
114
-
115
- }
116
-
117
- else {
118
-
119
- map.Add(new List<int>());
120
-
121
- }
122
-
123
- EditorGUILayout.EndVertical();
124
-
125
- }
126
-
127
- }
128
-
129
- EditorGUILayout.EndHorizontal();
130
-
131
- if (mapSize < map.Count) {
132
-
133
- map.RemoveRange(mapSize, map.Count - mapSize);
134
-
135
- }
136
-
137
- }
138
-
139
- mapManager.SetMap(map);
140
-
141
- }
142
-
143
- ```

2

抜けがあったので修正

2017/10/23 23:10

投稿

suvera
suvera

スコア106

test CHANGED
File without changes
test CHANGED
@@ -39,6 +39,12 @@
39
39
  void Start() {
40
40
 
41
41
  Debug.Log(map);
42
+
43
+ }
44
+
45
+ public void SetMap(List<List<BlockStatus>> newMap) {
46
+
47
+ map = newMap;
42
48
 
43
49
  }
44
50
 

1

スクリプトを上げるように言われたので上げました

2017/10/23 12:30

投稿

suvera
suvera

スコア106

test CHANGED
File without changes
test CHANGED
@@ -21,3 +21,117 @@
21
21
  Unity 2017
22
22
 
23
23
  C#
24
+
25
+
26
+
27
+ # スクリプトの一部
28
+
29
+
30
+
31
+ MonoBehaviour継承クラス
32
+
33
+ ```MapManagerClass
34
+
35
+ public List<List<int>> map;
36
+
37
+
38
+
39
+ void Start() {
40
+
41
+ Debug.Log(map);
42
+
43
+ }
44
+
45
+ ```
46
+
47
+
48
+
49
+ Editorスクリプト
50
+
51
+ ```
52
+
53
+ void OnGUI() {
54
+
55
+ mapManager = EditorGUILayout.ObjectField("MapManagerコンポーネント を持ったオブジェクト", mapManager, typeof(MapManager), true) as MapManager;
56
+
57
+
58
+
59
+ if (mapManager == null)
60
+
61
+ return;
62
+
63
+
64
+
65
+ List<List<int>> map = mapManager.map;
66
+
67
+ int mapSize = 0;
68
+
69
+ Debug.Log(map);
70
+
71
+ if (map != null) {
72
+
73
+ mapSize = map.Count;
74
+
75
+ }
76
+
77
+ else {
78
+
79
+ mapManager.map = new List<List<int>>();
80
+
81
+ map = mapManager.map;
82
+
83
+ }
84
+
85
+
86
+
87
+ foldoutMapList = EditorGUILayout.Foldout(foldoutMapList, "map");
88
+
89
+ if (this.foldoutMapList) {
90
+
91
+ mapSize = EditorGUILayout.IntField("Size", mapSize);
92
+
93
+ mapSize = Mathf.Clamp(mapSize, 1, 5);
94
+
95
+ EditorGUILayout.BeginHorizontal(GUI.skin.box);
96
+
97
+ {
98
+
99
+ for (int index = 0; index < mapSize; index++) {
100
+
101
+ EditorGUILayout.BeginVertical(GUI.skin.box);
102
+
103
+ {
104
+
105
+ if (index < map.Count) {
106
+
107
+ EditorGUILayout.LabelField(index.ToString());
108
+
109
+ }
110
+
111
+ else {
112
+
113
+ map.Add(new List<int>());
114
+
115
+ }
116
+
117
+ EditorGUILayout.EndVertical();
118
+
119
+ }
120
+
121
+ }
122
+
123
+ EditorGUILayout.EndHorizontal();
124
+
125
+ if (mapSize < map.Count) {
126
+
127
+ map.RemoveRange(mapSize, map.Count - mapSize);
128
+
129
+ }
130
+
131
+ }
132
+
133
+ mapManager.SetMap(map);
134
+
135
+ }
136
+
137
+ ```