Beispiel #1
0
        private void SetSelectObject(GuideObject _object, bool _multiple = true)
        {
            bool flag = Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305);
            bool key  = Input.GetKey((KeyCode)120);

            if (_multiple && flag && !key)
            {
                if (Object.op_Equality((Object)_object, (Object)null) || this.hashSelectObject.Contains(_object) || this.hashSelectObject.Count != 0 && !_object.enableMaluti)
                {
                    return;
                }
                this.AddObject(_object, this.hashSelectObject.Count == 0);
            }
            else
            {
                switch (Studio.Studio.optionSystem.selectedState)
                {
                case 0:
                    this.StopSelectObject();
                    break;

                case 1:
                    GuideObject selectObject = this.selectObject;
                    if (!Object.op_Equality((Object)selectObject, (Object)null))
                    {
                        if (!selectObject.isChild)
                        {
                            if (Object.op_Implicit((Object)_object) && _object.isChild)
                            {
                                selectObject.SetActive(false, false);
                                break;
                            }
                            this.StopSelectObject();
                            break;
                        }
                        selectObject.SetActive(false, false);
                        break;
                    }
                    break;
                }
                this.hashSelectObject.Clear();
                if (Object.op_Implicit((Object)_object) && !_object.enables[this.m_Mode])
                {
                    for (int index = 0; index < 3; ++index)
                    {
                        if (_object.enables[index])
                        {
                            this.mode = index;
                            break;
                        }
                    }
                }
                this.AddObject(_object, true);
            }
            this.guideInput.guideObject = _object;
        }
        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;
        }
        private static OCIChar.IKInfo AddIKTarget(
            OCIChar _ociChar,
            IKCtrl _ikCtrl,
            int _no,
            Transform _target,
            bool _usedRot,
            Transform _bone,
            bool _isRed)
        {
            OIIKTargetInfo _targetInfo = (OIIKTargetInfo)null;
            bool           flag        = !_ociChar.oiCharInfo.ikTarget.TryGetValue(_no, out _targetInfo);

            if (flag)
            {
                _targetInfo = new OIIKTargetInfo(Studio.Studio.GetNewIndex());
                _ociChar.oiCharInfo.ikTarget.Add(_no, _targetInfo);
            }
            switch (_no)
            {
            case 0:
                _targetInfo.group = OIBoneInfo.BoneGroup.Body;
                break;

            case 1:
            case 2:
            case 3:
                _targetInfo.group = OIBoneInfo.BoneGroup.LeftArm;
                break;

            case 4:
            case 5:
            case 6:
                _targetInfo.group = OIBoneInfo.BoneGroup.RightArm;
                break;

            case 7:
            case 8:
            case 9:
                _targetInfo.group = OIBoneInfo.BoneGroup.LeftLeg;
                break;

            case 10:
            case 11:
            case 12:
                _targetInfo.group = OIBoneInfo.BoneGroup.RightLeg;
                break;
            }
            GameObject gameObject = new GameObject(((Object)_target).get_name() + "(work)");

            gameObject.get_transform().SetParent(((Component)_ociChar.charInfo).get_transform());
            GuideObject _guideObject = Singleton <GuideObjectManager> .Instance.Add(gameObject.get_transform(), _targetInfo.dicKey);

            _guideObject.mode              = GuideObject.Mode.LocalIK;
            _guideObject.enableRot         = _usedRot;
            _guideObject.enableScale       = false;
            _guideObject.enableMaluti      = false;
            _guideObject.calcScale         = false;
            _guideObject.scaleRate         = 0.5f;
            _guideObject.scaleRot          = 0.05f;
            _guideObject.scaleSelect       = 0.1f;
            _guideObject.parentGuide       = _ociChar.guideObject;
            _guideObject.guideSelect.color = !_isRed?Color.get_blue() : Color.get_red();

            _guideObject.moveCalc = GuideMove.MoveCalc.TYPE3;
            OCIChar.IKInfo ikInfo = new OCIChar.IKInfo(_guideObject, _targetInfo, _target, gameObject.get_transform(), _bone);
            if (!flag)
            {
                _targetInfo.changeAmount.OnChange();
            }
            _ikCtrl.addIKInfo = ikInfo;
            _ociChar.listIKTarget.Add(ikInfo);
            _guideObject.SetActive(false, true);
            return(ikInfo);
        }
        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);
        }