コード例 #1
0
        /// <summary>
        /// 线程驱动
        /// </summary>
        public void ProcessQueue()
        {
            long nowTicks = TimeUtil.NOW();
            List <LiXianGuaJiRoleItem> LiXianGuaJiRoleItems = GetLiXianGuaJiRoleItemList();

            for (int i = 0; i < LiXianGuaJiRoleItems.Count; i++)
            {
                //先计时,再检测是否打到时限
                DoSpriteMeditateTime(LiXianGuaJiRoleItems[i]);

                //挂机结束
                if (/*nowTicks - LiXianGuaJiRoleItems[i].StartTicks >= MaxMingXiangTicks || */ (LiXianGuaJiRoleItems[i].MeditateTime + LiXianGuaJiRoleItems[i].NotSafeMeditateTime) >= MaxMingXiangTicks)
                {
                    SaveDBLiXianGuaJiTimeForRole(LiXianGuaJiRoleItems[i]); //保存挂机时间
                    RemoveLiXianGuaJiRole(LiXianGuaJiRoleItems[i].RoleID); //从列表移除

                    //移除假人
                    if (LiXianGuaJiRoleItems[i].FakeRoleID > 0)
                    {
                        FakeRoleManager.ProcessDelFakeRole(LiXianGuaJiRoleItems[i].FakeRoleID);
                    }
                    //提示用户离线挂机终止

                    continue;
                }
            }
        }
コード例 #2
0
        public void LogoutTest()
        {
            UserManager <AppUser>      um  = new FakeUserManager();
            SignInManager <AppUser>    sim = new FakeSignInManager();
            Mock <IUnitOfWork>         uow = new Mock <IUnitOfWork>();
            RoleManager <IdentityRole> rm  = new FakeRoleManager();
            AuthController             AC  = new AuthController(um, sim, uow.Object, rm);

            var result = AC.Logout().Result;

            result.Should().NotBeNull();
        }
コード例 #3
0
        public AuthenticationControllerTests()
        {
            var _loggerMock      = new Mock <ILogger <AuthenticationController> >();
            var _mapperMock      = new Mock <IMapper>();
            var _fakeRoleManager = new FakeRoleManager();

            _mockSignInManager = new Mock <FakeSignInManager>();
            _mockUserManager   = new Mock <FakeUserManager>();

            _authenticationController =
                new AuthenticationController(_mockUserManager.Object, _fakeRoleManager, _mockSignInManager.Object, _loggerMock.Object, _mapperMock.Object);
        }
コード例 #4
0
        public void LoginTest()
        {
            UserManager <AppUser>      um  = new FakeUserManager();
            SignInManager <AppUser>    sim = new FakeSignInManager();
            Mock <IUnitOfWork>         uow = new Mock <IUnitOfWork>();
            RoleManager <IdentityRole> rm  = new FakeRoleManager();
            AuthController             AC  = new AuthController(um, sim, uow.Object, rm);

            var result = AC.Login("https://google.com.ua") as ViewResult;

            result.Should().NotBeNull();

            var result2 = AC.Login(fakelvm, "https://google.com.ua");

            result2.Should().NotBeNull();
        }
コード例 #5
0
        /// <summary>
        /// 刷新雕像
        /// </summary>
        /// <param name="manStatue"></param>
        /// <param name="wifeStatue"></param>
        private void ReshowCoupleStatue(RoleDataEx manStatue, RoleDataEx wifeStatue)
        {
            NPC manNpc = NPCGeneralManager.FindNPC(GameManager.MainMapCode, FakeRoleNpcId.CoupleWishMan);

            if (null != manNpc)
            {
                if (manStatue == null)
                {
                    manNpc.ShowNpc = true;
                    GameManager.ClientMgr.NotifyMySelfNewNPCBy9Grid(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, manNpc);
                    FakeRoleManager.ProcessDelFakeRoleByType(FakeRoleTypes.CoupleWishMan, true);
                }
                else
                {
                    manNpc.ShowNpc = false;
                    GameManager.ClientMgr.NotifyMySelfDelNPCBy9Grid(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, manNpc);
                    FakeRoleManager.ProcessDelFakeRoleByType(FakeRoleTypes.CoupleWishMan, true);
                    SafeClientData clientData = new SafeClientData();
                    clientData.RoleData = manStatue;
                    FakeRoleManager.ProcessNewFakeRole(clientData, manNpc.MapCode, FakeRoleTypes.CoupleWishMan, (int)manNpc.CurrentDir, (int)manNpc.CurrentPos.X, (int)manNpc.CurrentPos.Y, FakeRoleNpcId.CoupleWishMan);
                }
            }

            NPC wifeNpc = NPCGeneralManager.FindNPC(GameManager.MainMapCode, FakeRoleNpcId.CoupleWishWife);

            if (null != wifeNpc)
            {
                if (wifeStatue == null)
                {
                    // wifeNpc.ShowNpc = true;
                    // GameManager.ClientMgr.NotifyMySelfNewNPCBy9Grid(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, wifeNpc);

                    wifeNpc.ShowNpc = true;
                    GameManager.ClientMgr.NotifyMySelfNewNPCBy9Grid(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, wifeNpc);
                    FakeRoleManager.ProcessDelFakeRoleByType(FakeRoleTypes.CoupleWishWife, true);
                }
                else
                {
                    wifeNpc.ShowNpc = false;
                    GameManager.ClientMgr.NotifyMySelfDelNPCBy9Grid(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, wifeNpc);
                    FakeRoleManager.ProcessDelFakeRoleByType(FakeRoleTypes.CoupleWishWife, true);
                    SafeClientData clientData = new SafeClientData();
                    clientData.RoleData = wifeStatue;
                    FakeRoleManager.ProcessNewFakeRole(clientData, wifeNpc.MapCode, FakeRoleTypes.CoupleWishWife, (int)wifeNpc.CurrentDir, (int)wifeNpc.CurrentPos.X, (int)wifeNpc.CurrentPos.Y, FakeRoleNpcId.CoupleWishWife);
                }
            }
        }
コード例 #6
0
        public frmInbox()
        {
            IRoleManager roleManager = new FakeRoleManager();

            InitializeComponent();

            //Testing purposes
            _threadManager = new FakeThreadManager();
            _employee      = new Employee
            {
                Email         = "*****@*****.**",
                EmployeeRoles = roleManager.RetrieveAllRoles()
            };

            SetupThreadList();
            DisableThreadFields();
        }
コード例 #7
0
        public static void DelFakeRoleByClient(GameClient client)
        {
            int fakeRoleID = -1;
            LiXianSaleRoleItem liXianSaleRoleItem = null;

            lock (LiXianBaiTanManager._LiXianRoleInfoDict)
            {
                if (!LiXianBaiTanManager._LiXianRoleInfoDict.TryGetValue(client.ClientData.RoleID, out liXianSaleRoleItem))
                {
                    return;
                }
                fakeRoleID = liXianSaleRoleItem.FakeRoleID;
            }
            if (fakeRoleID > 0)
            {
                FakeRoleManager.ProcessDelFakeRole(fakeRoleID, false);
            }
        }
コード例 #8
0
        public void ProcessQueue()
        {
            long nowTicks = TimeUtil.NOW();
            List <LiXianGuaJiRoleItem> LiXianGuaJiRoleItems = LiXianGuaJiManager.GetLiXianGuaJiRoleItemList();

            for (int i = 0; i < LiXianGuaJiRoleItems.Count; i++)
            {
                this.DoSpriteMeditateTime(LiXianGuaJiRoleItems[i]);
                if (LiXianGuaJiRoleItems[i].MeditateTime + LiXianGuaJiRoleItems[i].NotSafeMeditateTime >= 43200000)
                {
                    LiXianGuaJiManager.SaveDBLiXianGuaJiTimeForRole(LiXianGuaJiRoleItems[i]);
                    LiXianGuaJiManager.RemoveLiXianGuaJiRole(LiXianGuaJiRoleItems[i].RoleID);
                    if (LiXianGuaJiRoleItems[i].FakeRoleID > 0)
                    {
                        FakeRoleManager.ProcessDelFakeRole(LiXianGuaJiRoleItems[i].FakeRoleID, false);
                    }
                }
            }
        }
コード例 #9
0
        public static bool DelFakeRoleByClient(GameClient client)
        {
            int fakeRoleID = -1;
            LiXianGuaJiRoleItem liXianGuaJiRoleItem = null;

            lock (LiXianGuaJiManager._LiXianRoleInfoDict)
            {
                if (!LiXianGuaJiManager._LiXianRoleInfoDict.TryGetValue(client.ClientData.RoleID, out liXianGuaJiRoleItem))
                {
                    return(false);
                }
                fakeRoleID = liXianGuaJiRoleItem.FakeRoleID;
            }
            if (fakeRoleID > 0)
            {
                FakeRoleManager.ProcessDelFakeRole(fakeRoleID, false);
            }
            return(true);
        }
コード例 #10
0
        public void RegisterTest()
        {
            UserManager <AppUser>      um  = new FakeUserManager();
            SignInManager <AppUser>    sim = new FakeSignInManager();
            Mock <IUnitOfWork>         uow = new Mock <IUnitOfWork>();
            RoleManager <IdentityRole> rm  = new FakeRoleManager();
            AuthController             AC  = new AuthController(um, sim, uow.Object, rm);

            var result = AC.Register() as ViewResult;

            result.Should().NotBeNull();

            var result2 = AC.Register(fakeRVM).Result;

            result2.Should().NotBeNull();
            fakeRVM.Name = "another";
            result2      = AC.Register(fakeRVM).Result;
            result2.Should().NotBeNull();
        }
コード例 #11
0
        public async Task TestBaseMock_Ok()
        {
            var mockLogger  = new Mock <ILogger <UserService> >();
            var dbcontext   = TestHelpers.DbContext();
            var context     = TestHelpers.Context(Guid.NewGuid(), "Admin", new string[] { UserRol.AdminRol });
            var userManager = new FakeUserManager(new UserStore <UserApp, UserRol, ApiDbContext, Guid>(dbcontext));
            var roleManager = new FakeRoleManager(new RoleStore <UserRol, ApiDbContext, Guid>(dbcontext));

            var signManager = new FakeSignInManager(userManager, roleManager, TestHelpers.Options(), context.Object);

            ApiDbContext.SeedData(userManager, roleManager);

            var userservice = new UserService(GetIConfigurationRoot(), userManager, signManager, _mockRepo.Object, context.Object, mockLogger.Object);

            LoginController login = new LoginController(userservice);
            // Probamos a loguearnos, que como tenemos generado el falso usuario dara el Ok
            var loginResult = await login.Authenticate(new LoginRequest
            {
                Username = "******",
                Password = "******"
            });

            // Assert
            Assert.IsType <OkObjectResult>(loginResult);

            UserController controller = new UserController(userservice);
            // Probamos a añadir el usuario, que como esta moqueado dará el Ok tambien
            var result = await controller.Post(new UserAPI
            {
                Username = "******",
                Password = "******"
            });

            Assert.IsAssignableFrom <ObjectResult>(result);

            var objectResponse = result as ObjectResult;

            Assert.Equal(200, objectResponse.StatusCode);
        }
コード例 #12
0
 public void Setup()
 {
     _roleManager = new FakeRoleManager();
     _handler     = new Logic.Roles.List.Handler(_roleManager);
 }
コード例 #13
0
        /// <summary>
        /// 获取敌人位置
        /// </summary>
        /// <param name="enemyID"></param>
        /// <param name="enemyX"></param>
        /// <param name="enemyY"></param>
        /// <returns></returns>
        private static bool GetEnemyPos(int mapCode, int enemyID, out Point pos)
        {
            bool ret = false;

            pos = new Point(0, 0);

            //根据敌人ID判断对方是系统爆的怪还是其他玩家
            GSpriteTypes st = Global.GetSpriteType((UInt32)enemyID);

            if (st == GSpriteTypes.Monster)
            {
                Monster monster = GameManager.MonsterMgr.FindMonster(mapCode, enemyID);
                if (null != monster)
                {
                    ret = true;
                    pos = new Point(monster.SafeCoordinate.X, monster.SafeCoordinate.Y);
                }
            }
            else if (st == GSpriteTypes.Pet)
            {
                ;//
            }
            else if (st == GSpriteTypes.BiaoChe)
            {
                BiaoCheItem biaoCheItem = BiaoCheManager.FindBiaoCheByID(enemyID);
                if (null != biaoCheItem)
                {
                    ret = true;
                    pos = new Point(biaoCheItem.PosX, biaoCheItem.PosY);
                }
                else //如果是宠物
                {
                    ;//
                }
            }
            else if (st == GSpriteTypes.JunQi)
            {
                JunQiItem junQiItem = JunQiManager.FindJunQiByID(enemyID);
                if (null != junQiItem)
                {
                    ret = true;
                    pos = new Point(junQiItem.PosX, junQiItem.PosY);
                }
                else //如果是宠物
                {
                    ;//
                }
            }
            else if (st == GSpriteTypes.FakeRole)
            {
                FakeRoleItem fakeRoleItem = FakeRoleManager.FindFakeRoleByID(enemyID);
                if (null != fakeRoleItem)
                {
                    ret = true;
                    pos = new Point(fakeRoleItem.MyRoleDataMini.PosX, fakeRoleItem.MyRoleDataMini.PosY);
                }
                else //如果是宠物
                {
                    ;//
                }
            }
            else
            {
                GameClient client = GameManager.ClientMgr.FindClient(enemyID);
                if (null != client)
                {
                    ret = true;
                    pos = new Point(client.ClientData.PosX, client.ClientData.PosY);
                }
            }

            return(ret);
        }