本文整理汇总了C#中Sprite.SetTransform方法的典型用法代码示例。如果您正苦于以下问题:C# Sprite.SetTransform方法的具体用法?C# Sprite.SetTransform怎么用?C# Sprite.SetTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprite
的用法示例。
在下文中一共展示了Sprite.SetTransform方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public override void Render(Sprite sprite)
{
for (int i = subElements.Count - 1; i >= 0; i--)
{
subElements[i].Render(sprite);
sprite.SetTransform(Matrix.Identity);
}
}
示例2: Render
public override void Render(Sprite sprite)
{
if (state != NIGDialogState.Hiding)
{
ColorValue overlayColor = ColorValue.Transparent;
overlayColor.A = (byte)(165 * showPrg);
sprite.Draw(overlay, 0, 0, overlayColor);
int x = 373;
int y = 54;
float scale = -MathEx.Sqr(MathEx.Saturate(showPrg) * 1.5f - 1) + 1;
scale = (1.0f / 0.75f) * scale;
Matrix trans = Matrix.Translation(-background.Width / 2, -background.Height / 2, 0) *
Matrix.Scaling(scale, scale, 1) *
Matrix.Translation(x + background.Width / 2, y + background.Height / 2, 0);
sprite.SetTransform(trans);
sprite.Draw(background, 0, 0, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
}
if (state == NIGDialogState.Showing)
{
//sprite.Draw(failTex, 661, 54, ColorValue.White);
if (clearProgress > 1)
{
float scale = -MathEx.Sqr(MathEx.Saturate(1 * 6) * 1.5f - 1) + 1;
scale = 0.5f + 1.5f * scale;
Matrix trans = Matrix.Scaling(scale, scale, 1) *
Matrix.Translation(661 + failTex.Width / 2, 54 + failTex.Height / 2, 0);
sprite.SetTransform(trans);
sprite.Draw(failTex, -failTex.Width / 2, -failTex.Height / 2, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
}
if (clearProgress <= 1)
{
float scale = -MathEx.Sqr(MathEx.Saturate(clearProgress * 6) * 1.5f - 1) + 1;
scale = 0.5f + 1.5f * scale;
Matrix trans = Matrix.Scaling(scale, scale, 1) *
Matrix.Translation(661 + failTex.Width / 2, 54 + failTex.Height / 2, 0);
sprite.SetTransform(trans);
sprite.Draw(failTex, -failTex.Width / 2, -failTex.Height / 2, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
}
sprite.Draw(backButton.Image, backButton.X, backButton.Y, ColorValue.White);
if (backButton.IsMouseOver)
{
sprite.Draw(backButton.Image, backButton.X, backButton.Y - 4, ColorValue.White);
}
sprite.Draw(replayButton.Image, replayButton.X, replayButton.Y, ColorValue.White);
if (replayButton.IsMouseOver)
{
sprite.Draw(replayButton.Image, replayButton.X, replayButton.Y - 4, ColorValue.White);
}
RenderRank(sprite);
}
}
示例3: Render
public override void Render(Sprite sprite)
{
if (state != NIGDialogState.Hiding)
{
ColorValue overlayColor = ColorValue.Transparent;
overlayColor.A = (byte)(165 * showPrg);
sprite.Draw(overlay, 0, 0, overlayColor);
int x = 451;
int y = 157;
float scale = -MathEx.Sqr(MathEx.Saturate(showPrg) * 1.5f - 1) + 1;
scale = (1.0f / 0.75f) * scale;
Matrix trans = Matrix.Translation(-background.Width / 2, -background.Height / 2, 0) *
Matrix.Scaling(scale, scale, 1) *
Matrix.Translation(x + background.Width / 2, y + background.Height / 2, 0);
sprite.SetTransform(trans);
sprite.Draw(background, 0, 0, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
sprite.Draw(resumeButton.Image, resumeButton.X, resumeButton.Y, ColorValue.White);
if (resumeButton.IsMouseOver)
{
sprite.Draw(resumeButton.Image, resumeButton.X, resumeButton.Y - 4, ColorValue.White);
}
sprite.Draw(restartButton.Image, restartButton.X, restartButton.Y, ColorValue.White);
if (restartButton.IsMouseOver)
{
sprite.Draw(restartButton.Image, restartButton.X, restartButton.Y - 4, ColorValue.White);
}
sprite.Draw(exitButton.Image, exitButton.X, exitButton.Y, ColorValue.White);
if (exitButton.IsMouseOver)
{
sprite.Draw(exitButton.Image, exitButton.X, exitButton.Y - 4, ColorValue.White);
}
}
}
示例4: RenderCityStatus
private void RenderCityStatus(Sprite sprite)
{
if (selectCity != null)
{
int hp = (int)selectCity.HealthValue;
int hpFull = (int)(selectCity.HealthValue / selectCity.HPRate);
int level = selectCity.Level;
string name = selectCity.Name;
if (selectCity.Owner == player)
{
sprite.Draw(statusBackground, 405, 580, ColorValue.White);
}
else
{
sprite.Draw(statusEnemyBackground, 405, 580, ColorValue.White);
}
if (isHPBuffer)
{
Matrix buffScale = Matrix.Scaling(new Vector3(0.1f * (float)Math.Sin(buffWave) + 1));
buffScale.TranslationValue = new Vector3(776 + statusHPBufferTex.Width / 2, 624 + statusHPBufferTex.Height / 2, 0);
sprite.SetTransform(buffScale);
sprite.Draw(statusHPBufferTex, -statusHPBufferTex.Width / 2, -statusHPBufferTex.Height / 2, ColorValue.White);
}
if (isExpBuffer)
{
Matrix buffScale = Matrix.Scaling(new Vector3(0.1f * (float)Math.Sin(buffWave) + 1));
buffScale.TranslationValue = new Vector3(802 + statusExpBuffTex.Width / 2, 624 + statusExpBuffTex.Height / 2, 0);
sprite.SetTransform(buffScale);
sprite.Draw(statusExpBuffTex, -statusExpBuffTex.Width / 2, -statusExpBuffTex.Height / 2, ColorValue.White);
}
if (isDownShow)
{
Matrix buffScale = Matrix.Scaling(new Vector3(0.1f * (float)Math.Sin(buffWave) + 1));
buffScale.TranslationValue = new Vector3(839 + statusExpdownBuff.Width / 2, 622 + statusExpdownBuff.Height / 2, 0);
sprite.SetTransform(buffScale);
sprite.Draw(statusExpdownBuff, -statusExpdownBuff.Width / 2, -statusExpdownBuff.Height / 2, ColorValue.White);
}
sprite.SetTransform(Matrix.Identity);
f6.DrawString(sprite, selectCity.Name.ToUpperInvariant(), 456, 572, ColorValue.White);
f6.DrawString(sprite, level.ToString().ToUpperInvariant(), 775, 570, ColorValue.White);
//画资源球图标
int hpTexWidth = (int)(statusHPTex.Width * SelectedCity.HPRate);
string hpInfo = hp.ToString() + "/" + hpFull.ToString();
int expTexWidth = (int)(statusExpTex.Width * selectCity.LevelEP);
string expInfo = "EXP " + ((int)(selectCity.LevelEP * 100)).ToString() + "/100";
//HP
sprite.Draw(statusHPTex, new Rectangle(505, 638, hpTexWidth, statusHPTex.Height),
new Rectangle(0, 0, hpTexWidth, statusHPTex.Height), ColorValue.White);
sprite.Draw(statusHPBackground, 506, 640, ColorValue.White);
if (selectCity.Owner == player)
{
Matrix trans = Matrix.Scaling(0.8f, 0.8f, 1) * Matrix.Translation(new Vector3(579, 638, 0));
sprite.SetTransform(trans);
f8.DrawString(sprite, hpInfo, 0, 0, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
//EXP
sprite.Draw(statusExpTex, new Rectangle(578, 624, expTexWidth, statusExpTex.Height),
new Rectangle(0, 0, expTexWidth, statusExpTex.Height), ColorValue.White);
sprite.Draw(statusExpBackground, 579, 624, ColorValue.White);
trans = Matrix.Scaling(0.8f, 0.8f, 1) * Matrix.Translation(new Vector3(635, 620, 0));
sprite.SetTransform(trans);
f8.DrawString(sprite, expInfo, 0, 0, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
}
}
}
示例5: RenderBallIcon
private void RenderBallIcon(Sprite sprite)
{
if (selectCity != null && selectCity.Owner == player)
{
//Array.Sort(resBallsCount, BallRecordCompare);
int left = 0;
for (int i = 0; i < resBallsCount.Length; i++)
{
RBallType ballType = resBallsCount[i].Type;
bool overrideDraw = selectCity.CanProduceProduction() ? (ballType == selectCity.GetProductionType()) : false;
//resBallsCount[i].Type == selectCity.GetProductionType()
switch (ballType)
{
case RBallType.Green:
{
if (resBallsCount[i].count != 0 || overrideDraw)
{
if (selectCity.CanProduceProduction() && selectCity.GetProductionType() == RBallType.Green)
{
if (selectCity.IsFull())
{
sprite.Draw(statusMaxBalls, 651 + 69 * left, 723 - statusMaxBalls.Height, ColorValue.White);
}
else
{
int height = (int)(selectCity.GetProductionProgress() * statusProducePrgTex.Height);
sprite.Draw(statusProducePrgTex, new Rectangle(651 + 69 * left, 723 - height, statusProducePrgTex.Width, height),
new Rectangle(0, statusProducePrgTex.Height - height, statusProducePrgTex.Width, height), ColorValue.White);
}
}
int x = 687 + 69 * left - greenBallTex.Width / 2;
int y = 692 - greenBallTex.Height / 2;
sprite.Draw(greenBallTex, x, y, ColorValue.White);
Matrix trans = Matrix.Scaling(0.8f, 0.8f, 1) *
Matrix.Translation(new Vector3(x + 45 - f8.MeasureString(resBallsCount[i].count.ToString()).Width, y + 18, 0));
sprite.SetTransform(trans);
f8.DrawString(sprite, resBallsCount[i].count.ToString(), 0, 0, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
left++;
}
}
break;
case RBallType.Education:
{
if (resBallsCount[i].count != 0 || overrideDraw)
{
if (selectCity.CanProduceProduction() && selectCity.GetProductionType() == RBallType.Education)
{
if (selectCity.IsFull())
{
sprite.Draw(statusMaxBalls, 651 + 69 * left, 723 - statusMaxBalls.Height, ColorValue.White);
}
else
{
int height = (int)(selectCity.GetProductionProgress() * statusProducePrgTex.Height);
sprite.Draw(statusProducePrgTex, new Rectangle(651 + 69 * left, 723 - height, statusProducePrgTex.Width, height),
new Rectangle(0, statusProducePrgTex.Height - height, statusProducePrgTex.Width, height), ColorValue.White);
}
}
int x = 687 + 69 * left - educationBallTex.Width / 2;
int y = 692 - educationBallTex.Height /2 ;
sprite.Draw(educationBallTex, x, y, ColorValue.White);
Matrix trans = Matrix.Scaling(0.8f, 0.8f, 1) *
Matrix.Translation( new Vector3(x + 45 - f8.MeasureString(resBallsCount[i].count.ToString()).Width, y + 18, 0));
sprite.SetTransform(trans);
f8.DrawString(sprite, resBallsCount[i].count.ToString(), 0, 0, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
left++;
}
}
break;
case RBallType.Health:
{
if (resBallsCount[i].count != 0 || overrideDraw)
{
if (selectCity.CanProduceProduction() && selectCity.GetProductionType() == RBallType.Health)
{
if (selectCity.IsFull())
{
sprite.Draw(statusMaxBalls, 651 + 69 * left, 723 - statusMaxBalls.Height, ColorValue.White);
}
else
{
int height = (int)(selectCity.GetProductionProgress() * statusProducePrgTex.Height);
//.........这里部分代码省略.........
示例6: RenderHarv
void RenderHarv(Sprite sprite)
{
sprite.Draw(statusHarvBackground, 405, 580, ColorValue.White);
int harvHPBarWidth = (int)(statusHPBarBarValue.Width * selectedHarv.HealthValue / selectedHarv.GetProps().HP);
int harvSTBarWidth = (int)(statusHPBarBarValue.Width * selectedHarv.CurrentStorage / selectedHarv.GetProps().Storage);
string hpInfo = ((int)selectedHarv.HealthValue).ToString() + "/" + ((int)selectedHarv.GetProps().HP).ToString();
string stInfo = ((int)selectedHarv.CurrentStorage).ToString() + "/" + ((int)selectedHarv.GetProps().Storage).ToString();
sprite.Draw(statusHarvBackground, 405, 580, ColorValue.White);
sprite.Draw(statusHPBarBarValue, new Rectangle(562, 640, harvHPBarWidth, statusHPBarBarValue.Height),
new Rectangle(0, 0, harvHPBarWidth, statusHPBarBarValue.Height), ColorValue.White);
sprite.Draw(statusHPBarBarEdge, 544, 637, ColorValue.White);
sprite.Draw(statusSTBarBarValue, new Rectangle(679, 672, harvSTBarWidth, statusSTBarBarValue.Height),
new Rectangle(0, 0, harvSTBarWidth, statusSTBarBarValue.Height), ColorValue.White);
sprite.Draw(statusSTBarBarEdge, 661, 666, ColorValue.White);
Matrix trans = Matrix.Scaling(0.8f, 0.8f, 1) * Matrix.Translation(new Vector3(715, 667, 0));
sprite.SetTransform(trans);
f8.DrawString(sprite, stInfo, 0, 0, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
}
示例7: RenderSelectedCityHP
private void RenderSelectedCityHP(Sprite sprite)
{
if (SelectedCity != null)
{
float radLng = MathEx.Degree2Radian(SelectedCity.Longitude);
float radLat = MathEx.Degree2Radian(SelectedCity.Latitude);
Vector3 tangy = PlanetEarth.GetTangentY(radLng, radLat);
Vector3 tangx = PlanetEarth.GetTangentX(radLng, radLat);
Vector3 cityNormal = PlanetEarth.GetNormal(radLng, radLat);
cityNormal.Normalize();
Vector3 hpPos = SelectedCity.Position + tangy * 150 + cityNormal * 400;
Viewport vp = renderSys.Viewport;
Vector3 screenPos = vp.Project(hpPos, scene.Camera.ProjectionMatrix,
scene.Camera.ViewMatrix, Matrix.Identity);
Vector3 lp = vp.Project(hpPos + tangx, scene.Camera.ProjectionMatrix,
scene.Camera.ViewMatrix, Matrix.Identity);
Vector3 rp = vp.Project(hpPos - tangx, scene.Camera.ProjectionMatrix,
scene.Camera.ViewMatrix, Matrix.Identity);
float scale = 1.75f * Vector3.Distance(lp, rp) / 2;
Matrix trans = Matrix.Translation(-onCityHPBackground.Width / 2, -onCityHPBackground.Height / 2, 0) *
Matrix.Scaling(scale, scale, 1) * Matrix.Translation(screenPos.X, screenPos.Y, 0);
int hpTexWidth = (int)(onCityHPTex.Width * SelectedCity.HPRate);
sprite.SetTransform(trans);
sprite.Draw(onCityHPBase, 0, 0, ColorValue.White);
sprite.Draw(onCityHPTex, new Rectangle(0, 0, hpTexWidth, onCityHPTex.Height),
new Rectangle(0, 0, hpTexWidth, onCityHPTex.Height), ColorValue.White);
sprite.Draw(onCityHPBackground, 0, 0, ColorValue.White);
f6.DrawString(sprite, SelectedCity.Level.ToString(), 25, -16, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
}
}
示例8: Render
public override void Render(Sprite sprite)
{
sprite.Draw(background, 0, 0, ColorValue.White);
if (showPrg > 0.5f)
{
Matrix trans = Matrix.Translation(-background.Width / 2, -background.Height / 2, 0) *
Matrix.Scaling((showPrg - 0.5f) * 2 * 0.8f + 0.2f, 1, 1) *
Matrix.Translation(97 + background.Width / 2, 24 + background.Height / 2, 0);
sprite.SetTransform(trans);
sprite.Draw(panel, 0, 0, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
}
//int idx = currentPage;
//if (idx >= TotalPages)
// idx = TotalPages - 1;
if (state == NIGDialogState.Showing)
{
sprite.Draw(nextBtn, nextButton.X, nextButton.Y, ColorValue.White);
if (nextButton.IsMouseOver && !nextButton.IsPressed)
{
sprite.Draw(nextBtn, nextButton.X, nextButton.Y - 1, ColorValue.White);
}
sprite.Draw(prevBtn, prevButton.X, prevButton.Y, ColorValue.White);
if (prevButton.IsMouseOver && !exitButton.IsPressed)
{
sprite.Draw(prevBtn, prevButton.X, prevButton.Y - 1, ColorValue.White);
}
sprite.Draw(exitBtn, exitButton.X, exitButton.Y, ColorValue.White);
if (exitButton.IsMouseOver && !exitButton.IsPressed)
{
sprite.Draw(exitBtn, exitButton.X, exitButton.Y - 3, ColorValue.White);
}
sprite.Draw(help[currentPage], 0, 0, ColorValue.White);
}
sprite.Draw(cursor, mousePosition.X, mousePosition.Y, ColorValue.White);
}
示例9: Render
public override void Render(Sprite sprite)
{
if (state != NIGDialogState.Hiding)
{
ColorValue overlayColor = ColorValue.Transparent;
overlayColor.A = (byte)(165 * showPrg);
sprite.Draw(overlay, 0, 0, overlayColor);
int x = 442;
int y = 164;
float scale = -MathEx.Sqr(MathEx.Saturate(showPrg) * 1.5f - 1) + 1;
scale = (1.0f / 0.75f) * scale;
Matrix trans = Matrix.Translation(-background.Width / 2, -background.Height / 2, 0) *
Matrix.Scaling(scale, scale, 1) *
Matrix.Translation(x + background.Width / 2, y + background.Height / 2, 0);
sprite.SetTransform(trans);
sprite.Draw(background, 0, 0, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
}
if (state == NIGDialogState.Showing)
{
sprite.Draw(okButton.Image, okButton.X, okButton.Y, ColorValue.White);
if (okButton.IsMouseOver)
{
sprite.Draw(okButton.Image, okButton.X, okButton.Y - 4, ColorValue.White);
}
GameFontManager.Instance.FRuanEdged8.DrawString(sprite, "TRANSFORM 23 CITIES.\nYOU MUST SURVIVE.", 540, 240, ColorValue.White);
}
}
示例10: Render
public override void Render(Sprite sprite)
{
sprite.SetTransform(Matrix.Identity);
sprite.Draw(background, 0, 0, ColorValue.White);
sprite.Draw(waterTex, 0, 0, ColorValue.White);
sprite.Draw(mapTex, 0, 0, ColorValue.White);
//sprite.Draw(rolesTex, 258, 75, ColorValue.White);
sprite.Draw(boarderTex, 0, 0, ColorValue.White);
float rolescale = -MathEx.Sqr(MathEx.Saturate(rolesProgress * 6) * 1.5f - 1) + 1;
rolescale = (1.0f / 0.75f) * rolescale;
Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
Matrix.Translation(258 + rolesTex.Width / 2, 75 + rolesTex.Height / 2, 0);
sprite.SetTransform(roletrans);
sprite.Draw(rolesTex, -rolesTex.Width / 2, -rolesTex.Height / 2, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
if (logoProgress > 0)
{
float logoScale = -MathEx.Sqr(MathEx.Saturate(logoProgress * 6) * 1.5f - 1) + 1;
logoScale = (1.0f / 0.75f) * logoScale;
Matrix logoTrans = Matrix.Scaling(logoScale, logoScale, 1) *
Matrix.Translation(31 + logo.Width / 2, 29 + logo.Height / 2, 0);
Rectangle rect = new Rectangle(-logo.Width / 2, -logo.Height / 2, 554 - 31, 315 - 28);
sprite.SetTransform(logoTrans);
sprite.Draw(logo, rect, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
}
if (logoProgress >= 0.67f)
{
if (startButton.IsMouseOver)
{
// y=-(x-1)^2+1
float scale = -MathEx.Sqr(MathEx.Saturate(startProgress * 6) * 1.5f - 1) + 1;
scale = 0.5f + 1.5f * scale;
Matrix trans = Matrix.Scaling(scale, scale, 1) *
Matrix.Translation(startButton.X + start.Width / 2, startButton.Y + start.Height / 2, 0);
//sprite.Draw(start, startButton.X, startButton.Y, ColorValue.Yellow);
sprite.SetTransform(trans);
sprite.Draw(start, -start.Width / 2, -start.Height / 2, ColorValue.Yellow);
sprite.SetTransform(Matrix.Identity);
}
else
{
sprite.Draw(start, startButton.X, startButton.Y, ColorValue.White);
}
if (helpButton.IsMouseOver)
{
// sprite.Draw(help, helpButton.X, helpButton.Y, ColorValue.Yellow);
float scale = -MathEx.Sqr(MathEx.Saturate(helpProgress * 6) * 1.5f - 1) + 1;
scale = 0.5f + 1.5f * scale;
Matrix trans = Matrix.Scaling(scale, scale, 1) *
Matrix.Translation(helpButton.X + help.Width / 2, helpButton.Y + help.Height / 2, 0);
sprite.SetTransform(trans);
sprite.Draw(help, -help.Width / 2, -help.Height / 2, ColorValue.Yellow);
sprite.SetTransform(Matrix.Identity);
}
else
{
sprite.Draw(help, helpButton.X, helpButton.Y, ColorValue.White);
}
if (exitButton.IsMouseOver)
{
//sprite.Draw(exit, exitButton.X, exitButton.Y, ColorValue.Yellow);
float scale = -MathEx.Sqr(MathEx.Saturate(exitProgress * 6) * 1.5f - 1) + 1;
scale = 0.5f + 1.5f * scale;
Matrix trans = Matrix.Scaling(scale, scale, 1) *
Matrix.Translation(exitButton.X + exit.Width / 2, exitButton.Y + exit.Height / 2, 0);
sprite.SetTransform(trans);
sprite.Draw(exit, -help.Width / 2, -exit.Height / 2, ColorValue.Yellow);
sprite.SetTransform(Matrix.Identity);
}
else
{
sprite.Draw(exit, exitButton.X, exitButton.Y, ColorValue.White);
}
if (creditButton.IsMouseOver)
{
//sprite.Draw(credits, creditButton.X, creditButton.Y, ColorValue.Yellow);
float scale = -MathEx.Sqr(MathEx.Saturate(creditProgress * 6) * 1.5f - 1) + 1;
scale = 0.5f + 1.5f * scale;
Matrix trans = Matrix.Scaling(scale, scale, 1) *
Matrix.Translation(creditButton.X + credits.Width / 2, creditButton.Y + credits.Height / 2, 0);
sprite.SetTransform(trans);
sprite.Draw(credits, -credits.Width / 2, -credits.Height / 2, ColorValue.Yellow);
sprite.SetTransform(Matrix.Identity);
//.........这里部分代码省略.........
示例11: Render
public override void Render(Sprite sprite)
{
sprite.Draw(bg, 0, 0, ColorValue.White);
//int panelHeight = 538;
//int h = (int)(roll * (list.Height + panelHeight));
//if (h < panelHeight)
//{
// Rectangle drect = new Rectangle(658, 46 + panelHeight - h, list.Width, h);
// Rectangle srect = new Rectangle(0, 0, list.Width, h);
// sprite.Draw(list, drect, srect, ColorValue.White);
//}
//else if (h > list.Height - panelHeight)
//{
// Rectangle drect = new Rectangle(658, 46, list.Width, list.Height * 2 - h + panelHeight);
// Rectangle srect = new Rectangle(0, h - panelHeight, list.Width, list.Height * 2 - h + panelHeight);
// sprite.Draw(list, drect, srect, ColorValue.White);
//}
if (ruanProgress > 0)
{
float rolescale = -MathEx.Sqr(MathEx.Saturate(ruanProgress * 6) * 1.5f - 1) + 1;
rolescale = (1.0f / 0.75f) * rolescale;
Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
Matrix.Translation(179 + crdRuan.Width / 2, 292 + crdRuan.Height / 2, 0);
sprite.SetTransform(roletrans);
sprite.Draw(crdRuan, -crdRuan.Width / 2, -crdRuan.Height / 2, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
}
if (zjProgress > 0)
{
float rolescale = -MathEx.Sqr(MathEx.Saturate(zjProgress * 6) * 1.5f - 1) + 1;
rolescale = (1.0f / 0.75f) * rolescale;
Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
Matrix.Translation(701 + crdZj.Width / 2, 465 + crdZj.Height / 2, 0);
sprite.SetTransform(roletrans);
sprite.Draw(crdZj, -crdZj.Width / 2, -crdZj.Height / 2, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
}
if (xinProgress > 0)
{
float rolescale = -MathEx.Sqr(MathEx.Saturate(xinProgress * 6) * 1.5f - 1) + 1;
rolescale = (1.0f / 0.75f) * rolescale;
Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
Matrix.Translation(230 + crdXin.Width / 2, 460 + crdXin.Height / 2, 0);
sprite.SetTransform(roletrans);
sprite.Draw(crdXin, -crdXin.Width / 2, -crdXin.Height / 2, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
}
if (ybProgress > 0)
{
float rolescale = -MathEx.Sqr(MathEx.Saturate(ybProgress * 6) * 1.5f - 1) + 1;
rolescale = (1.0f / 0.75f) * rolescale;
Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
Matrix.Translation(695 + crdYb.Width / 2, 288 + crdYb.Height / 2, 0);
sprite.SetTransform(roletrans);
sprite.Draw(crdYb, -crdYb.Width / 2, -crdYb.Height / 2, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
}
if (musicProgress > 0)
{
float rolescale = -MathEx.Sqr(MathEx.Saturate(musicProgress * 6) * 1.5f - 1) + 1;
rolescale = (1.0f / 0.75f) * rolescale;
Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
Matrix.Translation(218 + crdMusic.Width / 2, 649 + crdMusic.Height / 2, 0);
sprite.SetTransform(roletrans);
sprite.Draw(crdMusic, -crdMusic.Width / 2, -crdMusic.Height / 2, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
}
sprite.Draw(backBtn.Image, backBtn.X, backBtn.Y, ColorValue.White);
if (backBtn.IsMouseOver)
{
sprite.Draw(backBtn.Image, backBtn.X, backBtn.Y - 4, ColorValue.White);
}
sprite.Draw(cursor, mousePosition.X, mousePosition.Y, ColorValue.White);
}
示例12: Render
public override void Render(Sprite sprite)
{
float d = 3 * time / duration;
d = d - (float)Math.Truncate(d);
float alpha = MathEx.Saturate(1 - d);
ColorValue modClr = modColor;// new ColorValue(1, 1, 1, alpha);
modClr.A = (byte)(byte.MaxValue * alpha);
float scale = 5 - 4 * alpha;
sprite.SetTransform(Matrix.Translation(-texture.Width / 2, -texture.Height / 2, 0) * Matrix.Scaling(scale, scale, scale) * Matrix.Translation(x, y, 0));
sprite.Draw(texture, 0, 0, modClr);
sprite.SetTransform(Matrix.Identity);
}
示例13: Render
public override void Render(Sprite sprite)
{
if (state != NIGDialogState.Hiding)
{
ColorValue overlayColor = ColorValue.Transparent;
overlayColor.A = (byte)(165 * showPrg);
sprite.Draw(overlay, 0, 0, overlayColor);
int x = 461;
int y = 166;
float scale = -MathEx.Sqr(MathEx.Saturate(showPrg) * 1.5f - 1) + 1;
scale = (1.0f / 0.75f) * scale;
Matrix trans = Matrix.Translation(-background.Width / 2, -background.Height / 2, 0) *
Matrix.Scaling(scale, scale, 1) *
Matrix.Translation(x + background.Width / 2, y + background.Height / 2, 0);
sprite.SetTransform(trans);
sprite.Draw(background, 0, 0, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
}
if (state == NIGDialogState.Showing)
{
sprite.Draw(chooseColor, 673, 208, gameLogic.LocalHumanPlayer.SideColor);
sprite.Draw(okButton.Image, okButton.X, okButton.Y, ColorValue.White);
if (okButton.IsMouseOver)
{
sprite.Draw(okButton.Image, okButton.X, okButton.Y - 4, ColorValue.White);
}
}
}
示例14: RenderGreen
void RenderGreen(Sprite sprite)
{
sprite.Draw(statusGreenBackground, 405, 580, ColorValue.White);
ForestObject oil = (ForestObject)selectedResource;
{
int hp = (int)oil.CurrentAmount;
int hpFull = (int)(oil.MaxAmount);
int hpTexWidth = (int)(statusGreenBarValue.Width * (oil.CurrentAmount / oil.MaxAmount));
sprite.Draw(statusGreenBarValue, new Rectangle(598, 615, hpTexWidth, statusGreenBarValue.Height),
new Rectangle(0, 0, hpTexWidth, statusGreenBarValue.Height), ColorValue.White);
sprite.Draw(statusGreenBarEdge, 580, 600, ColorValue.White);
string hpInfo = hp.ToString() + "/" + hpFull.ToString();
Matrix trans = Matrix.Scaling(0.8f, 0.8f, 1) * Matrix.Translation(new Vector3(680, 624, 0));
sprite.SetTransform(trans);
f8.DrawString(sprite, hpInfo, 0, 0, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
}
}
示例15: RenderRank
public void RenderRank(Sprite sprite)
{
List<Player> players = new List<Player>();
for (int i = 0; i < gameLogic.LocalPlayerCount; i++)
players.Add(gameLogic.GetLocalPlayer(i));
RankInfo.StatisticRank(players);
int startX = 543;
int startY = 160;
for (int i = 0; i < players.Count; i++)
{
if (players[i].Type != PlayerType.LocalHuman)
{
string s = (i + 1).ToString();
sprite.Draw(rankBackground, startX, startY, ColorValue.White);
f8.DrawString(sprite, s, startX, startY - 20, ColorValue.White);
Matrix trans = Matrix.Scaling(0.33f, 0.33f, 1) * Matrix.Translation(new Vector3(startX + 19, startY + 14, 0));
sprite.SetTransform(trans);
f8.DrawString(sprite, "TH", 0, 0, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
sprite.Draw(rankColor, startX + 35, startY + 9, players[i].SideColor);
f8.DrawString(sprite, players[i].Area.CityCount.ToString(), startX + 80, startY - 20, ColorValue.White);
startY += 37;
}
else
{
string s = (i + 1).ToString();
sprite.Draw(homeBackground, startX, startY - 4, players[i].SideColor);
f8.DrawString(sprite, s, startX + 2, startY, ColorValue.White);
Matrix trans = Matrix.Scaling(0.35f, 0.35f, 1) * Matrix.Translation(new Vector3(startX + 22, startY + 35, 0));
sprite.SetTransform(trans);
f8.DrawString(sprite, "TH", 0, 0, ColorValue.White);
sprite.SetTransform(Matrix.Identity);
f6.DrawString(sprite, players[i].Area.CityCount.ToString(), startX + 73, startY - 45, ColorValue.White);
startY += 70;
}
}
}