示例#1
0
        private static async void RunTask(int count)
        {
            IList <Task> tasks = new List <Task>();

            for (int i = 0; i < count; i++)
            {
                var task = Task.Run(() =>
                {
                    for (int index = 0; index < 100; index++)
                    {
                        LogProxy.Error(string.Format("{0}_{1}", "Exception : ", index), "Snake.DemoConsole", new Random().Next(1, 5), new List <string>()
                        {
                            "Block", "Red"
                        });
                        LogProxy.Debug(string.Format("{0}_{1}", "Debug : ", index), "Snake.DemoConsole", tags: new List <string>()
                        {
                            "Blue", "Red"
                        });
                        Console.WriteLine("Log{0} published", index);
                    }
                });
                tasks.Add(task);
            }
            await Task.WhenAll(tasks.ToArray());

            Console.WriteLine("Completed...");
        }
示例#2
0
 public void UpdateSimulation(TickMessage tickMessage)
 {
     LogProxy.Debug("ExplicitUpdate Simulation");
     lock (_queueLock)
     {
         _queuedMessages.Enqueue(tickMessage);
     }
     _messageSignal.Set();
 }
示例#3
0
        protected override void OnTick(float deltaTime)
        {
            try
            {
                if (_photonClient.ClientState == PlayGen.Photon.Unity.Client.ClientState.Disconnected)
                {
                    _photonClient.Connect();
                }

                _stateController.Tick(deltaTime);
            }
            catch (Exception exception)
            {
                LogProxy.Error(exception.ToString());
                LogProxy.Debug(exception.StackTrace);
                OnException(exception);
            }
        }
示例#4
0
        public void ExplicitUpdate()
        {
            LogProxy.Debug("ItemPanel ExplicitUpdate: Director Id {0} player is null: {1}", _director.InstanceId, _director.Player.Name);

            if (_director.Player != null)
            {
                // TODO: the following shouldnt be necessary when the container reference isnt changed
                if (_director.Player.Entity.TryGetComponent(out ItemStorage itemStorage))
                {
                    var inventoryItemContainer = itemStorage.Items[0] as InventoryItemContainer;
                    _inventoryItem.ItemContainer = inventoryItemContainer;
                    // TODO: keep this when above fixed
                    _inventoryItem.Update();
                }
            }
            else
            {
                LogProxy.Error($"Director {_director.InstanceId} Player is unassigned");
            }
        }