コード例 #1
0
ファイル: UIToLua.cs プロジェクト: Hengle/Unity3D-1
        public void Run(IServiceRunner runner)
        {
            new ServicesTask(new string[] {
                "com.giant.service.uisystem",
                "com.giant.service.luaruntime",
            }).Start().Continue(task =>
            {
                var services   = task.Result as IService[];
                var luaRuntime = services[1] as ILuaRuntime;

                UISystemToLua.RegLuaBridgeFunction(luaRuntime);
                ElementToLua.RegLuaBridgeFunction(luaRuntime);
                ButtonToLua.RegLuaBridgeFunction(luaRuntime);
                DropdownToLua.RegLuaBridgeFunction(luaRuntime);
                ImageToLua.RegLuaBridgeFunction(luaRuntime);
                ImageAnimationToLua.RegLuaBridgeFunction(luaRuntime);
                InputFieldToLua.RegLuaBridgeFunction(luaRuntime);
                LabelToLua.RegLuaBridgeFunction(luaRuntime);
                ScrollViewToLua.RegLuaBridgeFunction(luaRuntime);
                SliderToLua.RegLuaBridgeFunction(luaRuntime);
                ToggleToLua.RegLuaBridgeFunction(luaRuntime);
                TogglesToLua.RegLuaBridgeFunction(luaRuntime);
                WindowToLua.RegLuaBridgeFunction(luaRuntime);

                runner.Ready(_Terminate);

                return(null);
            });
        }
コード例 #2
0
ファイル: AssetManager.cs プロジェクト: Hengle/Unity3D-1
 public void Run(IServiceRunner runner)
 {
     UpdateAsync(() =>
     {
         runner.Ready(_Terminate);
     });
 }
コード例 #3
0
ファイル: ByteStorage.cs プロジェクト: Hengle/Unity3D-1
        public void Run(IServiceRunner runner)
        {
            ByteArray.BigEndian = runner.GetArgs <bool>("BigEndian");

            this.blocks.Add(new ByteBlock(this, MIN_BUFFER_SIZE));
            runner.Ready(_Terminate);
        }
コード例 #4
0
ファイル: XRouterManager.cs プロジェクト: bzamecnik/XRouter
 public XRouterManager(string daemonNtConfigFile, string xRouterServiceName, string xRouterManagerServiceName)
 {
     xRouterRunner = new ProcessRunner(daemonNtConfigFile, xRouterServiceName);
     xRouterManagerRunner = new ProcessRunner(daemonNtConfigFile, xRouterManagerServiceName);
     xRouterManagerRunner.Start();
     ConsoleServerProxy = GetConsoleServerProxy();
 }
コード例 #5
0
 public void Run(IServiceRunner runner)
 {
     new ServiceTask("com.giant.service.bytestorage").Start().Continue(task =>
     {
         this.storage = task.Result as IByteStorage;
         runner.Ready(_Terminate);
         Logger <INetworkManager> .L("NetworkManager service is ready.");
         return(null);
     });
 }
コード例 #6
0
        public DeploymentService(IServiceRunner serviceRunner, Config config)
        {
            if (serviceRunner == null) { throw new ArgumentNullException("serviceRunner"); }
            if (config == null) { throw new ArgumentNullException("config"); }

            this.ServiceRunner = serviceRunner;
            this.Config = config;

            InitializeComponent();
        }
コード例 #7
0
        public void Run(IServiceRunner runner)
        {
            new ServicesTask(new string[] {
                "com.giant.service.nativechannel",
                "com.giant.service.uisystem"
            }).Start().Continue(task =>
            {
                var services      = task.Result as IService[];
                var nativeChannel = services[0] as INativeChannel;
                this.proxy        = nativeChannel.Connect(new NativeModule
                {
                    IOS     = "IOSGiantVoiceWrapper",
                    Android = "com.giant.giantvoice.GiantVoiceWrapper",
                }, this);


                var system = services[1] as IUISystem;
                system.RegisterFactory(this);

                var gameId       = runner.GetArgs <int>("GameId");  //游戏应用id
                var userId       = runner.GetArgs <long>("UserId"); //用户id
                var maxTime      = runner.GetArgs <float>("MaxTime");
                var minTime      = runner.GetArgs <float>("MinTime");
                var gameName     = runner.GetArgs <string>("GameName"); //游戏名
                var zoneId       = runner.GetArgs <string>("ZoneId");   //服务器区id
                var androidAppId = runner.GetArgs <string>("AndroidAppId");
                var iosAppId     = runner.GetArgs <string>("IosAppId");
                var httpServer   = runner.GetArgs <string>("HttpServer");

                this.proxy.Call("SetHttpServer", httpServer);
                this.proxy.Call("Initialize", gameId, 100, userId, gameName, zoneId);
                this.proxy.Call("SetRecordMaxTime", maxTime);
                this.proxy.Call("SetRecordMinTime", minTime);

                if (Application.platform == RuntimePlatform.Android)
                {
                    this.proxy.Call("EnableVoiceToWord", androidAppId);
                }
                else
                {
                    this.proxy.Call("EnableVoiceToWord", iosAppId);
                }
                this.proxy.Call("SetVoiceLanguage", "zh_cn");
                this.proxy.Call("DeleteAllGCloudFile");

                this.recorderListener      = new VoiceRecordListsener(this);
                this.playerListener        = new VoicePlayerListener(this);
                this.converterListener     = new VoiceToWordListener(this);
                this.voiceUploadListener   = new VoiceUploadListener(this);
                this.voiceDownloadListener = new VoiceDownloadListener(this);

                runner.Ready(_Terminate);
                return(null);
            });
        }
コード例 #8
0
        public void Run(IServiceRunner runner)
        {
            new ServiceTask("com.giant.service.luaruntime").Start().Continue(task =>
            {
                var luaRuntime = task.Result as ILuaRuntime;
                luaRuntime.InstallLibrary(NativeMethods.LuaOpenStruct);
                runner.Ready(_Terminate);

                return(null);
            });
        }
コード例 #9
0
        public void Load(ServicePackage package)
        {
            Unload();
            _servicePackage = package;
            var domain = _domain = DomainManager.CreateDomain(package);
            var agent  = DomainAgent.CreateInstance(domain);

            _inner = agent.CreateRunner();
            _inner.Load(package);
            _unloaded = false;
        }
コード例 #10
0
ファイル: LevelSystem.cs プロジェクト: Hengle/Unity3D-1
        public void Run(IServiceRunner runner)
        {
            this.validateData = runner.GetArgs <bool>("ValidateData");

            new ServiceTask <IAssetManager>().Start().Continue(task =>
            {
                ScenePrefab.CreateRecyclePool();

                runner.Ready(_Terminate);
                return(null);
            });
        }
コード例 #11
0
        public void Run()
        {
            foreach (var runner in GetRunners())
            {
                _runner = runner;

                if (runner.TryRun())
                {
                    return;
                }
            }
        }
コード例 #12
0
        protected virtual IServiceRunner CreateRunner()
        {
            if (!Configuration.KeepAlive)
            {
                return(Configuration.CreateRunner(this));
            }

            if (_runner == null)
            {
                _runner = Configuration.CreateRunner(this);
            }

            return(_runner);
        }
コード例 #13
0
        protected virtual void FreeRunner()
        {
            if (Configuration.KeepAlive)
            {
                return;
            }

            // dispose runner if possible
            var disposable = _runner as IDisposable;

            disposable?.Dispose();

            _runner = null;
        }
コード例 #14
0
ファイル: LuaRuntime.cs プロジェクト: Hengle/Unity3D-1
        public void Run(IServiceRunner runner)
        {
            this.luaState = LuaLib.LuaLNewState();
            LuaLib.LuaLOpenLibs(this.luaState);

            // We need to keep this in a managed reference so the delegate doesn't get garbage collected
            this.panicCallback = new LuaNativeFunction(_PanicCallback);
            LuaLib.LuaAtPanic(this.luaState, this.panicCallback);

            // Inject print module with our own function
            // - mouguangyi
            this.printCallback = new LuaNativeFunction(_PrintCallback);
            LuaLib.LuaPushStdCallCFunction(luaState, this.printCallback);
            LuaLib.LuaSetGlobal(this.luaState, "print");

            // Inject dofile module with our own function
            // - mouguangyi
            this.dofileCallback = new LuaNativeFunction(_DoFileCallback);
            LuaLib.LuaPushStdCallCFunction(luaState, this.dofileCallback);
            LuaLib.LuaSetGlobal(this.luaState, "dofile");

            // Inject searcher module with our own function
            // - mouguangyi
            this.searcherCallback = new LuaNativeFunction(_SearcherCallback);
            LuaLib.LuaGetGlobal(this.luaState, "package");
            LuaLib.LuaGetField(this.luaState, -1, "loaders");
            LuaLib.LuaPushStdCallCFunction(this.luaState, this.searcherCallback);
            for (var i = (LuaLib.LuaObjLen(this.luaState, -2) + 1); i >= 2; --i)
            {
                LuaLib.LuaRawGetI(this.luaState, -2, i - 1);
                LuaLib.LuaRawSetI(this.luaState, -3, i);
            }
            LuaLib.LuaRawSetI(this.luaState, -2, 2);
            LuaLib.LuaPop(this.luaState, 2);

            // Create luaruntime metatable
            // - mouguangyi
            this.collectCallback = new LuaNativeFunction(LuaExecuter._CollectObject);
            LuaLib.LuaLNewMetatable(this.luaState, "luaruntime");
            LuaLib.LuaPushString(this.luaState, "__gc");
            LuaLib.LuaPushStdCallCFunction(this.luaState, this.collectCallback);
            LuaLib.LuaSetTable(this.luaState, -3);

            new ServiceTask("com.giant.service.assetmanager").Start().Continue(task =>
            {
                runner.Ready(_Terminate);
                return(null);
            });
        }
コード例 #15
0
ファイル: WebView.cs プロジェクト: Hengle/Unity3D-1
 public void Run(IServiceRunner runner)
 {
     new ServiceTask <INativeChannel>().Start().Continue(task =>
     {
         var nativeChannel = task.Result as INativeChannel;
         this.webView      = nativeChannel.Connect(new NativeModule
         {
             IOS     = "CWebViewPlugin",
             Android = "com.giant.libwebview.CWebViewPlugin",
         }, this);
         this.runner = runner;
         this.runner.Ready(_Terminate);
         return(null);
     });
 }
コード例 #16
0
		public DefaultService()
		{
			try
			{
				CoreDependencyRegistrar.Register();
				Logger.Info(this, "Tarantino.Daemon Service starting");
				ServiceName = SERVICE_NAME;
				_serviceRunner = ObjectFactory.GetInstance<IServiceRunner>();
				Logger.Info(this, "Service Runner loaded");
			}
			catch (Exception exc)
			{
				Logger.Fatal(this, "Service failed to start", exc);
				throw;
			}
		}
コード例 #17
0
 public DefaultService()
 {
     try
     {
         CoreDependencyRegistrar.Register();
         Logger.Info(this, "Tarantino.Daemon Service starting");
         ServiceName    = SERVICE_NAME;
         _serviceRunner = ObjectFactory.GetInstance <IServiceRunner>();
         Logger.Info(this, "Service Runner loaded");
     }
     catch (Exception exc)
     {
         Logger.Fatal(this, "Service failed to start", exc);
         throw;
     }
 }
コード例 #18
0
        public void Run(IServiceRunner runner)
        {
            new ServicesTask(new string[] {
                "com.giant.service.gameanalytics",
                "com.giant.service.luaruntime",
            }).Start().Continue(task =>
            {
                var services   = task.Result as IService[];
                gameAnalytics  = services[0] as IGameAnalytics;
                var luaRuntime = services[1] as ILuaRuntime;

                GameAnalyticsToLua.RegLuaBridgeFunction(luaRuntime);

                runner.Ready(_Terminate);
                return(null);
            });
        }
コード例 #19
0
ファイル: GiantFreeServer.cs プロジェクト: Hengle/Unity3D-1
        public void Run(IServiceRunner runner)
        {
            new ServicesTask(new string[] {
                "com.giant.service.bytestorage",    // ByteStorage service
                "com.giant.service.networkmanager", // NetworkManager service
            })
            .Start()
            .Continue(task =>
            {
                var services     = task.Result as IService[];
                this.storage     = services[0] as IByteStorage;
                this.network     = services[1] as INetworkManager;
                this.loginModule = new LoginModule(this);
                runner.Ready(_Terminate);

                return(null);
            });
        }
コード例 #20
0
ファイル: GiantLightGame.cs プロジェクト: Hengle/Unity3D-1
        public void Run(IServiceRunner runner)
        {
            this.serverIP   = runner.GetArgs <string>("GiantServerIP");
            this.serverPort = runner.GetArgs <int>("GiantServerPort");

            new ServiceTask("com.giant.service.giantlightserver").Start()
            .Continue(task =>
            {
                this.server = task.Result as IGiantLightServer;
                runner.Ready(_Terminate);
                return(null);
            })
            .Continue(task =>
            {
                // this.server.Connect(this.serverIP, this.serverPort, this);
                Logger <IGiantGame> .L("Start to connect giant server...");
                return(null);
            });
        }
コード例 #21
0
ファイル: GameAnalytics.cs プロジェクト: Hengle/Unity3D-1
        public void Run(IServiceRunner runner)
        {
            new ServiceTask <INativeChannel>().Start().Continue(task =>
            {
                var nativeChannel = task.Result as INativeChannel;
                this.proxy        = nativeChannel.Connect(new NativeModule
                {
                    IOS     = "IOSGameAnalyticsWrapper",
                    Android = "com.giant.gameanalytics.AndroidGameAnalyticsWrapper",
                }, this);

                var appId      = runner.GetArgs <string>("AppId");      //сно╥id
                var appChannel = runner.GetArgs <string>("AppChannel"); //сно╥гЧ╣ю╨е
                this.proxy.Call("init", appId, appChannel);

                runner.Ready(_Terminate);
                return(null);
            });
        }
コード例 #22
0
ファイル: Getui.cs プロジェクト: Hengle/Unity3D-1
        public void Run(IServiceRunner runner)
        {
            new ServiceTask <INativeChannel>().Start().Continue(task =>
            {
                var appId         = runner.GetArgs <string>("AppId");
                var appKey        = runner.GetArgs <string>("AppKey");
                var appSecret     = runner.GetArgs <string>("AppSecret");
                var nativeChannel = task.Result as INativeChannel;
                nativeChannel.Call(new NativeModule {
                    IOS     = "GetuiWrapper",
                    Android = "com.giant.getui.GetuiWrapper",
                }, "init", appId, appKey, appSecret);

                Logger <IGetui> .L("Getui initialize complete.");

                runner.Ready(_Terminate);
                return(null);
            });
        }
コード例 #23
0
ファイル: GiantVoiceToLua.cs プロジェクト: Hengle/Unity3D-1
        public void Run(IServiceRunner runner)
        {
            new ServicesTask(new string[] {
                "com.giant.service.giantvoice",
                "com.giant.service.luaruntime",
            }).Start().Continue(task =>
            {
                var services   = task.Result as IService[];
                giantVoice     = services[0] as IGiantVoice;
                var luaRuntime = services[1] as ILuaRuntime;

                GiantVoiceToLua.RegLuaBridgeFunction(luaRuntime);
                GiantVoicePlayerToLua.RegLuaBridgeFunction(luaRuntime);
                GiantVoiceRecorderToLua.RegLuaBridgeFunction(luaRuntime);

                runner.Ready(_Terminate);
                return(null);
            });
        }
コード例 #24
0
        public void Run(IServiceRunner runner)
        {
            this.appServer   = runner.GetArgs <string>("AppServer");
            this.assetServer = runner.GetArgs <string>("AssetServer");
            this.valid       = (runner.GetArgs <bool>("Valid") && !string.IsNullOrEmpty(this.assetServer));

            new ServicesTask(new string[] {
                "com.giant.service.assetmanager",
                "com.giant.service.assetlistupdater",
            }).Start().Continue(task =>
            {
                var services = task.Result as IService[];
                this.manager = services[0] as IAssetManager;
                this.updater = services[1] as IAssetListUpdater;

                runner.Ready(_Terminate);

                return(null);
            });
        }
コード例 #25
0
ファイル: ClientCollector.cs プロジェクト: Hengle/Unity3D-1
        public void Run(IServiceRunner runner)
        {
            this.infoPack = new ClientInfoPack();
            new ServiceTask("com.giant.service.geoquery")
            .Start()
            .Continue(task =>
            {
                var geoService = task.Result as IGeoQuery;
                return(geoService.SimpleQuery());
            })
            .Continue(task =>
            {
                var result = task.Result as IGeoResult;
                if (0 == result.Status)
                {
                    this.infoPack.Nation = result.CountryCode;
                }
                return(null);
            });

            runner.Ready(_Terminate);
        }
コード例 #26
0
ファイル: UISystem.cs プロジェクト: Hengle/Unity3D-1
        public void Run(IServiceRunner runner)
        {
            new ServicesTask(new string[] {
                "com.giant.service.assetmanager",
                "com.giant.service.objectpool"
            }).Start().Continue(task =>
            {
                var services      = task.Result as IService[];
                this.assetManager = services[0] as IAssetManager;
                this.pool         = (services[1] as IRecycleManager).Create("GameBox.Service.UI.Window", this);

                var rootObj = new GameObject("_UIManager");

                //var cameraObj = new GameObject("_UICamera", new[] { typeof(Camera) });
                //var camera = cameraObj.GetComponent<Camera>();
                //camera.orthographic = true;
                //camera.farClipPlane = 50f;
                //camera.cullingMask = 1 << 8;

                var canvas        = rootObj.AddComponent <Canvas>();
                canvas.renderMode = RenderMode.ScreenSpaceOverlay;
                //canvas.worldCamera = camera;

                var scaler                 = rootObj.AddComponent <CanvasScaler>();
                scaler.uiScaleMode         = CanvasScaler.ScaleMode.ScaleWithScreenSize;
                scaler.referenceResolution = new Vector2(640f, 1136f);
                scaler.matchWidthOrHeight  = 1f;
                rootObj.AddComponent <GraphicRaycaster>();

                this.root = rootObj.transform;

                //var transform = cameraObj.transform;
                //transform.SetParent(this.root);
                //transform.localPosition = new Vector3(0f, 0f, -100f);

                runner.Ready(_Terminate);
                return(null);
            });
        }
コード例 #27
0
        public void Run(IServiceRunner runner)
        {
            new ServiceTask <INativeChannel>().Start().Continue(task =>
            {
                var nativeChannel = task.Result as INativeChannel;
                this.proxy        = nativeChannel.Connect(new NativeModule {
                    IOS     = "BuglyWrapper",
                    Android = "com.giant.bugly.BuglyWrapper",
                }, this);

                string appId = "";
                switch (Application.platform)
                {
                case RuntimePlatform.IPhonePlayer:
                    appId = runner.GetArgs <string>("AppIdForIOS");
                    break;

                case RuntimePlatform.Android:
                    appId = runner.GetArgs <string>("AppIdForAndroid");
                    break;
                }

                if (!string.IsNullOrEmpty(appId))
                {
                    _ConfigDebugMode(runner.GetArgs <bool>("IsDebug"));
                    this.proxy.Call("setGameType", GAME_TYPE_UNITY);
                    this.proxy.Call("init", appId);
                    _RegisterExceptionHandler();

                    Logger <IBugly> .L("Bugly initialized with app id: " + appId);
                }

                runner.Ready(_Terminate);

                return(null);
            });
        }
コード例 #28
0
        public ServiceInstance
        (
            ILogFactory logFactory,
            IConfiguration configuration,
            IServiceRunner serviceRunner
        )
        {
            try
            {
                _log           = logFactory.GetLogger(this);
                _serviceRunner = serviceRunner;

                //this.ServiceName = configuration[ServiceNameKey];

                InstanceStopped = new ManualResetEvent(false);

                InitializeComponent();
            }
            catch (Exception e)
            {
                _log.Log(LogCatagory.Error, e, "Service Instance caught an unexpected exception on initialise.");
                throw;
            }
        }
コード例 #29
0
ファイル: LuaProtocolBuffer.cs プロジェクト: Hengle/Unity3D-1
        public void Run(IServiceRunner runner)
        {
            new ServiceTask("com.giant.service.luaruntime").Start().Continue(task =>
            {
                var luaRuntime = task.Result as ILuaRuntime;
                luaRuntime.InstallLibrary(NativeMethods.LuaOpenProtocolBuffer);

                // DoString()(或LoadString() tolua库里所有的与ProtoBuffer有关的lua接口)
                // - gexiaoyi
                LuaWireformatModule.Install(luaRuntime);
                LuaTypecheckersModule.Install(luaRuntime);
                LuaEncoderModule.Install(luaRuntime);
                LuaDecoderModule.Install(luaRuntime);
                LuaListenerModule.Install(luaRuntime);
                LuaContainersModule.Install(luaRuntime);
                LuaDescriptorModule.Install(luaRuntime);
                LuaTextformatModule.Install(luaRuntime);
                LuaProtobufModule.Install(luaRuntime);

                runner.Ready(_Terminate);

                return(null);
            });
        }
コード例 #30
0
 public void Run(IServiceRunner runner)
 {
     _Initialize(this.queryEngineType);
     runner.Ready(_Terminate);
 }
コード例 #31
0
 public virtual void Run(IServiceRunner runner)
 {
     // runner.Ready();
 }
コード例 #32
0
 public RunnerWrap(string serviceName, IServiceRunner runner)
 {
     this.ServiceName = serviceName;
     this.Runner      = runner;
 }
コード例 #33
0
 public void Run(IServiceRunner runner)
 {
     runner.Ready(_Terminate);
 }
コード例 #34
0
ファイル: RunnerWrap.cs プロジェクト: mer2/devfx
 public RunnerWrap(string serviceName, IServiceRunner runner)
 {
     this.ServiceName = serviceName;
     this.Runner = runner;
 }