Exemplo n.º 1
0
        private void initGridControl()
        {
            SimTerrainType.loadTerrainTileTypes();

            gridControl1.DataRows.Clear();
            //setup our control grid
            gridControl1.DataSource      = mTypesList;
            gridControl1.SingleClickEdit = true;
            //  AddComboEditor(gridControl1.Columns, getColumWithName("TerrainGroup"), SimEditor.SimTerrainType.mValidGroupings.ToArray());

            int count = SimTerrainType.mTerrainTileTypes.mTypes.Count;

            string[] values = new string[count];
            for (int i = 0; i < count; i++)
            {
                values[i] = SimTerrainType.mTerrainTileTypes.mTypes[i].Name;
            }
            AddComboEditor(gridControl1.Columns, getColumWithName("TileType"), values);

            //load our thumbnail images
            gridControl1.Columns["Preview"].Width = thumnailRes;
            for (int i = 0; i < mTypesList.Count; i++)
            {
                string             pureName = SimTerrainType.getpureFileNameNoExt(mTypesList[i].TextureName);
                string             texName  = CoreGlobals.getWorkPaths().mTerrainTexturesPath + @"\" + mTypesList[i].Theme + @"\" + pureName + "_df.tga";
                Xceed.Grid.DataRow row      = gridControl1.DataRows[i];
                row.Cells["Preview"].BackgroundImage = TextureManager.loadTextureToThumbnail(texName, thumnailRes);
                row.Height = thumnailRes;
            }
        }
Exemplo n.º 2
0
        public void LoadResouces()
        {
            //mStringTable.Load();
            mTechData.Load();
            mProtoObjectData.Load();
            mObjectTypeData.Load();
            mProtoSquadData.Load();
            mGameData.Load();
            mLeaders.Load();
            mPowers.Load();
            mExposedScripts.Load();
            mIconData.Load();
            mPlacementRuleData.Load();
            SimTerrainType.loadTerrainTileTypes();

            mHintConcepts.Load();
        }
Exemplo n.º 3
0
        private int writeTileType()
        {
            ECF.ECFChunkHolder chunkHolder = new ECF.ECFChunkHolder();
            chunkHolder.mDataMemStream = new MemoryStream();
            BinaryWriter binWriter = new BinaryWriter(chunkHolder.mDataMemStream);

            BTerrainSimRep simRep = TerrainGlobals.getEditor().getSimRep();


            // Write tile types
            int numTiles             = simRep.getNumXTiles();
            int obstructionArraySize = numTiles * numTiles;

            SimTerrainType.loadTerrainTileTypes();
            int tileTypeArraySize = obstructionArraySize;

            byte[] tileTypeArray = new byte[tileTypeArraySize];
            for (int x = 0; x < numTiles; x++)
            {
                for (int z = 0; z < numTiles; z++)
                {
                    int index = (x * numTiles + z);

                    //if we have a tile type override, use it
                    int typeOverride = TerrainGlobals.getEditor().getSimRep().getDataTiles().getJaggedTileType(z, x);
                    if (typeOverride > 0)
                    {
                        tileTypeArray[index] = (byte)typeOverride;
                    }
                    else
                    {
                        // Get each tile's dominant texture index
                        int dominantTextureIndex = TerrainGlobals.getEditor().giveDominantTextureAtTile(x, z, simRep);

                        tileTypeArray[index] = 0;
                        if (dominantTextureIndex != -1)
                        {
                            byte   numTypes            = (byte)SimTerrainType.mTerrainTileTypes.mTypes.Count;
                            string dominantTextureType = SimTerrainType.mTextureList[dominantTextureIndex].TileType;
                            // Find the dominant texture's type
                            for (byte typeIndex = 0; typeIndex < numTypes; typeIndex++)
                            {
                                if (SimTerrainType.mTerrainTileTypes.mTypes[typeIndex].Name == dominantTextureType)
                                {
                                    tileTypeArray[index] = typeIndex;
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            binWriter.Write(tileTypeArray);

            ExportTo360.mECF.addChunk((int)eXSD_ChunkID.cXSD_TileTypes, chunkHolder, binWriter.BaseStream.Length);
            binWriter.Close();
            binWriter = null;
            chunkHolder.Close();
            chunkHolder = null;

            return(tileTypeArray.Length);
        }