本文整理汇总了C#中FSprite.SetAnchor方法的典型用法代码示例。如果您正苦于以下问题:C# FSprite.SetAnchor方法的具体用法?C# FSprite.SetAnchor怎么用?C# FSprite.SetAnchor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSprite
的用法示例。
在下文中一共展示了FSprite.SetAnchor方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LevelBar
public LevelBar(int numDashes)
{
this.numDashes = numDashes;
string borderElementName = "UI/Stats/LevelBar_" + numDashes;
if (numDashes == 5) {
dashWidth = 19;
} else if (numDashes == 10) {
dashWidth = 9;
} else if (numDashes == 25) {
dashWidth = 3;
}
AddChild (barContainer = new FContainer ());
barContainer.AddChild (background = new FSprite ("Box")); //black bg
background.color = Color.black;
background.SetAnchor (0.0f, 0.0f);
barContainer.AddChild (borderSprite = new FSprite (borderElementName));//white border
borderSprite.SetAnchor (0.0f, 0);
borderSprite.SetPosition (0, 0);
barContainer.AddChild (dashContainer = new FContainer ());
dashSpacing = 1;
totalWidth = 100;
dashHeight = 3;
barOffset = new Vector2 (-51, 0);
dashOffset = new Vector2 (1, 2);
ApplyConfig ();
}
示例2: Start
public override void Start()
{
// once play navigates away from home screen, don't play the intro when they return
Main.instance.playIntro = false;
FSprite background = new FSprite("viewport");
background.SetAnchor(0.0f, 0.0f);
AddChild(background);
string backButtonText = "Back";
string titleText = "About The Game";
if (Main.instance.gameFinished){
// Display end game messages
titleText = "The Ship Went Nuclear!";
_scoreLabel = new FLabel("Emulogic", "You Saved " + Main.instance.crewSaved + " Crew Members");
_scoreLabel.color = Color.black; // new Color(0.173f, 0.722f, 0.976f, 1.0f);
_scoreLabel.scale = 0.25f;
_scoreLabel.SetPosition(Futile.screen.halfWidth, Futile.screen.halfHeight + Futile.screen.halfHeight / 2);
AddChild(_scoreLabel);
_againButton = new FButton("buttonWide");
_againButton.AddLabel("Emulogic","Play Again",Color.black); //new Color(0.45f,0.25f,0.0f,1.0f)
_againButton.label.scale = 0.25f;
_againButton.SetPosition(Futile.screen.halfWidth, Futile.screen.halfHeight + 80);
AddChild(_againButton);
_againButton.SignalRelease += HandleAgainButtonRelease;
backButtonText = "Home";
} else {
// diplay generic message
}
_textLabel = new FLabel("Emulogic", titleText);
_textLabel.color = Color.black;
_textLabel.scale = 0.5f;
_textLabel.SetPosition(Futile.screen.halfWidth, Futile.screen.halfHeight + Futile.screen.halfHeight * 2 / 3);
AddChild(_textLabel);
_quitButton = new FButton("buttonWide");
_quitButton.AddLabel("Emulogic",backButtonText,Color.black); //new Color(0.45f,0.25f,0.0f,1.0f)
_quitButton.label.scale = 0.25f;
_quitButton.SetPosition(Futile.screen.halfWidth, Futile.screen.halfHeight);
AddChild(_quitButton);
_quitButton.SignalRelease += HandleQuitButtonRelease;
string about = "Game Designed and created by Jason Rendel,\nfor Ludum Dare 27. My first game jam ever!\nCreated for the 48 hour competition.\n\n ---- Tools ----\n Unity 3d - Futile - Gimp \nTexture Packer - Glyph Designer - CFXR\n\nFollow me @jasonrendel\nCheck out what else I'm up to at www.jasonrendel.com";
_scoreLabel = new FLabel("Emulogic", about);
_scoreLabel.color = Color.black;
_scoreLabel.scale = 0.20f;
_scoreLabel.SetPosition(Futile.screen.halfWidth, 200);
AddChild(_scoreLabel);
}
示例3: VirtualControlButton
public VirtualControlButton( InputControlType controlType, string elementName, Vector2 position )
{
this.controlType = controlType;
value = 0.0f;
touchId = -1;
alpha = 0.5f;
sprite = new FSprite( elementName );
sprite.SetAnchor( new Vector2( 0.5f, 0.5f ) );
AddChild( sprite );
SetPosition( position );
}
示例4: DrawLayer
public FContainer DrawLayer(int id)
{
FContainer cont = new FContainer();
for(int row = 0;row < _layers[id]._height; row++) {
for(int column = 0;column < _layers[id]._width; column++) {
int sid = _layers[id]._data[(row*_layers[id]._width)+column];
if(sid!=0){
FSprite s = new FSprite(_tileset[0]._elements[sid-1]);
s.SetAnchor(0, 1);
s.x = column*32;
s.y = -row*32;
cont.AddChild(s);
}
}
}
return cont;
}
示例5: FDebugFrameRateGraph
public FDebugFrameRateGraph()
: base()
{
_texWidth = BASE_TEX_WIDTH;
_texHeight = BASE_TEX_HEIGHT;
_numPixels = _texWidth * _texHeight;
_newFramePixels = new Color[_texHeight];
_graphTex = new Texture2D(_texWidth, _texHeight, TextureFormat.ARGB32, false);
_graphTex.filterMode = FilterMode.Point;
// Initialize the graph
Color[] blank = new Color[_numPixels];
for (int i = 0; i < _numPixels; i++)
{
blank[i] = _blank;
}
_graphTex.SetPixels(blank);
// Draw lines for the target frame rate
_targetRow = Mathf.FloorToInt(IDEAL_FRAME_TIME / (MAX_FRAME_TIME / (float)_texHeight));
_doubleTargetRow = Mathf.FloorToInt(2.0f * IDEAL_FRAME_TIME / (MAX_FRAME_TIME / (float)_texHeight));
Color[] targetColor = new Color[_texWidth];
Color[] doubleTargetColor = new Color[_texWidth];
Color[] maxTargetColor = new Color[_texWidth];
for (int i = 0; i < _texWidth; i++)
{
targetColor[i] = Color.black;
doubleTargetColor[i] = Color.black;
maxTargetColor[i] = Color.black;
}
_graphTex.SetPixels(0, _targetRow, _texWidth, 1, targetColor);
_graphTex.SetPixels(0, _doubleTargetRow, _texWidth, 1, doubleTargetColor);
_graphTex.SetPixels(0, _texHeight - 1, _texWidth, 1, maxTargetColor);
_graphTex.Apply();
Futile.atlasManager.LoadAtlasFromTexture("debugFrameGraph", _graphTex);
_graphSprite = new FSprite("debugFrameGraph");
_graphSprite.SetAnchor(0.0f, 0.0f);
_graphSprite.scale = Futile.resourceScale;
AddChild(_graphSprite);
ListenForUpdate(HandleUpdate);
}
示例6: VirtualControlStick
public VirtualControlStick( InputControlType xAxis, InputControlType yAxis )
{
this.xAxis = xAxis;
this.yAxis = yAxis;
delta = Vector2.zero;
value = Vector2.zero;
touchId = -1;
alpha = 0.5f;
baseSprite = new FSprite( "VirtualInput/StickBase" );
baseSprite.SetAnchor( new Vector2( 0.5f, 0.5f ) );
AddChild( baseSprite );
headSprite = new FSprite( "VirtualInput/StickHead" );
headSprite.SetAnchor( new Vector2( 0.5f, 0.5f ) );
AddChild( headSprite );
SetPosition( -Futile.screen.halfWidth + 96, -Futile.screen.halfHeight + 96 );
}
示例7: HollowRect
public static void HollowRect(float x, float y, float width, float height, Color color)
{
rect.x = (int)x;
rect.y = (int)y;
rect.width = (int)width;
rect.height = 1;
FSprite sprite = new FSprite(Pixel);
SpriteBatch.AddChild(sprite);
sprite.SetAnchor(0, 0);
sprite.SetPosition(rect.x, rect.y);
sprite.width = rect.width;
sprite.height = rect.height;
sprite.color = color;
//SpriteBatch.Draw(Pixel.Texture2D, rect, Pixel.Rect, color);
rect.y += (int)height - 1;
sprite = new FSprite(Pixel);
SpriteBatch.AddChild(sprite);
sprite.SetAnchor(0, 0);
sprite.SetPosition(rect.x, rect.y);
sprite.width = rect.width;
sprite.height = rect.height;
sprite.color = color;
//SpriteBatch.Draw(Pixel.Texture2D, rect, Pixel.Rect, color);
rect.y -= (int)height - 1;
rect.width = 1;
rect.height = (int)height;
sprite = new FSprite(Pixel);
SpriteBatch.AddChild(sprite);
sprite.SetAnchor(0, 0);
sprite.SetPosition(rect.x, rect.y);
sprite.width = rect.width;
sprite.height = rect.height;
sprite.color = color;
//SpriteBatch.Draw(Pixel.Texture2D, rect, Pixel.Rect, color);
rect.x += (int)width - 1;
sprite = new FSprite(Pixel);
SpriteBatch.AddChild(sprite);
sprite.SetAnchor(0, 0);
sprite.SetPosition(rect.x, rect.y);
sprite.width = rect.width;
sprite.height = rect.height;
sprite.color = color;
//SpriteBatch.Draw(Pixel.Texture2D, rect, Pixel.Rect, color);
}
示例8: Rect
public static void Rect(Rect rect, Color color)
{
Draw.rect = rect;
FSprite sprite = new FSprite(Pixel);
SpriteBatch.AddChild(sprite);
sprite.SetAnchor(0, 0);
sprite.SetPosition(rect.x, rect.y);
sprite.width = rect.width;
sprite.height = rect.height;
sprite.color = color;
//SpriteBatch.Draw(Pixel.Texture2D, rect, Pixel.Rect, color);
}
示例9: SetupDashes
public void SetupDashes(List<DashData> dashDatas)
{
for(int d = 0; d<dashDatas.Count; d++)
{
FSprite dash = new FSprite("Box");
dash.SetAnchor(0,0);
dash.width = dashWidth;
dash.height = dashHeight;
dash.x = dashOffset.x + d * (dashWidth+dashSpacing);
dash.y = dashOffset.y;
dash.color = dashDatas[d].color;
dashes.Add(dash);
dashContainer.AddChild(dash);
}
}
示例10: Start
public override void Start()
{
Main.instance.crewSaved = 0;
Main.instance.gameFinished = false;
FSprite background = new FSprite("viewport");
background.SetAnchor(0.0f, 0.0f);
AddChild(background);
_introLabel = new FLabel("Emulogic", "");
_introLabel.color = Color.black; //Color.green; // new Color(0.173f, 0.722f, 0.976f, 1.0f);
_introLabel.scale = 0.2f;
_introLabel.SetAnchor(0.0f, 1.0f);
_introLabel.SetPosition(60, Futile.screen.height - 14);
AddChild(_introLabel);
_titleLabel = new FLabel("Emulogic", "");
_titleLabel.color = Color.black;
_titleLabel.scale = 1.0f;
_titleLabel.SetAnchor(0.0f, 1.0f);
_titleLabel.SetPosition(200, 550);
AddChild(_titleLabel);
_finalLabel = new FLabel("Emulogic", "");
_finalLabel.color = Color.black; //Color.green;
_finalLabel.scale = 0.2f;
_finalLabel.SetAnchor(0.0f, 1.0f);
_finalLabel.SetPosition(575, 400);
AddChild(_finalLabel);
if (!Main.instance.playIntro){
_introLabel.text = _introText;
_titleLabel.text = _titleText;
_finalLabel.text = _finalText;
}
_startButton = new FButton("buttonWide");
_startButton.AddLabel("Emulogic","Play!",Color.black); //new Color(0.45f,0.25f,0.0f,1.0f)
_startButton.label.scale = 0.25f;
_startButton.SetPosition(Futile.screen.width - 225, 155);
AddChild(_startButton);
_startButton.SignalRelease += HandleStartButtonRelease;
_creditsButton = new FButton("buttonWide");
_creditsButton.AddLabel("Emulogic","About",Color.black); //new Color(0.45f,0.25f,0.0f,1.0f)
_creditsButton.label.scale = 0.25f;
_creditsButton.SetPosition(Futile.screen.width - 225, 75);
AddChild(_creditsButton);
_creditsButton.SignalRelease += HandleCreditsButtonRelease;
_lastTextUpdate = Main.GameTime;
FSprite escapePod = new FSprite("escapePod");
FSprite doors = new FSprite("doorsIcon");
FSprite crew = new FSprite("floatingCharacter");
FSprite clock = new FSprite("moveTileIcon");
//FSprite clock = new FSprite("clock4");
escapePod.scale = 0.5f;
doors.scale = 0.5f;
escapePod.SetPosition(140, 305);
doors.SetPosition(140, 230);
crew.SetPosition(140, 155);
clock.SetPosition(140, 80);
AddChild(escapePod);
AddChild(doors);
AddChild(crew);
AddChild(clock);
FLabel escapePodLabel = new FLabel("Emulogic", "Get the crew to \nthe escape pods!");
escapePodLabel.color = Color.black; //Color.green;
escapePodLabel.scale = 0.15f;
escapePodLabel.SetAnchor(0.0f, 0.5f);
escapePodLabel.SetPosition(200, 305);
AddChild(escapePodLabel);
FLabel doorsLabel = new FLabel("Emulogic", "Touch doors to \nopen and close them.");
doorsLabel.color = Color.black; //Color.green;
doorsLabel.scale = 0.15f;
doorsLabel.SetAnchor(0.0f, 0.5f);
doorsLabel.SetPosition(200, 230);
AddChild(doorsLabel);
FLabel crewLabel = new FLabel("Emulogic", "The Crew. They will walk \nthrough open doors, \nbut don't expect much else.");
crewLabel.color = Color.black; //Color.green;
crewLabel.scale = 0.15f;
crewLabel.SetAnchor(0.0f, 0.5f);
crewLabel.SetPosition(200, 155);
AddChild(crewLabel);
FLabel clockLabel = new FLabel("Emulogic", "Place movement tiles \nto redirect the crew.");
//FLabel clockLabel = new FLabel("Emulogic", "10 Seconds.");
clockLabel.color = Color.black; //Color.green;
//.........这里部分代码省略.........
示例11: Start
public override void Start()
{
// once play navigates away from home screen, don't play the intro when they return
Main.instance.playIntro = false;
Main.instance.crewSaved = 0;
FSprite background = new FSprite("mainGameViewport");
background.SetAnchor(0.0f, 0.0f);
AddChild(background);
_levelManager = new LevelManager();
AddChild(_levelManager);
this.shouldSortByZ = true;
meltdownBar = new FSprite("meltdown");
meltdownBar.SetPosition(Futile.screen.halfWidth, 672);
AddChild(meltdownBar);
_closeButton = new FButton("button");
_closeButton.AddLabel("Emulogic","Quit",Color.black);
_closeButton.label.scale = 0.25f;
_closeButton.sortZ = 1;
_closeButton.SignalRelease += HandleCloseButtonRelease;
_closeButton.x = Futile.screen.width - 125.0f;
_closeButton.y = Futile.screen.height -75.0f;
AddChild(_closeButton);
Clock clock = new Clock();
clock.SetPosition( 75.0f, Futile.screen.height - 75.0f);
AddChild(clock);
crewSavedLabel = new FLabel("Emulogic", "Crew Members Saved: 0");
crewSavedLabel.SetPosition( Futile.screen.halfWidth, Futile.screen.height - 45.0f);
crewSavedLabel.scale = 0.25f;
AddChild(crewSavedLabel);
selectedInventory = new FSprite("inventorySelected");
selectedInventory.isVisible = false;
AddChild(selectedInventory);
//spawnInventory();
spawnCrew(2);
_lastCycle = Main.GameTime;
}