質問編集履歴
2
あ
title
CHANGED
File without changes
|
body
CHANGED
@@ -12,15 +12,6 @@
|
|
12
12
|
|
13
13
|
virtualButtonMaterial [0].material.color = Color.red;
|
14
14
|
break;
|
15
|
-
|
16
|
-
case "actionButton1":
|
17
|
-
|
18
|
-
virtualButtonMaterial[1].material.color = Color.blue;
|
19
|
-
|
20
|
-
break;
|
21
|
-
|
22
|
-
case "actionButton2":
|
23
|
-
|
24
15
|
virtualButtonMaterial [2].material.color = Color.yellow;
|
25
16
|
|
26
17
|
break;
|
@@ -31,216 +22,4 @@
|
|
31
22
|
で色を変更しようとしているのですがヴァーチャルボタンに触れなくても色が変わると思いきや、↓のコードを実行せず+1 あるいは -1をしてくれません。
|
32
23
|
解決策や原因などご教授ください。
|
33
24
|
|
34
|
-
```C#
|
35
|
-
if (vb.name == "actionButton0" && int.Parse (_3DtextInstance [0].text)>0 && int.Parse (_3DtextInstance [0].text)<6)
|
36
|
-
_3DtextInstance [0].text = int.Parse (_3DtextInstance [0].text) + 1 + "";
|
37
|
-
|
38
|
-
if (vb.name == "actionButton0" && int.Parse (_3DtextInstance [0].text)>1 && int.Parse (_3DtextInstance [0].text)<7)
|
39
|
-
_3DtextInstance [0].text = int.Parse (_3DtextInstance [0].text) - 1 + "";
|
40
|
-
`
|
25
|
+
`
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-

|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
```C#
|
49
|
-
using System.Collections;
|
50
|
-
using System.Collections.Generic;
|
51
|
-
using UnityEngine;
|
52
|
-
using Vuforia;
|
53
|
-
using System;
|
54
|
-
public class vbScript : MonoBehaviour,Vuforia.IVirtualButtonEventHandler {
|
55
|
-
|
56
|
-
GameObject[] virtualButtonObject = new GameObject[3];
|
57
|
-
GameObject[] _3Dtext = new GameObject[3];
|
58
|
-
public TextMesh[] _3DtextInstance = new TextMesh[3];
|
59
|
-
public GameObject[] actionButtonPlane = new GameObject[3];
|
60
|
-
Renderer[] virtualButtonMaterial = new Renderer[3];
|
61
|
-
public sample sampleClass;
|
62
|
-
void Start () {
|
63
|
-
|
64
|
-
for (int i= 0; virtualButtonObject.Length > i ;i++){
|
65
|
-
|
66
|
-
virtualButtonObject[i] = GameObject.Find ("actionButton"+i);
|
67
|
-
virtualButtonObject[i].GetComponent<VirtualButtonBehaviour> ().RegisterEventHandler (this);
|
68
|
-
virtualButtonMaterial[i] = actionButtonPlane[i].GetComponent<Renderer>();
|
69
|
-
|
70
|
-
}
|
71
|
-
|
72
|
-
_3DtextInstance [0].text = "1";
|
73
|
-
}
|
74
|
-
|
75
|
-
// Update is called once per frame
|
76
|
-
void Update () {
|
77
|
-
|
78
|
-
switch(int.Parse (_3DtextInstance [0].text)){
|
79
|
-
|
80
|
-
|
81
|
-
case 1:
|
82
|
-
|
83
|
-
_3DtextInstance [1].text = sampleClass.csvDatas [1] [0];
|
84
|
-
break;
|
85
|
-
|
86
|
-
case 2:
|
87
|
-
|
88
|
-
_3DtextInstance [1].text = sampleClass.csvDatas [1] [1];
|
89
|
-
break;
|
90
|
-
|
91
|
-
|
92
|
-
case 3:
|
93
|
-
|
94
|
-
_3DtextInstance [1].text = sampleClass.csvDatas [1] [2];
|
95
|
-
break;
|
96
|
-
|
97
|
-
case 4:
|
98
|
-
|
99
|
-
_3DtextInstance [1].text = sampleClass.csvDatas [1] [3];
|
100
|
-
break;
|
101
|
-
|
102
|
-
case 5:
|
103
|
-
|
104
|
-
_3DtextInstance [1].text = sampleClass.csvDatas [1] [4];
|
105
|
-
break;
|
106
|
-
|
107
|
-
case 6:
|
108
|
-
|
109
|
-
_3DtextInstance [1].text = sampleClass.csvDatas [1] [5];
|
110
|
-
break;
|
111
|
-
|
112
|
-
default :
|
113
|
-
|
114
|
-
_3DtextInstance [1].text = "ERROR";
|
115
|
-
break;
|
116
|
-
|
117
|
-
}
|
118
|
-
|
119
|
-
|
120
|
-
}
|
121
|
-
|
122
|
-
public void OnButtonPressed(VirtualButtonAbstractBehaviour vb){
|
123
|
-
|
124
|
-
|
125
|
-
switch (vb.name){
|
126
|
-
|
127
|
-
case "actionButton0":
|
128
|
-
|
129
|
-
virtualButtonMaterial [0].material.color = Color.red;
|
130
|
-
break;
|
131
|
-
|
132
|
-
case "actionButton1":
|
133
|
-
|
134
|
-
virtualButtonMaterial[1].material.color = Color.blue;
|
135
|
-
|
136
|
-
break;
|
137
|
-
|
138
|
-
case "actionButton2":
|
139
|
-
|
140
|
-
virtualButtonMaterial [2].material.color = Color.yellow;
|
141
|
-
|
142
|
-
break;
|
143
|
-
}
|
144
|
-
|
145
|
-
try{
|
146
|
-
|
147
|
-
if (vb.name == "actionButton0" && int.Parse (_3DtextInstance [0].text)>0 && int.Parse (_3DtextInstance [0].text)<6)
|
148
|
-
_3DtextInstance [0].text = int.Parse (_3DtextInstance [0].text) + 1 + "";
|
149
|
-
|
150
|
-
if (vb.name == "actionButton0" && int.Parse (_3DtextInstance [0].text)>1 && int.Parse (_3DtextInstance [0].text)<7)
|
151
|
-
_3DtextInstance [0].text = int.Parse (_3DtextInstance [0].text) - 1 + "";
|
152
|
-
|
153
|
-
|
154
|
-
}catch(FormatException){
|
155
|
-
|
156
|
-
|
157
|
-
_3DtextInstance [0].text = "1";
|
158
|
-
|
159
|
-
}
|
160
|
-
}
|
161
|
-
|
162
|
-
public void OnButtonReleased(VirtualButtonAbstractBehaviour vb){
|
163
|
-
|
164
|
-
switch (vb.name){
|
165
|
-
|
166
|
-
case "actionButton0":
|
167
|
-
|
168
|
-
virtualButtonMaterial [0].material.color = new Color(255,111,0);
|
169
|
-
break;
|
170
|
-
|
171
|
-
case "actionButton1":
|
172
|
-
|
173
|
-
virtualButtonMaterial[1].material.color = new Color(255,111,0);
|
174
|
-
|
175
|
-
break;
|
176
|
-
|
177
|
-
case "actionButton2":
|
178
|
-
|
179
|
-
virtualButtonMaterial [2].material.color = new Color(255,111,0);
|
180
|
-
|
181
|
-
break;
|
182
|
-
}
|
183
|
-
|
184
|
-
|
185
|
-
}
|
186
|
-
|
187
|
-
}
|
188
|
-
```
|
189
|
-
|
190
|
-
|
191
|
-
```sample
|
192
|
-
1,2,3,4,5,6
|
193
|
-
会計学,ネットワーク概論,財政学,統計学,,no Classes
|
194
|
-
倫理学,経済学
|
195
|
-
13,14,15,16
|
196
|
-
17.18,19,20
|
197
|
-
```
|
198
|
-
|
199
|
-
```ここに言語を入力
|
200
|
-
using System.Collections;
|
201
|
-
using System.Collections.Generic;
|
202
|
-
using UnityEngine;
|
203
|
-
using System.IO;
|
204
|
-
using System;
|
205
|
-
|
206
|
-
public class sample : MonoBehaviour {
|
207
|
-
[SerializeField]public TextAsset csvFile; // GUIでcsvファイルを割当
|
208
|
-
public List<string[]> csvDatas = new List<string[]>();
|
209
|
-
public string[][] cc ;
|
210
|
-
// Use this for initialization
|
211
|
-
void Awake () {
|
212
|
-
|
213
|
-
//csvFile = Resources.Load ("sample") as TextAsset;
|
214
|
-
|
215
|
-
// 格納
|
216
|
-
|
217
|
-
string[] lines = csvFile.text.Replace ("\r\n", "\n").Split ('\n');
|
218
|
-
|
219
|
-
foreach (var line in lines) {
|
220
|
-
|
221
|
-
if (line == "") {
|
222
|
-
continue;
|
223
|
-
}
|
224
|
-
|
225
|
-
csvDatas.Add (line.Split (',')); // string[]を追加している
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
}
|
230
|
-
}
|
231
|
-
|
232
|
-
void Strat(){
|
233
|
-
foreach(string[] ss in csvDatas){
|
234
|
-
int i = 0;
|
235
|
-
|
236
|
-
foreach(string sss in ss){
|
237
|
-
int j = 0;
|
238
|
-
cc[i][j++] = sss ;
|
239
|
-
Debug.Log (cc [i] [j]);
|
240
|
-
}
|
241
|
-
i++;
|
242
|
-
}
|
243
|
-
}
|
244
|
-
|
245
|
-
}
|
246
|
-
```
|
1
a
title
CHANGED
File without changes
|
body
CHANGED
@@ -194,4 +194,53 @@
|
|
194
194
|
倫理学,経済学
|
195
195
|
13,14,15,16
|
196
196
|
17.18,19,20
|
197
|
+
```
|
198
|
+
|
199
|
+
```ここに言語を入力
|
200
|
+
using System.Collections;
|
201
|
+
using System.Collections.Generic;
|
202
|
+
using UnityEngine;
|
203
|
+
using System.IO;
|
204
|
+
using System;
|
205
|
+
|
206
|
+
public class sample : MonoBehaviour {
|
207
|
+
[SerializeField]public TextAsset csvFile; // GUIでcsvファイルを割当
|
208
|
+
public List<string[]> csvDatas = new List<string[]>();
|
209
|
+
public string[][] cc ;
|
210
|
+
// Use this for initialization
|
211
|
+
void Awake () {
|
212
|
+
|
213
|
+
//csvFile = Resources.Load ("sample") as TextAsset;
|
214
|
+
|
215
|
+
// 格納
|
216
|
+
|
217
|
+
string[] lines = csvFile.text.Replace ("\r\n", "\n").Split ('\n');
|
218
|
+
|
219
|
+
foreach (var line in lines) {
|
220
|
+
|
221
|
+
if (line == "") {
|
222
|
+
continue;
|
223
|
+
}
|
224
|
+
|
225
|
+
csvDatas.Add (line.Split (',')); // string[]を追加している
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
}
|
230
|
+
}
|
231
|
+
|
232
|
+
void Strat(){
|
233
|
+
foreach(string[] ss in csvDatas){
|
234
|
+
int i = 0;
|
235
|
+
|
236
|
+
foreach(string sss in ss){
|
237
|
+
int j = 0;
|
238
|
+
cc[i][j++] = sss ;
|
239
|
+
Debug.Log (cc [i] [j]);
|
240
|
+
}
|
241
|
+
i++;
|
242
|
+
}
|
243
|
+
}
|
244
|
+
|
245
|
+
}
|
197
246
|
```
|