public void ActivateSpaceNodeEventArgsConstructorTest() { MapSpaceNode mapSpaceNode = null; // TODO: 初始化为适当的值 ActivateSpaceNodeEventArgs target = new ActivateSpaceNodeEventArgs(mapSpaceNode); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
protected virtual void OnActivate() { if (this.EventActivateSpaceNode != null) { ActivateSpaceNodeEventArgs eventArgs = new ActivateSpaceNodeEventArgs(this); this.EventActivateSpaceNode(this, eventArgs); } }
public void ActivateSpaceNodeTest() { IPartitionSpaceNode target = CreateIPartitionSpaceNode(); // TODO: 初始化为适当的值 object sender = null; // TODO: 初始化为适当的值 ActivateSpaceNodeEventArgs eventArgs = null; // TODO: 初始化为适当的值 target.ActivateSpaceNode(sender, eventArgs); Assert.Inconclusive("无法验证不返回值的方法。"); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> public void ActivateSpaceNode(object sender, ActivateSpaceNodeEventArgs eventArgs) { MapSpaceNode mapSpaceNode = eventArgs.SpaceNode; Debug.Assert(mapSpaceNode != null, "PartitionSpaceStrategy.ActivateSpaceNode(...) - mapSpaceNode == null error!"); MapSpaceNode parentMapSpaceNode = mapSpaceNode.Parent; Debug.Assert(parentMapSpaceNode != null, "PartitionSpaceStrategy.ActivateSpaceNode(...) - parentMapSpaceNode == null error!"); ReaderWriterLockSlimEx.EnterWriteLock(m_LockAllSpaceNodes); { // 激活自己 this.ActivateSelfSpaceNode(mapSpaceNode); int iGridCellPointX = parentMapSpaceNode.RankIndex.Rank0Index * MAX_NUMBER_OF_CELLS; int iGridCellPointY = parentMapSpaceNode.RankIndex.Rank1Index * MAX_NUMBER_OF_CELLS; // ActivateSpaceNode1 MapSpaceNode subSpaceNode1 = this.GetSubSpaceNode(iGridCellPointX + mapSpaceNode.RankIndex.Rank0Index - 1, iGridCellPointY + mapSpaceNode.RankIndex.Rank1Index - 1, mapSpaceNode.Owner); if (subSpaceNode1 != null) { this.ActivateNearSpaceNode(subSpaceNode1); } // ActivateSpaceNode2 MapSpaceNode subSpaceNode2 = this.GetSubSpaceNode(iGridCellPointX + mapSpaceNode.RankIndex.Rank0Index, iGridCellPointY + mapSpaceNode.RankIndex.Rank1Index - 1, mapSpaceNode.Owner); if (subSpaceNode2 != null) { this.ActivateNearSpaceNode(subSpaceNode2); } // ActivateSpaceNode3 MapSpaceNode subSpaceNode3 = this.GetSubSpaceNode(iGridCellPointX + mapSpaceNode.RankIndex.Rank0Index + 1, iGridCellPointY + mapSpaceNode.RankIndex.Rank1Index - 1, mapSpaceNode.Owner); if (subSpaceNode3 != null) { this.ActivateNearSpaceNode(subSpaceNode3); } // ActivateSpaceNode4 MapSpaceNode subSpaceNode4 = this.GetSubSpaceNode(iGridCellPointX + mapSpaceNode.RankIndex.Rank0Index - 1, iGridCellPointY + mapSpaceNode.RankIndex.Rank1Index, mapSpaceNode.Owner); if (subSpaceNode4 != null) { this.ActivateNearSpaceNode(subSpaceNode4); } // ActivateSpaceNode5 == SelfSpaceNode // ActivateSpaceNode6 MapSpaceNode subSpaceNode6 = this.GetSubSpaceNode(iGridCellPointX + mapSpaceNode.RankIndex.Rank0Index + 1, iGridCellPointY + mapSpaceNode.RankIndex.Rank1Index, mapSpaceNode.Owner); if (subSpaceNode6 != null) { this.ActivateNearSpaceNode(subSpaceNode6); } // ActivateSpaceNode7 MapSpaceNode subSpaceNode7 = this.GetSubSpaceNode(iGridCellPointX + mapSpaceNode.RankIndex.Rank0Index - 1, iGridCellPointY + mapSpaceNode.RankIndex.Rank1Index + 1, mapSpaceNode.Owner); if (subSpaceNode7 != null) { this.ActivateNearSpaceNode(subSpaceNode7); } // ActivateSpaceNode8 MapSpaceNode subSpaceNode8 = this.GetSubSpaceNode(iGridCellPointX + mapSpaceNode.RankIndex.Rank0Index, iGridCellPointY + mapSpaceNode.RankIndex.Rank1Index + 1, mapSpaceNode.Owner); if (subSpaceNode8 != null) { this.ActivateNearSpaceNode(subSpaceNode8); } // ActivateSpaceNode9 MapSpaceNode subSpaceNode9 = this.GetSubSpaceNode(iGridCellPointX + mapSpaceNode.RankIndex.Rank0Index + 1, iGridCellPointY + mapSpaceNode.RankIndex.Rank1Index + 1, mapSpaceNode.Owner); if (subSpaceNode9 != null) { this.ActivateNearSpaceNode(subSpaceNode9); } } ReaderWriterLockSlimEx.ExitWriteLock(m_LockAllSpaceNodes); }
public void ActivateSpaceNodeEventArgsConstructorTest() { MapSpaceNode mapSpaceNode = null; // TODO: 初始化为适当的值 ActivateSpaceNodeEventArgs target = new ActivateSpaceNodeEventArgs( mapSpaceNode ); Assert.Inconclusive( "TODO: 实现用来验证目标的代码" ); }
protected virtual void OnActivate() { if ( this.EventActivateSpaceNode != null ) { ActivateSpaceNodeEventArgs eventArgs = new ActivateSpaceNodeEventArgs( this ); this.EventActivateSpaceNode( this, eventArgs ); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> public void ActivateSpaceNode( object sender, ActivateSpaceNodeEventArgs eventArgs ) { MapSpaceNode mapSpaceNode = eventArgs.SpaceNode; Debug.Assert( mapSpaceNode != null, "PartitionSpaceStrategy.ActivateSpaceNode(...) - mapSpaceNode == null error!" ); MapSpaceNode parentMapSpaceNode = mapSpaceNode.Parent; Debug.Assert( parentMapSpaceNode != null, "PartitionSpaceStrategy.ActivateSpaceNode(...) - parentMapSpaceNode == null error!" ); ReaderWriterLockSlimEx.EnterWriteLock( m_LockAllSpaceNodes ); { // 激活自己 this.ActivateSelfSpaceNode( mapSpaceNode ); int iGridCellPointX = parentMapSpaceNode.RankIndex.Rank0Index * MAX_NUMBER_OF_CELLS; int iGridCellPointY = parentMapSpaceNode.RankIndex.Rank1Index * MAX_NUMBER_OF_CELLS; // ActivateSpaceNode1 MapSpaceNode subSpaceNode1 = this.GetSubSpaceNode( iGridCellPointX + mapSpaceNode.RankIndex.Rank0Index - 1, iGridCellPointY + mapSpaceNode.RankIndex.Rank1Index - 1, mapSpaceNode.Owner ); if ( subSpaceNode1 != null ) this.ActivateNearSpaceNode( subSpaceNode1 ); // ActivateSpaceNode2 MapSpaceNode subSpaceNode2 = this.GetSubSpaceNode( iGridCellPointX + mapSpaceNode.RankIndex.Rank0Index, iGridCellPointY + mapSpaceNode.RankIndex.Rank1Index - 1, mapSpaceNode.Owner ); if ( subSpaceNode2 != null ) this.ActivateNearSpaceNode( subSpaceNode2 ); // ActivateSpaceNode3 MapSpaceNode subSpaceNode3 = this.GetSubSpaceNode( iGridCellPointX + mapSpaceNode.RankIndex.Rank0Index + 1, iGridCellPointY + mapSpaceNode.RankIndex.Rank1Index - 1, mapSpaceNode.Owner ); if ( subSpaceNode3 != null ) this.ActivateNearSpaceNode( subSpaceNode3 ); // ActivateSpaceNode4 MapSpaceNode subSpaceNode4 = this.GetSubSpaceNode( iGridCellPointX + mapSpaceNode.RankIndex.Rank0Index - 1, iGridCellPointY + mapSpaceNode.RankIndex.Rank1Index, mapSpaceNode.Owner ); if ( subSpaceNode4 != null ) this.ActivateNearSpaceNode( subSpaceNode4 ); // ActivateSpaceNode5 == SelfSpaceNode // ActivateSpaceNode6 MapSpaceNode subSpaceNode6 = this.GetSubSpaceNode( iGridCellPointX + mapSpaceNode.RankIndex.Rank0Index + 1, iGridCellPointY + mapSpaceNode.RankIndex.Rank1Index, mapSpaceNode.Owner ); if ( subSpaceNode6 != null ) this.ActivateNearSpaceNode( subSpaceNode6 ); // ActivateSpaceNode7 MapSpaceNode subSpaceNode7 = this.GetSubSpaceNode( iGridCellPointX + mapSpaceNode.RankIndex.Rank0Index - 1, iGridCellPointY + mapSpaceNode.RankIndex.Rank1Index + 1, mapSpaceNode.Owner ); if ( subSpaceNode7 != null ) this.ActivateNearSpaceNode( subSpaceNode7 ); // ActivateSpaceNode8 MapSpaceNode subSpaceNode8 = this.GetSubSpaceNode( iGridCellPointX + mapSpaceNode.RankIndex.Rank0Index, iGridCellPointY + mapSpaceNode.RankIndex.Rank1Index + 1, mapSpaceNode.Owner ); if ( subSpaceNode8 != null ) this.ActivateNearSpaceNode( subSpaceNode8 ); // ActivateSpaceNode9 MapSpaceNode subSpaceNode9 = this.GetSubSpaceNode( iGridCellPointX + mapSpaceNode.RankIndex.Rank0Index + 1, iGridCellPointY + mapSpaceNode.RankIndex.Rank1Index + 1, mapSpaceNode.Owner ); if ( subSpaceNode9 != null ) this.ActivateNearSpaceNode( subSpaceNode9 ); } ReaderWriterLockSlimEx.ExitWriteLock( m_LockAllSpaceNodes ); }