Esempio n. 1
0
        public bool Add(string ident, ref GameObj obj)
        {
            if (ident == null || obj == null ||
                ident.Length == 0)
            {
                return(false);
            }

            try
            {
                obj.SetIdent(ident);
                obj.SetHash(Tools.GetHashValueCase(ident));
                if (mObjects.ContainsKey(ident))
                {
                    return(false);
                }

                mObjects.Add(ident, obj);
            }
            catch (Exception ex)
            {
                LogSystem.Log("Error,GameObjectSet.Add Exception:", ex.ToString());
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
        public bool Add(ObjectID ident, ref GameObj obj)
        {
            if (obj == null ||
                ident.IsNull())
            {
                return(false);
            }

            try
            {
                obj.SetIdent(ident);
                obj.SetHash(Tools.GetHashValueCase(ident));
                if (mObjects.ContainsKey(ident))
                {
                    return(false);
                }

                mObjects.Add(ident, obj);
            }
            catch (Exception ex)
            {
                //Log.Trace("Error,GameObjectSet.Add Exception:" + ex.ToString());
                return(false);
            }
            return(true);
        }
Esempio n. 3
0
        public bool Change(string old_ident, string new_ident)
        {
            if (old_ident == null || new_ident == null ||
                old_ident.Length == 0 || new_ident.Length == 0)
            {
                return(false);
            }

            try
            {
                if (!mObjects.ContainsKey(old_ident))
                {
                    return(false);
                }

                if (!mObjects.ContainsKey(new_ident))
                {
                    return(false);
                }

                GameObj oldObj = mObjects[old_ident];
                GameObj newObj = mObjects[new_ident];
                if (oldObj == null || newObj == null)
                {
                    return(false);
                }

                newObj.SetIdent(old_ident);
                newObj.SetHash(Tools.GetHashValueCase(old_ident));

                oldObj.SetIdent(new_ident);
                oldObj.SetHash(Tools.GetHashValueCase(new_ident));
            }
            catch (Exception ex)
            {
                LogSystem.LogError("Error, exception ", ex.ToString());
                return(false);
            }
            return(true);
        }
Esempio n. 4
0
        public bool Change(ObjectID old_ident, ObjectID new_ident)
        {
            if (old_ident.IsNull() || new_ident.IsNull())
            {
                return(false);
            }

            try
            {
                if (!mObjects.ContainsKey(old_ident))
                {
                    return(false);
                }

                if (!mObjects.ContainsKey(new_ident))
                {
                    return(false);
                }

                GameObj oldObj = mObjects[old_ident];
                GameObj newObj = mObjects[new_ident];
                if (oldObj == null || newObj == null)
                {
                    return(false);
                }

                newObj.SetIdent(old_ident);
                newObj.SetHash(Tools.GetHashValueCase(old_ident));

                oldObj.SetIdent(new_ident);
                oldObj.SetHash(Tools.GetHashValueCase(new_ident));
            }
            catch (Exception ex)
            {
                //Log.TraceError("Error, exception " + ex.ToString());
                return(false);
            }
            return(true);
        }