public void AddWorldTest() { BaseWorld world = null; // TODO: 初始化为适当的值 OneServer.AddWorld(world); Assert.Inconclusive("无法验证不返回值的方法。"); }
public void StartCheckAllAliveTimeTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 target.StartCheckAllAliveTime(); Assert.Inconclusive("无法验证不返回值的方法。"); }
public void FlushAllTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 target.FlushAll(); Assert.Inconclusive("无法验证不返回值的方法。"); }
public void ProcessDisposedTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 target.ProcessDisposed(); Assert.Inconclusive("无法验证不返回值的方法。"); }
public void OnExitTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 target.OnExit(); Assert.Inconclusive("无法验证不返回值的方法。"); }
public void LoadSeasonTextures() { if (!string.IsNullOrEmpty(SeasonColorTexture)) { Textures = Textures.Select(t => BaseWorld.GetSeasonTexture(TextureManager.GetTexture(Path.Combine("Textures", "Seasons", SeasonColorTexture)), t)).ToArray(); } }
/// <summary> /// /// </summary> internal WorldWaitExecute( BaseWorld world ) { if ( world == null ) throw new Exception( "WorldWaitExecute.WorldWaitExecute(...) - world == null error!" ); m_World = world; }
public void BaseWorldEventArgsConstructorTest() { BaseWorld baseWorld = null; // TODO: 初始化为适当的值 BaseWorldEventArgs target = new BaseWorldEventArgs(baseWorld); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
public void WorldInitSuccessTest() { List <EntityData> entities = new List <EntityData>(); entities.Add(new EntityData("TestEntityType", "GameUtilities.Entities.BaseEntity,GameUtilities")); WorldData data = new WorldData("TEST", "TEST", entities); target = new BaseWorld(data); obj = new PrivateObject(target); logger = new LoggerUtility("logger"); obj.SetFieldOrProperty("mLogger", logger); Mock <IExecutableContext> contextMock = new Mock <IExecutableContext>(); Mock <IMessageRouter> routerMock = new Mock <IMessageRouter>(); ConfigManager config = new ConfigManager(); config.Init(".\\TestConfig\\"); contextMock.Setup(f => f.MessageRouter).Returns(routerMock.Object); contextMock.Setup(f => f.ConfigManager).Returns(config); target.Init(contextMock.Object); Assert.IsTrue(logger.ErrorMessages.Count == 0); List <IEntity> entList = (List <IEntity>)obj.GetFieldOrProperty("EntityList"); Dictionary <string, IEntity> EntityIdDictionary = (Dictionary <string, IEntity>)obj.GetFieldOrProperty("EntityIdDictionary"); Assert.AreEqual(1, entList.Count); Assert.AreEqual(1, EntityIdDictionary.Keys.Count); }
public void StopThreadPoolTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 target.StopThreadPool(); Assert.Inconclusive("无法验证不返回值的方法。"); }
public void WorldWaitExecuteConstructorTest() { BaseWorld world = null; // TODO: 初始化为适当的值 WorldWaitExecute target = new WorldWaitExecute(world); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
public void SetWorldSignalTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 target.SetWorldSignal(); Assert.Inconclusive("无法验证不返回值的方法。"); }
public void SliceTest() { BaseWorld world = null; // TODO: 初始化为适当的值 WorldWaitExecute target = new WorldWaitExecute(world); // TODO: 初始化为适当的值 target.Slice(); Assert.Inconclusive("无法验证不返回值的方法。"); }
public void OnHandleComponentMessageTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 ComponentMessage componentMessage = new ComponentMessage(); // TODO: 初始化为适当的值 target.OnHandleComponentMessage(componentMessage); Assert.Inconclusive("无法验证不返回值的方法。"); }
public void DisposedNetStatesTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 NetState netSatate = null; // TODO: 初始化为适当的值 target.DisposedNetStates(netSatate); Assert.Inconclusive("无法验证不返回值的方法。"); }
public void AddMessagePumpTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 MessagePump messagePump = null; // TODO: 初始化为适当的值 target.AddMessagePump(messagePump); Assert.Inconclusive("无法验证不返回值的方法。"); }
public void SavingTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 bool actual; actual = target.Saving; Assert.Inconclusive("验证此测试方法的正确性。"); }
public void WaitExecuteTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 WorldWaitExecute actual; actual = target.WaitExecute; Assert.Inconclusive("验证此测试方法的正确性。"); }
public void NetStateManagerTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 NetStateManager actual; actual = target.NetStateManager; Assert.Inconclusive("验证此测试方法的正确性。"); }
public void SliceUpdateTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 SliceUpdate <ISupportSlice> actual; actual = target.SliceUpdate; Assert.Inconclusive("验证此测试方法的正确性。"); }
public void StartThreadPoolTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 int maxThreadsAllowed = 0; // TODO: 初始化为适当的值 target.StartThreadPool(maxThreadsAllowed); Assert.Inconclusive("无法验证不返回值的方法。"); }
public void MessagePumpTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 MessagePump[] actual; actual = target.MessagePump; Assert.Inconclusive("验证此测试方法的正确性。"); }
public void BaseWorldTest() { BaseWorld baseWorld = null; // TODO: 初始化为适当的值 BaseWorldEventArgs target = new BaseWorldEventArgs(baseWorld); // TODO: 初始化为适当的值 BaseWorld actual; actual = target.BaseWorld; Assert.Inconclusive("验证此测试方法的正确性。"); }
public CityFoodConsumptionEvent(BaseWorld world, WorldData worldData, float period) : base(world) { _worldData = worldData; _updatePeriod = period; _foodInfos = new List <ResourceInfo>(_worldData.ResourceInfos. Where(x => x.ResourceType == ResourceType.Food)); }
public void WorldTest() { BaseWorld world = null; // TODO: 初始化为适当的值 WorldWaitExecute target = new WorldWaitExecute(world); // TODO: 初始化为适当的值 BaseWorld actual; actual = target.World; Assert.Inconclusive("验证此测试方法的正确性。"); }
public void BroadcastEventArgsConstructorTest() { BaseWorld baseWorld = null; // TODO: 初始化为适当的值 string strText = string.Empty; // TODO: 初始化为适当的值 object state = null; // TODO: 初始化为适当的值 BroadcastEventArgs target = new BroadcastEventArgs(baseWorld, strText, state); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
public void JoinWaitExecuteQueueTest() { BaseWorld world = null; // TODO: 初始化为适当的值 WorldWaitExecute target = new WorldWaitExecute(world); // TODO: 初始化为适当的值 IWaitExecuteInfo waitExecuteInfo = null; // TODO: 初始化为适当的值 target.JoinWaitExecuteQueue(waitExecuteInfo); Assert.Inconclusive("无法验证不返回值的方法。"); }
private void CreateWorldData(BaseWorld world) { // create dummy stockpile var stockpile = _unitFactory.CreateBuilding(_unitFactory. BuildingInfos.First(info => info.Id == "StockpileBlock")); stockpile.SetPosition(Vector3.zero); world.Stockpile.AddStockpileBlock(stockpile as StockpileBlock); }
public void SubScribeComponentMessageTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 ComponentId componentId = new ComponentId(); // TODO: 初始化为适当的值 ComponentMessage componentMessage = new ComponentMessage(); // TODO: 初始化为适当的值 target.SubScribeComponentMessage(componentId, componentMessage); Assert.Inconclusive("无法验证不返回值的方法。"); }
public void BroadcastTest() { BaseWorld target = new BaseWorld(); // TODO: 初始化为适当的值 object state = null; // TODO: 初始化为适当的值 string strText = string.Empty; // TODO: 初始化为适当的值 target.Broadcast(state, strText); Assert.Inconclusive("无法验证不返回值的方法。"); }
private BaseWorld CreateWorld(RelationshipMap relationshipMap) { var world = new BaseWorld(_worldData.WorldInfo, relationshipMap, _worldData.Fireplace.position); //init unit factory _unitFactory.Initialize(world, _worldData); return(world); }
private void GoToSettings() { nextWorld = new SettingsWorld(bloomPostProcess); TransferToNextLevel(); }
private void LoadGame() { GlobalVariables.LoadGame(); nextWorld = new DriveSelectorWorld(bloomPostProcess); TransferToNextLevel(); }
private void ReturnToMainMenu() { nextWorld = new MainMenuWorld(bloomPostProcess); TransferToNextLevel(); }
private void GoToDriveMenu() { nextWorld = new DriveSelectorWorld(bloomPostProcess); GoToNextWorld(); }
private void GoToArmoryOrGameplay() { GlobalVariables.CurrentLevel = announcer.GetSelectedLevel(); LevelData levelData = LevelData.GetNextLevel(); //Go to armory if (!levelData.IsSelectedLevel()) { nextWorld = new ArmoryWorld(bloomPostProcess); } else { //Go to game play levelData.LoadSelectedLevelData(); Dictionary<Type, EnemyData> newViruses = GlobalVariables.GetNewViruses(); if (newViruses.Count > 0) { nextWorld = new VirusNotifierWorld(newViruses, bloomPostProcess); } else { nextWorld = new GameplayWorld(levelData, bloomPostProcess); } } GoToNextWorld(); }
private void ReturnToLevelSelector() { nextWorld = new LevelSelectorWorld(bloomPostProcess); }
private void GoToGamePlay() { Dictionary<Type, EnemyData> newViruses = GlobalVariables.GetNewViruses(); if (newViruses.Count > 0) { nextWorld = new VirusNotifierWorld(newViruses, bloomPostProcess); } else { nextWorld = new GameplayWorld(LevelData.GetNextLevel(), bloomPostProcess); } GoToNextWorld(); }
private void GoToSurvivalWorld() { nextWorld = new SurvivalTypeWorld(bloomPostProcess); GoToNextWorld(); }
private void ReturnToUpgradeMenu() { //TODO: go to the upgrade menu nextWorld = new ArmoryWorld(bloomPostProcess); }
/// <summary> /// /// </summary> /// <param name="baseWorld"></param> public static void RemoveWorld( BaseWorld world ) { if ( world == null ) throw new Exception( "OneServer.RemoveWorld(...) - world == null error!" ); BaseWorld matchWorld = null; s_OnlyLockAddRemove.Enter(); { List<BaseWorld> worldList = new List<BaseWorld>(); foreach ( BaseWorld itemWorld in worldList ) { if ( itemWorld != world ) worldList.Add( itemWorld ); else matchWorld = world; } s_WorldArray = worldList.ToArray(); } s_OnlyLockAddRemove.Exit(); if ( matchWorld != null && s_bIsInitWorld == true ) { // 停止世界线程 matchWorld.StopThreadPool(); // 停止保存数据的时间片 world.StopSaveTimeSlice(); // 停止网络客户端在线状态的检查 world.StopCheckAllAliveTime(); // 在结束世界之前,保存一次数据 matchWorld.OnSave(); matchWorld.OnExit(); } }
/// <summary> /// /// </summary> /// <param name="baseWorld"></param> public static void AddWorld( BaseWorld world ) { if ( world == null ) throw new Exception( "OneServer.AddWorld(...) - world == null error!" ); s_OnlyLockAddRemove.Enter(); { // 创建新的MessagePump数组,添加数据,交换数组数据,不需要锁定,没有引用时自动会回收数据 BaseWorld[] tempWorld = new BaseWorld[s_WorldArray.Length + 1]; for ( int iIndex = 0; iIndex < s_WorldArray.Length; ++iIndex ) tempWorld[iIndex] = s_WorldArray[iIndex]; tempWorld[s_WorldArray.Length] = world; s_WorldArray = tempWorld; } s_OnlyLockAddRemove.Exit(); // 是否已经初始化过World了 if ( s_bIsInitWorld == true ) { // 创建World运行世界的线程 if ( s_ConfigServer.IsChangeWorldThreadCount == true ) world.StartThreadPool( s_ConfigServer.WorldThreadCount ); else world.StartThreadPool( OneServer.ProcessorCount * 2 + 2 ); // 在开始运行世界之前,初始化一次BaseWorld world.OnInitOnce(); // 启动BaseWorld保存数据的时间片 world.StartSaveTimeSlice(); // 初始化网络客户端在线状态的检查 world.StartCheckAllAliveTime(); } }
/// <summary> /// 开始运行主服务架构程序 /// </summary> /// <param name="args"></param> /// <param name="baseWorld"></param> /// <returns></returns> public static bool RunServer( string[] args, BaseWorld world ) { if ( world == null ) throw new Exception( "OneServer.RunServer(...) - world == null error!" ); AddWorld( world ); return InsideRunServer( args == null ? new string[0] : args ); }
private void GoToDriveSelector() { nextWorld = new DriveSelectorWorld(bloomPostProcess); TransferToNextLevel(); }
private void GoToAreaSelector() { nextWorld = new LevelSelectorWorld(bloomPostProcess); GoToNextWorld(); }
private void GoToCredits() { nextWorld = new CreditsWorld(bloomPostProcess); TransferToNextLevel(); }
private void ReturnToArmoryConsole() { nextWorld = new SurvivalArmoryWorld(bloomPostProcess); }
private void GameWin() { GlobalVariables.PlayerScore += GlobalVariables.LevelScore; GlobalVariables.CurrentLevel += 1; GlobalVariables.ClearedLevels += 1; if (GlobalVariables.CurrentLevel <= LevelData.MAX_LEVEL_DRIVE_NUMBER) { GlobalVariables.LockedLevels[(GlobalVariables.CurrentDrive - 1) * LevelData.MAX_LEVEL_DRIVE_NUMBER + GlobalVariables.CurrentLevel - 1] = false; LevelData tempLevelData = LevelData.GetNextLevel(); if (!tempLevelData.IsSelectedLevel()) { nextWorld = new ArmoryWorld(bloomPostProcess); } else { //Go to game play tempLevelData.LoadSelectedLevelData(); Dictionary<Type, EnemyData> newViruses = GlobalVariables.GetNewViruses(); if (newViruses.Count > 0) { nextWorld = new VirusNotifierWorld(newViruses, bloomPostProcess); } else { nextWorld = new GameplayWorld(tempLevelData, bloomPostProcess); } } GoToNextWorld(); } else { GlobalVariables.CurrentLevel = LevelData.MAX_LEVEL_DRIVE_NUMBER; if (GlobalVariables.IsDemoVersion) { nextWorld = new DemoWorld(bloomPostProcess); } else { nextWorld = new EndStoryWorld(bloomPostProcess); } GoToNextWorld(); } }
private void ReturnToMainMenu() { nextWorld = new MainMenuWorld(bloomPostProcess); }
private void GoToSurvivalGamePlay() { nextWorld = new SurvivalGameplayWorld(LevelData.GetSurvivalLevel(), bloomPostProcess); GoToNextWorld(); }
private void GoToMainMenu() { nextWorld = new MainMenuWorld(bloomPostProcess); GoToNextWorld(); }
private void GoToStoryWorld() { GlobalVariables.SurvivalMode = -1; GlobalVariables.CurrentDrive = announcer.GetSelectedDrive(); DriveData.SetDriveBackdrop(GlobalVariables.CurrentDrive); GlobalVariables.CurrentLevel = GlobalVariables.GetLargestLevel(GlobalVariables.CurrentDrive); //Go to Level Selector nextWorld = new StoryWorld(bloomPostProcess); GoToNextWorld(); }
private void GoToSurvivalVirusWorld() { Dictionary<Type, EnemyData> viruses = new Dictionary<Type, EnemyData>(); Dictionary<Type, int> temp = GlobalVariables.AllEnemyTypes; foreach (KeyValuePair<Type, int> item in temp) { viruses.Add(item.Key, GlobalVariables.Data.Enemies[item.Value]); } nextWorld = new SurvivalVirusDatabaseWorld(viruses, bloomPostProcess); GoToNextWorld(); }
private void GoToAchievementWorld() { nextWorld = new AchievementWorld(bloomPostProcess); GoToNextWorld(); }
private void ReturnToDriveConsole() { nextWorld = new DriveSelectorWorld(bloomPostProcess); GoToNextWorld(); }
private void RetryLevel() { nextWorld = new SurvivalGameplayWorld(levelData, bloomPostProcess); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { v = graphics.GraphicsDevice.Viewport; // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); if (firstTry) { currentWorld = worldList[0]; currentWorld.initWorld(); firstTry = false; } else { checkMovement(); } base.Update(gameTime); }