コード例 #1
0
 void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
コード例 #2
0
    void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
            return;
        }
        else
        {
            instance = this;
        }

        DontDestroyOnLoad(this.gameObject);
    }
コード例 #3
0
    void Start()
    {
        signalRController = GameObject.Find("SignalRController").GetComponent <SignalRController>();
        serverListener    = GameObject.Find("ServerListener").GetComponent <ServerListener>();
        audioManager      = GameObject.Find("Controller_Audio").GetComponent <AudioManager>();

        btnPlay     = GameObject.Find("Canvas/pnl_MainMenu/btn_Play").GetComponent <UnityEngine.UI.Button>();
        btnLogin    = GameObject.Find("Canvas/pnl_MainMenu/btn_Login").GetComponent <UnityEngine.UI.Button>();
        btnLogout   = GameObject.Find("Canvas/pnl_MainMenu/btn_Logout").GetComponent <UnityEngine.UI.Button>();
        btnRegister = GameObject.Find("Canvas/pnl_MainMenu/btn_Register").GetComponent <UnityEngine.UI.Button>();

        //btnPlay.gameObject.SetActive(false);
        //btnLogout.gameObject.SetActive(false);

        PlaySound("Menu BGM"); // Play the main menu BGM.

        RegistrationFeedback.text = "Registering...";
    }
コード例 #4
0
    void Update()
    {
        data.horizontal = Input.GetAxis("Horizontal");
        data.vertical   = Input.GetAxis("Vertical");
        data.state      = PlayerState.None;

        if (Input.GetKey(KeyCode.LeftShift))
        {
            data.state = PlayerState.Shield;
        }
        else if (Input.GetMouseButton(0))
        {
            data.state = PlayerState.Shoot;
        }

        if (SignalRController.isConnected)
        {
            SignalRController.SendPlayerData(data);
        }

        // processing input
        if (data.state == PlayerState.Shield)
        {
            Shield.SetActive(true);
        }
        else
        {
            Shield.SetActive(false);
        }

        if (data.state == PlayerState.Shoot)
        {
            var bulletBody = Instantiate(Bullet,
                                         BulletSpawn.position,
                                         Quaternion.identity);
            bulletBody.GetComponent <Rigidbody>().velocity = transform.forward * 10;
        }
        body.AddForce(data.horizontal * MoveSpeed, 0, data.vertical * MoveSpeed);
    }
コード例 #5
0
        public async Task BeginExecutionAsync()
        {
            TestContext.Progress.WriteLine("****** Begin test run ******");
            await RestController.StartClientAsync().ConfigureAwait(false);

            ActionManager.CurrentUser   = TestConfig.AdminUser;
            ActionManager.CurrentTenant = TenantTitle.manylang;

            if (TestConfig.IsReportingEnabled)
            {
                await ReportManager.InitReportAsync(TestContext.Parameters.Get("build")).ConfigureAwait(false);
            }

            if (TestConfig.IsDeleteExpiredReports)
            {
                await ReportManager.DeleteExpiredReportsAsync().ConfigureAwait(false);
            }

            await KillWebDriverProcessesAsync().ConfigureAwait(false);

            await SignalRController.StartClientAsync().ConfigureAwait(false);
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: mkbiltek2019/LanBackup
        public static void Main()
        {
            //conf logger
            logger    = LogManager.GetCurrentClassLogger();
            messenger = new TinyMessengerHub();

            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += CurrentDomain_UnhandledException;


            //setup DI container
            // Register individual components
            DI.Container.Register <ILogger>(() => logger, Lifestyle.Singleton);
            DI.Container.Register <ITinyMessengerHub>(() => messenger, Lifestyle.Singleton);
            network = new Network(logger);
            DI.Container.Register <Network>(() => network, Lifestyle.Singleton);
            DI.Container.Register <BackgroundRefreshController>(Lifestyle.Transient);
            string        webApiUrl = ConfigurationManager.AppSettings["webApiUrl"];
            WebApiService api       = new WebApiService(webApiUrl, logger, messenger);

            DI.Container.Register <WebApiService>(() => api, Lifestyle.Singleton);
            SignalRController signarl = new SignalRController(webApiUrl, logger, messenger, network);

            DI.Container.Register <SignalRController>(() => signarl, Lifestyle.Singleton);
            DI.Container.Register <LanCopyController>(Lifestyle.Transient);
            logger.Trace("DI initialized");



            logger.Trace("Starting service");
            HostFactory.Run(x =>
            {
                //use NLog logger
                x.UseNLog();

                x.Service <LanBackupAgentService>(s =>
                {
                    s.ConstructUsing(name => new LanBackupAgentService(logger, messenger));
                    s.WhenStarted(async tc => await tc.Start());
                    s.WhenStopped(tc => tc.Stop());
                });
                x.RunAsNetworkService();
                x.StartAutomatically(); // Start the service automatically

                x.SetDescription("LanBackup Agent Service");
                x.SetDisplayName("LanBackup Agent");
                //recommended that service names not contains spaces or other whitespace characters.
                x.SetServiceName("LanBackupAgent");


                x.EnableServiceRecovery(r =>
                {
                    //you can have up to three of these
                    //r.RestartComputer(5, "message");
                    r.RestartService(1);//minutes for restart
                    //the last one will act for all subsequent failures
                    //r.RunProgram(7, "ping google.com");

                    //should this be true for crashed or non-zero exits
                    r.OnCrashOnly();

                    //number of days until the error count resets
                    r.SetResetPeriod(1);
                });


                //x.BeforeInstall(() => { ... });
                //x.AfterInstall(() => { ... });
                //x.BeforeUninstall(() => { ... });
                //x.AfterUninstall(() => { ... });

                x.OnException(ex =>
                {
                    // Do something with the exception
                    logger.Error(ex, "LanBackup Agent service Error: ");
                });
            });
            logger.Trace("Program DONE!");
        }
コード例 #7
0
 void Start()
 {
     signalRController = GameObject.Find("SignalRController").GetComponent <SignalRController>();
     uiController      = GameObject.Find("Controller_Menu").GetComponent <UiController>();
 }