コード例 #1
0
 public ProjectorAssetProcessor(GeometryProjector parent)
 {
     this.parent       = parent;
     this.handles      = new List <AssetHandle>();
     this.orphans      = new List <GameObject>();
     this.loadedAssets = new List <GameObject>();
 }
コード例 #2
0
        public static void OnDefaultAssetSuccess(GeometryProjector projector)
        {
            ProjectorConfig config = projector.Config;

            projector.Renderer.Render(config);
            projector.Renderer.PostRender(config);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
 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();
         }
     }
 }
コード例 #6
0
        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);
        }
コード例 #7
0
 public static void OnDefaultAssetFailure(GeometryProjector projector)
 {
     projector.Destroy();
 }
コード例 #8
0
        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);
        }
コード例 #9
0
 public ProjectorForceReloadHelper(GeometryProjector projector)
 {
     this.Projector = projector;
     Service.Get <EventManager>().RegisterObserver(this, EventId.ForceGeometryReload, EventPriority.Default);
 }
コード例 #10
0
 public static void ResetProjectorMembers(GeometryProjector projector)
 {
     projector.AssetProcessor.Reset();
     projector.Renderer.Render(projector.Config);
 }