Ejemplo n.º 1
0
        public Item GetItem(string idOrRid, string belong = null, bool isNotIncludeChildScene = false)
        {
            var items = this.GetItems(null, belong, isNotIncludeChildScene);

            for (var i = 0; i < items.Length; i++)
            {
                var item = items[i];
                if (IdUtil.IsIdOrRidEquals(idOrRid, item.GetId(), item.GetRid()))
                {
                    return(item);
                }
            }

            return(null);
        }
Ejemplo n.º 2
0
        public static T GetSubDoer <T>(Doer parentDoer, string subDoerKey, string idOrRid) where T : Doer
        {
            var ts = GetSubDoers <T>(parentDoer, subDoerKey, null, null);

            for (var i = 0; i < ts.Length; i++)
            {
                var subDoer = ts[i];
                if (IdUtil.IsIdOrRidEquals(idOrRid, subDoer.GetId(), subDoer.GetRid()))
                {
                    return(subDoer);
                }
            }

            return(null);
        }
Ejemplo n.º 3
0
        public DBase(string idOrRid, Hashtable db = null, Hashtable dbTmp = null)
        {
            if (IdUtil.IsRid(idOrRid))
            {
                string rid = idOrRid;
                this.rid = rid;
                this.id  = IdUtil.RidToId(rid);
            }
            else
            {
                this.id  = idOrRid;
                this.rid = IdUtil.NewRid(this.id);
            }

            this.db    = db ?? new Hashtable();
            this.dbTmp = dbTmp ?? new Hashtable();
        }
Ejemplo n.º 4
0
        // 创建逻辑对象
        public Doer NewDoer(string idOrRid)
        {
            string id    = IdUtil.RidToId(idOrRid);
            var    doer  = this._NewDoer(id);
            var    dbase = this._NewDBase(idOrRid);

            doer.SetDBase(dbase);
            dbase.SetDoer(doer);
            doer.factory = this;
            string rid       = dbase.GetRid();
            var    dbaseDict = this.idDict.GetOrAddDefault(id, () => new Dictionary <string, DBase>());

            dbaseDict[rid] = dbase;
            doer.Init();
            doer.PostInit();
            doer.SetIsEnabled(true, false);
            return(doer);
        }
Ejemplo n.º 5
0
        public static T RemoveSubDoer <T>(Doer parentDoer, string subDoerKey, string rid) where T : Doer
        {
            var id       = IdUtil.RidToId(rid);
            var subDoers = GetSubDoers_ToEdit(parentDoer, subDoerKey, id);

            for (int i = subDoers.Count - 1; i >= 0; i--)
            {
                var curSubDoer = subDoers[i] as T;
                if (curSubDoer.GetRid().Equals(rid))
                {
                    curSubDoer.SetEnv(null);
                    subDoers.RemoveAt(i);
                    return(curSubDoer);
                }
            }

            return(null);
        }
Ejemplo n.º 6
0
 public Scene GetChildScene(string idOrRid, string belong = null)
 {
     if (IdUtil.IsRid(idOrRid))             // rid的情况
     {
         string rid = idOrRid;
         if (!this.oChildScenes.GetSceneDict_ToEdit().ContainsKey(rid))
         {
             return(null);
         }
         Scene childScene = this.oChildScenes.GetSceneDict_ToEdit()[rid] as Scene;
         if (belong != null && !childScene.GetBelong().Equals(belong))
         {
             return(null);
         }
         return(childScene);
     }
     else             // id的情况
     {
         string  id          = idOrRid;
         Scene[] childScenes = GetChildScenes(id, belong);
         return(childScenes.Length == 0 ? null : childScenes[0]);
     }
 }
Ejemplo n.º 7
0
 public string GetRidSeq()
 {
     return(IdUtil.RidToSeq(this.rid));
 }