Exemple #1
0
        public List<string> LoadFromString(ConditionTable allConditions, string conditionIDs)
        {
            List<string> errorMsg = new List<string>();

            char[] separator = new char[] { ' ', '\n', '\r', '\t' };
            string[] strArray = conditionIDs.Split(separator, StringSplitOptions.RemoveEmptyEntries);
            Condition condition = null;

            for (int i = 0; i < strArray.Length; i++)
            {
                int arrayI;
                if (int.TryParse(strArray[i], out arrayI))
                {
                    if (allConditions.Conditions.TryGetValue(int.Parse(strArray[i]), out condition))
                    {
                        this.AddCondition(condition);
                    }
                    else
                    {
                        errorMsg.Add("条件ID" + int.Parse(strArray[i]) + "不存在");
                    }
                }
                else
                {
                    errorMsg.Add("条件一栏应为半型空格分隔的条件ID");
                }
            }
            //}
            //catch
            //{
            //    errorMsg.Add("条件一栏应为半型空格分隔的条件ID");
            //}
            return errorMsg;
        }
        public List<string> LoadFromString(ConditionTable allConditions, string conditionIDs)
        {
            List<string> errorMsg = new List<string>();

            char[] separator = new char[] { ' ', '\n', '\r', '\t' };
            string[] strArray = conditionIDs.Split(separator, StringSplitOptions.RemoveEmptyEntries);
            Condition condition = null;
            try
            {
                for (int i = 0; i < strArray.Length; i++)
                {
                    if (allConditions.Conditions.TryGetValue(int.Parse(strArray[i]), out condition))
                    {
                        this.AddCondition(condition);
                    }
                    else
                    {
                        errorMsg.Add("条件ID" + int.Parse(strArray[i]) + "不存在");
                    }
                }
            }
            catch
            {
                errorMsg.Add("条件一栏应为半型空格分隔的条件ID");
            }
            return errorMsg;
        }
Exemple #3
0
        public static List <string> LoadConditionWeightFromString(ConditionTable conditions, string str, out Dictionary <Condition, float> result)
        {
            result = new Dictionary <Condition, float>();

            str = str.NullToString("");

            char[]   separator = new char[] { ' ', '\n', '\r', '\t' };
            string[] strArray  = str.Split(separator, StringSplitOptions.RemoveEmptyEntries);

            Condition     condition = null;
            List <string> errorMsg  = new List <string>();

            try
            {
                for (int i = 0; i < strArray.Length; i += 2)
                {
                    if (conditions.Conditions.TryGetValue(int.Parse(strArray[i]), out condition))
                    {
                        result.Add(condition, float.Parse(strArray[i + 1]));
                    }
                    else
                    {
                        errorMsg.Add("条件ID" + int.Parse(strArray[i]) + "不存在");
                    }
                }
            }
            catch
            {
                errorMsg.Add("条件AI应为半型空格分隔的条件ID及数值相间");
            }
            return(errorMsg);
        }
 public void LoadFromString(ConditionTable allConditions, string conditionIDs)
 {
     char[] separator = new char[] { ' ', '\n', '\r', '\t' };
     string[] strArray = conditionIDs.Split(separator, StringSplitOptions.RemoveEmptyEntries);
     Condition condition = null;
     for (int i = 0; i < strArray.Length; i++)
     {
         if (allConditions.Conditions.TryGetValue(int.Parse(strArray[i]), out condition))
         {
             this.AddCondition(condition);
         }
     }
 }
Exemple #5
0
        public void LoadFromString(ConditionTable allConditions, string conditionIDs)
        {
            char[]    separator = new char[] { ' ', '\n', '\r' };
            string[]  strArray  = conditionIDs.Split(separator, StringSplitOptions.RemoveEmptyEntries);
            Condition condition = null;

            for (int i = 0; i < strArray.Length; i++)
            {
                if (allConditions.Conditions.TryGetValue(int.Parse(strArray[i]), out condition))
                {
                    this.AddCondition(condition);
                }
            }
        }
Exemple #6
0
        public void LoadPersonCondFromString(ConditionTable allConds, string data)
        {
            char[] separator = new char[] { ' ', '\n', '\r' };
            string[] strArray = data.Split(separator, StringSplitOptions.RemoveEmptyEntries);

            this.personCond = new Dictionary<int, List<Condition>>();
            for (int i = 0; i < strArray.Length; i += 2)
            {
                int n = int.Parse(strArray[i]);
                int id = int.Parse(strArray[i + 1]);
                if (!allConds.Conditions.ContainsKey(id)) continue;
                if (!this.personCond.ContainsKey(n))
                {
                    this.personCond[n] = new List<Condition>();
                }
                this.personCond[n].Add(allConds.Conditions[id]);
            }
        }
Exemple #7
0
        public void LoadFactionCondFromString(ConditionTable c, string data)
        {
            char[] separator = new char[] { ' ', '\n', '\r' };
            string[] strArray = data.Split(separator, StringSplitOptions.RemoveEmptyEntries);

            this.factionCond = new List<Condition>();
            foreach (string i in strArray)
            {
                if (!c.Conditions.ContainsKey(int.Parse(i))) continue;
                this.factionCond.Add(c.Conditions[int.Parse(i)]);
            }
        }