本文整理汇总了C#中Tile.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Tile.ToString方法的具体用法?C# Tile.ToString怎么用?C# Tile.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tile
的用法示例。
在下文中一共展示了Tile.ToString方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddTile
public void AddTile(int downsample, Tile tile)
{
SortedDictionary<string, Tile> tiles;
if (TilesAtLevel.ContainsKey(downsample) == false)
{
tiles = new SortedDictionary<string, Tile>();
tiles.Add(tile.ToString(), tile);
TilesAtLevel.Add(downsample, tiles);
}
else
{
tiles = TilesAtLevel[downsample];
Debug.Assert(false == tiles.ContainsKey(tile.ToString()));
tiles.Add(tile.ToString(), tile);
}
}
示例2: AddAndSpawnKebabBuilding
public void AddAndSpawnKebabBuilding(KebabBuilding building, Tile tile)
{
StopCoroutine("CustomerSpawnerRutine");
if (tile.type == TileType.Buildable)
Destroy(GameObject.Find(tile.ToString()));
world.AddBuilding(building, tile);
SpawnBuilding(building);
StartCoroutine(world.SetNewCustomerDestinations(tile.x, tile.z));
StartCoroutine("CustomerSpawnerRutine");
}
示例3: TileToChar
private static char TileToChar(Tile tile)
{
switch (tile)
{
case Tile.Empty:
return ' ';
case Tile.Floor:
return '.';
case Tile.Wall:
return '#';
default:
throw new KeyNotFoundException(tile.ToString());
}
}
示例4: SaveElement
public static bool SaveElement(UIElement element, Tile tile)
{
try
{
var side = (tile == Tile.Small) ? 159 : 336;
element.Measure(new Size(side, side));
element.Arrange(new Rect(0, 0, side, side));
var bmp = new WriteableBitmap(side, side);
bmp.Render(element, null);
bmp.Invalidate();
var name = tile.ToString() + Guid.NewGuid() + ".png";
using (var isf = IsolatedStorageFile.GetUserStoreForApplication())
{
if (!isf.DirectoryExists("/CustomLiveTiles"))
{
isf.CreateDirectory("/CustomLiveTiles");
}
using (var myFileStream = isf.CreateFile("shared/shellcontent/" + name))
{
// Encode WriteableBitmap object to a PNG stream.
bmp.WritePng(myFileStream);
}
var filesTodelete =
from f in isf.GetFileNames("shared/shellcontent/" + tile + "*").AsQueryable()
where !f.EndsWith(name)
select f;
foreach (var file in filesTodelete)
{
isf.DeleteFile("shared/shellcontent/" + file);
}
}
SaveTilePart("isostore:/Shared/ShellContent/" + name, tile);
}
catch (Exception)
{
Thread.Sleep(1000);
if (tile == Tile.Small)
{
SaveTilePart(GetDefaultSmallTile(), tile);
}
else
{
SaveTilePart((tile == Tile.Front) ? GetDefaultFrontTile() : GetDefaultBackTile(), tile);
}
return false;
}
return true;
}
示例5: Main
static void Main(string[] args)
{
byte[] rom = File.ReadAllBytes(ROM_PATH);
List<Tile> tiles = new List<Tile>();
using (StreamWriter outfile = new StreamWriter(VECTOR_FILE_PATH))
for (int level = 0; level < LEVELS.Length; level++)
{
Tile t = null;
for (int i = LEVELS[level]; (t == null) || (!t.End); i += 2)
{
byte rom_0 = rom[i];
byte rom_1 = rom[i + 1];
t = new Tile(rom_0, rom_1);
string word = t.ToWord();
outfile.WriteLine(word);
Tile recreated = new Tile(word);
if (t.ToString() != recreated.ToString())
{
throw new Exception("Recreated tile failed to match!");
}
ushort recreatedBytes = recreated.ToBytes();
byte byte0 = (byte)((recreatedBytes & 0xFF00) >> 8);
byte byte1 = (byte)(recreatedBytes & 0xFF);
if (rom_0 != byte0)
{
//throw new Exception("Recreated bytes failed to match!");
Debugger.Break();
}
if (!recreated.End &&
rom_1 != byte1)
{
//throw new Exception("Recreated bytes failed to match!");
Debugger.Break();
}
tiles.Add(t);
}
}
}
示例6: CompareSimilarPatterns
public void CompareSimilarPatterns()
{
// Setup
int bitsPerColour = 8;
int tileSize = 16;
int offsetX = 0;
int offsetY = 0;
//Bitmap croppedImage = Program.LoadImage(@"C:\Users\nicB\Documents\tileTest.png");
Program.LoadImage(@"C:\Users\nicB\Documents\tileTest.png", tileSize, offsetX, offsetY);
//int x = 0;
//int y = 0;
int index = 0;
//Bitmap image1 = Program.GetTileImage(x, y, TileSize);
Bitmap image1 = Program.GetTileImage(index);
Tile tile1 = new Tile(image1, bitsPerColour, tileSize, index);
Console.WriteLine("Tile 1: " + tile1.ToString());
//x = 16;
index = 1;
//Bitmap image2 = Program.GetTileImage(x, y, TileSize);
Bitmap image2 = Program.GetTileImage(index);
Tile tile2 = new Tile(image2, bitsPerColour, tileSize, 1);
Console.WriteLine("Tile 2: " + tile2.ToString());
// Execution
Tuple<float, float> results = tile1.GetMatches(tile2);
float patternMatch = results.Item1;
float colourMatch = results.Item2;
bool identical = tile1.IdenticalTo(tile2);
// Assertion
float expectedPatternMatch = 223 / 255f;
Assert.IsTrue(patternMatch == expectedPatternMatch, string.Format("Expected {0}, Actual {1}", expectedPatternMatch, patternMatch));
Assert.IsFalse(identical);
}
示例7: AddBuilding
public void AddBuilding(Building building, Tile tile)
{
if (tile.type == TileType.Buildable)
{
buildings.Add(building);
building.tile = tile;
building.tile.type = TileType.Occupied;
if (building is KebabBuilding)
{
_kebabBuildings.Add((KebabBuilding)building);
SanityCheckKebabBuildingsCount();
}
}
else
throw new Exception("Tried to add a new building to tile " + tile.ToString() + " when not allowed. Should not happend. Fix originating code.");
}
示例8: RemoveInteractable
/**
* Remove the interactable on the given tile from the list of tiles
*
* Arguments
* - Tile toRemove - The tile that contains an interactable object
*/
public void RemoveInteractable(Tile toRemove)
{
int index = GetInteractable(toRemove); // The index of the interactive object in the list
if (index == -1) {
Debug.Log("Can't find Tile");
return;
}
blockedTiles.Remove(toRemove);
InteractiveTiles.Remove(InteractiveTiles[index]);
Debug.Log("int Remove: " + toRemove.ToString());
Object.FindObjectOfType<GameManager>().OpenDoor(toRemove);
}
示例9: Reach
public void Reach(Tile tile)
{
client.Send("<REACH hai=\"" + tile.ToString() + "\" />");
GameData.player[0].reached = true;
}
示例10: ToStringTest
public void ToStringTest()
{
Tile target = new Tile(); // TODO: Initialize to an appropriate value
string expected = string.Empty; // TODO: Initialize to an appropriate value
string actual;
actual = target.ToString();
Assert.AreEqual(expected, actual);
Assert.Inconclusive("Verify the correctness of this test method.");
}
示例11: StartMe
/**
* Overload for intializing this interactive object.
*
* Arguments
* - GameManager g - The game manager script
*/
public void StartMe(GameManager g)
{
if (DebugOption)
Debug.Log("Started");
// Initialize variables
position = new Tile(
Tile.TilePosition(transform.position.x),
Tile.TilePosition(transform.position.z)
); // Interactive object position tile
IsInactivated = false; // Interactive object activated value
MinCost = Cost; // Interactive object cost value
panel = GameObject.FindGameObjectWithTag("SkillPanel"); // Reference to skill panel
nameLabel = panel.transform.FindChild("SkillCheckText").GetComponent<Text>(); // Skill panel text
APSlider = panel.transform.FindChild("Slider").GetComponent<Slider>(); // Skill panel slider
MController = g.GetPlayerControllers(); // Game movenment controller
//player = GameObject.Find ("Player"); // Player gameobject
PrimaryO = GameObject.FindGameObjectWithTag ("Objective UI")
.GetComponent<PrimaryObjectiveController>(); // Primary Objective script
player = Player.MyPlayer; // Player gameobject
PlayerScript = player.GetComponent<Player>(); // Player script
MController.AddInteractable(this); // Add interactable to Movement controller
if (DebugOption)
Debug.Log(position.ToString());
}