Exemplo n.º 1
0
        /// <summary>
        /// Returns false if user quit the application during initializtion
        /// </summary>
        public bool Initialize(List <GameObject> gameObjects, Camera mainCamera, string windowTitle, int windowPositionX, int windowPositionY, int windowWidth, int windowHeight)
        {
            _gameObjects = gameObjects;

            _window = new Window(windowTitle + " - Initializing...", windowPositionX, windowPositionY, windowWidth, windowHeight, SDL_WindowFlags.SDL_WINDOW_RESIZABLE);

            _vulkan = new VulkanRenderer(_window, gameObjects, mainCamera);

            var tokenSrc = new CancellationTokenSource();
            var initTask = _vulkan.InitializeAsync(tokenSrc.Token);

            while (initTask.IsCompleted == false)
            {
                var sdlEvent = SdlWrapper.PollEvent();
                if (sdlEvent.type == SDL_EventType.SDL_QUIT)
                {
                    _logger.LogInfo("Cancelling initialization...");
                    tokenSrc.Cancel();
                    initTask.Wait();
                    _logger.LogInfo("Initialization cancelled");
                    return(false);
                }
            }

            _window.Title = windowTitle;

            return(true);
        }
Exemplo n.º 2
0
        public async Task CreateMasterUser()
        {
            var user = await _userManager.FindByNameAsync("admin");

            if (user == null)
            {
                user = new ApplicationUser()
                {
                    Email    = "*****@*****.**",
                    UserName = "******"
                };

                IdentityResult result = await _userManager.CreateAsync(user, "Admin_01");

                if (!result.Succeeded)
                {
                    MyLogger.LogError("Could not create admin user.  Messages were: " + String.Join("; ", result.Errors.Select(x => x.Description)));
                    return;
                }
            }

            var claims = await _userManager.GetClaimsAsync(user);

            await AddClaim(user, claims, "ManageConfig");
            await AddClaim(user, claims, "ArmDisarm");

            MyLogger.LogInfo("Added the default roles to admin user with default password and roles");
        }
Exemplo n.º 3
0
        public static void SetKeyDown(SDL_Keycode keycode)
        {
            _logger.LogInfo("SetKeyDown " + keycode);

            switch (keycode)
            {
            case SDL_Keycode.SDLK_a:
                A = true;
                if (ADownLock == false)
                {
                    ADown     = true;
                    ADownLock = true;
                }
                break;

            case SDL_Keycode.SDLK_d: D = true; break;

            case SDL_Keycode.SDLK_w: W = true; break;

            case SDL_Keycode.SDLK_s: S = true; break;

            case SDL_Keycode.SDLK_LSHIFT: LeftShift = true; break;

            default: break;
            }
        }
Exemplo n.º 4
0
        public void TestFromTestMethod()
        {
            var info = "From TestMethods" + Environment.NewLine + GetCurrentDirInfo();

            MyLogger.Configuration.MapNewlinesToBr = true;
            MyLogger.LogInfo(info);
        }
Exemplo n.º 5
0
 void OnOwnerChanged(Guid netObjId)
 {
     if (_localNetObjs.ContainsKey(netObjId))
     {
         MyLogger.LogInfo("owner changed: netobj: " + netObjId);
         _localNetObjs[netObjId].IsLocalPlayer = false;
         _localNetObjs[netObjId].GetComponent <Rigidbody>().isKinematic = true;
         _otherNetObjs.Add(netObjId, _localNetObjs[netObjId]);
         _localNetObjs.Remove(netObjId);
     }
 }
Exemplo n.º 6
0
        public static void PrintQueueFamilies(this PhysicalDevice @this)
        {
            var queueFamilyProperties = @this.GetQueueFamilyProperties();

            _logger.LogInfo($"Queue families from device {@this.GetName()}:");

            for (int i = 0; i < queueFamilyProperties.Length; i++)
            {
                var family = queueFamilyProperties[i];
                _logger.LogInfo("\tFamily " + i + ":");
                _logger.LogInfo("\t\tCount: " + family.QueueCount);
                _logger.LogInfo("\t\tFlags: " + family.QueueFlags);
                _logger.LogInfo("\t\tTimestampValidBits: " + family.TimestampValidBits);
                _logger.LogInfo("\t\tMinImageTransferGranularity:");
                _logger.LogInfo($"\t\t\tWidth: {family.MinImageTransferGranularity.Width}");
                _logger.LogInfo($"\t\t\tHeight: {family.MinImageTransferGranularity.Height}");
                _logger.LogInfo($"\t\t\tDepth: {family.MinImageTransferGranularity.Depth}");
            }
        }
Exemplo n.º 7
0
        void SendMessageToClient(UdpMessage udpMessage, IPEndPoint destination)
        {
            var payloadJson  = JsonConvert.SerializeObject(udpMessage);
            var payloadBytes = Encoding.UTF8.GetBytes(payloadJson);

            try
            {
                _udpClient.SendAsync(payloadBytes, payloadBytes.Length, destination);
            }
            catch (Exception ex)
            {
                _logger.LogInfo(ex);
            }
        }
Exemplo n.º 8
0
        void ProcessConectedClientMessage(ReceivedClientMessage message)
        {
            message.Client.RefreshLastActivity();

            switch (message.Message.Message.Event)
            {
            case "position":  PositionUpdated?.Invoke(message); break;

            case "netobjcreate":
                var newNetObj = JsonConvert.DeserializeObject <NetObj>(message.Message.Message.Data.ToString());
                _logger.LogInfo("netobjcreate: " + message.Message.Message.Data.ToString());
                NetObjCreated?.Invoke(message.Client, newNetObj);
                break;

            case "request-ownership": OwnershipRequested?.Invoke(message.Client, new Guid(message.Message.Message.Data.ToString())); break;

            default: BadConnectedClientMessage?.Invoke(message); break;
            }
        }
Exemplo n.º 9
0
 void OnNatPunch(ReceivedMessage message)
 {
     _logger.LogInfo("natpunch requested from " + message.Result.RemoteEndPoint);
     _udpServer.MessageSender.SendNatPunch(message);
 }
Exemplo n.º 10
0
 public void TestLogInfo()
 {
     MyLogger.LogInfo("Demo");
     MyAssert.LessThan("Some Test Step", 5, 42);
 }
Exemplo n.º 11
0
 public ActionResult <IEnumerable <string> > Get()
 {
     MyLogger.LogInfo("Values Controller");
     return(new string[] { "value1", "value2" });
 }
Exemplo n.º 12
0
 void OnConnected()
 {
     MyLogger.LogInfo("Connected!");
     SpawnLocalStuff();
 }
Exemplo n.º 13
0
 void OnPlayerDisconnect(Guid disconnectedPlayerGuid)
 {
     MyLogger.LogInfo("Player disconnected: " + disconnectedPlayerGuid);
 }
Exemplo n.º 14
0
 public static async Task AndLogAsync(TimeSpan waitAmount, MyLogger logger)
 {
     logger.LogInfo($"Waiting {waitAmount.TotalSeconds} seconds...");
     await Task.Delay(waitAmount);
 }