public OCItem( OIItem _oiItem, GameObject _gameObject, CraftInfo _craftInfo, Manager.Housing.LoadInfo _loadInfo) : base((IObjectInfo)_oiItem, _gameObject, _craftInfo) { this.LoadInfo = _loadInfo; this.m_itemComponent = !Object.op_Inequality((Object)this.GameObject, (Object)null) ? (ItemComponent)null : (ItemComponent)this.GameObject.GetComponent <ItemComponent>(); if (Object.op_Equality((Object)this.m_itemComponent, (Object)null)) { this.m_itemComponent = (ItemComponent)this.GameObject.AddComponent <ItemComponent>(); this.m_itemComponent.Setup(false); } if (this.m_itemComponent != null) { this.m_itemComponent.SetHPoint(); } ObservableExtensions.Subscribe <IList <bool> >((IObservable <M0>)Observable.BatchFrame <bool>(Observable.Merge <bool>((IObservable <M0>[]) new IObservable <bool>[4] { (IObservable <bool>) this.subjectColor1, (IObservable <bool>) this.subjectColor2, (IObservable <bool>) this.subjectColor3, (IObservable <bool>) this.subjectEmissionColor }), 0, (FrameCountType)0), (Action <M0>)(_ => this.UpdateColor())); }
public OIItem(OIItem _src) { this.Pos = _src.Pos; this.Rot = _src.Rot; this.Category = _src.Category; this.ID = _src.ID; this.Color1 = _src.Color1; this.Color2 = _src.Color2; this.Color3 = _src.Color3; this.EmissionColor = _src.EmissionColor; this.VisibleOption = _src.VisibleOption; }
public void UpdateColor() { if (Object.op_Equality((Object)this.ItemComponent, (Object)null) || !this.ItemComponent.IsColor) { return; } OIItem info = this.OIItem; foreach (ItemComponent.Info renderer in this.ItemComponent.renderers) { Material[] materials = ((Renderer)renderer.meshRenderer).get_materials(); for (int index = 0; index < materials.Length; ++index) { Material m = materials[index]; if (!Object.op_Equality((Object)m, (Object)null)) { renderer.materialInfos.SafeProc <ItemComponent.MaterialInfo>(index, (Action <ItemComponent.MaterialInfo>)(_info => { if (_info.isColor1) { m.SetColor(ItemShader._Color, info.Color1); } if (_info.isColor2) { m.SetColor(ItemShader._Color2, info.Color2); } if (_info.isColor3) { m.SetColor(ItemShader._Color3, info.Color3); } if (!_info.isEmission) { return; } m.SetColor(ItemShader._EmissionColor, info.EmissionColor); })); } } ((Renderer)renderer.meshRenderer).set_materials(materials); } }
public OIItem(OIItem _src, bool _idCopy) { this.Pos = _src.Pos; this.Rot = _src.Rot; this.Category = _src.Category; this.ID = _src.ID; if (_idCopy) { this.ActionPoints = this.Clone(_src.ActionPoints); this.FarmPoints = this.Clone(_src.FarmPoints); this.PetHomePoints = this.Clone(_src.PetHomePoints); this.JukePoints = this.Clone(_src.JukePoints); this.CraftPoints = this.Clone(_src.CraftPoints); this.LightSwitchPoints = this.Clone(_src.LightSwitchPoints); } this.Color1 = _src.Color1; this.Color2 = _src.Color2; this.Color3 = _src.Color3; this.EmissionColor = _src.EmissionColor; this.VisibleOption = _src.VisibleOption; }