Пример #1
0
 public void UpdateColor(OIItemInfo _info)
 {
     foreach (Renderer renderer in this.renderer)
     {
         renderer.get_material().SetColor(ItemShader._Color, _info.colors[0].mainColor);
         renderer.get_material().SetVector(ItemShader._patternuv1, _info.colors[0].pattern.uv);
         renderer.get_material().SetFloat(ItemShader._patternuv1Rotator, _info.colors[0].pattern.rot);
         renderer.get_material().SetFloat(ItemShader._patternclamp1, !_info.colors[0].pattern.clamp ? 0.0f : 1f);
     }
 }
Пример #2
0
        public static void LoadChild(
            BinaryReader _reader,
            Version _version,
            List <ObjectInfo> _list,
            bool _import)
        {
            int num1 = _reader.ReadInt32();

            for (int index = 0; index < num1; ++index)
            {
                int num2 = _reader.ReadInt32();
                switch (num2)
                {
                case 0:
                    OICharInfo oiCharInfo = new OICharInfo((ChaFileControl)null, _import ? Studio.Studio.GetNewIndex() : -1);
                    oiCharInfo.Load(_reader, _version, _import, true);
                    _list.Add((ObjectInfo)oiCharInfo);
                    break;

                case 1:
                    OIItemInfo oiItemInfo = new OIItemInfo(-1, -1, -1, _import ? Studio.Studio.GetNewIndex() : -1);
                    oiItemInfo.Load(_reader, _version, _import, true);
                    _list.Add((ObjectInfo)oiItemInfo);
                    break;

                case 2:
                    OILightInfo oiLightInfo = new OILightInfo(-1, _import ? Studio.Studio.GetNewIndex() : -1);
                    oiLightInfo.Load(_reader, _version, _import, true);
                    _list.Add((ObjectInfo)oiLightInfo);
                    break;

                case 3:
                    OIFolderInfo oiFolderInfo = new OIFolderInfo(_import ? Studio.Studio.GetNewIndex() : -1);
                    oiFolderInfo.Load(_reader, _version, _import, true);
                    _list.Add((ObjectInfo)oiFolderInfo);
                    break;

                case 4:
                    OIRouteInfo oiRouteInfo = new OIRouteInfo(_import ? Studio.Studio.GetNewIndex() : -1);
                    oiRouteInfo.Load(_reader, _version, _import, true);
                    _list.Add((ObjectInfo)oiRouteInfo);
                    break;

                case 5:
                    OICameraInfo oiCameraInfo = new OICameraInfo(_import ? Studio.Studio.GetNewIndex() : -1);
                    oiCameraInfo.Load(_reader, _version, _import, true);
                    _list.Add((ObjectInfo)oiCameraInfo);
                    break;

                default:
                    Debug.LogWarning((object)string.Format("おかしい情報が入っている : {0}", (object)num2));
                    break;
                }
            }
        }
Пример #3
0
 public void UpdateColor(OIItemInfo _info)
 {
     if (((IList <ParticleSystem>) this.particleColor1).IsNullOrEmpty <ParticleSystem>())
     {
         return;
     }
     foreach (ParticleSystem particleSystem in this.particleColor1)
     {
         ParticleSystem.MainModule main = particleSystem.get_main();
         ((ParticleSystem.MainModule) ref main).set_startColor(ParticleSystem.MinMaxGradient.op_Implicit(_info.colors[0].mainColor));
     }
 }
Пример #4
0
        public static OCIItem Load(
            OIItemInfo _info,
            ObjectCtrlInfo _parent,
            TreeNodeObject _parentNode)
        {
            ChangeAmount _source = _info.changeAmount.Clone();
            OCIItem      ociItem = AddObjectItem.Load(_info, _parent, _parentNode, false, -1);

            _info.changeAmount.Copy(_source, true, true, true);
            AddObjectAssist.LoadChild(_info.child, (ObjectCtrlInfo)ociItem, (TreeNodeObject)null);
            return(ociItem);
        }
Пример #5
0
        public static OCIItem Load(
            OIItemInfo _info,
            ObjectCtrlInfo _parent,
            TreeNodeObject _parentNode,
            bool _addInfo,
            int _initialPosition)
        {
            OCIItem _ociItem = new OCIItem();

            Info.ItemLoadInfo loadInfo = AddObjectItem.GetLoadInfo(_info.group, _info.category, _info.no);
            if (loadInfo == null)
            {
                Debug.LogWarningFormat("存在しない : G[{0}] : C[{1}] : N[{2}]", new object[3]
                {
                    (object)_info.group,
                    (object)_info.category,
                    (object)_info.no
                });
                loadInfo = AddObjectItem.GetLoadInfo(0, 0, 399);
            }
            _ociItem.objectInfo = (ObjectInfo)_info;
            GameObject gameObject = CommonLib.LoadAsset <GameObject>(loadInfo.bundlePath, loadInfo.fileName, true, loadInfo.manifest);

            if (Object.op_Equality((Object)gameObject, (Object)null))
            {
                Debug.LogError((object)string.Format("読み込み失敗 : {0} : {1} : {2}", (object)loadInfo.manifest, (object)loadInfo.bundlePath, (object)loadInfo.fileName));
                Studio.Studio.DeleteIndex(_info.dicKey);
                return((OCIItem)null);
            }
            gameObject.get_transform().SetParent(Singleton <Scene> .Instance.commonSpace.get_transform());
            _ociItem.objectItem    = gameObject;
            _ociItem.itemComponent = (ItemComponent)gameObject.GetComponent <ItemComponent>();
            _ociItem.arrayRender   = ((IEnumerable <Renderer>)gameObject.GetComponentsInChildren <Renderer>()).Where <Renderer>((Func <Renderer, bool>)(v => v.get_enabled())).ToArray <Renderer>();
            ParticleSystem[] componentsInChildren = (ParticleSystem[])gameObject.GetComponentsInChildren <ParticleSystem>();
            if (!((IList <ParticleSystem>)componentsInChildren).IsNullOrEmpty <ParticleSystem>())
            {
                _ociItem.arrayParticle = ((IEnumerable <ParticleSystem>)componentsInChildren).Where <ParticleSystem>((Func <ParticleSystem, bool>)(v => v.get_isPlaying())).ToArray <ParticleSystem>();
            }
            MeshCollider component = (MeshCollider)gameObject.GetComponent <MeshCollider>();

            if (Object.op_Implicit((Object)component))
            {
                ((Collider)component).set_enabled(false);
            }
            _ociItem.dynamicBones = (DynamicBone[])gameObject.GetComponentsInChildren <DynamicBone>();
            GuideObject guideObject = Singleton <GuideObjectManager> .Instance.Add(gameObject.get_transform(), _info.dicKey);

            guideObject.isActive      = false;
            guideObject.scaleSelect   = 0.1f;
            guideObject.scaleRot      = 0.05f;
            guideObject.isActiveFunc += new GuideObject.IsActiveFunc(((ObjectCtrlInfo)_ociItem).OnSelect);
            guideObject.enableScale   = !Object.op_Inequality((Object)_ociItem.itemComponent, (Object)null) || _ociItem.itemComponent.isScale;
            guideObject.SetVisibleCenter(true);
            _ociItem.guideObject = guideObject;
            if (Object.op_Inequality((Object)_ociItem.itemComponent, (Object)null) && Object.op_Inequality((Object)_ociItem.itemComponent.childRoot, (Object)null))
            {
                _ociItem.childRoot = _ociItem.itemComponent.childRoot;
            }
            if (Object.op_Equality((Object)_ociItem.childRoot, (Object)null))
            {
                _ociItem.childRoot = gameObject.get_transform();
            }
            _ociItem.animator = (Animator)gameObject.GetComponentInChildren <Animator>();
            if (Object.op_Implicit((Object)_ociItem.animator))
            {
                ((Behaviour)_ociItem.animator).set_enabled(Object.op_Inequality((Object)_ociItem.itemComponent, (Object)null) && _ociItem.itemComponent.isAnime);
            }
            if (Object.op_Inequality((Object)_ociItem.itemComponent, (Object)null))
            {
                _ociItem.itemComponent.SetGlass();
                _ociItem.itemComponent.SetEmission();
                if (_addInfo && _ociItem.itemComponent.check)
                {
                    Color[] defColorMain = _ociItem.itemComponent.defColorMain;
                    for (int index = 0; index < 3; ++index)
                    {
                        _info.colors[index].mainColor = defColorMain[index];
                    }
                    Color[] defColorPattern = _ociItem.itemComponent.defColorPattern;
                    for (int index = 0; index < 3; ++index)
                    {
                        _info.colors[index].pattern.color = defColorPattern[index];
                        _info.colors[index].metallic      = _ociItem.itemComponent.info[index].defMetallic;
                        _info.colors[index].glossiness    = _ociItem.itemComponent.info[index].defGlossiness;
                        _info.colors[index].pattern.clamp = _ociItem.itemComponent.info[index].defClamp;
                        _info.colors[index].pattern.uv    = _ociItem.itemComponent.info[index].defUV;
                        _info.colors[index].pattern.rot   = _ociItem.itemComponent.info[index].defRot;
                    }
                    _info.colors[3].mainColor = _ociItem.itemComponent.defGlass;
                    _info.emissionColor       = _ociItem.itemComponent.DefEmissionColor;
                    _info.emissionPower       = _ociItem.itemComponent.defEmissionStrength;
                    _info.lightCancel         = _ociItem.itemComponent.defLightCancel;
                }
                _ociItem.itemComponent.SetupSea();
            }
            _ociItem.particleComponent = (ParticleComponent)gameObject.GetComponent <ParticleComponent>();
            if (Object.op_Inequality((Object)_ociItem.particleComponent, (Object)null) && _addInfo)
            {
                _info.colors[0].mainColor = _ociItem.particleComponent.defColor01;
            }
            _ociItem.iconComponent = (IconComponent)gameObject.GetComponent <IconComponent>();
            if (Object.op_Inequality((Object)_ociItem.iconComponent, (Object)null))
            {
                _ociItem.iconComponent.Layer = LayerMask.NameToLayer("Studio/Camera");
            }
            _ociItem.VisibleIcon    = Singleton <Studio.Studio> .Instance.workInfo.visibleGimmick;
            _ociItem.panelComponent = (PanelComponent)gameObject.GetComponent <PanelComponent>();
            if (_addInfo && Object.op_Inequality((Object)_ociItem.panelComponent, (Object)null))
            {
                _info.colors[0].mainColor     = _ociItem.panelComponent.defColor;
                _info.colors[0].pattern.uv    = _ociItem.panelComponent.defUV;
                _info.colors[0].pattern.clamp = _ociItem.panelComponent.defClamp;
                _info.colors[0].pattern.rot   = _ociItem.panelComponent.defRot;
            }
            _ociItem.seComponent = (SEComponent)gameObject.GetComponent <SEComponent>();
            if (_addInfo && Object.op_Inequality((Object)_ociItem.itemComponent, (Object)null) && !((IList <ItemComponent.OptionInfo>)_ociItem.itemComponent.optionInfos).IsNullOrEmpty <ItemComponent.OptionInfo>())
            {
                _info.option = Enumerable.Repeat <bool>(true, _ociItem.itemComponent.optionInfos.Length).ToList <bool>();
            }
            if (_addInfo)
            {
                Studio.Studio.AddInfo((ObjectInfo)_info, (ObjectCtrlInfo)_ociItem);
            }
            else
            {
                Studio.Studio.AddObjectCtrlInfo((ObjectCtrlInfo)_ociItem);
            }
            TreeNodeObject _parent1       = !Object.op_Inequality((Object)_parentNode, (Object)null) ? (_parent == null ? (TreeNodeObject)null : _parent.treeNodeObject) : _parentNode;
            TreeNodeObject treeNodeObject = Studio.Studio.AddNode(loadInfo.name, _parent1);

            treeNodeObject.treeState               = _info.treeState;
            treeNodeObject.onVisible              += new TreeNodeObject.OnVisibleFunc(((ObjectCtrlInfo)_ociItem).OnVisible);
            treeNodeObject.enableVisible           = true;
            treeNodeObject.visible                 = _info.visible;
            guideObject.guideSelect.treeNodeObject = treeNodeObject;
            _ociItem.treeNodeObject                = treeNodeObject;
            if (!loadInfo.bones.IsNullOrEmpty <string>())
            {
                _ociItem.itemFKCtrl = (ItemFKCtrl)gameObject.AddComponent <ItemFKCtrl>();
                _ociItem.itemFKCtrl.InitBone(_ociItem, loadInfo, _addInfo);
            }
            else
            {
                _ociItem.itemFKCtrl = (ItemFKCtrl)null;
            }
            if (_initialPosition == 1)
            {
                _info.changeAmount.pos = Singleton <Studio.Studio> .Instance.cameraCtrl.targetPos;
            }
            _info.changeAmount.OnChange();
            Studio.Studio.AddCtrlInfo((ObjectCtrlInfo)_ociItem);
            _parent?.OnLoadAttach(!Object.op_Inequality((Object)_parentNode, (Object)null) ? _parent.treeNodeObject : _parentNode, (ObjectCtrlInfo)_ociItem);
            if (Object.op_Implicit((Object)_ociItem.animator))
            {
                if (_info.animePattern != 0)
                {
                    _ociItem.SetAnimePattern(_info.animePattern);
                }
                _ociItem.animator.set_speed(_info.animeSpeed);
                if ((double)_info.animeNormalizedTime != 0.0 && _ociItem.animator.get_layerCount() != 0)
                {
                    _ociItem.animator.Update(1f);
                    AnimatorStateInfo animatorStateInfo = _ociItem.animator.GetCurrentAnimatorStateInfo(0);
                    _ociItem.animator.Play(((AnimatorStateInfo) ref animatorStateInfo).get_shortNameHash(), 0, _info.animeNormalizedTime);
                }
            }
            _ociItem.SetupPatternTex();
            _ociItem.SetMainTex();
            _ociItem.UpdateColor();
            _ociItem.ActiveFK(_ociItem.itemInfo.enableFK);
            _ociItem.UpdateFKColor();
            _ociItem.ActiveDynamicBone(_ociItem.itemInfo.enableDynamicBone);
            _ociItem.UpdateOption();
            _ociItem.particleComponent?.PlayOnLoad();
            return(_ociItem);
        }