public static void InitHairBone(OCIChar _ociChar, Dictionary <int, Info.BoneInfo> _dicBoneInfo) { GameObject referenceInfo = _ociChar.charReference.GetReferenceInfo(ChaReference.RefObjKey.HeadParent); Dictionary <int, OCIChar.BoneInfo> dictionary = new Dictionary <int, OCIChar.BoneInfo>(); foreach (KeyValuePair <int, Info.BoneInfo> keyValuePair in _dicBoneInfo.Where <KeyValuePair <int, Info.BoneInfo> >((Func <KeyValuePair <int, Info.BoneInfo>, bool>)(b => MathfEx.RangeEqualOn <int>(7, b.Value.group, 9)))) { GameObject loop = referenceInfo.get_transform().FindLoop(keyValuePair.Value.bone); if (!Object.op_Equality((Object)loop, (Object)null)) { OCIChar.BoneInfo boneInfo1 = (OCIChar.BoneInfo)null; if (dictionary.TryGetValue(keyValuePair.Value.sync, out boneInfo1)) { boneInfo1.AddSyncBone(loop); } else { OIBoneInfo _boneInfo = (OIBoneInfo)null; if (!_ociChar.oiCharInfo.bones.TryGetValue(keyValuePair.Key, out _boneInfo)) { _boneInfo = new OIBoneInfo(Studio.Studio.GetNewIndex()); _ociChar.oiCharInfo.bones.Add(keyValuePair.Key, _boneInfo); } _boneInfo.group = OIBoneInfo.BoneGroup.Hair; _boneInfo.level = keyValuePair.Value.level; GuideObject _guideObject = AddObjectAssist.AddBoneGuide(loop.get_transform(), _boneInfo.dicKey, _ociChar.guideObject, keyValuePair.Value.name); OCIChar.BoneInfo boneInfo2 = new OCIChar.BoneInfo(_guideObject, _boneInfo, keyValuePair.Key); _ociChar.listBones.Add(boneInfo2); _guideObject.SetActive(false, true); if (keyValuePair.Value.sync != -1) { dictionary.Add(keyValuePair.Key, boneInfo2); } } } } _ociChar.UpdateFKColor(OIBoneInfo.BoneGroup.Hair); }
public void InitBone(OCIItem _ociItem, Info.ItemLoadInfo _loadInfo, bool _isNew) { Transform transform = _ociItem.objectItem.get_transform(); _ociItem.listBones = new List <OCIChar.BoneInfo>(); foreach (string bone in _loadInfo.bones) { GameObject loop = transform.FindLoop(bone); if (Object.op_Equality((Object)loop, (Object)null)) { Debug.LogWarning((object)string.Format("無い : {0}", (object)bone)); } else { OIBoneInfo _boneInfo = (OIBoneInfo)null; if (!_ociItem.itemInfo.bones.TryGetValue(bone, out _boneInfo)) { _boneInfo = new OIBoneInfo(Studio.Studio.GetNewIndex()); _ociItem.itemInfo.bones.Add(bone, _boneInfo); } GuideObject _guideObject = Singleton <GuideObjectManager> .Instance.Add(loop.get_transform(), _boneInfo.dicKey); _guideObject.enablePos = false; _guideObject.enableScale = false; _guideObject.enableMaluti = false; _guideObject.calcScale = false; _guideObject.scaleRate = 0.5f; _guideObject.scaleRot = 0.025f; _guideObject.scaleSelect = 0.05f; _guideObject.parentGuide = _ociItem.guideObject; _ociItem.listBones.Add(new OCIChar.BoneInfo(_guideObject, _boneInfo, -1)); _guideObject.SetActive(false, true); this.listBones.Add(new ItemFKCtrl.TargetInfo(loop, _boneInfo.changeAmount, _isNew)); } } this.count = this.listBones.Count; }
public static void InitBone( OCIChar _ociChar, Transform _transformRoot, Dictionary <int, Info.BoneInfo> _dicBoneInfo) { Dictionary <int, OCIChar.BoneInfo> dictionary = new Dictionary <int, OCIChar.BoneInfo>(); foreach (KeyValuePair <int, Info.BoneInfo> keyValuePair in _dicBoneInfo) { if (_ociChar.sex != 1 || keyValuePair.Value.level != 2) { GameObject loop; switch (keyValuePair.Value.group) { case 7: case 8: case 9: loop = _ociChar.charReference.GetReferenceInfo(ChaReference.RefObjKey.HeadParent).get_transform().FindLoop(keyValuePair.Value.bone); break; default: loop = _transformRoot.FindLoop(keyValuePair.Value.bone); if (Object.op_Equality((Object)loop, (Object)null)) { Debug.LogWarning((object)keyValuePair.Value.bone); break; } break; } if (!Object.op_Equality((Object)loop, (Object)null)) { OCIChar.BoneInfo boneInfo1 = (OCIChar.BoneInfo)null; if (dictionary.TryGetValue(keyValuePair.Value.sync, out boneInfo1)) { boneInfo1.AddSyncBone(loop); } else { OIBoneInfo _boneInfo = (OIBoneInfo)null; if (!_ociChar.oiCharInfo.bones.TryGetValue(keyValuePair.Key, out _boneInfo)) { _boneInfo = new OIBoneInfo(Studio.Studio.GetNewIndex()); _ociChar.oiCharInfo.bones.Add(keyValuePair.Key, _boneInfo); } switch (keyValuePair.Value.group) { case 0: case 1: case 2: case 3: case 4: _boneInfo.group = (OIBoneInfo.BoneGroup)(1 << keyValuePair.Value.group | 1); break; case 7: case 8: case 9: _boneInfo.group = OIBoneInfo.BoneGroup.Hair; break; case 10: _boneInfo.group = OIBoneInfo.BoneGroup.Neck; break; case 11: case 12: _boneInfo.group = OIBoneInfo.BoneGroup.Breast; break; case 13: _boneInfo.group = OIBoneInfo.BoneGroup.Skirt; break; default: _boneInfo.group = (OIBoneInfo.BoneGroup)(1 << keyValuePair.Value.group); break; } _boneInfo.level = keyValuePair.Value.level; GuideObject _guideObject = AddObjectAssist.AddBoneGuide(loop.get_transform(), _boneInfo.dicKey, _ociChar.guideObject, keyValuePair.Value.name); switch (_boneInfo.group) { case OIBoneInfo.BoneGroup.RightHand: case OIBoneInfo.BoneGroup.LeftHand: _guideObject.scaleSelect = 0.025f; break; } OCIChar.BoneInfo boneInfo2 = new OCIChar.BoneInfo(_guideObject, _boneInfo, keyValuePair.Key); _ociChar.listBones.Add(boneInfo2); _guideObject.SetActive(false, true); if (keyValuePair.Value.no == 65) { _ociChar.transSon = loop.get_transform(); } if (keyValuePair.Value.sync != -1) { dictionary.Add(keyValuePair.Key, boneInfo2); } } } } } _ociChar.UpdateFKColor(FKCtrl.parts); }
public void InitBones(OICharInfo _info, ChaReference _charReference) { if (_info == null) { return; } this.listBones.Clear(); Dictionary <int, FKCtrl.TargetInfo> dictionary = new Dictionary <int, FKCtrl.TargetInfo>(); foreach (KeyValuePair <int, Info.BoneInfo> keyValuePair in Singleton <Info> .Instance.dicBoneInfo) { GameObject loop; switch (keyValuePair.Value.group) { case 7: case 8: case 9: loop = _charReference.GetReferenceInfo(ChaReference.RefObjKey.HeadParent).get_transform().FindLoop(keyValuePair.Value.bone); break; default: loop = this.transform.FindLoop(keyValuePair.Value.bone); if (Object.op_Equality((Object)loop, (Object)null)) { Debug.LogWarning((object)keyValuePair.Value.bone); break; } break; } if (!Object.op_Equality((Object)loop, (Object)null)) { FKCtrl.TargetInfo targetInfo1 = (FKCtrl.TargetInfo)null; if (dictionary.TryGetValue(keyValuePair.Value.sync, out targetInfo1)) { targetInfo1.AddSyncBone(loop); } else { OIBoneInfo oiBoneInfo = (OIBoneInfo)null; if (_info.bones.TryGetValue(keyValuePair.Key, out oiBoneInfo)) { OIBoneInfo.BoneGroup _group; switch (keyValuePair.Value.group) { case 0: case 1: case 2: case 3: case 4: _group = OIBoneInfo.BoneGroup.Body; break; case 7: case 8: case 9: _group = OIBoneInfo.BoneGroup.Hair; break; case 10: _group = OIBoneInfo.BoneGroup.Neck; break; case 11: case 12: _group = OIBoneInfo.BoneGroup.Breast; break; case 13: _group = OIBoneInfo.BoneGroup.Skirt; break; default: _group = (OIBoneInfo.BoneGroup)(1 << keyValuePair.Value.group); break; } FKCtrl.TargetInfo targetInfo2 = new FKCtrl.TargetInfo(loop, oiBoneInfo.changeAmount, _group, keyValuePair.Value.level); this.listBones.Add(targetInfo2); if (keyValuePair.Value.sync != -1) { dictionary.Add(keyValuePair.Key, targetInfo2); } } } } } this.count = this.listBones.Count; }