本文整理汇总了C#中VectorLine.MakeRect方法的典型用法代码示例。如果您正苦于以下问题:C# VectorLine.MakeRect方法的具体用法?C# VectorLine.MakeRect怎么用?C# VectorLine.MakeRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VectorLine
的用法示例。
在下文中一共展示了VectorLine.MakeRect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRect
/// <summary>
/// 绘制矩形
/// </summary>
private void CreateRect(float posX, float posY, float width, float height, Color color)
{
VectorLine squareLine = new VectorLine ("Square", new Vector2[8], null, 1.0f, LineType.Discrete, Joins.Weld);
squareLine.MakeRect (new Rect (posX, posY, width, height));
squareLine.SetColor (color);
squareLine.Draw ();
}
示例2: DrawCells
/// <summary>
/// Draw cells for debugging purposes only
/// </summary>
/// <param name="cells">Cells.</param>
private void DrawCells(List<Cell> cells)
{
// Calculate point count for Discrete type of line that will contain Rects
int pointCount = cells.Count * 8;
// Clear all debug lines each time (no exception if null)
VectorLine.Destroy(ref debugCellLine);
VectorLine.Destroy(ref debugPaddingLine);
// Build line with proper parameters
debugCellLine = new VectorLine("DebugCellLine", new Vector2[pointCount], null, 2, LineType.Discrete, Joins.Weld);
debugCellLine.color = gridviewParameters.gridColor;
debugPaddingLine = new VectorLine("DebugPaddingCellLine", new Vector2[pointCount], null, 2, LineType.Discrete, Joins.Weld);
debugPaddingLine.color = gridviewParameters.paddingCellColor;
// Build each Cell
for(int i = 0; i < cells.Count; i++)
{
Cell cell = cells[i];
debugCellLine.MakeRect(cell.GetRectPoints(), i*8);
debugPaddingLine.MakeRect(cell.GetPaddinRectPosition(), i*8);
}
// Show results
debugCellLine.Draw();
debugPaddingLine.Draw();
}
示例3: DrawPanel
private void DrawPanel()
{
int pointCount = 8;
// Build debug panel line with proper parameters
debugPanelLine = new VectorLine("DebugPanelLine", new Vector2[pointCount], null, 2, LineType.Discrete, Joins.Weld);
debugPanelLine.color = gridviewParameters.panelColor;
//Get panel size
Vector2 size = new Vector2(panel.finalClipRegion.z, panel.finalClipRegion.w);
//Get panel position
Vector2 position = new Vector2(panel.finalClipRegion.x + panel.transform.localPosition.x + Screen.width / 2f - size.x / 2f,
panel.finalClipRegion.y + panel.transform.localPosition.y + Screen.height / 2f - size.y / 2f);
//Draw panel rect
Rect rect = new Rect(position, size);
debugPanelLine.MakeRect(rect);
debugPanelLine.Draw();
}
示例4: Start
// Use this for initialization
void Start()
{
//vectorCam = VectorLine.GetCamera();
maxH = Screen.height - 2 * minH;
maxW = Screen.width - 2 * minW;
linePoints= new Vector2[100];
for (int i=0; i<100; i++) {
linePoints[i]=Vector2.zero;
}
canerinArray = new Vector2[49];
for (int i=0; i<49; i++) {
canerinArray[i]=Vector2.zero;
}
VelocityArray=new Vector2[50];
for (int i=0; i<49; i++) {
VelocityArray[i]=Vector2.zero;
}
linePointsX=new Vector2[(maxW/snToPixel)*4];
for (int i =0; i<=maxW/snToPixel*2; i+=2) {
linePointsX[i].x=minW+i*snToPixel/2;
linePointsX[i].y=(Screen.height/2)-5;
linePointsX[i+1].x=minW+i*snToPixel/2;
linePointsX[i+1].y=(Screen.height/2)+5;
}
linePointsY=new Vector2[(maxH/snToPixel)*4];
for (int i =0; i<=maxH / snToPixel * 2+2; i+=2) {
linePointsY[i].x=minW-5;
linePointsY[i].y=minH+i*snToPixel/2;
linePointsY[i+1].x=minW+5;
linePointsY[i+1].y=minH+i*snToPixel/2;
}
refY = minH;
refX = minW;
time = minW;
index = 0;
oldWidth = Screen.width;
SetLine();
finish = false;
CizimBasladi = false;
CizimBitti = false;
instantiated = false;
inside = false;
gecici = new VectorLine("gecici", new Vector2[2]{new Vector2(minW,minH),new Vector2(minW,minH)}, Color.white, lineMaterial, 2f, LineType.Discrete);
gecici.Draw();
guideY = new VectorLine ("guideY",new Vector2[2]{new Vector2(time,minH),new Vector2(time,maxH+minH)},Color.red,null,2f,LineType.Discrete);
guideY.Draw ();
allGuide=new VectorLine("Guide",new Vector2[4]{new Vector2(minW,minH),new Vector2(minW,maxH+minH),new Vector2(minW,Screen.height/2),new Vector2(maxW+minW,Screen.height/2)},null,3f,LineType.Discrete);
allGuide.Draw ();
/*
plane.transform.localScale = new Vector3 ((float)(1.35f*maxW)/(float)(Screen.width),0.1f,(float)(Screen.height-minH*2)/(float)Screen.height);
plane.transform.position = new Vector3(plane.transform.position.x,plane.transform.position.y,Camera.main.transform.position.z+1);
*/
box.x = -Screen.width/2+minW;
box.y= -Screen.height/2+minH;
box.width = maxW;
box.height = maxH;
BG.guiTexture.pixelInset = box;
rectV = new VectorLine ("Rectangle",new Vector2[8],Color.black,null,4f);
rectV.capLength = 2;
rectV.MakeRect (new Rect (minW, Screen.height - minH, maxW, maxH));
rectV.Draw();
}
示例5: OnGUI
//.........这里部分代码省略.........
}
//Numara yazımı
for (int i =0; i<(maxH/5)*2; i+=2) {
VectorLine.Destroy(ref linePointsYNmb[i/2]);
}
for (int i =0; i<=maxH / snToPixel*2+2; i+=2) {
linePointsYNmb[i/2]=new VectorLine("Numb"+i/2,new Vector2[2]{new Vector2(minW-15,minH+i*snToPixel/2),new Vector2(minW,minH+i*snToPixel/2)},null,2f,LineType.Discrete,Joins.Weld);
if(i/2*snToPixel>maxH/2)
linePointsYNmb[i/2].MakeText(""+(i/2*snToPixel-maxH/2)/snToPixel,new Vector2(minW-15,minH+i*snToPixel/2),10f);
else
linePointsYNmb[i/2].MakeText(""+(maxH/2-(i/2-1)*snToPixel)/snToPixel*-1 ,new Vector2(minW-25,minH+i*snToPixel/2),10f);
linePointsYNmb[i/2].Draw();
}
VectorLine.Destroy (ref textVec);
textVec=new VectorLine("Text"+(index),new Vector2[2]{new Vector2(refX,refY-5),new Vector2(refX+15,refY+15)},Color.black,null,2f,LineType.Discrete,Joins.Weld);
if(refY>Screen.height/2)
textVec.MakeText("(t="+(mousePos.x-minW)/snToPixel+",a="+(mousePos.y-minH-maxH/2)/snToPixel+")",new Vector2(mousePos.x,mousePos.y+25),10f);
else
textVec.MakeText("(t="+(mousePos.x-minW)/snToPixel+",a="+(maxH/2-(mousePos.y-minH))/snToPixel*-1+")",new Vector2(mousePos.x,mousePos.y+25),10f);
refY = minH;
refX = minW;
time = minW;
index = 0;
oldWidth = Screen.width;
SetLine();
finish = false;
CizimBasladi = false;
CizimBitti = false;
instantiated = false;
inside = false;
gecici = new VectorLine("gecici", new Vector2[4]{new Vector2(minW,minH),new Vector2(minW,minH),new Vector2(minW,minH),new Vector2(minW,minH)}, Color.white, null, 2f, LineType.Discrete);
gecici.Draw();
guideY = new VectorLine ("guideY",new Vector2[2]{new Vector2(time,minH),new Vector2(time,maxH+minH)},Color.red,null,2f,LineType.Discrete);
guideY.Draw ();
allGuide=new VectorLine("Guide",new Vector2[4]{new Vector2(minW,minH),new Vector2(minW,maxH+minH),new Vector2(minW,Screen.height/2),new Vector2(maxW+minW,Screen.height/2)},null,3f,LineType.Discrete);
allGuide.Draw ();
/*
plane.transform.localScale = new Vector3 ((float)(1.35f*maxW)/(float)(Screen.width),0.1f,(float)(Screen.height-minH*2)/(float)Screen.height);
plane.transform.position = new Vector3(plane.transform.position.x,plane.transform.position.y,Camera.main.transform.position.z+1);
*/
box.x = -Screen.width/2+minW;
box.y= -Screen.height/2+minH;
box.width = maxW;
box.height = maxH;
bg.pixelInset = box;
rectV = new VectorLine ("Rectangle",new Vector2[8],Color.black,null,4f);
rectV.capLength = 2;
rectV.MakeRect (new Rect (minW, Screen.height - minH, maxW, maxH));
rectV.Draw();
}
if (GUI.Button (new Rect (Screen.width - 150, Screen.height - 50, 150, 50), "Back To The Schene")) {
//Buraya Kamera değiştirme scripti gelcek.
VectorLine.Destroy (ref allGuide);
VectorLine.Destroy (ref atGraphAfterVt);
VectorLine.Destroy (ref gecici);
VectorLine.Destroy (ref guideY);
VectorLine.Destroy (ref line);
VectorLine.Destroy (ref rectV);
VectorLine.Destroy (ref refPointsOnX);
VectorLine.Destroy (ref refPointsOnY);
VectorLine.Destroy (ref textVec);
VectorLine.Destroy (ref vtGraph);
VectorPoints.Destroy (ref dots);
for (int i =0; i<linePointsYNmb.Length;i++) {
VectorLine.Destroy (ref linePointsYNmb[i]);
}
for (int i =0; i<textVectors.Length;i++){
VectorLine.Destroy (ref textVectors[i]);
}
finish = true;
walkOrDraw.btnClicked=false;
}
}
}
示例6: Start
//.........这里部分代码省略.........
maxH = Screen.height - 2 * minH;
maxW = Screen.width - 2 * minW;
linePoints= new Vector2[100];
for (int i=0; i<100; i++) {
linePoints[i]=Vector2.zero;
}
atGraphAfterVtPoints = new Vector2[100];
for(int i=0;i<100;i++){
atGraphAfterVtPoints[i]=Vector2.zero;
}
canerinArray = new Vector2[49];
for (int i=0; i<49; i++) {
canerinArray[i]=Vector2.zero;
}
VelocityArray=new Vector2[50];
for (int i=0; i<49; i++) {
VelocityArray[i]=Vector2.zero;
}
dotPoints = new Vector2[50];
for(int i=0;i<50;i++){
dotPoints[i]=Vector2.zero;
}
numberOfDots = 0;
dots = new VectorPoints ("Dots", dotPoints, Color.red, null, 10f);
dots.maxDrawIndex = numberOfDots;
linePointsX=new Vector2[(maxW/snToPixel)*4];
for (int i =0; i<=maxW/snToPixel*2; i+=2) {
linePointsX[i].x=minW+i*snToPixel/2;
linePointsX[i].y=(Screen.height/2)-5;
linePointsX[i+1].x=minW+i*snToPixel/2;
linePointsX[i+1].y=(Screen.height/2)+5;
}
//snToPixel en az 5 olabilir ise.
linePointsY=new Vector2[(maxH/5)*4];
for (int i =0; i<=maxH / snToPixel * 2+2; i+=2) {
linePointsY[i].x=minW-5;
linePointsY[i].y=minH+i*snToPixel/2;
linePointsY[i+1].x=minW+5;
linePointsY[i+1].y=minH+i*snToPixel/2;
}
//Numara yazımı
linePointsYNmb=new VectorLine[(maxH/5)*2];
for (int i =0; i<=maxH / snToPixel*2+2; i+=2) {
linePointsYNmb[i/2]=new VectorLine("Numb"+i/2,new Vector2[2]{new Vector2(minW-15,minH+i*snToPixel/2),new Vector2(minW,minH+i*snToPixel/2)},null,2f,LineType.Discrete,Joins.Weld);
if(i/2*snToPixel>maxH/2)
linePointsYNmb[i/2].MakeText(""+(i/2*snToPixel-maxH/2)/snToPixel,new Vector2(minW-15,minH+i*snToPixel/2),10f);
else
linePointsYNmb[i/2].MakeText(""+(maxH/2-(i/2-1)*snToPixel)/snToPixel*-1 ,new Vector2(minW-25,minH+i*snToPixel/2),10f);
linePointsYNmb[i/2].Draw();
}
VectorLine.Destroy (ref textVec);
textVec=new VectorLine("Text"+(index),new Vector2[2]{new Vector2(refX,refY-5),new Vector2(refX+15,refY+15)},Color.black,null,2f,LineType.Discrete,Joins.Weld);
if(refY>Screen.height/2)
textVec.MakeText("(t="+(mousePos.x-minW)/snToPixel+",a="+(mousePos.y-minH-maxH/2)/snToPixel+")",new Vector2(mousePos.x,mousePos.y+25),10f);
else
textVec.MakeText("(t="+(mousePos.x-minW)/snToPixel+",a="+(maxH/2-(mousePos.y-minH))/snToPixel*-1+")",new Vector2(mousePos.x,mousePos.y+25),10f);
textVec.Draw();
gecici = new VectorLine("gecici", new Vector2[4]{new Vector2(minW,minH),new Vector2(minW,minH),new Vector2(minW,minH),new Vector2(minW,minH)}, Color.white, null, 2f, LineType.Discrete);
gecici.Draw();
guideY = new VectorLine ("guideY",new Vector2[2]{new Vector2(time,minH),new Vector2(time,maxH+minH)},Color.red,null,2f,LineType.Discrete);
guideY.Draw ();
allGuide=new VectorLine("Guide",new Vector2[4]{new Vector2(minW,minH),new Vector2(minW,maxH+minH),new Vector2(minW,Screen.height/2),new Vector2(maxW+minW,Screen.height/2)},null,3f,LineType.Discrete);
allGuide.Draw ();
/*
plane.transform.localScale = new Vector3 ((float)(1.35f*maxW)/(float)(Screen.width),0.1f,(float)(Screen.height-minH*2)/(float)Screen.height);
plane.transform.position = new Vector3(plane.transform.position.x,plane.transform.position.y,Camera.main.transform.position.z+1);
*/
box.x = -Screen.width/2+minW;
box.y= -Screen.height/2+minH;
box.width = maxW;
box.height = maxH;
bg.pixelInset = box;
rectV = new VectorLine ("Rectangle",new Vector2[8],Color.black,null,4f);
rectV.capLength = 2;
rectV.MakeRect (new Rect (minW, Screen.height - minH, maxW, maxH));
rectV.Draw();
SetLine();
}