Beispiel #1
0
        //---------------------------------------------------------------------
        static void Main(string[] args)
        {
            Console.Title           = "EcTest";
            Console.ForegroundColor = ConsoleColor.Green;
            EbLog.NoteCallback      = Console.WriteLine;
            EbLog.WarningCallback   = Console.WriteLine;
            EbLog.ErrorCallback     = Console.WriteLine;

            mEntityMgr = new EntityMgr();
            mEntityMgr.regComponentFactory(new ComponentFactory <EcApp <DefApp> >(mEntityMgr));
            mEntityMgr.create((byte)_eNodeType.Ec, _eNodeType.Ec.ToString(), 0, null);

            Entity et = mEntityMgr.createEmptyEntity("EtApp", null);

            et.addComponent <EcApp <DefApp> >();

            EbLog.Note("按任意键退出。。。");

            while (true)
            {
                mEntityMgr.update(0.0f);

                Thread.Sleep(100);

                if (Console.KeyAvailable)
                {
                    break;
                }
            }

            mEntityMgr.Dispose();
        }
Beispiel #2
0
        //---------------------------------------------------------------------
        public override void init()
        {
            EbLog.Note("TestEntity.init()");

            if (mEntityMgr == null)
            {
                mEntityMgr = new EntityMgr();
                mEntityMgr.create(1, "", 1, null);

                mEntityMgr.regComponentFactory(new ComponentFactory <CellPlayer <DefPlayer> >(mEntityMgr));
            }

            Entity et = mEntityMgr.createEmptyEntity("EtPlayer", null);

            et.addComponent <CellPlayer <DefPlayer> >();
            mEntityMgr.asyncSaveEntity(new EntitySaverJson(mEntityMgr, "EtPlayer.json", et, true));

            //mEntityMgr.asyncLoadEntity(new EntityLoaderJson(mEntityMgr, "EtPlayer.json"));
        }