private void HandleMouseEvent(PointF pos, PositionDelegate headerEvent, PositionDelegate contentEvent)
		{
			if (Collapsed)
			{
				if (pos.X >= HeaderCollapsed.AbsoluteX &&
					pos.X <= HeaderCollapsed.AbsoluteX + HeaderCollapsed.ActualWidth &&
					pos.Y >= HeaderCollapsed.AbsoluteY &&
					pos.Y <= HeaderCollapsed.AbsoluteY + HeaderCollapsed.ActualHeight)
				{
					headerEvent(this, pos);
				}
			}
			else
			{
				if (pos.X >= HeaderExpanded.AbsoluteX &&
					pos.X <= HeaderExpanded.AbsoluteX + HeaderExpanded.ActualWidth &&
					pos.Y >= HeaderExpanded.AbsoluteY &&
					pos.Y <= HeaderExpanded.AbsoluteY + HeaderExpanded.ActualHeight)
				{
					headerEvent(this, pos);
				}
				else if (pos.X >= Content.AbsoluteX &&
						pos.X <= Content.AbsoluteX + Content.ActualWidth &&
						pos.Y >= Content.AbsoluteY &&
						pos.Y <= Content.AbsoluteY + Content.ActualHeight)
				{
					contentEvent(this, pos);
				}
			}
		}
Beispiel #2
0
 private void HandleMouseEvent(PointF pos, PositionDelegate headerEvent, PositionDelegate contentEvent)
 {
     if (Collapsed)
     {
         if (pos.X >= HeaderCollapsed.AbsoluteX &&
             pos.X <= HeaderCollapsed.AbsoluteX + HeaderCollapsed.ActualWidth &&
             pos.Y >= HeaderCollapsed.AbsoluteY &&
             pos.Y <= HeaderCollapsed.AbsoluteY + HeaderCollapsed.ActualHeight)
         {
             headerEvent(this, pos);
         }
     }
     else
     {
         if (pos.X >= HeaderExpanded.AbsoluteX &&
             pos.X <= HeaderExpanded.AbsoluteX + HeaderExpanded.ActualWidth &&
             pos.Y >= HeaderExpanded.AbsoluteY &&
             pos.Y <= HeaderExpanded.AbsoluteY + HeaderExpanded.ActualHeight)
         {
             headerEvent(this, pos);
         }
         else if (pos.X >= Content.AbsoluteX &&
                  pos.X <= Content.AbsoluteX + Content.ActualWidth &&
                  pos.Y >= Content.AbsoluteY &&
                  pos.Y <= Content.AbsoluteY + Content.ActualHeight)
         {
             contentEvent(this, pos);
         }
     }
 }
Beispiel #3
0
        protected Boss(XmasHell game, BossType type, PositionDelegate playerPositionDelegate)
        {
            Game     = game;
            BossType = type;
            _playerPositionDelegate = playerPositionDelegate;

            InitialPosition = new Vector2(
                Game.ViewportAdapter.VirtualWidth / 2f,
                Game.ViewportAdapter.VirtualHeight * 0.15f
                );
            InitialLife = GameConfig.BossDefaultLife;

            // Behaviours
            Behaviours = new List <AbstractBossBehaviour>();

            // BulletML
            BulletPatternFiles = new List <string>();

            HitColor = Color.White * 0.5f;

            _hpBar = new Sprite(
                new TextureRegion2D(
                    Assets.GetTexture2D("pixel"),
                    0, 0, GameConfig.VirtualResolution.X, 50
                    )
                )
            {
                Origin = Vector2.Zero,
                Color  = Color.Red
            };

            Game.SpriteBatchManager.Boss = this;
            Game.SpriteBatchManager.UISprites.Add(_hpBar);

            _timerLabel = new AbstractGuiLabel("00:00", Assets.GetFont("Graphics/Fonts/ui-small"), new Vector2(Game.ViewportAdapter.VirtualWidth / 2f, 25), Color.White, true);
            Game.SpriteBatchManager.UILabels.Add(_timerLabel);

            // To compute line/wall intersection
            _bottomWallLine = new Line(
                new Vector2(0f, GameConfig.VirtualResolution.Y),
                new Vector2(GameConfig.VirtualResolution.X, GameConfig.VirtualResolution.Y)
                );

            _leftWallLine = new Line(
                new Vector2(0f, 0f),
                new Vector2(0f, GameConfig.VirtualResolution.Y)
                );

            _rightWallLine = new Line(
                new Vector2(GameConfig.VirtualResolution.X, 0f),
                new Vector2(GameConfig.VirtualResolution.X, GameConfig.VirtualResolution.Y)
                );

            _upWallLine = new Line(
                new Vector2(0f, 0f),
                new Vector2(GameConfig.VirtualResolution.X, 0f)
                );
        }
Beispiel #4
0
        public Camera(XmasHell game, GraphicsDevice graphicsDevice) : base(graphicsDevice)
        {
            _game          = game;
            _targetingZoom = false;
            _targetZoom    = 1f;

            _followPositionDelegate = null;
            _followingPosition      = false;
        }
Beispiel #5
0
        public XmasReindeer(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.XmasReindeer, playerPositionDelegate)
        {
            // BulletML
            BulletPatternFiles.Add("XmasReindeer/pattern1");

            // Behaviours
            Behaviours.Add(new XmasReindeerBehaviour1(this));

            SpriterFilename = "Graphics/Sprites/Bosses/XmasReindeer/xmas-reindeer";
        }
Beispiel #6
0
        static void loadEventHandlers()
        {
            onNewFormDataEvent  += new NewStringDataHandler(ShowStatus);
            onNewSecurityEvent  += new NewStringDataHandler(ShowStatus);
            onNewTimeframeEvent += new NewStringDataHandler(ShowStatus);
            onNewStatusEvent    += new NewBoolDataHandler(ConnectionStatusReflect);
            onPositionSuscriber += new PositionDelegate(setTakingClosingPosition);

            bConnected  = false;
            bConnecting = false;
        }
Beispiel #7
0
        public BossDebug(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.Debug, playerPositionDelegate)
        {
            // BulletML
            BulletPatternFiles.Add("BossDebug/pattern1");

            // Behaviours
            Behaviours.Add(new BossDebugBehaviour1(this));

            SpriterFilename = "Graphics/Sprites/Bosses/BossDebug/boss-debug";
        }
Beispiel #8
0
        public XmasTree(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.XmasTree, playerPositionDelegate)
        {
            // BulletML
            BulletPatternFiles.Add("XmasTree/pattern1.1");
            BulletPatternFiles.Add("XmasTree/pattern1.2");

            // Behaviours
            Behaviours.Add(new XmasTreeBehaviour1(this));

            SpriterFilename = "Graphics/Sprites/Bosses/XmasTree/xmas-tree";
        }
Beispiel #9
0
        public XmasLog(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.XmasLog, playerPositionDelegate)
        {
            // BulletML
            BulletPatternFiles.Add("sample");

            // Spriter
            SpriterFilename = "Graphics/Sprites/Bosses/XmasLog/xmas-log";

            // Behaviours
            Behaviours.Add(new XmasLogBehaviour1(this));
        }
Beispiel #10
0
        public Camera(XmasHell game, ViewportAdapter viewportAdapter) : base(viewportAdapter)
        {
            _game          = game;
            _targetingZoom = false;
            _targetZoom    = 1f;

            _followPositionDelegate = null;
            _followingPosition      = false;

            MaximumZoom = 5f;
            MinimumZoom = 0.01f;
        }
Beispiel #11
0
        public XmasGift(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.XmasGift, playerPositionDelegate)
        {
            // Spriter
            SpriterFilename = "Graphics/Sprites/Bosses/XmasGift/xmas-gift";

            // BulletML
            BulletPatternFiles.Add("sample");

            // Behaviours
            Behaviours.Add(new XmasGiftBehaviour1(this, World));
        }
Beispiel #12
0
 public BossCore(
     DnK gameRef, 
     Entity parent, 
     PositionDelegate playerPositionDelegate, 
     MoverManager moverManager,
     List<BulletPattern> bulletPatterns,
     float initialHp = 100f)
     : base(gameRef)
 {
     _parent = parent;
     _hp = initialHp;
     _activated = false;
     _playerPositionDelegate = playerPositionDelegate;
     _moverManager = moverManager;
     _bulletPatterns = bulletPatterns;
 }
Beispiel #13
0
        public XmasCandy(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.XmasCandy, playerPositionDelegate)
        {
            InitialLife = 500f;

            // BulletML
            BulletPatternFiles.Add("XmasCandy/pattern1");
            BulletPatternFiles.Add("XmasCandy/pattern2");

            // Behaviours
            Behaviours.Add(new XmasCandyBehaviour1(this));
            Behaviours.Add(new XmasCandyBehaviour2(this));
            Behaviours.Add(new XmasCandyBehaviour3(this));

            SpriterFilename = "Graphics/Sprites/Bosses/XmasCandy/xmas-candy";
        }
Beispiel #14
0
 public BossCore(
     GameRunner gameRef,
     Entity parent,
     PositionDelegate playerPositionDelegate,
     MoverManager moverManager,
     List <BulletPattern> bulletPatterns,
     float initialHp = 100f)
     : base(gameRef)
 {
     _parent    = parent;
     _hp        = initialHp;
     _activated = false;
     _playerPositionDelegate = playerPositionDelegate;
     _moverManager           = moverManager;
     _bulletPatterns         = bulletPatterns;
 }
Beispiel #15
0
        public XmasLog(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.XmasLog, playerPositionDelegate)
        {
            // BulletML
            BulletPatternFiles.Add("XmasLog/pattern1");

            // Spriter
            SpriterFilename = "Graphics/Sprites/Bosses/XmasLog/xmas-log";

            // Behaviours
            Behaviours.Add(new XmasLogBehaviour1(this));
            Behaviours.Add(new XmasLogBehaviour2(this));
            Behaviours.Add(new XmasLogBehaviour3(this));
            Behaviours.Add(new XmasLogBehaviour4(this));

            InitialPosition = new Vector2(GameConfig.VirtualResolution.X / 2f, GameConfig.VirtualResolution.Y * 0.15f);
        }
Beispiel #16
0
        public XmasBall(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.XmasBall, playerPositionDelegate)
        {
            // BulletML
            BulletPatternFiles.Add("XmasBall/pattern1");
            BulletPatternFiles.Add("XmasBall/pattern2");
            BulletPatternFiles.Add("XmasBall/pattern3");
            BulletPatternFiles.Add("XmasBall/pattern4");

            // Behaviours
            Behaviours.Add(new XmasBallBehaviour1(this));
            Behaviours.Add(new XmasBallBehaviour2(this));
            Behaviours.Add(new XmasBallBehaviour3(this));
            Behaviours.Add(new XmasBallBehaviour4(this));

            SpriterFilename = "Graphics/Sprites/Bosses/XmasBall/xmas-ball";
        }
Beispiel #17
0
        public XmasSnowman(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.XmasSnowman, playerPositionDelegate)
        {
            // BulletML
            BulletPatternFiles.Add("XmasSnowman/pattern1");
            BulletPatternFiles.Add("XmasSnowman/pattern3_1");
            BulletPatternFiles.Add("XmasSnowman/pattern3_2");

            // Behaviours
            Behaviours.Add(new XmasSnowmanBehaviour1(this));
            Behaviours.Add(new XmasSnowmanBehaviour2(this));
            Behaviours.Add(new XmasSnowmanBehaviour3(this));
            Behaviours.Add(new XmasSnowmanBehaviour4(this));

            SpriterFilename = "Graphics/Sprites/Bosses/XmasSnowman/xmas-snowman";

            InitialPosition = new Vector2(GameConfig.VirtualResolution.X / 2f, GameConfig.VirtualResolution.Y * 0.25f);
        }
Beispiel #18
0
        public XmasSnowflake(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.XmasSnowflake, playerPositionDelegate)
        {
            // BulletML
            BulletPatternFiles.Add("XmasSnowflake/pattern1");
            BulletPatternFiles.Add("XmasSnowflake/pattern2");
            BulletPatternFiles.Add("XmasSnowflake/pattern3");
            BulletPatternFiles.Add("XmasSnowflake/pattern4");

            // Behaviours
            Behaviours.Add(new XmasSnowflakeBehaviour1(this));
            Behaviours.Add(new XmasSnowflakeBehaviour2(this));
            Behaviours.Add(new XmasSnowflakeBehaviour3(this));
            Behaviours.Add(new XmasSnowflakeBehaviour4(this));

            SpriterFilename = "Graphics/Sprites/Bosses/XmasSnowflake/xmas-snowflake";

            InitializeDestroyedParticleEffect();
        }
Beispiel #19
0
        public static Boss CreateBoss(BossType type, XmasHell game, PositionDelegate playerPositionDelegate)
        {
            switch (type)
            {
            case BossType.Debug:
                return(new DebugBoss.BossDebug(game, playerPositionDelegate));

            case BossType.XmasBall:
                return(new XmasBall.XmasBall(game, playerPositionDelegate));

            case BossType.XmasBell:
                return(new XmasBell.XmasBell(game, playerPositionDelegate));

            case BossType.XmasCandy:
                return(new XmasCandy.XmasCandy(game, playerPositionDelegate));

            case BossType.XmasSnowflake:
                return(new XmasSnowflake.XmasSnowflake(game, playerPositionDelegate));

            case BossType.XmasLog:
                return(new XmasLog.XmasLog(game, playerPositionDelegate));

            case BossType.XmasTree:
                break;

            case BossType.XmasGift:
                return(new XmasGift.XmasGift(game, playerPositionDelegate));

            case BossType.XmasReinder:
                break;

            case BossType.XmasSnowman:
                break;

            case BossType.XmasSanta:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }

            return(new XmasBall.XmasBall(game, playerPositionDelegate));
        }
Beispiel #20
0
        public XmasBell(XmasHell game, PositionDelegate playerPositionDelegate) :
            base(game, BossType.XmasBell, playerPositionDelegate)
        {
            // Spriter
            SpriterFilename = "Graphics/Sprites/Bosses/XmasBell/xmas-bell";

            // BulletML
            BulletPatternFiles.Add("XmasBell/pattern1");
            BulletPatternFiles.Add("XmasBell/pattern2");
            BulletPatternFiles.Add("XmasBell/pattern4");
            BulletPatternFiles.Add("XmasBell/pattern5");

            // Behaviours
            Behaviours.Add(new XmasBellBehaviour1(this));
            Behaviours.Add(new XmasBellBehaviour2(this));
            //Behaviours.Add(new XmasBellBehaviour3(this));
            Behaviours.Add(new XmasBellBehaviour4(this));
            Behaviours.Add(new XmasBellBehaviour5(this));

            InitializeDestroyedParticleEffect();
        }
Beispiel #21
0
        protected Boss(XmasHell game, BossType type, PositionDelegate playerPositionDelegate)
        {
            Game     = game;
            BossType = type;
            _playerPositionDelegate = playerPositionDelegate;

            InitialPosition = GameConfig.BossDefaultPosition;

            // Behaviours
            Behaviours = new List <AbstractBossBehaviour>();

            // BulletML
            BulletPatternFiles = new List <string>();

            HitColor = Color.White * 0.5f;

            HitBoxes = new List <CollisionElement>();

            // To compute line/wall intersection
            _bottomWallLine = new Line(
                new Vector2(0f, GameConfig.VirtualResolution.Y),
                new Vector2(GameConfig.VirtualResolution.X, GameConfig.VirtualResolution.Y)
                );

            _leftWallLine = new Line(
                new Vector2(0f, 0f),
                new Vector2(0f, GameConfig.VirtualResolution.Y)
                );

            _rightWallLine = new Line(
                new Vector2(GameConfig.VirtualResolution.X, 0f),
                new Vector2(GameConfig.VirtualResolution.X, GameConfig.VirtualResolution.Y)
                );

            _upWallLine = new Line(
                new Vector2(0f, 0f),
                new Vector2(GameConfig.VirtualResolution.X, 0f)
                );
        }
Beispiel #22
0
        //================================================================================
        void MainFormLoad(object sender, EventArgs e)
        {
            ctl_Tabs.SelectTab("tab_Param");

            // параметры по умолчанию
            ServerIP   = "tr1.finam.ru";
            ServerPort = "3900";

            loadLogginDetails();

            session_timeout = 25;
            request_timeout = 10;

            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "FORTS", Value = 4
            });
            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "ММВБ", Value = 1
            });
            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "SPBEX", Value = 7
            });
            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "INF", Value = 8
            });
            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "MMA", Value = 14
            });
            comboBox1.Items.Add(new ComboboxItem()
            {
                Text = "ETS", Value = 8
            });

            comboBox1.SelectedIndex = 0;


            edt_Login.Text    = sLogin;
            edt_Password.Text = sPassword;
            edt_IP.Text       = ServerIP;
            edt_Port.Text     = ServerPort;

            bConnected  = false;
            bConnecting = false;

            Enable_Password_Controls(false);

            Init_Data();

            // открытие лог-файла
            log.StartLogging(AppDir + "log" + DateTime.Now.ToString("yyMMdd") + ".txt");

            TXmlConnector.statusTimeout = session_timeout * 1000;

            TXmlConnector.ConnectorSetCallback(OnNewFormData, OnNewSecurity, OnNewTimeframe, OnNewStatus);

            this.onNewFormDataEvent  += new NewStringDataHandler(Add_FormData);
            this.onNewSecurityEvent  += new NewStringDataHandler(Add_Security);
            this.onNewTimeframeEvent += new NewStringDataHandler(Add_Timeframe);
            this.onNewStatusEvent    += new NewBoolDataHandler(ConnectionStatusReflect);

            TXmlConnector.Orders4HMISubscribe(OrdersSubscriber);
            this.onOrdersPublished += new NewStringDataHandler(processOrdersDistribution);


            OportunityMonitor.init();

            TXmlConnector.FormReady = true;

            string LogPath = AppDir + "\0";

            if (TXmlConnector.ConnectorInitialize(LogPath, 3))
            {
                TXmlConnector.statusDisconnected.Set();
            }

            OportunityMonitor.subscribeQuotationUpdate(quotationCall);
            this.onQuotation += new quotationDelegate(setQuotationPrice);

            OportunityMonitor.PositionPublisherCallback(PositionPublisherCall);
            onPositionSuscriber += new PositionDelegate(setTakingClosingPosition);

            MamuschkaRepeater.mamushkaStatusSubscribe(mamuschkaStatusCall);
            onMamushkaStatusResponse += new NewStringDataHandler(setMamushkaServerStatus);
            MamuschkaRepeater.monitorMamuschkaServer();
        }
 /// <summary>
 /// 视图设定【核心】
 /// </summary>
 /// <param name="lstView">视图控件</param>
 /// <param name="StatisticRecords">统计数据集</param>
 public static void FillPositionListView(ListView lstView, List<PositionStatistic> StatisticRecords, PositionDelegate condition)
 {
     lstView.Clear();
     for (int i = 0; i < CurrentPositionViewFields.Length; i++)
     {
         //pay attention the order!
         lstView.Columns.Add(CurrentPositionViewFields[i]);
     }
     int cnt = 0;
     foreach (var Record in StatisticRecords)
     {
         if (Record.BasicInfo.Position == SystemManager.strTotal)
         {
             ListViewItem item = new ListViewItem();
             cnt++;
             Record.BasicInfo.No = cnt.ToString();
             BindPositionListViewItem(item, Record);
             item.BackColor = Color.LightYellow;
             lstView.Items.Add(item);
         }
         else
         {
             if (Record.Gap != 0 && condition(Record.BasicInfo))
             {
                 ListViewItem item = new ListViewItem();
                 cnt++;
                 Record.BasicInfo.No = cnt.ToString();
                 BindPositionListViewItem(item, Record);
                 lstView.Items.Add(item);
             }
         }
     }
     foreach (var Record in StatisticRecords)
     {
         if (!condition(Record.BasicInfo)) continue;
         if (Record.Gap == 0 && Record.BasicInfo.Position != SystemManager.strTotal)
         {
             ListViewItem item = new ListViewItem();
             cnt++;
             Record.BasicInfo.No = cnt.ToString();
             BindPositionListViewItem(item, Record);
             item.BackColor = Color.LightGray;
             lstView.Items.Add(item);
         }
     }
     Utility.ListViewColumnResize(lstView);
 }
 public MoverManager(PositionDelegate playerDelegate)
 {
     _getPlayerPosition = playerDelegate;
 }
Beispiel #25
0
 public void FollowPosition(PositionDelegate positionDelegate)
 {
     _followPositionDelegate = positionDelegate;
     _followingPosition      = true;
 }
Beispiel #26
0
 static extern void GetData(float[] orientation, int Osize, float[] position, int Psize, PositionDelegate SentPosition);
Beispiel #27
0
 public void SetPlayerPositionDelegate(PositionDelegate playerDelegate)
 {
     _getPlayerPosition = playerDelegate;
 }
Beispiel #28
0
 public static void PositionPublisherCallback(PositionDelegate callback)
 {
     onPositionPublisher += new PositionDelegate(callback);
 }
Beispiel #29
0
        public static Composite MoveTo(PositionDelegate positionDelegate, XyzPositionDelegate xyzPositionDelegate = null, MovementSpec spec = null)
        {
            return(new Sequence(
                       new Action(delegate(object context)
            {
                var position = positionDelegate(context);
                if (position == null)
                {
                    WillBot.LogMessageCombo($"Unable to set path to null position");
                    return RunStatus.Failure;
                }
                bool didSetPath = WillBot.Mover.SetPath((Vector2)position);
                if (didSetPath == false)
                {
                    WillBot.LogMessageCombo($"Unable to set path to {position}");
                    return RunStatus.Failure;
                }
                else
                {
                    WillBot.LogMessageCombo($"Successfully found path to {position}");
                    ControlTimer.Restart();
                    return RunStatus.Success;
                }
            }),
                       new Action(delegate(object context)
            {
                bool isZDifferenceOk = true;
                var entityPos = xyzPositionDelegate?.Invoke(context);
                var entityGridPos = positionDelegate?.Invoke(context);
                if (entityPos != null)
                {
                    isZDifferenceOk = Math.Abs(GameController.Player.Pos.Z - entityPos.GetValueOrDefault().Z) < WillBot.Settings.MovementCancelingForLootZThreshold;
                }
                // if zdifferencenotOk, but the path is relatively straight to the object and close -> use movement skill
                WillBot.LogMessageCombo($"Remaining path distance squared : {WillBot.Mover.pathFindingWrapper.RemainingPathDistanceSquaredToTarget}");
                var airDistanceSquared = entityGridPos.GetValueOrDefault().DistanceSquared(WillBot.gameController.Player.GridPos);
                if (isZDifferenceOk == false && (WillBot.Mover.pathFindingWrapper.RemainingPathDistanceSquaredToTarget < 1300) &&
                    WillBot.Mover.pathFindingWrapper.RemainingPathDistanceSquaredToTarget < 1.07 * airDistanceSquared)
                {
                    WillBot.LogMessageCombo($"Using movement skill to most likely jump a cliff which incorrectly is set to walkable");
                    InputWrapper.ResetMouseButtons();
                    var screenPos = Camera.WorldToScreen((Vector3)entityPos);
                    Mouse.SetCursorPosAndLeftOrRightClick(screenPos, 10, clickType: Mouse.MyMouseClicks.NoClick);
                    InputWrapper.KeyPress(Keys.E);
                    //MoverHelper.ClickToStopCharacter();
                    return RunStatus.Failure;
                }
                switch (spec.cancelReason)
                {
                case CancelReason.None:
                    break;

                case CancelReason.PathDistanceLessThanRange:
                    if ((WillBot.Mover.pathFindingWrapper.RemainingPathDistanceSquaredToTarget < (spec.cancelRangeSquared)) && isZDifferenceOk)
                    {
                        WillBot.LogMessageCombo($"Canceled movement in range to object {spec.cancelRange}");
                        InputWrapper.ResetMouseButtons();
                        //MoverHelper.ClickToStopCharacter();
                        return RunStatus.Failure;
                    }
                    break;

                case CancelReason.PathDistanceLessThanRangeIfStraightPath:
                    /* Cancel pathfinding if path distance to object is less than X and distance to object and path distance are roughly equal
                     * use 1: Looting, avoid having to pathfind really close to loot before clicking the label.
                     */
                    //var airDistanceSquared = entityGridPos.GetValueOrDefault().DistanceSquared(WillBot.gameController.Player.GridPos);

                    if ((WillBot.Mover.pathFindingWrapper.RemainingPathDistanceSquaredToTarget < spec.cancelRangeSquared) &&
                        WillBot.Mover.pathFindingWrapper.RemainingPathDistanceSquaredToTarget < 1.07 * airDistanceSquared)
                    {
                        WillBot.LogMessageCombo($"Canceled movement in range to object with straight line {spec.cancelRange}");
                        InputWrapper.ResetMouseButtons();
                        //MoverHelper.ClickToStopCharacter();
                        return RunStatus.Failure;
                    }
                    break;
                }

                if (spec.cancelForMonster && DoCombat())
                {
                    WillBot.LogMessageCombo($"Canceled movement to do combat");
                    InputWrapper.ResetMouseButtons();
                    return RunStatus.Failure;
                }
                if (spec.cancelForLoot && DoLooting())
                {
                    WillBot.LogMessageCombo($"Canceled movement to do looting");
                    InputWrapper.ResetMouseButtons();
                    return RunStatus.Failure;
                }
                if (spec.cancelForOpenables && (WillBot.Me.StrongBox != null || WillBot.Me.HarvestChest != null || WillBot.Me.EssenceMonsterMonolith != null))
                {
                    InputWrapper.ResetMouseButtons();
                    WillBot.LogMessageCombo($"Canceled movement to do openables");
                    return RunStatus.Failure;
                }
                if (ControlTimer.ElapsedMilliseconds > 3500 && StuckTracker.GetDistanceMoved() < 40)
                {
                    InputWrapper.ResetMouseButtons();
                    WillBot.LogMessageCombo($"Canceled movement due to being stuck!. Using movement ability");
                    InputWrapper.KeyPress(WillBot.Settings.MovementAbilityKey);
                    return RunStatus.Failure;
                }
                // If movement last x duration less than .. return
                return WillBot.Mover.FollowPath();
            })
                       ));
        }
        /// <summary>
        /// 视图设定【核心】
        /// </summary>
        /// <param name="lstView">视图控件</param>
        /// <param name="StatisticRecords">统计数据集</param>
        public static void FillPositionListView(ListView lstView, List <PositionStatistic> StatisticRecords, PositionDelegate condition)
        {
            lstView.Clear();
            for (int i = 0; i < CurrentPositionViewFields.Length; i++)
            {
                //pay attention the order!
                lstView.Columns.Add(CurrentPositionViewFields[i]);
            }
            int cnt = 0;

            foreach (var Record in StatisticRecords)
            {
                if (Record.BasicInfo.Position == SystemManager.strTotal)
                {
                    ListViewItem item = new ListViewItem();
                    cnt++;
                    Record.BasicInfo.No = cnt.ToString();
                    BindPositionListViewItem(item, Record);
                    item.BackColor = Color.LightYellow;
                    lstView.Items.Add(item);
                }
                else
                {
                    if (Record.Gap != 0 && condition(Record.BasicInfo))
                    {
                        ListViewItem item = new ListViewItem();
                        cnt++;
                        Record.BasicInfo.No = cnt.ToString();
                        BindPositionListViewItem(item, Record);
                        lstView.Items.Add(item);
                    }
                }
            }
            foreach (var Record in StatisticRecords)
            {
                if (!condition(Record.BasicInfo))
                {
                    continue;
                }
                if (Record.Gap == 0 && Record.BasicInfo.Position != SystemManager.strTotal)
                {
                    ListViewItem item = new ListViewItem();
                    cnt++;
                    Record.BasicInfo.No = cnt.ToString();
                    BindPositionListViewItem(item, Record);
                    item.BackColor = Color.LightGray;
                    lstView.Items.Add(item);
                }
            }
            Utility.ListViewColumnResize(lstView);
        }
Beispiel #31
0
 public void Initialize(PositionDelegate playerDelegate)
 {
     Debug.Assert(null != playerDelegate);
     GetPlayerPosition = playerDelegate;
     _shoot            = _gameRef.Content.Load <SoundEffect>(@"Audio/SE/boss_shoot");
 }
 public void Initialize(PositionDelegate playerDelegate)
 {
     Debug.Assert(null != playerDelegate);
     GetPlayerPosition = playerDelegate;
     _shoot = _gameRef.Content.Load<SoundEffect>(@"Audio/SE/boss_shoot");
 }
Beispiel #33
0
 public MoverManager(PositionDelegate playerDelegate)
 {
     Debug.Assert(null != playerDelegate);
     GetPlayerPosition = playerDelegate;
 }
Beispiel #34
0
 private static extern void SetPositionHandler(PositionDelegate func);