Skip to content

Commit 5c3119f

Browse files
authored
Merge pull request #9 from katsumasa/develop
Develop
2 parents 433a8a3 + 001315a commit 5c3119f

File tree

5 files changed

+64
-29
lines changed

5 files changed

+64
-29
lines changed

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Changelog
22

3+
## [1.1.3] - 2022-09-14
34

4-
## [0.1.0] - 2021-10-15
5+
- [Fixed] イベントスクリプトエラーが発生した場合、Playボタンが押せなくなっていた不具合を修正
6+
- [Fixed] Autoプレイ時に選択したイベントスクリプトではなく、先頭のスクリプトが実行されていた不具合を修正
7+
- [Changed] イベントスクリプトエラーが発生した場合、Debug.LogではなくDebug.LogErrorでコンソール出力を行うように変更。また、可能な場合、イベントスクリプト名と行数を表示するようにした。
58

6-
### Changes
9+
## [0.1.0] - 2021-10-15
710

8-
- 1st Release
11+
- [New] 1st Release

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ ifls i 100 goto LOOP1
6666
## 使用方法
6767

6868
- UnityEditorUnityPlayer(実機)の両方で実行出来ます。
69-
- 既存のEventSystemオブジェクトとEventSystemBotオブジェクトを差し替える必要があります
69+
- 既存の`Event System`オブジェクトと`Event System Bot`オブジェクトを差し替える必要があります
7070
- 具体的な手順は下記の通りです。
7171

7272
### インストール方法
7373

7474
1. 本リポジトリを使用したいUnityProjectAsset以下に配置します。</br></br>
75-
2. Scene上に、`EventSystemBot` を配置します。元々Scene上にある`EventSystem`は無効化して下さい。</br></br>
75+
2. Scene上に、`Event System Bot` を配置します。元々Scene上にある`EventSystem`は無効化して下さい。</br></br>
7676
![7bb999acffa06c965befe08d2e0dfb32](https://user-images.githubusercontent.com/29646672/114997568-f414e000-9eda-11eb-9019-e399679cc537.gif)</br></br>
7777
3. [イベントスクリプト]を作成します。イベントスクリプトの記述情報に関しては、[こちら](https://github.com/katsumasa/UnityBotKun/wiki/EventScript)をご確認下さい。また、プレイ中の入力を記録し、イベントスクリプトに書き出すことも可能です。</br></br>
78-
4. イベントスクリプトをEventSystemBot->EventScriptSystem->Scriptsに登録します。</br></br>
78+
4. イベントスクリプトを`Event System Bot`->`Event Script System`->`Scripts`に登録します。</br></br>
7979
![4cc62410ddd69f7453220c85b54bae02](https://user-images.githubusercontent.com/29646672/115168940-9f9a7c00-a0f7-11eb-9f37-8630c06d885c.gif)</br></br>
8080
5. プログラム中に[Input](https://docs.unity3d.com/ja/2018.4/ScriptReference/Input.html)を使用している箇所は`Input2`に置き換えて下さい。</br> example</br>
8181

@@ -91,7 +91,7 @@ var horizontal = Input2.GetAxsisRow("Horizontal");
9191

9292
### UnityEditorでの実行方法
9393

94-
Unity EditorをPlay Modeで実行し、任意のタイミングでEventScriptSystemのPlayボタンを押します。</br></br>
94+
Unity EditorをPlay Modeで実行し、任意のタイミングで`Event Script System`のPlayボタンを押します。</br></br>
9595
![223d79121d8f60d04063952a468103fb](https://user-images.githubusercontent.com/29646672/115173162-9f9f7980-a101-11eb-9bc1-88bb9615ca79.gif)</br></br>
9696

9797
### UnityPlayer(実機)での実行方法
@@ -105,13 +105,13 @@ UnityBotKun Remote Clientを使ってApplicationをUnityEditorからリモート
105105

106106
## Component
107107

108-
ここでは、`EventSystemBot` にAddされているコンポーネントを説明します。
108+
ここでは、`Event System Bot` にAddされているコンポーネントを説明します。
109109

110110
### Event System Bot
111111

112-
EventSystemBotはEventSystem,StandaloneInputModuleOverrider,ScriptBot,InputBot,InputRecorder,DontDestory等の複数のコンポーネントで構成されています。
112+
`Event System Bot`はEventSystem,StandaloneInputModuleOverrider,ScriptBot,InputBot,InputRecorder,DontDestory等の複数のコンポーネントで構成されています。
113113

114-
### EventSystem
114+
### Event System
115115

116116
![img](https://user-images.githubusercontent.com/29646672/115169576-65ca7500-a0f9-11eb-95cf-c1f649bcf857.png)
117117

@@ -125,7 +125,7 @@ EventSystemBotはEventSystem,StandaloneInputModuleOverrider,ScriptBot,InputBot,I
125125
Axisやボタンの名称を変更する場合はこちらで設定を行います。
126126
詳細に関しては、[スクリプトリファレンス](https://docs.unity3d.com/ja/2018.4/ScriptReference/EventSystems.StandaloneInputModule.html)をご確認下さい。</br></br>
127127

128-
### EventScriptSystem
128+
### Event Script System
129129

130130
![img](https://user-images.githubusercontent.com/29646672/115514564-31081a80-a2bf-11eb-9ca6-991f5ed9b4e2.png)
131131

@@ -175,12 +175,12 @@ InputをHackするコンポーネントです。
175175

176176
### Dont Destory
177177

178-
Sceneを跨いでEventSystemBotを使用する為のコンポーネントです
178+
Sceneを跨いで`Event System Bot`を使用する為のコンポーネントです
179179

180180
![img](https://user-images.githubusercontent.com/29646672/115174476-44bb5180-a104-11eb-9dc0-43120e0f571a.png)
181181

182182
- Is Dont Destroy On Load
183-
Scene切り替え時のEventSystemBotを破棄したくない場合は有効にする必要があります
183+
Scene切り替え時の`Event System Bot`を破棄したくない場合は有効にする必要があります
184184

185185
### Remote Player
186186

@@ -190,7 +190,7 @@ Sceneを跨いでEventSystemBotを使用する為のコンポーネントです
190190

191191
<img width="426" alt="RemoteClient" src="https://user-images.githubusercontent.com/29646672/116061453-d48d6c80-a6bd-11eb-93f5-2dcfc7384654.png">
192192

193-
UnityPlayer(実機)上のEventSystemBotをUnityEditorから制御する為のWindowです
193+
UnityPlayer(実機)上の`Event System Bot`をUnityEditorから制御する為のWindowです
194194

195195
① Refleshボタン。Player上のUnityBotKunの情報を取得します。</br>
196196
② イベントスクリプト実行ボタン。④で指定されたイベントスクリプトを実行/停止を行います。
@@ -217,10 +217,10 @@ UnityPlayer(実機)上のEventSystemBotをUnityEditorから制御する為のWin
217217
- A</br>`InpurRecorder`はInputのみを記録しています。処理落ちや乱数など、結果に対して様々な要員がある為、同じ結果にならない場合があります。
218218

219219
- Q</br>イベントスクリプトを実行しても、Inputが反映されません。
220-
- A</br>他の`EventSystem`が有効になっている可能性があります。実行時に`EventSystemBot`以外の`EventSystem``Scene`上に存在しないか確認してみて下さい。また、`Standalone Iput Module Override``Force Module Active`を有効にすることで改善する可能性があります。
220+
- A</br>他の`Event System`が有効になっている可能性があります。実行時に`Event System Bot`以外の`Event System``Scene`上に存在しないか確認してみて下さい。また、`Standalone Iput Module Override``Force Module Active`を有効にすることで改善する可能性があります。
221221

222222
- Q</br>`uGUI`にはタッチやマウスのクリックが反応しますが、3D等他のオブジェクトに反応しません。
223-
- A</br>`EventSystem`を利用している為、`MonoBehaviour.OnMouseXXX`系のイベントは発生しません。[IPointerEnterHandler](https://docs.unity3d.com/ja/2018.4/ScriptReference/EventSystems.IPointerEnterHandler.html)を継承する等してイベントをキャッチして下さい。また、Cameraオブジェクトに[PhysicsRaycaster](https://docs.unity3d.com/ja/2018.4/ScriptReference/EventSystems.PhysicsRaycaster.html)[Physics2DRaycaster](https://docs.unity3d.com/ja/2018.4/ScriptReference/EventSystems.Physics2DRaycaster.html)をAddすることもお忘れなく。
223+
- A</br>`Event System`を利用している為、`MonoBehaviour.OnMouseXXX`系のイベントは発生しません。[IPointerEnterHandler](https://docs.unity3d.com/ja/2018.4/ScriptReference/EventSystems.IPointerEnterHandler.html)を継承する等してイベントをキャッチして下さい。また、Cameraオブジェクトに[PhysicsRaycaster](https://docs.unity3d.com/ja/2018.4/ScriptReference/EventSystems.PhysicsRaycaster.html)[Physics2DRaycaster](https://docs.unity3d.com/ja/2018.4/ScriptReference/EventSystems.Physics2DRaycaster.html)をAddすることもお忘れなく。
224224

225225
[^1]:リリース済みのアプリケーションを制御出来る訳ではありません。)
226226
[^2]:Input単体での再現の為、再現性の精度は低いです。

Runtime/Scripts/EventScriptSystem.cs

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ IEnumerator Start()
393393
{
394394
if (BaseInputOverride.instance != null)
395395
{
396-
Play();
396+
Play(m_currentScriptIndex);
397397
break;
398398
}
399399
else
@@ -601,7 +601,7 @@ bool CommandWait(string[] args)
601601
m_waitSceneChanged = GetInt(args[2]);
602602
}
603603
}
604-
return false;
604+
return true;
605605
}
606606

607607

@@ -619,7 +619,7 @@ bool CommandGoto(string[] args)
619619
}
620620
else
621621
{
622-
Debug.Log("Invalid Label :" + args);
622+
Debug.LogError("Invalid Label :" + args[1]);
623623
isError = true;
624624
return false;
625625
}
@@ -667,7 +667,7 @@ bool CommandSet(string[] args)
667667
}
668668
else
669669
{
670-
Debug.Log("Invalid variable name : " + args[1]);
670+
Debug.LogError("Invalid variable name : " + args[1]);
671671
isError = true;
672672
return false;
673673
}
@@ -701,7 +701,8 @@ bool CommandAdd(string[] args)
701701
else
702702
{
703703
isError = true;
704-
Debug.Log("Invalid args in add "+ args);
704+
Debug.LogError("Invalid args in add "+ args[1]);
705+
return false;
705706
}
706707
return true;
707708
}
@@ -722,6 +723,12 @@ bool CommandSub(string[] args)
722723
{
723724
variableFloats[args[1]] -= GetFloat(args[2]) - GetFloat(args[3]);
724725
}
726+
else
727+
{
728+
isError = true;
729+
Debug.LogError("Invalid args in Sub " + args[1]);
730+
return false;
731+
}
725732
return true;
726733
}
727734

@@ -744,7 +751,7 @@ bool CommandMul(string[] args)
744751
else
745752
{
746753
isError = true;
747-
Debug.Log("Invalid args in Mul " + args);
754+
Debug.LogError("Invalid args in Mul " + args[1]);
748755
return false;
749756
}
750757
return true;
@@ -769,7 +776,7 @@ bool CommandDiv(string[] args)
769776
else
770777
{
771778
isError = true;
772-
Debug.Log("Invalid args in div " + args);
779+
Debug.LogError("Invalid args in div " + args[1]);
773780
return false;
774781
}
775782
return true;
@@ -1182,7 +1189,7 @@ bool SyntaxAnalysis(string[] args)
11821189
}
11831190
else
11841191
{
1185-
Debug.Log("Invalid Command Name "+ args[0]);
1192+
Debug.LogError("Invalid Command Name "+ args[0]);
11861193
isError = true;
11871194
return false;
11881195
}
@@ -1246,6 +1253,11 @@ void Interpreter(float deltaTime)
12461253

12471254
// 構文解析
12481255
if (SyntaxAnalysis(args) == false) {
1256+
isPlay = false;
1257+
break;
1258+
}
1259+
if (m_waitFrame > 0 || (m_waitTime > 0f) || m_waitSceneChanged > 0)
1260+
{
12491261
break;
12501262
}
12511263
}
@@ -1386,10 +1398,11 @@ void PreProcessor()
13861398

13871399

13881400

1389-
1401+
var lineNo = 0;
13901402
while (!m_textAssetReader.EndOfStream)
13911403
{
13921404
var line = m_textAssetReader.ReadLine();
1405+
lineNo++;
13931406
if (line == null)
13941407
{
13951408
break;
@@ -1398,7 +1411,14 @@ void PreProcessor()
13981411
{
13991412
//var args = line.Split(new char[] { '#' }, StringSplitOptions.RemoveEmptyEntries);
14001413
var args = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
1401-
labelOfsts.Add(args[1], m_textAssetReader.Position);
1414+
if (args.Length == 2)
1415+
{
1416+
labelOfsts.Add(args[1], m_textAssetReader.Position);
1417+
}
1418+
else
1419+
{
1420+
Debug.LogError($@"<a href=""{m_textAssetReader.Name}"" line=""{lineNo}"">{m_textAssetReader.Name}:{lineNo}</a> Invalid Label format {line}");
1421+
}
14021422
}
14031423
else if (line.StartsWith("int"))
14041424
{

Runtime/Scripts/TextAssetReader.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
using System.Collections.Generic;
33
using System.IO;
44
using UnityEngine;
5-
5+
#if UNITY_EDITOR
6+
using UnityEditor;
7+
#endif
68

79
namespace Utj.UnityBotKun
810
{
@@ -23,6 +25,12 @@ public long Position
2325
set;
2426
}
2527

28+
public string Name
29+
{
30+
get;
31+
private set;
32+
}
33+
2634

2735
public bool EndOfStream
2836
{
@@ -52,7 +60,11 @@ public TextAssetReader(TextAsset textAsset)
5260
{
5361
Position = 0;
5462
lines = new List<string>();
55-
63+
#if UNITY_EDITOR
64+
Name = AssetDatabase.GetAssetPath(textAsset);
65+
#else
66+
Name = textAsset.name + ".txt";
67+
#endif
5668
using (var ms = new MemoryStream(textAsset.bytes))
5769
{
5870
using (var sr = new StreamReader(ms))

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.utj.unitybotkun",
33
"displayName": "UnityBotKun",
4-
"version": "1.1.2",
4+
"version": "1.1.3",
55
"unity": "2019.3",
66
"keywords": [
77
"unity",

0 commit comments

Comments
 (0)