Exemple #1
0
 public void Destroy()
 {
     Service.Get <EventManager>().UnregisterObserver(this, EventId.ForceGeometryReload);
     Service.Get <ProjectorManager>().RemoveProjector(this);
     if (this.AssetProcessor != null)
     {
         this.AssetProcessor.UnloadAllAssets(null);
         this.AssetProcessor = null;
     }
     if (this.Renderer != null)
     {
         this.Renderer.Destroy();
         this.Renderer = null;
     }
     if (this.Config != null)
     {
         this.Config.Destroy();
         this.Config = null;
     }
     if (this.ReloadHelper != null)
     {
         this.ReloadHelper.Destroy();
         this.ReloadHelper = null;
     }
 }
Exemple #2
0
 public GeometryProjector(ProjectorConfig config)
 {
     this.Config         = config;
     this.ProjectorIndex = Service.Get <ProjectorManager>().AddProjector(this);
     this.AssetProcessor = new ProjectorAssetProcessor(this);
     Service.Get <EventManager>().RegisterObserver(this, EventId.ForceGeometryReload, EventPriority.Default);
 }
Exemple #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);
        }
Exemple #4
0
 public void Destroy()
 {
     Service.ProjectorManager.RemoveProjector(this);
     if (this.AssetProcessor != null)
     {
         this.AssetProcessor.UnloadAllAssets(null);
         this.AssetProcessor = null;
     }
     if (this.Renderer != null)
     {
         this.Renderer.Destroy();
         this.Renderer = null;
     }
     if (this.Config != null)
     {
         this.Config.Destroy();
         this.Config = null;
     }
     if (this.ReloadHelper != null)
     {
         this.ReloadHelper.Destroy();
         this.ReloadHelper = null;
     }
 }
Exemple #5
0
 public GeometryProjector(ProjectorConfig config)
 {
     this.Config         = config;
     this.ProjectorIndex = Service.ProjectorManager.AddProjector(this);
     this.AssetProcessor = new ProjectorAssetProcessor(this);
 }