Exemple #1
0
 public Object(string typeName, Vector3 pos, double angle)
     : base()
 {
     if ((Asset.map.majorAssets["StandingWaterAreas"] as StandingWaterAreas).areas.Length > 0)
     {
         float num = (float)(Asset.map.majorAssets["StandingWaterAreas"] as StandingWaterAreas).areas[0].waterHeight;
         int index1 = (int)((double)pos[0] / 10.0);
         int index2 = (int)((double)pos[1] / 10.0);
         if (index1 >= 0 && index1 < Asset.map.mapWidth && (index2 >= 0 && index2 < Asset.map.mapHeight) && (double)Asset.map.heightMap.elevations[index1, index2] < (double)num)
             pos[2] = num - pos[2];
     }
     this.typeName = typeName;
     this.position = pos;
     this.angle = (float)angle;
     this.objectInitialHealth = new SubAsset<int>("objectInitialHealth", 100, this.namedSubAssets);
     this.objectEnabled = new SubAsset<bool>("objectEnabled", true, this.namedSubAssets);
     this.objectIndestructible = new SubAsset<bool>("objectIndestructible", false, this.namedSubAssets);
     this.objectUnsellable = new SubAsset<bool>("objectUnsellable", false, this.namedSubAssets);
     this.objectPowered = new SubAsset<bool>("objectPowered", true, this.namedSubAssets);
     this.objectRecruitableAI = new SubAsset<bool>("objectRecruitableAI", true, this.namedSubAssets);
     this.objectTargetable = new SubAsset<bool>("objectTargetable", false, this.namedSubAssets);
     this.objectSleeping = new SubAsset<bool>("objectSleeping", false, this.namedSubAssets);
     this.objectBasePriority = new SubAsset<int>("objectBasePriority", 40, this.namedSubAssets);
     this.objectBasePhase = new SubAsset<int>("objectBasePhase", 1, this.namedSubAssets);
     this.objectLayer = new SubAsset<string>("objectLayer", "", this.namedSubAssets);
 }
Exemple #2
0
 public Team(string name, string owner, bool singleton)
 {
     this.namedSubAssets = new Dictionary<string, SubAsset>();
     this.teamName = new SubAsset<string>("teamName", name, this.namedSubAssets);
     this.teamOwner = new SubAsset<string>("teamOwner", owner, this.namedSubAssets);
     this.teamIsSingleton = new SubAsset<bool>("teamIsSingleton", singleton, this.namedSubAssets);
 }
Exemple #3
0
 public Team(BinaryReader br)
 {
     short num1 = br.ReadInt16();
     this.namedSubAssets = new Dictionary<string, SubAsset>((int)num1);
     uint num2 = 0U;
     for (int index = 0; index < (int)num1; ++index)
     {
         string name = SubAsset.PeekSubAssetName(br);
         if (name.StartsWith("teamUnitType"))
         {
             SubAsset<string> subAsset1 = new SubAsset<string>(br, name, this.namedSubAssets);
         }
         else if (name.StartsWith("teamUnitMaxCount"))
         {
             SubAsset<int> subAsset2 = new SubAsset<int>(br, name, this.namedSubAssets);
         }
         else if (name.StartsWith("teamUnitMinCount"))
         {
             SubAsset<int> subAsset3 = new SubAsset<int>(br, name, this.namedSubAssets);
         }
         else
         {
             switch (name)
             {
                 case "teamName":
                     this.teamName = new SubAsset<string>(br, name, this.namedSubAssets);
                     continue;
                 case "teamOwner":
                     this.teamOwner = new SubAsset<string>(br, name, this.namedSubAssets);
                     continue;
                 case "teamIsSingleton":
                     this.teamIsSingleton = new SubAsset<bool>(br, name, this.namedSubAssets);
                     continue;
                 case "exportWithScript":
                     SubAsset<bool> subAsset4 = new SubAsset<bool>(br, name, this.namedSubAssets);
                     continue;
                 default:
                     SubAsset.ReadAsBytes(br, name);
                     ++num2;
                     continue;
             }
         }
     }
     if (num2 <= 0U)
         return;
     Console.WriteLine("!\t Asset: {0} skipped parsing {1} SubAssets", (object)this, (object)num2);
 }
        public HttpResponseMessage AddSubAsset(string blobName, string version, string subAssetUrl)
        {
            var asset = assetRep.GetAll().Where(d => d.CustomName == blobName).FirstOrDefault();

            if (asset != null)
            {
                if (asset.Type == "image")
                {
                    SubAsset subasset = new SubAsset();
                    subasset.AssetId     = asset.AssetId;
                    subasset.asset       = asset;
                    subasset.Version     = version;
                    subasset.SubAssetUrl = subAssetUrl;
                    subAssetRep.Create(subasset);
                    return(new HttpResponseMessage(HttpStatusCode.Accepted));
                }
            }
            return(new HttpResponseMessage(HttpStatusCode.BadRequest));
        }
Exemple #5
0
 public Object(BinaryReader br)
     : base(br)
 {
     this.position = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
     this.angle = (float)((double)br.ReadSingle() * 180.0 / 3.14159274101257);
     this.roadOptions = (Object.RoadOptions)br.ReadInt32();
     this.typeName = IOUtility.ReadString(br);
     short num1 = br.ReadInt16();
     uint num2 = 0U;
     for (int index = 0; index < (int)num1; ++index)
     {
         string name = SubAsset.PeekSubAssetName(br);
         switch (name)
         {
             case "objectInitialHealth":
                 this.objectInitialHealth = new SubAsset<int>(br, name, this.namedSubAssets);
                 break;
             case "objectEnabled":
                 this.objectEnabled = new SubAsset<bool>(br, name, this.namedSubAssets);
                 break;
             case "objectIndestructible":
                 this.objectIndestructible = new SubAsset<bool>(br, name, this.namedSubAssets);
                 break;
             case "objectUnsellable":
                 this.objectUnsellable = new SubAsset<bool>(br, name, this.namedSubAssets);
                 break;
             case "objectPowered":
                 this.objectPowered = new SubAsset<bool>(br, name, this.namedSubAssets);
                 break;
             case "objectRecruitableAI":
                 this.objectRecruitableAI = new SubAsset<bool>(br, name, this.namedSubAssets);
                 break;
             case "objectTargetable":
                 this.objectTargetable = new SubAsset<bool>(br, name, this.namedSubAssets);
                 break;
             case "objectSleeping":
                 this.objectSleeping = new SubAsset<bool>(br, name, this.namedSubAssets);
                 break;
             case "objectBasePriority":
                 this.objectBasePriority = new SubAsset<int>(br, name, this.namedSubAssets);
                 break;
             case "objectBasePhase":
                 this.objectBasePhase = new SubAsset<int>(br, name, this.namedSubAssets);
                 break;
             case "originalOwner":
                 this.originalOwner = new SubAsset<string>(br, name, this.namedSubAssets);
                 break;
             case "uniqueID":
                 this.uniqueID = new SubAsset<string>(br, name, this.namedSubAssets);
                 break;
             case "objectLayer":
                 this.objectLayer = new SubAsset<string>(br, name, this.namedSubAssets);
                 break;
             case "objectName":
                 this.objectName = new SubAsset<string>(br, name, this.namedSubAssets);
                 break;
             case "objectPrototypeScale":
                 this.objectPrototypeScale = new SubAsset<float>(br, name, this.namedSubAssets);
                 break;
             case "alignToTerrain":
                 this.alignToTerrain = new SubAsset<bool>(br, name, this.namedSubAssets);
                 break;
             case "objectTime":
                 this.objectTime = new SubAsset<int>(br, name, this.namedSubAssets);
                 break;
             case "objectWeather":
                 this.objectWeather = new SubAsset<int>(br, name, this.namedSubAssets);
                 break;
             case "objectEventsList":
                 this.objectEventsList = new SubAsset<string>(br, name, this.namedSubAssets);
                 break;
             case "objectInitialStance":
                 this.objectInitialStance = new SubAsset<int>(br, name, this.namedSubAssets);
                 break;
             case "exportWithScript":
                 this.exportWithScript = new SubAsset<bool>(br, name, this.namedSubAssets);
                 break;
             case "objectSoundAmbient":
                 this.objectSoundAmbient = new SubAsset<string>(br, name, this.namedSubAssets);
                 break;
             case "scorchType":
                 this.scorchType = new SubAsset<int>(br, name, this.namedSubAssets);
                 break;
             case "objectRadius":
                 this.objectRadius = new SubAsset<float>(br, name, this.namedSubAssets);
                 break;
             case "objectSoundAmbientEnabled":
                 SubAsset<bool> subAsset1 = new SubAsset<bool>(br, name, this.namedSubAssets);
                 break;
             case "objectSoundAmbientCustomized":
                 SubAsset<bool> subAsset2 = new SubAsset<bool>(br, name, this.namedSubAssets);
                 break;
             case "objectSoundAmbientVolume":
                 SubAsset<float> subAsset3 = new SubAsset<float>(br, name, this.namedSubAssets);
                 break;
             case "objectSoundAmbientMaxRange":
                 SubAsset<float> subAsset4 = new SubAsset<float>(br, name, this.namedSubAssets);
                 break;
             case "objectSoundAmbientMinRange":
                 SubAsset<float> subAsset5 = new SubAsset<float>(br, name, this.namedSubAssets);
                 break;
             case "waypointID":
                 this.waypointID = new SubAsset<int>(br, name, this.namedSubAssets);
                 break;
             case "waypointName":
                 this.waypointName = new SubAsset<string>(br, name, this.namedSubAssets);
                 break;
             case "waypointTypeOption":
                 this.waypointTypeOption = new SubAsset<string>(br, name, this.namedSubAssets);
                 break;
             case "waypointPathLabel1":
                 this.waypointPathLabel1 = new SubAsset<string>(br, name, this.namedSubAssets);
                 break;
             case "waypointPathLabel2":
                 this.waypointPathLabel2 = new SubAsset<string>(br, name, this.namedSubAssets);
                 break;
             case "waypointPathLabel3":
                 this.waypointPathLabel3 = new SubAsset<string>(br, name, this.namedSubAssets);
                 break;
             case "waypointPathBiDirectional":
                 this.waypointPathBiDirectional = new SubAsset<bool>(br, name, this.namedSubAssets);
                 break;
             case "waypointType":
                 this.waypointType = new SubAsset<Object.WaypointType>(br, name, this.namedSubAssets);
                 break;
             default:
                 SubAsset.ReadAsBytes(br, name);
                 ++num2;
                 break;
         }
     }
     if (num2 > 0U)
         Console.WriteLine("!\t Asset: {0} skipped parsing {1} SubAssets", (object)this.GetType().Name, (object)num2);
     if (this.roadOptions == (Object.RoadOptions)0)
         return;
     Console.WriteLine("!\t Asset: Object - {0} roadOptions = {1}", (object)this.uniqueID.data, (object)this.roadOptions);
 }
Exemple #6
0
 public WorldInfo(BinaryReader br, string[] assetStrings)
     : base(br)
 {
     short num1 = br.ReadInt16();
     uint num2 = 0U;
     for (int index = 0; index < (int)num1; ++index)
     {
         string name = SubAsset.PeekSubAssetName(br);
         switch (name)
         {
             case "musicZone":
                 this.musicZone = new SubAsset<string>(br, name, this.namedSubAssets);
                 break;
             case "terrainTextureStrings":
                 this.terrainTextureStrings = new SubAsset<string>(br, name, this.namedSubAssets);
                 break;
             case "weather":
                 this.weather = new SubAsset<WorldInfo.WeatherType>(br, name, this.namedSubAssets);
                 break;
             case "mapName":
                 this.mapName = new SubAsset<string>(br, name, this.namedSubAssets);
                 break;
             case "mapDescription":
                 this.mapDescription = new SubAsset<string>(br, name, this.namedSubAssets);
                 break;
             case "compression":
                 this.compression = new SubAsset<WorldInfo.CompressionType>(br, name, this.namedSubAssets);
                 break;
             case "cameraGroundMinHeight":
                 this.cameraGroundMinHeight = new SubAsset<float>(br, name, this.namedSubAssets);
                 break;
             case "cameraGroundMaxHeight":
                 this.cameraGroundMaxHeight = new SubAsset<float>(br, name, this.namedSubAssets);
                 break;
             case "cameraMinHeight":
                 this.cameraMinHeight = new SubAsset<float>(br, name, this.namedSubAssets);
                 break;
             case "cameraMaxHeight":
                 this.cameraMaxHeight = new SubAsset<float>(br, name, this.namedSubAssets);
                 break;
             case "isScenarioMultiplayer":
                 this.isScenarioMultiplayer = new SubAsset<bool>(br, name, this.namedSubAssets);
                 break;
             case "cameraPitchAngle":
                 this.cameraPitchAngle = new SubAsset<float>(br, name, this.namedSubAssets);
                 break;
             case "cameraYawAngle":
                 this.cameraYawAngle = new SubAsset<float>(br, name, this.namedSubAssets);
                 break;
             case "cameraScrollSpeedScalar":
                 this.cameraScrollSpeedScalar = new SubAsset<float>(br, name, this.namedSubAssets);
                 break;
             case "cameraMapHeightSmoothnessScalar":
                 this.cameraMapHeightSmoothnessScalar = new SubAsset<float>(br, name, this.namedSubAssets);
                 break;
             case "isLivingWorldScriptHolder":
                 SubAsset<bool> subAsset = new SubAsset<bool>(br, name, this.namedSubAssets);
                 break;
             default:
                 SubAsset.ReadAsBytes(br, name);
                 ++num2;
                 break;
         }
     }
     if (num2 > 0U)
         Console.WriteLine("!\t Asset: {0} skipped parsing {1} SubAssets", (object)this.GetType().Name, (object)num2);
     this.CheckParsedSize(br);
     if (this.mapName != null)
         return;
     this.mapName = new SubAsset<string>("mapName", "", this.namedSubAssets);
 }
Exemple #7
0
 public override void Default()
 {
     foreach (SubAsset subAsset in this.namedSubAssets.Values)
         subAsset.Clear();
     this.namedSubAssets.Clear();
     /*
     switch (this.game)
     {
         case Game.RA3:
             this.musicZone = new SubAsset<string>("musicZone", "MusicPalette:MusicPalette_NotSet", this.namedSubAssets);
             this.cameraMinHeight = new SubAsset<float>("cameraMinHeight", 40f, this.namedSubAssets);
             this.cameraMaxHeight = new SubAsset<float>("cameraMaxHeight", 650f, this.namedSubAssets);
             this.terrainTextureStrings = new SubAsset<string>("terrainTextureStrings", "RA3Grid1;RA3Grid1_NRM;", this.namedSubAssets);
             break;
         case Game.CC3:
             this.musicZone = new SubAsset<string>("musicZone", "MusicPalette_NotSet", this.namedSubAssets);
             this.cameraMinHeight = new SubAsset<float>("cameraMinHeight", 40f, this.namedSubAssets);
             this.cameraMaxHeight = new SubAsset<float>("cameraMaxHeight", 500f, this.namedSubAssets);
             break;
         default:
             Console.WriteLine("!\t Asset: WorldInfo does not know how to create default data for Game." + (object)this.game);
             break;
     }
     */
     this.weather = new SubAsset<WorldInfo.WeatherType>("weather", WorldInfo.WeatherType.Normal, this.namedSubAssets);
     this.mapName = new SubAsset<string>("mapName", "random", this.namedSubAssets);
     this.mapDescription = new SubAsset<string>("mapDescription", "map created with map generator by KOS4U2C", this.namedSubAssets);
     this.compression = new SubAsset<WorldInfo.CompressionType>("compression", WorldInfo.CompressionType.None, this.namedSubAssets);
     this.cameraGroundMinHeight = new SubAsset<float>("cameraGroundMinHeight", 0.0f, this.namedSubAssets);
     this.cameraGroundMaxHeight = new SubAsset<float>("cameraGroundMaxHeight", 2560f, this.namedSubAssets);
     this.isScenarioMultiplayer = new SubAsset<bool>("isScenarioMultiplayer", false, this.namedSubAssets);
 }