//ADV用SendMessageコマンドが実行されたタイミング void OnDoCommand(AdvCommandSendMessage command) { switch (command.Name) { case "3DOn": TreedOn(command); break; case "3DOff": TreedOff(command); break; case "RotateOn": RotateOn(command); break; case "RotateOff": RotateOff(command); break; case "Model": ModelOn(command); break; case "ModelOff": ModelOff(command); break; default: Debug.Log("Unknown Message:" + command.Name); break; } }
//回転ON void RotateOn(AdvCommandSendMessage command) { if (!float.TryParse(command.Arg2, out rotSpped)) { rotSpped = 15; } //演出としてカメラを回す StartCoroutine("CoRotate3D"); }
//ADV用SendMessageコマンドの処理待ちタイミング void OnWait(AdvCommandSendMessage command) { switch (command.Name) { default: command.IsWait = false; break; } }
//回転ON void RotateOn(AdvCommandSendMessage command) { if (!WrapperUnityVersion.TryParseFloatGlobal(command.Arg2, out rotSpped)) { rotSpped = 15; } //演出としてカメラを回す StartCoroutine("CoRotate3D"); }
//モデルの表示 void ModelOff(AdvCommandSendMessage command) { GameObject model = FindModel(command.Arg2); if (model != null) { model.SetActive(false); } }
//SendMessageコマンドの処理待ちタイミング void OnAgingInput(AdvCommandSendMessage command) { switch (command.Name) { case "InputFileld": inputFiled.gameObject.SetActive(false); break; default: break; } }
//モデルの表示 void ModelOn(AdvCommandSendMessage command) { GameObject model = FindModel(command.Arg2); if (model != null) { model.SetActive(true); if (!string.IsNullOrEmpty(command.Arg3)) { model.animation.CrossFade(command.Arg3); } } }
//SendMessageコマンドの処理待ちタイミング void OnWait(AdvCommandSendMessage command) { switch (command.Name) { case "InputFileld": //インプットフィールドが有効な間は待機 command.IsWait = inputFiled.gameObject.activeSelf; break; case "AutoLoad": command.IsWait = true; break; default: command.IsWait = false; break; } }
//SendMessageコマンドが実行されたタイミング void OnDoCommand(AdvCommandSendMessage command) { switch (command.Name) { case "DebugLog": DebugLog(command); break; case "InputFileld": InputFileld(command); break; case "AutoLoad": AutoLoad(command); break; default: Debug.Log("Unknown Message:" + command.Name); break; } }
//回転ON void RotateOff(AdvCommandSendMessage command) { StopCoroutine("CoRotate3D"); }
//3D表示OFF void TreedOff(AdvCommandSendMessage command) { root3d.SetActive(false); StopAllCoroutines(); }
//3D表示ON void TreedOn(AdvCommandSendMessage command) { root3d.SetActive(true); }
//設定された入力フィールドを有効化 void InputFileld(AdvCommandSendMessage command) { inputFiled.gameObject.SetActive(true); inputFiled.onEndEdit.RemoveAllListeners(); inputFiled.onEndEdit.AddListener((string text) => OnEndEditInputFiled(command.Arg2, text)); }
//デバッグログを出力 void DebugLog(AdvCommandSendMessage command) { Debug.Log(command.Arg2); }
//オートロード void AutoLoad(AdvCommandSendMessage command) { Debug.Log("AutoLoad"); StartCoroutine(CoAutoLoadSub()); }