/// <summary> /// 詳細モードのパターンオブジェクトの情報が変更されるときに呼び出される関数 /// </summary> /// <param name="index">リストindex</param> /// <param name="mode">変更モード</param> /// <param name="time">変更時間</param> public void ChangeCellWithIndex(int index, int mode, float time) { PTN_CELL cell = _CellList[index]; cell.Mode = mode; cell.Time = time; _CellList[index] = cell; }
/// <summary> /// バックアップしておいたパターン情報をロード /// </summary> private void LoadBackUp() { PTN_CELL cell; _CellList.Clear(); for (int i = 0; i < _AdvancedCellBackUp.Count; ++i) { cell = new PTN_CELL(); cell.SetCell(_AdvancedCellBackUp[i].Mode, _AdvancedCellBackUp[i].Time); _CellList.Add(cell); } _CurrentModeIndex = 0; }
/// <summary> /// 詳細モードでは、ユーザーが一つの電流パターンを追加するときにリストに追加されるオブジェクトを生成 /// </summary> public void AddCell() { PTN_CELL newCell = new PTN_CELL(); newCell.SetCell(1, 1f); _CellList.Add(newCell); GameObject newCellUI = Instantiate(_CellPrefab) as GameObject; newCellUI.transform.GetComponent <PatternCell>().Setup(_CellList.Count - 1, 1, 1); _AdvancedOpCellObjects.Add(newCellUI); //Front Number text change Transform cellTrans = newCellUI.transform; Text txt = cellTrans.Find("FrontNumber").GetComponent <Text>(); txt.text = _CellList.Count.ToString(); //Position Change cellTrans.SetParent(_Content.transform); Vector3 pos = new Vector3(135, 15); pos.y += _CellListMove * (_CellList.Count - 1); cellTrans.localPosition = pos; cellTrans.localScale = new Vector3(0.85f, 1); //Contentのサイズを調整する var _ContentRT = _Content.GetComponent <RectTransform>(); float contentSize = 51 * (_CellList.Count + 1); if (contentSize <= 350f) { contentSize = 350f; } _ContentRT.sizeDelta = new Vector2(0f, contentSize); //Contentの位置を調整する { Vector2 tmpVec = _ContentRT.anchoredPosition; tmpVec.y = Mathf.Max(contentSize - 350f, 0f); _ContentRT.anchoredPosition = tmpVec; } pos = new Vector3(135, 30); pos.y += _CellListMove * (_CellList.Count + 1); _CellAddButton.transform.localPosition = pos; }
/// <summary> /// 詳細モードのパターンリストをお気に入りから受けてい /// </summary> /// <param name="cellList">保存されていたパターンのリスト</param> public void SettingCustomCellListFromFav(List <PTN_CELL> cellList) { if (_PlayCo != null) { ForcedOffCoroutine(); } //一度詳細設定に戻しておいてみましょう if (PulseMain.instance.Get_PlayStateIsMusic == true) { //音楽であれば、一度音楽を取り出してくれる NormalMode(true); } //詳細モードではない場合、詳細モードで合わせてくれる if (_CurrentMoveState != PTN_STATE.PTN_CUSTOM) { NormalAdvancedToggle(); } //詳細モードで合わせてくれたから、中身を着替えかかる _CellList.Clear(); if (_AdvancedOpCellObjects.Count > 0) { for (int i = 0; i < _AdvancedOpCellObjects.Count; ++i) { Destroy(_AdvancedOpCellObjects[i]); } _AdvancedOpCellObjects.Clear(); } PTN_CELL cell; for (int i = 0; i < cellList.Count; ++i) { cell = new PTN_CELL(); cell.SetCell(cellList[i].Mode, cellList[i].Time); _CellList.Add(cell); } _CurrentModeIndex = 0; AdvancedListLoad(); Set_ModeDisplayText(_CellList[0].Mode); }
/// <summary> /// /// </summary> /// <param name="FirstNumber"></param> public void RandomModeSet(int FirstNumber = 0) { if (FirstNumber == 0) { if (_CurrentMoveState != PTN_STATE.PTN_RANDOM) { return; } } else { //First Number가 0이 넘어서 들어오는 경우는 반드시 Random모드로 들어오도록 한다 _CurrentMoveState = PTN_STATE.PTN_RANDOM; _FavLastIndex = -1; } //TextOutLogMgr.Instance.LogError("RandomModeSet"); _CellList.Clear(); List <int> tempList = new List <int>(); for (int i = 1; i <= PulseMain.instance.MaxPatternLv; ++i) { tempList.Add(i); } int iSet = 0; int iStartPoint = 1; PTN_CELL ptn; if (FirstNumber != 0) { //TextOutLogMgr.Instance.LogError("FirstNumber : " + FirstNumber); tempList.RemoveAt(FirstNumber - 1); ptn = new PTN_CELL(); ptn.SetCell(FirstNumber, _NormalStatePatternTick); _CellList.Add(ptn); ++iStartPoint; } else if (_FavLastIndex > 0) { tempList.RemoveAt(_FavLastIndex - 1); ptn = new PTN_CELL(); ptn.SetCell(_FavLastIndex, _NormalStatePatternTick); _CellList.Add(ptn); ++iStartPoint; _FavLastIndex = -1; } for (int i = iStartPoint; i <= PulseMain.instance.MaxPatternLv; ++i) { iSet = UnityEngine.Random.Range(0, tempList.Count); ptn = new PTN_CELL(); ptn.SetCell(tempList[iSet], _NormalStatePatternTick); _CellList.Add(ptn); tempList.RemoveAt(iSet); } _CurrentModeIndex = 0; }
/// <summary> /// 指定されたデフォルトのモードを設定してくれる関数 /// </summary> /// <param name="setState">変更されるデフォルトのモード</param> /// <param name="LastPatternNumber">最後に再生されたパターンナンバー</param> public void AutoModeSet(PTN_STATE setState, int LastPatternNumber = 0) { if (setState == PTN_STATE.PTN_RANDOM || setState == PTN_STATE.PTN_CUSTOM) { return; } _CellList.Clear(); int iStart = 0; int iNum = 0; switch (setState) { case PTN_STATE.PTN_AUTO_1: iStart = 1; iNum = 40; break; case PTN_STATE.PTN_AUTO_2: iStart = 1; iNum = 10; break; case PTN_STATE.PTN_AUTO_3: iStart = 11; iNum = 10; break; case PTN_STATE.PTN_AUTO_4: iStart = 21; iNum = 10; break; case PTN_STATE.PTN_AUTO_5: iStart = 31; iNum = 10; break; } PTN_CELL ptn; for (int i = 0; i < iNum; ++i) { ptn = new PTN_CELL(); ptn.SetCell(iStart, _NormalStatePatternTick); _CellList.Add(ptn); ++iStart; } if (LastPatternNumber > 0) { _CurrentModeIndex = LastPatternNumber; } else { if (_FavLastIndex > 0) { _CurrentModeIndex = _FavLastIndex; _FavLastIndex = -1; } else { _CurrentModeIndex = 0; } } }