Example #1
0
 public virtual void AddParaList(ParaList paras)
 {
     if (cache == null)
     {
         cache = new MyDictionary <string, MyDictionary <string, ParaList> >();
     }
     if (StringUtil.IsNullOrEmpty(order) && StringUtil.IsNullOrEmpty(unique))
     {
         if (this.list.Count < this.capacity)
         {
             this.list.Add(paras);
             foreach (string f in paras.GetFields())
             {
                 if (!cache.ContainsKey(f))
                 {
                     cache[f] = new MyDictionary <string, ParaList>();
                 }
                 IPara p = paras.Get(f);
                 if (p != null && p.GetValue() != null)
                 {
                     cache[f][p.GetValue().ToString()] = paras;
                 }
                 else
                 {
                     throw new GameConfigExpception(paras + " has null element");
                 }
             }
         }
     }
     else
     {
         this.list.Add(paras);
         this.list = Select(this.list, this.order, this.capacity);
     }
 }
Example #2
0
 public override void SetValue(string op, IPara v)
 {
     if (OP_ADD.Equals(op))
     {
         elapseTime = elapseTime + (int)v.GetValue();
     }
     else
     {
         if (OP_MINUS.Equals(op))
         {
             elapseTime = elapseTime - (int)v.GetValue();
         }
         else
         {
             if (OP_ASSIGN.Equals(op))
             {
                 if (v is IntPara)
                 {
                     totalTime  = (int)v.GetValue();
                     elapseTime = 0;
                 }
                 else
                 {
                     if (v is com.wd.free.para.TimeElapsePara)
                     {
                         com.wd.free.para.TimeElapsePara tep = (com.wd.free.para.TimeElapsePara)v;
                         totalTime  = tep.totalTime;
                         elapseTime = tep.elapseTime;
                     }
                 }
             }
         }
     }
 }
Example #3
0
 public override bool Meet(string con, IPara v)
 {
     if (v == null)
     {
         return(false);
     }
     if ("==".Equals(con))
     {
         if (value != null)
         {
             return(value.Equals(v.GetValue()));
         }
     }
     else
     {
         if (CON_NOT_EQUAL.Equals(con))
         {
             if (value != null)
             {
                 return(!value.Equals(v.GetValue()));
             }
         }
     }
     return(false);
 }
Example #4
0
 public override bool Meet(string con, IPara v)
 {
     if (v == null)
     {
         return(false);
     }
     if ("==".Equals(con))
     {
         if (v is IntPara)
         {
             return(map.Count == (int)v.GetValue());
         }
     }
     else
     {
         if (CON_NOT_EQUAL.Equals(con))
         {
             if (v is StringPara)
             {
                 return(map.ContainsKey((string)v.GetValue()));
             }
         }
     }
     return(false);
 }
Example #5
0
 private string GetKey(ParaList paras)
 {
     if (!StringUtil.IsNullOrEmpty(unique))
     {
         if (uniKeys == null)
         {
             uniKeys = new HashSet <string>();
             foreach (string uni in StringUtil.Split(unique, ","))
             {
                 uniKeys.Add(uni.Trim());
             }
         }
         IList <string> list = new List <string>();
         foreach (string uni_1 in uniKeys)
         {
             IPara para = paras.Get(uni_1);
             if (para != null)
             {
                 list.Add(para.GetValue().ToString());
             }
         }
         string key = StringUtil.GetStringFromStrings(list, "-");
         if (!StringUtil.IsNullOrEmpty(key))
         {
             return(key);
         }
     }
     return(null);
 }
Example #6
0
 public override void SetValue(string op, IPara v)
 {
     if (v == null)
     {
         return;
     }
     if ("=".Equals(op))
     {
         value = v.GetValue();
     }
 }
Example #7
0
 public override void SetValue(string op, IPara v)
 {
     try
     {
         para.SetValue(op, v);
         if (op.Equals(OP_ASSIGN))
         {
             field.SetValue(obj, para.GetValue());
         }
     }
     catch (Exception e)
     {
         throw new GameConfigExpception("set value failed.\n" + ExceptionUtil.GetExceptionContent(e));
     }
 }
Example #8
0
        public override void SetValue(string op, IPara v)
        {
            if (v == null)
            {
                return;
            }
            double v1 = GetDouble(value);
            double v2 = GetDouble(v.GetValue());

            switch (op)
            {
            case OP_ASSIGN:
            {
                value = v2;
                break;
            }

            case OP_ADD:
            {
                value = v1 + v2;
                break;
            }

            case OP_MINUS:
            {
                value = v1 - v2;
                break;
            }

            case OP_MULTI:
            {
                value = v1 * v2;
                break;
            }

            case OP_DIVIDE:
            {
                value = v1 / v2;
                break;
            }

            case OP_MOD:
            {
                value = v1 % v2;
                break;
            }
            }
        }
Example #9
0
        public override void SetValue(string op, IPara v)
        {
            long v1 = GetLong(value);
            long v2 = GetLong(v.GetValue());

            switch (op)
            {
            case OP_ASSIGN:
            {
                value = v2;
                break;
            }

            case OP_ADD:
            {
                value = v1 + v2;
                break;
            }

            case OP_MINUS:
            {
                value = v1 - v2;
                break;
            }

            case OP_MULTI:
            {
                value = v1 * v2;
                break;
            }

            case OP_DIVIDE:
            {
                value = v1 / v2;
                break;
            }

            case OP_MOD:
            {
                value = v1 % v2;
                break;
            }
            }
        }
Example #10
0
        public override bool Meet(string con, IPara v)
        {
            if (v == null)
            {
                return(false);
            }
            double v1 = GetDouble(value);
            double v2 = GetDouble(v.GetValue());

            switch (con)
            {
            case CON_EQUAL:
            {
                return(v1 == v2);
            }

            case CON_NOT_EQUAL:
            {
                return(v1 != v2);
            }

            case CON_GE:
            {
                return(v1 >= v2);
            }

            case CON_LE:
            {
                return(v1 <= v2);
            }

            case CON_GREATER:
            {
                return(v1 > v2);
            }

            case CON_LESS:
            {
                return(v1 < v2);
            }
            }
            return(false);
        }
Example #11
0
 public override bool Meet(string con, IPara v)
 {
     if (v is IntPara || v is UpdatePara)
     {
         int ev = ((int)GetValue());
         int cv = ((int)v.GetValue());
         if ("==".Equals(con))
         {
             return(ev == cv);
         }
         else
         {
             if (">".Equals(con))
             {
                 return(ev > cv);
             }
             else
             {
                 if ("<".Equals(con))
                 {
                     return(ev < cv);
                 }
                 else
                 {
                     if (">=".Equals(con))
                     {
                         return(ev >= cv);
                     }
                     else
                     {
                         if ("<=".Equals(con))
                         {
                             return(ev <= cv);
                         }
                     }
                 }
             }
         }
     }
     return(false);
 }
Example #12
0
        public override bool Meet(string con, IPara v)
        {
            int v1 = list.Count;
            int v2 = (int)v.GetValue();

            switch (con)
            {
            case CON_EQUAL:
            {
                return(v1 == v2);
            }

            case CON_NOT_EQUAL:
            {
                return(v1 != v2);
            }

            case CON_GE:
            {
                return(v1 >= v2);
            }

            case CON_LE:
            {
                return(v1 <= v2);
            }

            case CON_GREATER:
            {
                return(v1 > v2);
            }

            case CON_LESS:
            {
                return(v1 < v2);
            }
            }
            return(false);
        }
Example #13
0
        public override bool Meet(string con, IPara v)
        {
            long v1 = GetLong(value);
            long v2 = GetLong(v.GetValue());

            switch (con)
            {
            case CON_EQUAL:
            {
                return(v1 == v2);
            }

            case CON_NOT_EQUAL:
            {
                return(v1 != v2);
            }

            case CON_GE:
            {
                return(v1 >= v2);
            }

            case CON_LE:
            {
                return(v1 <= v2);
            }

            case CON_GREATER:
            {
                return(v1 > v2);
            }

            case CON_LESS:
            {
                return(v1 < v2);
            }
            }
            return(false);
        }
Example #14
0
        public override void SetValue(string op, IPara v)
        {
            if (v == null)
            {
                return;
            }
            string v1 = value.ToString();
            string v2 = v.GetValue().ToString();

            switch (op)
            {
            case OP_ASSIGN:
            {
                value = v2;
                break;
            }

            case OP_ADD:
            {
                value = v1 + v2;
                break;
            }
            }
        }