Exemple #1
0
        /// <summary>
        /// デバイスを開く.
        /// </summary>
        private void OpenVorzeDevices()
        {
            // システム登録済のデバイス一覧を取得.
            var deviceList = VorzeUSBSearcher.GetVorzeUSBDeviceList();

            // デバイス一覧が空でなければ、デバイスを開く
            if (deviceList != null)
            {
                foreach (var keyValue in deviceList)
                {
                    var device = new A10CycloneClass();

                    // デバイスのオープンに成功したら、リスト登録
                    if (device.OpenDevice(keyValue.Key))
                    {
                        devices.Add(device);
                    }
                }
            }
        }
Exemple #2
0
        private IEnumerator CycloneCoroutine(int iLastExcite, A10CycloneConfig.YotogiItem YotogiItem, Dictionary <string, A10CycloneConfig.LevelItem> A10CyclonePattanDict, bool InsertFlg, string Personal, A10CycloneClass a10Cyclone)
        {
            // 興奮状態のステータス
            yExciteStatus = YotogiPlay.GetExcitementStatus(iLastExcite);
            int iExciteStatus = (int)yExciteStatus;

            // 指定コマンドの制御状態をループする.
            while (true)
            {
                foreach (A10CycloneConfig.Control Item in YotogiItem.ControlData)
                {
                    // 性格を指定しているが不一致の場合は無視
                    if (Item.Personal != "" && Item.Personal != Personal)
                    {
                        continue;
                    }

                    // 挿入時指定をしているが挿入フラグがない場合は無視
                    if (Item.Insert && !InsertFlg)
                    {
                        continue;
                    }

                    // 接続機器を指定しているが不一致の場合は無視
                    if (Item.Device != "" && Item.Device != a10Cyclone.ConnectedModel.ToString())
                    {
                        continue;
                    }

                    // 興奮状態を指定しているが不一致の場合は無視
                    if (0 <= Item.Excite && Item.Excite != iExciteStatus)
                    {
                        continue;
                    }

                    //現在のPatternとLevel
                    A10CycloneClass.Pattern SetPattan = a10Cyclone.pattern;
                    int SetLevel = a10Cyclone.level;

                    //Patternの定義があれば更新
                    if (0 == Item.Pattern)
                    {
                        SetPattan = A10CycloneClass.Pattern.ClockWise;
                    }
                    else if (1 == Item.Pattern)
                    {
                        SetPattan = A10CycloneClass.Pattern.CounterClockWise;
                    }

                    //Levelの定義があれば更新
                    if (-1 < Item.Level)
                    {
                        SetLevel = Clamp(Item.Level, A10CycloneClass.Level_Min, A10CycloneClass.Level_Max);
                    }
                    //LevelNameの定義がある場合
                    if (Item.LvName != "")
                    {
                        if (A10CyclonePattanDict.ContainsKey(Item.LvName))
                        {
                            //興奮値を元にLevelを更新
                            SetLevel = Clamp(GetLevel(yExciteStatus, A10CyclonePattanDict[Item.LvName]), A10CycloneClass.Level_Min, A10CycloneClass.Level_Max);
                        }
                        else
                        {
                            DebugManager.Log("LevelNameの定義が見つかりません");
                        }
                    }

                    //ディレイ
                    if (0.0f < Item.Delay)
                    {
                        yield return(new WaitForSeconds(Item.Delay));
                    }

                    //振動を開始する
                    if (SetLevel != a10Cyclone.level || SetPattan != a10Cyclone.pattern)
                    {
                        //Cycloneの振動処理
                        a10Cyclone.SetPatternAndLevel(SetPattan, SetLevel);
                        //GUI用に更新をする。
                        NowPattern = (Int32)a10Cyclone.pattern;
                        NowLevel   = a10Cyclone.level;
                    }

                    //ログを追加
                    DebugManager.Log(a10Cyclone.ConnectedModel.ToString() + ": [Pattern:" + a10Cyclone.pattern + "][Level:" + a10Cyclone.level + "][Delay:" + Item.Delay + "][Time:" + Item.Time + "]");

                    //継続タイム
                    if (0.0f < Item.Time)
                    {
                        yield return(new WaitForSeconds(Item.Time));
                    }
                    else
                    {
                        // 継続時間の指定が無い場合、0.1秒毎に次の処理へ移行する
                        yield return(new WaitForSeconds(0.1f));
                    }

                    /*
                     * //性格の指定があるかどうか(未指定の場合はそのまま実行)
                     * if (Item.Personal == "" || Item.Personal == Personal)
                     * {
                     *      //挿入時に挿入フラグがあった場合もしくはそれ以外
                     *      if ((Item.Insert && InsertFlg) || Item.Insert == false)
                     *      {
                     *              // 接続機器の指定があるかどうか(未指定の場合はそのまま実行)
                     *              if ((Item.Device == "" || Item.Device == a10Cyclone.ConnectedModel.ToString()))
                     *              {
                     *                      // 興奮状態が指定と異なる場合は実行しない(未指定の場合はそのまま実行)
                     *                      if (0 <= Item.Excite && Item.Excite != iExciteStatus)
                     *                      {
                     *                              continue;
                     *                      }
                     *              }
                     *      }
                     * }
                     */
                }

                // 2ループ目以降の挿入フラグはオフにする
                InsertFlg = false;
            }
        }