public MetaResource GetResource(string set, string type, string key, string cultureCode = "en-US", bool enabled = true)
 {
     WithMetadataClient(metadataClient =>
     {
         _metaResourceResult = metadataClient.GetResource(set, type, key, cultureCode, enabled);
     });
     return(_metaResourceResult);
 }
Exemple #2
0
 public void AddGraphic(MetaResource <Model9, Model10> graphic)
 {
     graphics.Add(graphic);
     if (GraphicAdded != null)
     {
         GraphicAdded(this, graphic);
     }
 }
Exemple #3
0
 public void RemoveGraphic(MetaResource <Model9, Model10> graphic)
 {
     graphics.Remove(graphic);
     if (GraphicRemoved != null)
     {
         GraphicRemoved(this, graphic);
     }
 }
        public async Task <MetaResource> GetResourceAsync(string set, string type, string key, string cultureCode = "en-US", bool enabled = true)
        {
            await WithMetadataClientAsync(async metadataClient =>
            {
                _metaResourceResult = await metadataClient.GetResourceAsync(set, type, key, cultureCode, enabled);
            });

            return(_metaResourceResult);
        }
Exemple #5
0
        private void GenRes()
        {
            DataTable Res = _ds.Tables["Res"];

            MRS = new MetaResourceSet()
            {
                ResSet  = new ResourceSet(),
                SeatSet = new SeatSet()
            };
            InitState = new MetaResouceState();
            string      temp     = "";
            List <Seat> tempSeat = null;

            foreach (DataRow dr in Res.Rows)
            {
                Resource r = new Resource()
                {
                    ResID       = Convert.ToInt32(dr["ID"]),
                    Description = dr["Des"].ToString(),
                    Tag         = dr["Tag"].ToString()
                };
                ResSet.Add(r);
                InitState.ResDic.Add(r, 0);
                int num = Convert.ToInt32(dr["Cap"]);
                if (temp != r.Tag)
                {
                    tempSeat = new List <Seat>();
                    for (int i = MRS.SeatSet.Count; i < MRS.SeatSet.Count + num; i++)
                    {
                        tempSeat.Add(new Seat()
                        {
                            SeatID = i, Tag = r.Tag, IDinTrain = i - MRS.SeatSet.Count
                        });
                    }
                    MRS.SeatSet.AddRange(tempSeat);
                }
                for (int i = 0; i < num; i++)
                {
                    MetaResource mr = new MetaResource()
                    {
                        Name     = r.ResID + "_" + i,
                        ResID    = r.ResID,
                        SeatID   = i,
                        Resource = r,
                        Seat     = tempSeat[i]
                    };
                    InitState.MetaResDic.Add(mr, false);
                    MRS.Add(mr);
                    r.MetaResList.Add(mr);
                    tempSeat[i].MetaResList.Add(mr);
                }
                temp = r.Tag;
            }
            InitState.UpdateResDic();
        }
        public void SetGraphic(String id, MetaResource <Model9, Model10> graphic)
        {
            MetaResource <Model9, Model10> mm;

            if (idGraphics.TryGetValue(id, out mm))
            {
                RemoveGraphic(mm);
            }
            if (graphic != null)
            {
                AddGraphic(graphic);
                idGraphics[id] = graphic;
            }
        }
 public Button()
 {
     NormalTexture = new TextureFromFile("Graphics.Resources.ButtonBorder.png");
     HoverTexture = new TextureFromFile("Graphics.Resources.ButtonHoverBorder.png");
     ClickTexture = new TextureFromFile("Graphics.Resources.ButtonClickBorder.png");
     Background = new BorderGraphic
     {
         Layout = new Graphics.Content.BorderLayout(new Rectangle(0, 0, 4, 4), new Rectangle(3, 0, 1, 4), new Rectangle(0, 3, 4, 1), new Rectangle(3, 3, 1, 1))
         {
             BackgroundStyle = BorderBackgroundStyle.Inner,
             Border = new Vector2(4, 4)
         },
         Texture = new TextureFromFile("Graphics.Resources.ButtonBorder.png"),
         TextureSize = new Vector2(4, 4)
     };
 }
Exemple #8
0
        public MetaResource GetResource(string set, string type, string key, string cultureCode = "en-US", bool enabled = true)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                IMetaResourceRepository resourceRepository = _DataRepositoryFactory.GetDataRepository <IMetaResourceRepository>();
                MetaResource resource = resourceRepository.GetResource(set, type, key, cultureCode, enabled);

                if (resource == null)
                {
                    NotFoundFault fault = new NotFoundFault(string.Format("No resource found for set-type-code-culture-enabled: [{0}]-[{1}]-[{2}]-[{3}]-[{4}].", set, type, key, cultureCode, enabled));
                    throw new FaultException <NotFoundFault>(fault, fault.Message);
                }

                return resource;
            }));
        }
Exemple #9
0
 void entity_GraphicRemoved(Entity arg1, MetaResource <Model9, Model10> arg2)
 {
     RemoveRenderable(arg1, (MetaModel)arg2);
 }
 public void Add(Entity entity, MetaResource<Model9, Model10> metaResource, Model9 model, string metaName)
 {
     if (RenderRoot != null)
     {
         RenderRoot.Insert(model, entity, (MetaModel)((MetaModel)metaResource).Clone(), metaName, Settings);
     }
     else
         throw new Exception("Renderer needs initialization.");
 }
 public void SetGraphic(String id, MetaResource<Model9, Model10> graphic)
 {
     MetaResource<Model9, Model10> mm;
     if (idGraphics.TryGetValue(id, out mm))
         RemoveGraphic(mm);
     if (graphic != null)
     {
         AddGraphic(graphic);
         idGraphics[id] = graphic;
     }
 }
Exemple #12
0
 void entity_GraphicAdded(Entity arg1, MetaResource <Model9, Model10> arg2)
 {
     AddRenderable(arg1, (MetaModel)arg2);
 }
 public void RemoveGraphic(MetaResource<Model9, Model10> graphic)
 {
     graphics.Remove(graphic);
     if (GraphicRemoved != null)
         GraphicRemoved(this, graphic);
 }
        public MetaModel(MetaModel copy)
            : this()
        {
            if (copy.XMesh != null)
            {
                XMesh = (MetaResourceBase)copy.XMesh.Clone();
            }
            if (copy.Mesh != null)
            {
                Mesh = (MetaResource <Mesh9, Mesh10>)copy.Mesh.Clone();
            }
            if (copy.Texture != null)
            {
                Texture = (MetaResource <SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D>)
                          copy.Texture.Clone();
            }
            if (copy.SpecularTexture != null)
            {
                SpecularTexture = (MetaResource <SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D>)
                                  copy.SpecularTexture.Clone();
            }
            if (copy.SplatTexutre != null)
            {
                SplatTexutre = new MetaResource <SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D> [copy.SplatTexutre.Length];

                for (int i = 0; i < copy.SplatTexutre.Length; i++)
                {
                    SplatTexutre[i] = (MetaResource <SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D>)
                                      copy.SplatTexutre[i].Clone();
                }
            }

            if (copy.MaterialTexture != null)
            {
                MaterialTexture = new MetaResource <SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D> [copy.MaterialTexture.Length];

                for (int i = 0; i < copy.MaterialTexture.Length; i++)
                {
                    if (copy.MaterialTexture[i] != null)
                    {
                        MaterialTexture[i] = (MetaResource <SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D>)
                                             copy.MaterialTexture[i].Clone();
                    }
                }
            }

            if (copy.BaseTexture != null)
            {
                BaseTexture = (MetaResource <SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D>)copy.BaseTexture.Clone();
            }

            if (copy.SkinnedMesh != null)
            {
                SkinnedMesh = (MetaResource <SkinnedMesh>)copy.SkinnedMesh.Clone();
            }

            AlphaRef             = copy.AlphaRef;
            CastShadows          = copy.CastShadows;
            HasAlpha             = copy.HasAlpha;
            IsBillboard          = copy.IsBillboard;
            IsWater              = copy.IsWater;
            Opacity              = copy.Opacity;
            ReceivesAmbientLight = copy.ReceivesAmbientLight;
            ReceivesDiffuseLight = copy.ReceivesDiffuseLight;
            ReceivesSpecular     = copy.ReceivesSpecular;
            ReceivesShadows      = copy.ReceivesShadows;
            Animate              = copy.Animate;
            SplatMapped          = copy.SplatMapped;
            Visible              = copy.Visible;
            World               = copy.World;
            DontSort            = copy.DontSort;
            AxialDirection      = copy.AxialDirection;
            IsAxialBillboard    = copy.IsAxialBillboard;
            ReceivesFog         = copy.ReceivesFog;
            TextureAddress      = copy.TextureAddress;
            AmbientLight        = copy.AmbientLight;
            SpecularExponent    = copy.SpecularExponent;
            OverrideZBuffer     = copy.OverrideZBuffer;
            StoredFrameMatrices = copy.StoredFrameMatrices;
            OrientationRelation = copy.OrientationRelation;
        }
 public static MetaResource Expand(this MetaResource metaResource, string expandPath)
 {
     return(null);
 }
 public void AddGraphic(MetaResource<Model9, Model10> graphic)
 {
     graphics.Add(graphic);
     if (GraphicAdded != null)
         GraphicAdded(this, graphic);
 }
 public static MetaResource Select(this MetaResource metaResource, string selectPath)
 {
     return(null);
 }
 protected override void StartPerform()
 {
     base.StartPerform();
     second = true;
     tex = ((MetaModel)TargetUnit.MainGraphic).Texture;
     ((MetaModel)TargetUnit.MainGraphic).Texture
         = new TextureConcretizer
         {
             TextureDescription = new Graphics.Software.Textures.SingleColorTexture(
                 System.Drawing.Color.Black)
         };
 }
        public void Remove(Entity entity, MetaResource<Model9, Model10> metaResource, Model9 model, string metaName)
        {
            MetaModel metaModel = (MetaModel)metaResource;
            if (metaModel.HasAlpha)
            {
                RenderRoot.AlphaObjects.Remove(new Common.Tuple<Model9, Entity, string, string>(model, entity, metaName, GetTechniqueNameExtension(metaModel, Settings, techniqueNames)));

            #if LOG_RENDERTREE
                //renderTreeLogFile.WriteLine("R | Alpha");
                totalRemovedItems++;
            #endif
            }
            else if (metaModel.SplatMapped)
            {
                if(entity.Scene.DesignMode)
                    RenderRoot.SplatObjects.Remove(new Common.Tuple<Model9, Entity, string>(model, entity, metaName));

                RenderRoot.SplatTechniques["Standard" + GetTechniqueNameExtension(metaModel, Settings, techniqueNames) + RenderRoot.GetSplatTechniqueExtention(model, Settings)].TextureCombinations[new SplatTextureCombination { BaseTexture = model.BaseTexture, MaterialTexture = model.MaterialTexture, SplatTexture = model.SplatTexture }].RenderObjects.Remove(new Common.Tuple<Model9,Entity,string>(model, entity, metaName));
            #if LOG_RENDERTREE
                //renderTreeLogFile.WriteLine("R | Splat");
                totalRemovedItems++;
            #endif
            }
            else if (model.SkinnedMesh != null)
            {
                foreach (Common.Tuple<CustomFrame, CustomMeshContainer> meshContainer in model.SkinnedMesh.MeshContainers)
                {
                    if (meshContainer.Second.SkinInfo != null)
                    {
                        string tmp = "SkinnedMesh" + GetTechniqueNameExtension(metaModel, Settings, techniqueNames);

                        RenderRoot.Techniques[tmp].SkinnedMeshes[model.SkinnedMesh].Textures[model.Texture].RenderObjects.Remove(new Common.Tuple<Model9, Entity, string>(model, entity, metaName));

                        if (RenderRoot.Techniques[tmp].SkinnedMeshes[model.SkinnedMesh].Textures[model.Texture].RenderObjects.Count == 0)
                            RenderRoot.Techniques[tmp].SkinnedMeshes[model.SkinnedMesh].Textures.Remove(model.Texture);

            #if LOG_RENDERTREE
                        //renderTreeLogFile.WriteLine("R | SkinnedMesh");
                        totalRemovedItems++;
            #endif
                    }
                    else
                    {
            #if LOG_RENDERTREE
                        //renderTreeLogFile.WriteLine("R | Mesh");
                        totalRemovedItems++;
            #endif
                        string tmp = "ShadowedSceneInstanced" + GetTechniqueNameExtension(metaModel, Settings, techniqueNames);

            #if DEBUG_RENDERER
                        RenderRoot.Techniques[tmp].Meshes[meshContainer.Second.MeshData.Mesh].Textures[model.Texture].RenderObjects.Remove(new Common.Tuple<Model9, Entity, string>(model, entity, metaName));

                        if (RenderRoot.Techniques[tmp].Meshes[meshContainer.Second.MeshData.Mesh].Textures[model.Texture].RenderObjects.Count == 0)
                            RenderRoot.Techniques[tmp].Meshes[meshContainer.Second.MeshData.Mesh].Textures.Remove(model.Texture);
            #else
                        if (!model.SkinnedMesh.MeshContainers[0].Second.OriginalMesh.Disposed)
                            RenderRoot.Techniques[tmp].Meshes[meshContainer.Second.MeshData.Mesh].Textures[model.Texture].RenderObjects.Remove(new Common.Tuple<Model9, Entity, string>(model, entity, metaName));

                        if (meshContainer.Second.MeshData != null)
                            if (RenderRoot.Techniques[tmp].Meshes[meshContainer.Second.MeshData.Mesh].Textures[model.Texture].RenderObjects.Count == 0)
                                RenderRoot.Techniques[tmp].Meshes[meshContainer.Second.MeshData.Mesh].Textures.Remove(model.Texture);
            #endif
                    }
                }

                //RenderRoot.skinnedMeshes[model.SkinnedMesh].textures[model.Texture].RenderObjects.Remove(new Common.Tuple<Model9, Entity, string>(model, entity, metaName));
            }
            else if (model.XMesh != null)
            {
                string tmp = "ShadowedSceneInstanced" + GetTechniqueNameExtension(metaModel, Settings, techniqueNames);

                RenderRoot.Techniques[tmp].Meshes[model.XMesh].Textures[model.Texture].RenderObjects.Remove(new Common.Tuple<Model9, Entity, string>(model, entity, metaName));

                if (RenderRoot.Techniques[tmp].Meshes[model.XMesh].Textures[model.Texture].RenderObjects.Count == 0)
                    RenderRoot.Techniques[tmp].Meshes[model.XMesh].Textures.Remove(model.Texture);

                //RenderRoot.meshes[model.XMesh].textures[model.Texture].RenderObjects.Remove(new Common.Tuple<Model9, Entity, string>(model, entity, metaName));
            #if LOG_RENDERTREE
                //renderTreeLogFile.WriteLine("R | XMesh");
                totalRemovedItems++;
            #endif
            }
            if (!releaseWarningAdded)
            {
                releaseWarningAdded = true;
                Common.ProgramConfigurationInformation.AddWarning(new Common.ProgramConfigurationWarning
                {
                    Text = "RENDERER_RELEASE",
                    Type = Common.ProgramConfigurationWarningType.Performance | Common.ProgramConfigurationWarningType.Stability,
                    Importance = Common.Importance.Critical,
                    Description = "Content release is commented out in the renderer"
                });
            }
        }
 void entity_GraphicAdded(Entity arg1, MetaResource<Model9, Model10> arg2)
 {
     AddRenderable(arg1, (MetaModel)arg2);
 }
 void entity_GraphicRemoved(Entity arg1, MetaResource<Model9, Model10> arg2)
 {
     RemoveRenderable(arg1, (MetaModel)arg2);
 }