Exemplo n.º 1
0
        /// <summary>
        /// parses itself from source tags
        /// </summary>
        /// <param Name="source"></param>
        public void Parse(string source, IDictionary <string, string> modOptions)
        {
            foreach (var pair in source.Split('\t'))
            {
                var arg = pair.Split(new[] { '=' }, 2);
                if (arg.Length == 2)
                {
                    switch (arg[0])
                    {
                    case "game/startpostype":
                        StartPos = (BattleStartPos)int.Parse(arg[1]);
                        break;

                    default:
                        if (arg[0].ToLower().StartsWith("game/modoptions/") || arg[0].ToLower().StartsWith("game\\modoptions\\"))
                        {
                            var val = arg[0].Substring(16);
                            if (modOptions.ContainsKey(val))
                            {
                                modOptions[val] = arg[1];
                            }
                            else
                            {
                                modOptions.Add(val, arg[1]);
                            }
                        }
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
 public void Validate()
 {
     if (startingMetal < 0)
     {
         startingMetal = Default.startingMetal;
     }
     if (startingEnergy < 0)
     {
         startingEnergy = Default.startingEnergy;
     }
     if (maxUnits < 0)
     {
         maxUnits = Default.maxUnits;
     }
     if (startPos == BattleStartPos.NotSet)
     {
         startPos = Default.startPos;
     }
     if (endCondition == BattleEndCondition.NotSet)
     {
         endCondition = Default.endCondition;
     }
     if (limitDgun < 0)
     {
         limitDgun = Default.limitDgun;
     }
     if (diminishingMM < 0)
     {
         diminishingMM = Default.diminishingMM;
     }
     if (ghostedBuildings < 0)
     {
         ghostedBuildings = Default.ghostedBuildings;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// parses itself from source tags
        /// </summary>
        /// <param name="source"></param>
        public void Parse(string source, Dictionary <string, string> modOptions)
        {
            foreach (var pair in source.Split('\t'))
            {
                var arg = pair.Split(new[] { '=' }, 2);
                if (arg.Length == 2)
                {
                    switch (arg[0])
                    {
                    case "game/startmetal":
                        StartingMetal = int.Parse(arg[1]);
                        break;

                    case "game/startenergy":
                        StartingEnergy = int.Parse(arg[1]);
                        break;

                    case "game/maxunits":
                        MaxUnits = int.Parse(arg[1]);
                        break;

                    case "game/startpostype":
                        StartPos = (BattleStartPos)int.Parse(arg[1]);
                        break;

                    case "game/gamemode":
                        EndCondition = (BattleEndCondition)int.Parse(arg[1]);
                        break;

                    case "game/limitdgun":
                        LimitDgun = int.Parse(arg[1]);
                        break;

                    case "game/diminishingmms":
                        DiminishingMM = int.Parse(arg[1]);
                        break;

                    case "game/ghostedbuildings":
                        GhostedBuildings = int.Parse(arg[1]);
                        break;

                    default:
                        if (arg[0].ToLower().StartsWith("game/modoptions/") || arg[0].ToLower().StartsWith("game\\modoptions\\"))
                        {
                            string val = arg[0].Substring(16);
                            if (modOptions.ContainsKey(val))
                            {
                                modOptions[val] = arg[1];
                            }
                            else
                            {
                                modOptions.Add(val, arg[1]);
                            }
                        }
                        break;
                    }
                }
            }
        }
Exemplo n.º 4
0
		/// <summary>
		/// parses itself from source tags
		/// </summary>
		/// <param name="source"></param>
		public void Parse(string source, Dictionary<string, string> modOptions)
		{
			foreach (var pair in source.Split('\t')) {
				var arg = pair.Split(new[] {'='}, 2);
				if (arg.Length == 2) {
					switch (arg[0]) {
						case "game/startpostype":
							StartPos = (BattleStartPos) int.Parse(arg[1]);
							break;
						default:
							if (arg[0].ToLower().StartsWith("game/modoptions/") || arg[0].ToLower().StartsWith("game\\modoptions\\")) {
								string val = arg[0].Substring(16);
								if (modOptions.ContainsKey(val)) modOptions[val] = arg[1];
								else modOptions.Add(val, arg[1]);
							}
							break;
					}
				}
			}
		}
Exemplo n.º 5
0
		/// <summary>
		/// parses itself from source tags
		/// </summary>
		/// <param name="source"></param>
		public void Parse(string source, Dictionary<string, string> modOptions)
		{
			foreach (var pair in source.Split('\t')) {
				var arg = pair.Split(new[] {'='}, 2);
				if (arg.Length == 2) {
					switch (arg[0]) {
						case "game/startmetal":
							StartingMetal = int.Parse(arg[1]);
							break;
						case "game/startenergy":
							StartingEnergy = int.Parse(arg[1]);
							break;
						case "game/maxunits":
							MaxUnits = int.Parse(arg[1]);
							break;
						case "game/startpostype":
							StartPos = (BattleStartPos) int.Parse(arg[1]);
							break;
						case "game/gamemode":
							EndCondition = (BattleEndCondition) int.Parse(arg[1]);
							break;
						case "game/limitdgun":
							LimitDgun = int.Parse(arg[1]);
							break;
						case "game/diminishingmms":
							DiminishingMM = int.Parse(arg[1]);
							break;
						case "game/ghostedbuildings":
							GhostedBuildings = int.Parse(arg[1]);
							break;
						default:
							if (arg[0].ToLower().StartsWith("game/modoptions/") || arg[0].ToLower().StartsWith("game\\modoptions\\")) {
								string val = arg[0].Substring(16);
								if (modOptions.ContainsKey(val)) modOptions[val] = arg[1];
								else modOptions.Add(val, arg[1]);
							}
							break;
					}
				}
			}
		}
 public void Validate()
 {
   if (startingMetal < 0) startingMetal = Default.startingMetal;
   if (startingEnergy < 0) startingEnergy = Default.startingEnergy;
   if (maxUnits < 0) maxUnits = Default.maxUnits;
   if (startPos == BattleStartPos.NotSet) startPos = Default.startPos;
   if (endCondition == BattleEndCondition.NotSet) endCondition = Default.endCondition;
   if (limitDgun < 0) limitDgun = Default.limitDgun;
   if (diminishingMM < 0) diminishingMM = Default.diminishingMM;
   if (ghostedBuildings < 0) ghostedBuildings = Default.ghostedBuildings;
 }