public string detachAll(Action <Undo> undoListAdd, Func <bool[], bool[]> setIKButtonActive, bool[] boolList, string UndoFuncName) { //Undoチェック if (UndoFuncName != "IKDetachAll:MaidAll:") { UndoFuncName = "IKDetachAll:MaidAll:"; //IKでのUndo登録 IKManage tempIKManage = new IKManage(this); //Dictionary<string, Transform> goParentTransform; //var tempDic = attachIKMaidNo.Select((m) => new KeyValuePair<int ,Dictionary<int ,Transform>>(m, IKList.Select((list,index) => new KeyValuePair<int,Transform>( index, list.getParentTransform(m))).Where( n => n.Value != null).ToDictionary(l=>l.Key,l=>l.Value) )).ToDictionary(k=>k.Key,k=>k.Value); undoListAdd(Undo.createUndoIKAllMaidAll(setIKButtonActive, boolList.Clone() as bool[], this, tempIKManage, getIKTransformParentDictionary, getIKTransformParentDictionary())); //Debuginfo.Log(LogLabel + "Undo::" + UndoFuncName); attachIKMaidNo.ForEach(m => Array.ForEach(IKList, list => list.detachAll(m))); attachIKMaidNo.Clear(); attachIKMaidList.Clear(); trTargetIKBones.Clear(); } return(UndoFuncName); }
public static Undo createUndoIKAllMaidAll(Func <bool[], bool[]> setIKButtonActive, bool[] _boolList, IKManage _source, IKManage _copy, Func <Dictionary <int, Dictionary <int, Transform> > > getDicFunc, Dictionary <int, Dictionary <int, Transform> > _Dic) { return(new Undo(() => { var tempDic = getDicFunc(); IKManage temp = new IKManage(_source); _source.IKList[0].assignment(_copy.IKList[0]); _source.IKList[1].assignment(_copy.IKList[1]); _source.IKList[2].assignment(_copy.IKList[2]); _source.IKList[3].assignment(_copy.IKList[3]); _source.trTargetIKBones = _copy.trTargetIKBones; _source.attachIKMaidList = _copy.attachIKMaidList; _source.attachIKMaidNo = _copy.attachIKMaidNo; foreach (var i in _Dic) { foreach (var j in i.Value) { _source.IKList[j.Key].goIKTarget[i.Key] = new GameObject(); Vector3 tempVec = _source.IKList[j.Key].getIKPositionCurrent(i.Key); _source.IKList[j.Key].setParentTransform(i.Key, j.Value); _source.IKList[j.Key].setIKPosition(i.Key, tempVec); } } bool[] tempboolList = setIKButtonActive(_boolList); return createUndoIKAllMaidAll(setIKButtonActive, tempboolList, _source, temp, getDicFunc, tempDic); }, "IKAllMaidAll")); }
public IKManage(IKManage _copy) { IKList[0] = new IKPropList(_copy.IKList[0]); IKList[1] = new IKPropList(_copy.IKList[1]); IKList[2] = new IKPropList(_copy.IKList[2]); IKList[3] = new IKPropList(_copy.IKList[3]); attachIKMaidList = new Dictionary <int, Maid>(_copy.attachIKMaidList); attachIKMaidNo = new List <int>(_copy.attachIKMaidNo); trTargetIKBones = new Dictionary <int, Transform[]>(_copy.trTargetIKBones); GetMaid = _copy.GetMaid; }