コード例 #1
0
 public static TextureIndex[] RandomizeStrings(TextureIndex[] TI)
 {
     List<KeyValuePair<int, TextureIndex>> list = new List<KeyValuePair<int, TextureIndex>>();
     // Add all strings from array
     // Add new random int each time
     foreach (TextureIndex s in TI)
     {
         list.Add(new KeyValuePair<int, TextureIndex>(_random.Next(), s));
     }
     // Sort the list by the random number
     var sorted = from item in list
                  orderby item.Key
                  select item;
     // Allocate new string array
     TextureIndex[] result = new TextureIndex[TI.Length];
     // Copy values to array
     int index = 0;
     foreach (KeyValuePair<int, TextureIndex> pair in sorted)
     {
         result[index] = pair.Value;
         index++;
     }
     // Return copied array
     return result;
 }
コード例 #2
0
        public TextureMenu(Tile TileSelected, TextureIndex Index ,List<GuiItem> Garbage)
            : base("TileMenu")
        {
            this.Index = Index;
            this.Garbage = Garbage;
            this.TileSelected = TileSelected;

            foreach (TextureEntry Entry in Index.TextureList)
            {
                if (TileSelected.Type == TileType.Normal)
                {
                    if (Entry.Name.StartsWith("Normal"))
                    {
                        MenuItems.Add(new MenuItem(Entry.Name, Entry.Name));
                    }
                }
                else if(TileSelected.Type == TileType.Obstacle)
                {
                    if (Entry.Name.StartsWith("Obstacle"))
                    {
                        MenuItems.Add(new MenuItem(Entry.Name, Entry.Name));
                    }
                }
                else if (TileSelected.Type == TileType.CreepEnd || TileSelected.Type == TileType.CreepStart || TileSelected.Type == TileType.CreepPath)
                {
                    if (Entry.Name.StartsWith("Creep"))
                    {
                        MenuItems.Add(new MenuItem(Entry.Name, Entry.Name));
                    }
                }
            }

            FixAttribute();
        }
コード例 #3
0
 public BakedEntry(
     TextureIndex textureIndex,
     string name,
     string hashName)
 {
     Name = name;
     //WearableHashId = Guid.Parse(hashName);
     TextureIndex = textureIndex;
 }
コード例 #4
0
ファイル: BlockIndex.cs プロジェクト: li5414/Voxelmetric
    public void GetMissingDefinitions() {
        textureIndex = new TextureIndex();

        BlockDefinition[] definitions = World.instance.gameObject.GetComponentsInChildren<BlockDefinition>();

        foreach (var def in definitions)
        {
            if(def.enabled)
                def.AddToBlocks();
        }
    }
コード例 #5
0
        public void GetMissingDefinitions(BlockCollection blockCollection)
        {
            TextureIndex = new TextureIndex();
            TextureIndex.Initialize(blockCollection);
            TextureIndex.Load();

            foreach (var def in blockCollection.Blocks)
            {
                def.AddToBlocks();
            }
        }
コード例 #6
0
    public void GetMissingDefinitions()
    {
        textureIndex = new TextureIndex();

        BlockDefinition[] definitions = World.instance.gameObject.GetComponentsInChildren <BlockDefinition>();

        foreach (var def in definitions)
        {
            if (def.enabled)
            {
                def.AddToBlocks();
            }
        }
    }
コード例 #7
0
        public void AddPolygon(List <VertexPositionNormalTexture> vertices, Polygon polygon, uint textureID)
        {
            if (!TextureIndex.TryGetValue(textureID, out var textureIdx))
            {
                textureIdx = (byte)TextureIndex.Count;
                TextureIndex.Add(textureID, textureIdx);
            }

            foreach (var idx in polygon.Indices)
            {
                var v = vertices[idx];
                Vertices.Add(new VertexPositionNormalTextures(v.Position, v.Normal, v.TextureCoordinate, textureIdx));
            }
        }
コード例 #8
0
        public void ToXml(XmlWriter writer)
        {
            writer.WriteStartElement("slope");

            writer.WriteStartElement("float");
            writer.WriteAttributeString("name", "angleDegrees");
            writer.WriteAttributeString("value", AngleDegrees.ToString());
            writer.WriteEndElement();

            writer.WriteStartElement("int");
            writer.WriteAttributeString("name", "textureIndex");
            writer.WriteAttributeString("value", TextureIndex.ToString());
            writer.WriteEndElement();

            writer.WriteEndElement();
        }
コード例 #9
0
        /// <summary>
        /// Returns the starting index into Instances
        /// </summary>
        public int AddParticleSlot(uint textureID, Vector2 dims)
        {
            // since we are looping over this, change so dict lookup only happens once
            if (!TextureIndex.TryGetValue(textureID, out var textureIdx))
            {
                textureIdx = (byte)TextureIndex.Count;
                TextureIndex.Add(textureID, textureIdx);
            }

            var startIdx = Instances.Count;

            var instance = new ParticleDeclaration(textureIdx, dims);

            Instances.Add(instance);

            return(startIdx);
        }
コード例 #10
0
 public static Guid LocalTextureIndexToMagicId(TextureIndex index)
 {
     return(Instance.GuidByTextureIndex.ContainsKey(index) ? Instance.GuidByTextureIndex[index] : Guid.Empty);
 }
コード例 #11
0
        public void SetAlpha(int vertIndex, TextureIndex textureIndex, byte opacity)
        {
            int index = vertIndex * 16 + (int)textureIndex;

            alphas[index] = opacity;
        }
コード例 #12
0
 /// <summary>
 /// Given a texture entry, determine which wearable type owns it.
 /// </summary>
 /// <param name="index"></param>
 /// <returns></returns>
 public static WearableType GetWearableType(TextureIndex index)
 {
     return(Instance.Textures[index].WearableType);
 }
コード例 #13
0
ファイル: CubeMap.cs プロジェクト: DoubleDashes/SquidCraft
 public void SetIndex(TextureIndex index)
 {
     _index = index;
 }
コード例 #14
0
 // Edit Terrain Paint
 public void Paint(TerrainIndexMapping i, TextureIndex ti, byte opacity)
 {
     terrainChunks[i.x, i.y].SetAlpha(i.index, ti, opacity);
     chunkStatuses[i.x, i.y].needsPaintUpdate = true;
 }
コード例 #15
0
 private void RebakeLayer(TextureIndex index)
 {
     RebakeLayer(Baker.BakeTypeFor(index));
 }
コード例 #16
0
        private int AddImageDownload(TextureIndex index)
        {
            UUID image = AgentTextures[(int)index];

            if (image != UUID.Zero)
            {
                if (!ImageDownloads.ContainsKey(image))
                {
                    Log.DebugLog("Downloading layer " + index.ToString());
                    ImageDownloads.Add(image, index);
                }

                return 1;
            }

            return 0;
        }
コード例 #17
0
ファイル: Map.cs プロジェクト: Gabiroto/Memory
        public void RandomizeTiles()
        {
            TextureIndex[] tex = new TextureIndex[grid.Count];
            int ind = 0;
            TextureIndex[] excluded = { TextureIndex.Black, TextureIndex.Empty, TextureIndex.White };
            foreach (TextureIndex item in tiles.texture.Keys.Except(excluded))
            {
                tex[ind] = item;
                tex[ind+6] = item;
                ind++;
            }

            ind = 0;
            tex = RandomTextureIndexTool.RandomizeStrings(tex);

            for (int i = 0; i < nRows; i++)
            {
                for (int j = 0; j < nCols; j++)
                {
                    grid[Tuple.Create(j, i)].tile = tex[ind];
                    ind++;
                }
            }
        }
コード例 #18
0
        public EditorWindow(Surface Screen)
            : base("Map Editor", 640, 800, Screen)
        {
            AppsDirectory = Directory.GetCurrentDirectory();

            TexIndex = TextureIndex.LoadTextureIndex("../../../../assets/Textures/MapTiles.xml");

            Textures = TexIndex.LoadTextures();

            map = new Map();
            ButtonBg = new BackgroundItem(Color.LightGray);
            ButtonBg.Width = Width;
            ButtonBg.Height = 100;
            ButtonBg.X = 0;
            ButtonBg.Y = 0;

            Background = new BackgroundItem(Color.WhiteSmoke);
            Background.Width = Width;
            Background.Height = Height;

            //WinBar = new WindowBar("Map Editor", Width);
            //WinBar.CloseButton = true;

            LoadMapButton = new ButtonItem("LoadMap", 120, 22, "Load Map");
            LoadMapButton.X = 20;
            LoadMapButton.Y = 30;

            SaveMap = new ButtonItem("SaveMap", 120, 22, "Save Map");
            SaveMap.X = 146;
            SaveMap.Y = 30;

            NewMap = new ButtonItem("NewMap", 120, 22, "New Map");
            NewMap.X = 272;
            NewMap.Y = 30;

            ChangeMapName = new ButtonItem("ChangeMapName", 140, 22, "Change Map Name");
            ChangeMapName.X = 398;
            ChangeMapName.Y = 30;

            SetDefaultTexture = new ButtonItem("SetDefaultTexture", 140, 22, "Set Default Texture");
            SetDefaultTexture.X = 20;
            SetDefaultTexture.Y = 4;

            QuitButton = new ButtonItem("Quit", 100, 22, "Quit");
            QuitButton.X = 166;
            QuitButton.Y = 4;

            mapRenderer = new MapEditRenderer(map,Textures);
            mapRenderer.X = 20;
            mapRenderer.Y = 120;

            MapGrid = new Grid(40, 40);
            MapGrid.Width = 40 * map.Columns;
            MapGrid.Height = 40 * map.Rows;
            MapGrid.X = 20;
            MapGrid.Y = 120;

            MapNameLabel = new LabelItem("Map Name : " + map.MapName);
            MapNameLabel.X = 16;
            MapNameLabel.Y = 65;

            RowLabel = new LabelItem("Row : -");
            RowLabel.X = 20;
            RowLabel.Y = 610;
            ColumnLabel = new LabelItem("Column : -");
            ColumnLabel.X = 20;
            ColumnLabel.Y = 630;

            MapNameDialog = new TextInputDialogBox("Map Name", "Map Name");
            MapNameDialog.X = (Width - MapNameDialog.Width) / 2;
            MapNameDialog.Y = (Height - MapNameDialog.Height) / 2;

            MessageBox = new DialogBox("Message", "Not set");
            MessageBox.X = (Width - MessageBox.Width) / 2;
            MessageBox.Y = (Height - MessageBox.Height) / 2;

            openFile = new OpenFileDialog();
            openFile.InitialDirectory = @"..\..\..\..\Assets\Maps\";
            openFile.Multiselect = false;
            openFile.Title = "Load a Map";
            openFile.Filter = "XML T.D. Map (*.xml) | *.xml";

            Container.Add(Background);
            Container.Add(ButtonBg);

            //Container.Add(WinBar);

            Container.Add(LoadMapButton);
            Container.Add(SaveMap);
            Container.Add(NewMap);
            Container.Add(ChangeMapName);
            Container.Add(SetDefaultTexture);
            Container.Add(QuitButton);

            Container.Add(MapNameLabel);
            Container.Add(RowLabel);
            Container.Add(ColumnLabel);

            Container.Add(mapRenderer);
            Container.Add(MapGrid);

            //Container.Add(MapNameDialog);

            MapNameDialog.SetEvents();
        }
コード例 #19
0
        private void RebakeLayer(TextureIndex index)
        {
                             
            BakeType bakeType = Baker.BakeTypeFor(index);
                            
            Dictionary<int, float> paramValues;

            // Build a dictionary of appearance parameter indices and values from the wearables
            paramValues=MakeParamValues();    

            Baker bake = new Baker(Client, bakeType, 0, paramValues);
                
            for (int ii = 0; ii < AVATAR_TEXTURE_COUNT; ii++)
            { 
                if(bakeType==Baker.BakeTypeFor((TextureIndex)ii) && AgentAssets[ii]!=null)
                {
                    Logger.Log("Adding asset "+AgentAssets[ii].AssetID.ToString()+" to baker",Helpers.LogLevel.Debug);
                    bake.AddTexture((TextureIndex)ii,(AssetTexture)AgentAssets[ii],true);
                }
            }
        
            UploadBake(bake);
        }
コード例 #20
0
ファイル: Game1.cs プロジェクト: captaincobbs/MapDescriptor
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     // Creates a new SpriteBatch, which is used to draw textures.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     TextureIndex.LoadContent(Content);
 }
コード例 #21
0
        private int AddImageDownload(TextureIndex index)
        {
            Guid image = AgentTextures[(int)index];

            if (image != Guid.Empty)
            {
                if (!ImageDownloads.ContainsKey(image))
                {
                    Logger.DebugLog("Downloading layer " + index.ToString(), Client);
                    ImageDownloads.Add(image, index);
                }

                return 1;
            }

            return 0;
        }