public virtual void initKBEngine()
    {
        // 如果此处发生错误,请查看 Assets\Scripts\kbe_scripts\if_Entity_error_use______git_submodule_update_____kbengine_plugins_______open_this_file_and_I_will_tell_you.cs

        KBEngineArgs args = new KBEngineArgs();

        args.ip = ip;
        args.port = port;
        args.clientType = clientType;

        if(persistentDataPath == "Application.persistentDataPath")
            args.persistentDataPath = Application.persistentDataPath;
        else
            args.persistentDataPath = persistentDataPath;

        args.syncPlayer = syncPlayer;
        args.threadUpdateHZ = threadUpdateHZ;

        args.SEND_BUFFER_MAX = (UInt32)SEND_BUFFER_MAX;
        args.RECV_BUFFER_MAX = (UInt32)RECV_BUFFER_MAX;

        args.isMultiThreads = isMultiThreads;

        if(isMultiThreads)
            gameapp = new KBEngineAppThread(args);
        else
            gameapp = new KBEngineApp(args);
    }
예제 #2
0
        public override bool initialize(KBEngineArgs args)
        {
            base.initialize(args);

            KBEngineAppThread.threadUpdateHZ = args.threadUpdateHZ;
            threadUpdatePeriod = 1000f / threadUpdateHZ;

            kbethread = new KBEThread(this);
            _t = new Thread(new ThreadStart(kbethread.run));
            _t.Start();

            return true;
        }
예제 #3
0
 public KBEngineAppThread(KBEngineArgs args)
     : base(args)
 {
 }
예제 #4
0
        public virtual bool initialize(KBEngineArgs args)
        {
            _args = args;

            initNetwork();

            // 注册事件
            installEvents();

            // 允许持久化KBE(例如:协议,entitydef等)
            if(args.persistentDataPath != "")
             	   _persistentInofs = new PersistentInofs(args.persistentDataPath);

             	return true;
        }
예제 #5
0
        public KBEngineApp(KBEngineArgs args)
        {
            if (app != null)
                throw new Exception("Only one instance of KBEngineApp!");

            app = this;

            initialize(args);
        }