Exemple #1
1
        public bool UpdateProperty(ref string name, VarList.VarData val)
        {
            try
            {
                if (mPropSet == null)
                {
                    return(false);
                }

                if (!mPropSet.ContainsKey(name))
                {
                    mPropSet.Add(name, new GameProperty());
                }

                GameProperty prop = mPropSet[name];
                //prop.Name = name;
                prop.setPropValue(val);
            }
            catch (Exception ex)
            {
                //Log.Trace("Error,GameObject.UpdateProperty Exception:" + ex.ToString());
                return(false);
            }
            return(true);
        }
Exemple #2
1
        public bool QueryPropObject(string strPropName, ref ObjectID oResult)
        {
            if (strPropName == null)
            {
                return(false);
            }

            try
            {
                if (!mPropSet.ContainsKey(strPropName))
                {
                    return(false);
                }

                GameProperty prop = mPropSet[strPropName];
                if (null == prop)
                {
                    return(false);
                }

                VarList.VarData propValue = prop.getPropValue();
                if (propValue == null)
                {
                    return(false);
                }

                if (propValue.nType != VarType.Object)
                {
                    return(false);
                }

                oResult = (propValue.Data as ObjectID).Clone();
                return(true);
            }
            catch (Exception ex)
            {
                //Log.TraceError("Error, exception " + ex.ToString());
                return(false);
            }
        }
Exemple #3
0
        public bool FindProp(string name)
        {
            if (name == null || name.Length == 0)
            {
                //Log.Trace("Error:GameObject.FindProp name para is emtpy");
                return(false);
            }

            try
            {
                if (!mPropSet.ContainsKey(name))
                {
                    //Log.Trace("Error:GameObject.FindProp does not exist record:" + name);
                    return(false);
                }

                GameProperty property = mPropSet[name];
                if (property != null)
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                //Log.Trace("Error:GameObject.FindRecord Exception :" + ex.ToString());
                return(false);
            }
        }
Exemple #4
0
        public int GetPropType(string name)
        {
            int type = 0;

            if (name == null || name.Length == 0)
            {
                //Log.Trace("Error:GameObject.GetPropType name para is emtpy");
                return(type);
            }

            try
            {
                if (!mPropSet.ContainsKey(name))
                {
                    //Log.Trace("Error:GameObject.GetPropType does not exist property:" + name);
                    return(type);
                }

                GameProperty property = mPropSet[name];
                if (null != property)
                {
                    type = property.ValueType;
                }
            }
            catch (Exception ex)
            {
                //Log.Trace("Error:GameObject.GetPropType Exception :" + ex.ToString());
                return(type);
            }
            return(type);
        }
Exemple #5
0
        public bool QueryPropObject(string strPropName, ref ObjectID oResult)
        {
            if (strPropName == null)
            {
                return(false);
            }

            try
            {
                if (!mPropSet.ContainsKey(strPropName))
                {
                    return(false);
                }

                GameProperty prop = mPropSet[strPropName];

                Var propValue = prop.getPropValue();

                if (propValue.Type != VarType.Object)
                {
                    return(false);
                }

                oResult = propValue.GetObject();
                return(true);
            }
            catch (Exception ex)
            {
                LogSystem.LogError("Error, exception ", ex.ToString());
                return(false);
            }
        }
Exemple #6
0
 public bool UpdateProperty(ref string name, Var val)
 {
     try
     {
         if (mPropSet == null)
         {
             return(false);
         }
         GameProperty gameProp = GameProperty.zero;
         gameProp.setPropValue(val);
         if (!mPropSet.ContainsKey(name))
         {
             mPropSet.Add(name, gameProp);
         }
         else
         {
             mPropSet[name] = gameProp;
         }
     }
     catch (Exception ex)
     {
         LogSystem.Log("Error,GameObject.UpdateProperty Exception:", ex.ToString());
         return(false);
     }
     return(true);
 }
Exemple #7
0
        public Var QueryProp(string name)
        {
            try
            {
                if (!mPropSet.ContainsKey(name))
                {
                    return(Var.zero);
                }
                GameProperty prop = mPropSet[name];

                //防止值被逻辑重写,此处拷贝复制
                return(prop.PropValue.Clone());
            }
            catch (Exception ex)
            {
                LogSystem.LogError("Error, exception ", ex.ToString());
                return(Var.zero);
            }
        }
Exemple #8
0
        public VarList.VarData QueryProp(string name)
        {
            try
            {
                if (!mPropSet.ContainsKey(name))
                {
                    return(new VarList.VarData());
                }

                GameProperty prop = mPropSet[name];
                if (null == prop)
                {
                    return(new VarList.VarData());
                }

                //防止值被逻辑重写,此处拷贝复制
                return(prop.PropValue.Clone());
            }
            catch (Exception ex)
            {
                //Log.TraceError("Error, exception " + ex.ToString());
                return(new VarList.VarData());
            }
        }