public ProjectorAssetProcessor(GeometryProjector parent) { this.parent = parent; this.handles = new List <AssetHandle>(); this.orphans = new List <GameObject>(); this.loadedAssets = new List <GameObject>(); }
public static void OnDefaultAssetSuccess(GeometryProjector projector) { ProjectorConfig config = projector.Config; projector.Renderer.Render(config); projector.Renderer.PostRender(config); }
public static GeometryProjector GenerateProjector(ProjectorConfig config) { GeometryProjector geometryProjector = new GeometryProjector(config); if (config.FrameSprite != null) { geometryProjector.Renderer = new SpriteProjectorRenderer(config.FrameSprite, geometryProjector.ProjectorIndex); } else { geometryProjector.Renderer = new SurfaceProjectorRenderer(geometryProjector.ProjectorIndex); } if (config.Metered) { geometryProjector.Renderer = new ProjectorMeterDecorator(geometryProjector.Renderer); } geometryProjector.Renderer = new ProjectorOutlineDecorator(geometryProjector.Renderer); if (!string.IsNullOrEmpty(config.TrackerName)) { geometryProjector.Renderer = new ProjectorTurretDecorator(geometryProjector.Renderer); } if (!string.IsNullOrEmpty(config.buildingEquipmentShaderName) && ProjectorUtils.CanBeAnimated(config)) { geometryProjector.Renderer = new ProjectorEquipmentBuildingDecorator(geometryProjector.Renderer); } else { geometryProjector.Renderer = new ProjectorShaderSwapDecorator(geometryProjector.Renderer); } geometryProjector.Renderer = new ProjectorAnimationDecorator(geometryProjector.Renderer); bool flag = config.AnimPreference == AnimationPreference.NoAnimation; bool flag2 = config.AnimPreference == AnimationPreference.AnimationPreferred && HardwareProfile.IsLowEndDevice(); if (!flag && !flag2 && config.IconRotationSpeed > 0f) { geometryProjector.Renderer = new ProjectorRotationDecorator(geometryProjector.Renderer); } ProjectorAssetProcessor arg_16C_0 = geometryProjector.AssetProcessor; if (ProjectorUtils.< > f__mg$cache0 == null) { ProjectorUtils.< > f__mg$cache0 = new Action <GeometryProjector>(ProjectorUtils.OnDefaultAssetSuccess); } Action <GeometryProjector> arg_16C_1 = ProjectorUtils.< > f__mg$cache0; if (ProjectorUtils.< > f__mg$cache1 == null) { ProjectorUtils.< > f__mg$cache1 = new Action <GeometryProjector>(ProjectorUtils.OnDefaultAssetFailure); } arg_16C_0.LoadAllAssets(arg_16C_1, ProjectorUtils.< > f__mg$cache1); return(geometryProjector); }
public void RemoveProjector(GeometryProjector projector) { this.renderInstances.Remove(projector); int projectorIndex = projector.ProjectorIndex; if (this.unusedIndices.Count == 0) { this.unusedIndices.Add(projectorIndex); } else if (!this.unusedIndices.Contains(projectorIndex)) { int index = ProjectorManager.BinarySearch(ref this.unusedIndices, 0, this.unusedIndices.Count, projectorIndex); this.unusedIndices.Insert(index, projectorIndex); } }
public void DestroyProjector(UXSprite sprite) { if (sprite == null) { return; } for (int i = 0; i < this.renderInstances.Count; i++) { GeometryProjector geometryProjector = this.renderInstances[i]; if (geometryProjector.Config != null && geometryProjector.Config.FrameSprite == sprite) { geometryProjector.Config.FrameSprite = null; geometryProjector.Destroy(); } } }
public int AddProjector(GeometryProjector projector) { this.DestroyProjector(projector.Config.FrameSprite); this.renderInstances.Add(projector); int num; if (this.unusedIndices.Count > 0) { num = this.unusedIndices[0]; this.unusedIndices.RemoveAt(0); } else { num = this.highestUnusedIndex; this.highestUnusedIndex++; } Service.Logger.DebugFormat("* About to assign {0} to booth {1}", new object[] { projector.Config.FrameSprite, num }); return(num); }
public static void OnDefaultAssetFailure(GeometryProjector projector) { projector.Destroy(); }
private void OnAssetSuccess(object asset, object cookie) { string text = cookie as string; bool flag = !Service.Get <AssetManager>().IsAssetCloned(text); GameObject gameObject; if (flag) { gameObject = UnityEngine.Object.Instantiate <GameObject>(asset as GameObject); } else { gameObject = (asset as GameObject); } if (text == this.parent.Config.AssetName) { this.parent.Config.MainAsset = gameObject; int i = 0; int count = this.orphans.Count; while (i < count) { this.orphans[i].transform.parent = this.parent.Config.MainAsset.transform; i++; } this.orphans.Clear(); AssetMeshDataMonoBehaviour component = gameObject.GetComponent <AssetMeshDataMonoBehaviour>(); if (component != null && component.ShadowGameObject != null) { component.ShadowGameObject.SetActive(false); } } else if (this.parent.Config.MainAsset == null) { this.orphans.Add(gameObject); } else { gameObject.transform.parent = this.parent.Config.MainAsset.transform; } this.outstandingAssets--; if (this.outstandingAssets > 0) { return; } Renderer[] componentsInChildren = gameObject.GetComponentsInChildren <Renderer>(true); int j = 0; int num = componentsInChildren.Length; while (j < num) { Renderer renderer = componentsInChildren[j]; if (renderer.sharedMaterial != null && renderer.sharedMaterial.HasProperty("_OutlineInnerWidth") && renderer.sharedMaterial.HasProperty("_Outline")) { renderer.sharedMaterial.SetFloat("_Outline", 0f); renderer.sharedMaterial.SetFloat("_OutlineInnerWidth", 0f); } j++; } this.parent.Config.AssetReady = true; this.ExecuteCallback(0u, this.onLoadedCompleteCallback); }
public ProjectorForceReloadHelper(GeometryProjector projector) { this.Projector = projector; Service.Get <EventManager>().RegisterObserver(this, EventId.ForceGeometryReload, EventPriority.Default); }
public static void ResetProjectorMembers(GeometryProjector projector) { projector.AssetProcessor.Reset(); projector.Renderer.Render(projector.Config); }