示例#1
0
        private void EditBoxGotFocus(object sender, RoutedEventArgs e)
        {
            var textBox = (TextBox)sender;

            textBox.IsReadOnly = false;

            DelayedAction.Execute(textBox.SelectAll, 50);
        }
示例#2
0
        public void AddNotification(string message, double displaySeconds, SolidColorBrush brush = null)
        {
            var notification = new NotificationViewModel()
            {
                Message = message,
                Color   = brush ?? new SolidColorBrush(Colors.WhiteSmoke)
            };

            this.Notifications.Add(notification);
            DelayedAction.Execute(() => this.RemoveNotification(notification), (int)(displaySeconds * 1000));
        }
        public static void DJCommand(string value, WorldClient client)
        {
            int id = DelayedActionRecord.DelayedActions.DynamicPop(x => x.Id);
            DelayedActionRecord record = new DelayedActionRecord(id, "Monsters", 30, value, client.Character.Map.Id.ToString());

            record.AddElement();
            DelayedAction action = new DelayedAction(record);

            DelayedActionManager.AddAction(action);
            action.Execute();
        }
示例#4
0
        private void StartAutosimulateCountdown()
        {
            if (_isAutoSimulateOn)
            {
                if (_autoSimulationAction == null)
                {
                    _autoSimulationAction = DelayedAction.Execute(this.SimulationTool.RunMonteCarloSimulation, TimeSpan.FromSeconds(5));
                }

                _autoSimulationAction.Reset();
            }
        }
示例#5
0
        public static void DjCommand(string value, WorldClient client)
        {
            if (value == null)
            {
                client.Character.ReplyError("You must provide a list of monsters to spawn. Example: 23,24,25,26.");
                return;
            }

            int id = DelayedActionRecord.DelayedActions.DynamicPop(x => x.Id);
            DelayedActionRecord record =
                new DelayedActionRecord(id, "Monsters", 30, value, client.Character.Map.Id.ToString());

            record.AddElement();
            DelayedAction action = new DelayedAction(record);

            DelayedActionManager.AddAction(action);
            action.Execute();
        }
示例#6
0
        public static void CreateDelayedAction(string value, WorldClient client)
        {
            var split = value.Split(' ');

            string actionType = split[0];            // for dungeon: Monsters
            int    interval   = int.Parse(split[1]); // ex: 30 (in seconds)
            string value1     = split[2];            // For dungeons: list of monsters
            var    value2     = client.Character.Map.Id.ToString();

            DelayedActionRecord record = new DelayedActionRecord(actionType, interval, value1, value2);

            record.AddInstantElement();

            DelayedAction action = new DelayedAction(record);

            DelayedActionManager.AddAction(action);
            action.Execute();

            client.Character.Reply($"Successfully created DelayedAction record {record}.");
        }
        public static void TestCommand(string value, WorldClient client)
        {
            client.SendRaw(RawDataManager.GetRawData("gvgpanel"));
            client.Character.Reply("Done");
            //  client.Character.SpellAnim(7356);
            return;

            client.Character.Record.Stats.LifePoints         = 99999;
            client.Character.Record.Stats.ActionPoints.Base += 99;
            client.Character.Record.Stats.MaxLifePoints      = 99999;
            client.Character.RefreshStats();
            return;

            int id = DelayedActionRecord.DelayedActions.DynamicPop(x => x.Id);
            DelayedActionRecord record = new DelayedActionRecord(id, "CharacterMonster", 50, value, client.Character.Map.Id.ToString());

            record.AddElement();
            DelayedAction action = new DelayedAction(record);

            DelayedActionManager.AddAction(action);
            action.Execute();
        }
示例#8
0
        private void Update()
        {
            Rules rules = gameManager.Rules;

            // Check if trick is finished
            if (gameManager.Rules.TrickIsFinished(Game.CurrentTrick))
            {
                LastTrickWinner = rules.TrickWinner(Game.CurrentTrick);
            }
            else
            {
                // Reset last trick winner when trick is cleared
                LastTrickWinner = -1;
            }

            // Make AI actions
            for (int i = 0; i < Game.NumberOfPlayers; i++)
            {
                int player = i;

                // Check if player is an AI player
                if (GetPlayerByIndex(player) is HumanPlayerViewModel == false)
                {
                    // No delay for pass actions
                    if (rules.CanPassCards(player))
                    {
                        aiPlayer.MakeAction(gameManager, player);
                    }

                    // Delay play actions
                    if (rules.CanPlay(player))
                    {
                        delayedAction        = new DelayedAction();
                        delayedAction.Delay  = aiDelay;
                        delayedAction.Action = new Action(() =>
                        {
                            aiPlayer.MakeAction(gameManager, player);
                        });
                        delayedAction.Execute();
                    }
                }
            }

            // Check if waiting for new turn
            if (rules.CanStartNewTurn())
            {
                gameManager.StartNewTurn();
            }

            // Ceck if trick is finished
            if (rules.CanClearTrick())
            {
                delayedAction        = new DelayedAction();
                delayedAction.Delay  = clearTrickDelay;
                delayedAction.Action = new Action(() =>
                {
                    gameManager.ClearTrick();
                });
                delayedAction.Execute();
            }
        }
示例#9
0
 public void RemoveNotification(NotificationViewModel notification)
 {
     notification.IsRemoving = true;
     DelayedAction.Execute(() => this.Notifications.Remove(notification), 1000);
 }