示例#1
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var dmGuid = entity.DMGuid;

            WlyViewMgr.GoTo(dmGuid, WlyViewType.场景_主城);
            WlyUtilityBiz.GetPercent(dmGuid, new WxRect(137, 47, 238, 68), "e9e7cf-000000", out var persent);
            if (persent > 0.8)
            {
                return(new WlyTaskInfo(ID, true));

                WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_卖粮);
                DMService.Instance.LeftClick(dmGuid, new WxPoint(760, 343));
                DMService.Instance.LeftClick(dmGuid, new WxPoint(762, 377));
            }

            WlyViewMgr.GoTo(dmGuid, WlyViewType.建筑_农田);

            FlowLogicHelper.RepeatRun(() =>
            {
                if (DMService.Instance.FindColor(dmGuid, "aaaaaa-000000", new WxRect(341, 402, 367, 413)))
                {
                    return(true);
                }

                FlowLogicHelper.RepeatRun(() => DMService.Instance.LeftClick(dmGuid, new WxPoint(350, 407), TimeSpan.FromMilliseconds(100)), 5);
                return(false);
            }, TimeSpan.FromSeconds(10));

            return(new WlyTaskInfo(ID, true));
        }
示例#2
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var dmGuid = entity.DMGuid;
            var result = WlyUtilityBiz.GetPercent(dmGuid, new WxRect(137, 71, 236, 90), "e9e7cf-000000", out var percent);

            if (result && (percent < 1))
            {
                WlyUtilityBiz.GetSoldier(entity.DMGuid);
            }

            return(new WlyTaskInfo(ID, true));
        }
示例#3
0
        protected override void InternalAfterLogin()
        {
            SubTaskMgr.Instance.InitEntityTasks(this);
            m_loginFlag = true;

            if (!m_subAccountInfo.Check)
            {
                var wait = FlowLogicHelper.RepeatRun(() =>
                {
                    var view  = WlyViewMgr.GetView(WlyViewType.略_防沉迷验证);
                    var view1 = WlyViewMgr.GetView(WlyViewType.略_跳过);
                    return(DMService.Instance.FindPic(DMGuid, WlyPicType.择国家, WlyUtilityBiz.GameWndRect) || view.IsCurrentView(DMGuid) ||
                           view1.IsCurrentView(DMGuid));
                }, TimeSpan.FromSeconds(30));
                if (wait && DMService.Instance.FindPic(DMGuid, WlyPicType.择国家, WlyUtilityBiz.GameWndRect))
                {
                    CreateRole(AutoPlayerVM.Instance.GetAvailableName());
                }
            }

            WxLog.Debug($"SubEntity.InternalAfterLogin AutoPlay Start <{m_subAccountInfo.Name}>");

            // 先检测主公等级
            var level = WlyUtilityBiz.GetMainLevel(DMGuid);

            if (level > m_subAccountInfo.Level)
            {
                WlyMainLevelMgr.Upgrade(DMGuid);
                m_subAccountInfo.Level = level;
                m_subAccountInfo.Save();
            }

            // 检测银币数量是否到达上限
            var result = WlyUtilityBiz.GetPercent(DMGuid, new WxRect(133, 26, 217, 47), "f3f3da-000000", out var percent);

            if (!result)
            {
                throw new InvalidOperationException("Cannot Get Money Amount");
            }

            // 银币超过上限了,想尽办法进行使用
            if (percent >= 0.9)
            {
                GetEuqipments();
                UpgradeEquipments();
            }

            // 如果可以捐国政了,则捐国政
            var now       = DateTime.Now;
            var timeNotOK = (now.DayOfWeek == DayOfWeek.Sunday) && (now.Hour >= 4) && (now.Hour < 21);

            if ((percent >= 0.5) && (m_subAccountInfo.GetBuildingInfo(WlyBuildingType.主城).Level >= 130) && !timeNotOK)
            {
                // 捐款2600万获取100政绩
                WlyViewMgr.GoTo(DMGuid, WlyViewType.场景_国政);

                // 点开内政
                var wait = FlowLogicHelper.RepeatRun(() =>
                {
                    DMService.Instance.LeftClick(DMGuid, new WxPoint(95, 42));
                    if (DMService.Instance.FindStr(DMGuid, new WxRect(483, 100, 516, 120), "国政", WlyColor.Normal))
                    {
                        return(true);
                    }

                    Thread.Sleep(500);
                    return(false);
                }, TimeSpan.FromSeconds(10));
                if (!wait)
                {
                    throw new InvalidOperationException();
                }

                // 捐款铸造
                DMService.Instance.LeftClick(DMGuid, new WxPoint(560, 270));
                DMService.Instance.LeftClick(DMGuid, new WxPoint(613, 438));
                DMService.Instance.SendString(DMGuid, WndHwnd, "50000000");

                wait = FlowLogicHelper.RepeatRun(() =>
                {
                    if (WlyUtilityBiz.GetAmount(DMGuid, new WxRect(577, 429, 671, 447), "e7e7fd-000000", out var amount))
                    {
                        return(true);
                    }

                    Thread.Sleep(500);
                    return(false);
                }, TimeSpan.FromSeconds(10));
                if (!wait)
                {
                    throw new InvalidOperationException();
                }

                DMService.Instance.LeftClick(DMGuid, new WxPoint(739, 438));
            }

            // 如果可以进行开发,则马上开发并立刻结束
            //if (DevelopTime < DateTime.Now)
            //{
            //    WlyUtilityBiz.GetAmount(DMGuid, new WxRect(133, 26, 217, 47), "f3f3da-000000", out var amount);
            //    if (amount > 500000)
            //    {
            //        DevelopCity();
            //        //Stop();
            //    }
            //}
        }