本文整理汇总了C#中Area类的典型用法代码示例。如果您正苦于以下问题:C# Area类的具体用法?C# Area怎么用?C# Area使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Area类属于命名空间,在下文中一共展示了Area类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AreaGenerator
/// <summary>
/// Initializes a new instance of the <see cref="SharpNav.AreaGenerator"/> class.
/// </summary>
/// <param name="verts">collection of Triangles.</param>
/// <param name="triCount">The number of triangles to enumerate..</param>
/// <param name="defaultArea">Default area.</param>
private AreaGenerator(IEnumerable<Triangle3> verts, int triCount, Area defaultArea)
{
this.tris = verts;
this.triCount = triCount;
this.defaultArea = defaultArea;
conditions = new List<Tuple<Func<Triangle3, bool>, Area>>();
}
开发者ID:MaybeMars,项目名称:SharpNav,代码行数:13,代码来源:AreaGenerator.cs
示例2: SetUp
public void SetUp()
{
var placeholder1 = new Placeholder("area 1");
var placeholder2 = new Placeholder("area 2");
var widgetSpecification = new WidgetSpecification("widget");
widgetSpecification.Insert(0, placeholder1);
widgetSpecification.Insert(1, placeholder2);
var area = new Area("area 1");
var widget = new Widget("widget", new[] { area });
var buildContext = new BuildData(Enumerable.Empty<IContextItem>());
var builder = new Builder(RenderingInstructions.BuildForPreview(), w => widgetSpecification, null);
var instance = widget.Build(builder, new[] { 0 }, buildContext);
var rendererFactory = MockRepository.GenerateStub<IRendererFactory>();
this.viewHelper = MockRepository.GenerateStub<IViewHelper>();
var multiRenderer = new MultiRenderer(rendererFactory);
KolaConfigurationRegistry.RegisterRenderer(multiRenderer);
this.result = instance.Render(multiRenderer);
}
开发者ID:mr-sandy,项目名称:kola,代码行数:25,代码来源:WhenRenderingAWidgetWithoutAreasForAllPlaceholders.cs
示例3: NinePatchImage
public NinePatchImage(Texture2D texture)
{
_texture = texture;
XnaColor[] data = new XnaColor[texture.Width * texture.Height];
texture.GetData(data);
Stretch = new Area(
vertical: GetLine(texture, data, 0, 1, 0, 0),
horizontal: GetLine(texture, data, 1, 0, 0, 0));
Content = new Area(
vertical: GetLine(texture, data, 0, 1, _texture.Width - 1, 0),
horizontal: GetLine(texture, data, 1, 0, 0, _texture.Height - 1));
Width = _texture.Width - 2;
Height = _texture.Height - 2;
_leftTop = new XnaRectangle(1, 1, Stretch.Horizontal.Start, Stretch.Vertical.Start);
_leftCenter = new XnaRectangle(1, Stretch.Vertical.Start, Stretch.Horizontal.Start, Stretch.Vertical.Size);
_leftBottom = new XnaRectangle(1, Stretch.Vertical.End, Stretch.Horizontal.Start, texture.Height - 1 - Stretch.Vertical.End);
_centerTop = new XnaRectangle(Stretch.Horizontal.Start, 1, Stretch.Horizontal.Size, Stretch.Vertical.Start);
_center = new XnaRectangle(Stretch.Horizontal.Start, Stretch.Vertical.Start, Stretch.Horizontal.Size, Stretch.Vertical.Size);
_centerBottom = new XnaRectangle(Stretch.Horizontal.Start, Stretch.Vertical.End, Stretch.Horizontal.Size, texture.Height - 1 - Stretch.Vertical.End);
_rightTop = new XnaRectangle(Stretch.Horizontal.End, 1, texture.Width - 1 - Stretch.Horizontal.End, Stretch.Vertical.Start);
_rightCenter = new XnaRectangle(Stretch.Horizontal.End, Stretch.Vertical.Start, texture.Width - 1 - Stretch.Horizontal.End, Stretch.Vertical.Size);
_rightBottom = new XnaRectangle(Stretch.Horizontal.End, Stretch.Vertical.End, texture.Width - 1 - Stretch.Horizontal.End, texture.Height - 1 - Stretch.Vertical.End);
}
开发者ID:powerdude,项目名称:xamarin-forms-xna,代码行数:25,代码来源:NinePatchImage.cs
示例4: GenerateMinThresholdInRegion
public void GenerateMinThresholdInRegion(Area region, float minThreshold, float strength)
{
lastMinThreshold = minThreshold;
int x_min = region.botLeft.x;
int z_min = region.botLeft.z;
int x_max = region.topRight.x;
int z_max = region.topRight.z;
for (int x = x_min; x < x_max; x++)
{
for (int z = z_min; z < z_max; z++)
{
if (!globalMinThresholdC.IsDefined(x, z))
{
float height = lt.gt.GetHeight(x, z);
if (height < minThreshold)
{
fg.SetGlobalValue(x, z, -Mathf.Log(Mathf.Abs(height - minThreshold)+1, strength), false, globalMinThresholdC);
}
}
}
}
}
开发者ID:ja003,项目名称:Fractal-Nature-II,代码行数:26,代码来源:ThresholdFilter.cs
示例5: Wander
public Wander(Entity o, IWorld map)
: base(o)
{
WorldMap = map;
curDest = WorldMap.GetArea(random.Next(10), random.Next(10));
}
开发者ID:Twistie,项目名称:Tick,代码行数:7,代码来源:Wander.cs
示例6: DoAreaSelector
// RimWorld.AreaAllowedGUI
private static void DoAreaSelector( Rect rect, ref Area areaAllowed, Area area )
{
rect = rect.ContractedBy( 1f );
GUI.DrawTexture( rect, area == null ? BaseContent.GreyTex : area.ColorTexture );
Text.Anchor = TextAnchor.MiddleLeft;
string text = AreaUtility.AreaAllowedLabel_Area( area );
Rect rect2 = rect;
rect2.xMin += 3f;
rect2.yMin += 2f;
Widgets.Label( rect2, text );
if ( areaAllowed == area )
{
Widgets.DrawBox( rect, 2 );
}
if ( Mouse.IsOver( rect ) )
{
if ( area != null )
{
area.MarkForDraw();
}
if ( Input.GetMouseButton( 0 ) &&
areaAllowed != area )
{
areaAllowed = area;
SoundDefOf.DesignateDragStandardChanged.PlayOneShotOnCamera();
}
}
TooltipHandler.TipRegion( rect, text );
}
开发者ID:Reflexial,项目名称:Hardcore-SK,代码行数:30,代码来源:AreaAllowedGUI.cs
示例7: Render
public Color[,] Render(Size resolution, Area viewPort)
{
_log.InfoFormat("Starting to render ({0:N0}x{1:N0})", resolution.Width, resolution.Height);
viewPort.LogViewport();
var output = new Color[resolution.Width, resolution.Height];
_log.Debug("Rendering points");
var allPointsWithEscapeTimes =
resolution
.GetAllPoints()
.AsParallel()
.WithDegreeOfParallelism(GlobalArguments.DegreesOfParallelism)
.Select(p => Tuple.Create(p, PickColor(FindEscapeTime(viewPort.GetNumberFromPoint(resolution, p)))))
.AsEnumerable();
foreach (var result in allPointsWithEscapeTimes)
{
output[result.Item1.X, result.Item1.Y] = result.Item2;
}
return output;
}
开发者ID:ajalexander,项目名称:Fractals,代码行数:25,代码来源:MandelbrotEscapeRendererFancy.cs
示例8: Up
public override void Up()
{
var ccb = new Area
{
Nome = "CCB",
Ativo = true,
Abreviacao = "CCB",
Parent = null,
Segura = false
}.Persistir();
var administrador = new Perfil
{
Nome = "Administrador",
Ativo = true
}.Persistir();
new Usuario
{
Area = ccb,
Perfil = administrador,
Senha = new HashString().Do("pwd123"),
Login = "admin",
Nome = "Administrador do sistema",
Email = "[email protected]",
Ativo = true,
Expira = false
}.Persistir();
}
开发者ID:tbrito,项目名称:salus,代码行数:29,代码来源:301602121709_CriaUserAdmin.cs
示例9: Crear
public virtual JsonResult Crear(Area entidad)
{
var jsonResponse = new JsonResponse { Success = false };
if (ModelState.IsValid)
{
try
{
entidad.UsuarioCreacion = UsuarioActual.IdUsuario.ToString();
entidad.UsuarioModificacion = UsuarioActual.IdUsuario.ToString();
AreaBL.Instancia.Add(entidad);
jsonResponse.Success = true;
jsonResponse.Message = "Se Proceso con éxito";
}
catch (Exception ex)
{
logger.Error(string.Format("Mensaje: {0} Trace: {1}", ex.Message, ex.StackTrace));
jsonResponse.Message = "Ocurrio un error, por favor intente de nuevo o más tarde.";
}
}
else
{
jsonResponse.Message = "Por favor ingrese todos los campos requeridos";
}
return Json(jsonResponse, JsonRequestBehavior.AllowGet);
}
开发者ID:JolevqSAC,项目名称:Interv2,代码行数:27,代码来源:AreaController.cs
示例10: SetArea
public void SetArea(Area area)
{
var adjs =
from a in area.Adjacent
where a.Province == area.Province
select a;
this.SuspendLayout();
{
int btm = 35;
foreach (var a in adjs)
{
btm += 23;
var button = new Button {
Text = a.Name,
Dock = DockStyle.Top,
Tag = a
};
button.Click += this.ButtonClick;
this.Controls.Add(button);
}
this.Controls.Remove(_label);
this.Controls.Add(_label);
this.ClientSize = new Size(this.ClientSize.Width, btm);
}
this.ResumeLayout();
}
开发者ID:ProjectTane,项目名称:FarenDotNet,代码行数:26,代码来源:MoveAreaCandidateWindow.cs
示例11: Import
public int Import(string UPICode, string AreaName, string Description, int RegionId)
{
try
{
if (CheckExistedArea(AreaName) == false)
{
Area o = new Area();
o.UpiCode = UPICode;
o.AreaName = AreaName;
o.Description = Description;
o.RegionId = RegionId;
db.Areas.InsertOnSubmit(o);
db.SubmitChanges();
return o.Id;
}
var area = (from a in db.Areas where a.AreaName == AreaName select a).SingleOrDefault();
if (area != null) return area.Id;
return -1;
}
catch
{
return -1;
}
}
开发者ID:groshugo,项目名称:unitedpharma,代码行数:27,代码来源:AreasRepository.cs
示例12: ReloadWithSeat
public Area ReloadWithSeat(Area area, out IEnumerable<IArrangeSeatRule> availableOrganizations)
{
var result = _areaRepository.Get(area.Id);
var exists = _areaRepository.GetOrganizationSeatingArea(area.Id).ToDictionary(o => o.Object);
var all = new List<IArrangeSeatRule>();
var defaultTargetSeat = result.Seats.FirstOrDefault();
foreach (var item in ((Campaign)result.Campaign).Organizations)
{
if (exists.ContainsKey(item))
{
all.Add(exists[item]);
}
else
{
var o = defaultTargetSeat == null ? null : _entityFactory.Create<OrganizationSeatingArea>(new Dictionary<string, object> { { "Area", result }, { "Object", item }, { "TargetSeat", defaultTargetSeat } });
if (o != null)
{
_areaRepository.MakePersistent(o);
all.Add(o);
}
}
}
availableOrganizations = all.ToRebuildPriorityList<IArrangeSeatRule, IArrangeSeatRule>(true, null);
return result;
}
开发者ID:Mrding,项目名称:Ribbon,代码行数:30,代码来源:SeatingPrioritySetupModel.cs
示例13: PointToNumberToPointTest
public void PointToNumberToPointTest()
{
const int xRange = 500;
const int yRange = 500;
var resolution = new Size(xRange * 2, yRange * 2);
const int xLower = -1 * xRange;
const int xUpper = xRange;
const int yLower = -1 * yRange;
const int yUpper = yRange;
var area = new Area(new InclusiveRange(xLower, xUpper), new InclusiveRange(yLower, yUpper));
for (int x = xLower; x < xUpper; x++)
{
for (int y = yLower; y < yUpper; y++)
{
var point = new Point(x, y);
var calculatedNumber = area.GetNumberFromPoint(resolution, point);
var calculatedPoint = area.GetPointFromNumber(resolution, calculatedNumber);
Assert.AreEqual(point, calculatedPoint);
}
}
}
开发者ID:ajalexander,项目名称:Fractals,代码行数:26,代码来源:AreaTests.cs
示例14: InitRoutine
public bool InitRoutine(Area area)
{
this.area = area;
ArrayList possibleRoutines = new ArrayList();
if (canWalk){
possibleRoutines.Add(new GenericWanderAction(gameObject, area.wanderWaypointParent));
}
if (canSitOnChair && area.chairParent != null){
possibleRoutines.Add(new GenericSitAction(gameObject, "chair", "sit_chair", area.chairParent));
}
if (canEat && area.chairParent != null){
possibleRoutines.Add(new GenericSitAction(gameObject, "chair", "eat", area.chairParent));
}
if (canSitOnLounger && area.loungerParent != null){
possibleRoutines.Add(new GenericSitAction(gameObject, "lounger", "sit_lounger", area.loungerParent));
}
if (canSitOnDeckChair && area.deckChairParent != null){
possibleRoutines.Add(new GenericSitAction(gameObject, "deck_chair", "sit_deck_chair", area.deckChairParent));
}
if (canDance && area.name.Equals("Disco")){
// possibleRoutines.Add(new GenericDanceAction());
}
if (possibleRoutines.Count == 0){
routine = new GenericSelfDestructAction(gameObject);
return false;
} else {
routine = (Action)possibleRoutines[Random.Range(0, possibleRoutines.Count)];
//Debug.Log("Chosen routine: " + routine + " for " + name);
return true;
}
}
开发者ID:kiichi7,项目名称:Lies_and_Seductions,代码行数:31,代码来源:RoutineCreatorGeneric.cs
示例15: DoNotApplyDoorLocationToRoomDoors
public void DoNotApplyDoorLocationToRoomDoors()
{
var areaFromHall = new Area();
areaFromHall.Type = "area type";
areaFromHall.Width = 1;
mockAreaPercentileSelector.Setup(s => s.SelectFrom(TableNameConstants.DungeonAreaFromDoor)).Returns(areaFromHall);
var mockAreaGenerator = new Mock<AreaGenerator>();
mockAreaGeneratorFactory.Setup(f => f.HasSpecificGenerator("area type")).Returns(true);
mockAreaGeneratorFactory.Setup(f => f.Build("area type")).Returns(mockAreaGenerator.Object);
var specificArea = new Area();
var otherSpecificArea = new Area { Type = AreaTypeConstants.Door };
otherSpecificArea.Descriptions = new[] { "strong", "wood" };
mockAreaGenerator.Setup(g => g.Generate(9266, 90210, "temperature")).Returns(new[] { specificArea, otherSpecificArea });
var areas = dungeonGenerator.GenerateFromDoor(9266, 90210, "temperature");
Assert.That(areas, Contains.Item(specificArea));
Assert.That(areas, Contains.Item(otherSpecificArea));
Assert.That(areas.Count(), Is.EqualTo(2));
var last = areas.Last();
Assert.That(last, Is.EqualTo(otherSpecificArea));
Assert.That(otherSpecificArea.Descriptions, Contains.Item("strong"));
Assert.That(otherSpecificArea.Descriptions, Contains.Item("wood"));
Assert.That(otherSpecificArea.Descriptions.Count(), Is.EqualTo(2));
}
开发者ID:DnDGen,项目名称:DungeonGen,代码行数:29,代码来源:DungeonGeneratorTests.cs
示例16: DeleteAreaAuthorization
ObjectModMeta DeleteAreaAuthorization(Area obj)
{
var meta = SetModDetailsOnPrincipalAndStopModIfNegativeReputationAndReturnObjectModMeta(obj);
if (obj.Type == CfType.Province)
{
//-- Would be good to move this out of the method? W.I.F.??
if (!currentUser.IsGodUser) { throw new AccessViolationException("DeleteArea: Only god users can delete provinces."); }
}
if (meta.CQR > 7 && !currentUser.IsInRole("ModAdmin"))
{
throw new AccessViolationException("DeleteArea: Only Admin Moderators can delete places with CQR higher than 7");
}
else if (meta.CQR > 1 && !currentUser.IsInRole("ModAdmin,ModSenior"))
{
throw new AccessViolationException("DeleteArea: Only Senior Moderators can delete places with CQR higher than 1");
}
else if (!currentUser.IsInRole("ModAdmin,ModSenior,ModCommunity"))
{
throw new AccessViolationException("DeleteArea: You must be Moderator to delete places");
}
return meta;
}
开发者ID:jkresner,项目名称:Climbfind_v4_2011,代码行数:25,代码来源:GeoService.Areas.Authorization.cs
示例17: DoAllowedAreaSelectors
public static Area DoAllowedAreaSelectors( Rect rect, Area areaIn,
AllowedAreaMode mode = AllowedAreaMode.Humanlike, float lrMargin = 0 )
{
Area areaIO = areaIn;
DoAllowedAreaSelectors( rect, ref areaIO, mode, lrMargin );
return areaIO;
}
开发者ID:Reflexial,项目名称:Hardcore-SK,代码行数:7,代码来源:AreaAllowedGUI.cs
示例18: AreaRange_Range_NineRepeated
public void AreaRange_Range_NineRepeated()
{
Area<string> Area = new Area<string>("a", 99999999999L);
Assert.AreEqual("a", Area.Id);
Assert.AreEqual(0.99999999999m, Area.Start);
Assert.AreEqual(1m, Area.End);
}
开发者ID:gsimion,项目名称:AreaDestination,代码行数:7,代码来源:RangeTest.cs
示例19: AreaRegion
public AreaRegion(Area area, MathMLElement element, float x, float y)
{
this.Area = area;
this.Element = element;
this.X = x;
this.Y = y;
}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:7,代码来源:AreaRegion.cs
示例20: AreaRange_Range_Zero
public void AreaRange_Range_Zero()
{
Area<string> Area = new Area<string>("a", 0);
Assert.AreEqual("a", Area.Id);
Assert.AreEqual(0m, Area.Start);
Assert.AreEqual(0.1m, Area.End);
}
开发者ID:gsimion,项目名称:AreaDestination,代码行数:7,代码来源:RangeTest.cs
注:本文中的Area类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论