本文整理汇总了C#中Mesh.LoadFromText方法的典型用法代码示例。如果您正苦于以下问题:C# Mesh.LoadFromText方法的具体用法?C# Mesh.LoadFromText怎么用?C# Mesh.LoadFromText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mesh
的用法示例。
在下文中一共展示了Mesh.LoadFromText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartGame
private void StartGame()
{
Random rnd = new Random();
lock (Players)
{
Generator = Players[rnd.Next(Players.Count)];
}
Broadcast(new StartingGameBroadcast(-1));
GenerateResponse res = (GenerateResponse)Generator.Connection.SendMessage(new GenerateMessage(Profile));
current = new Mesh(0, 0, res.MeshType);
target = new Mesh(0, 0, res.MeshType);
current.LoadFromText(res.StartLines);
target.LoadFromText(res.EndLines);
for (int i = 5; i >= 0; i--)
{
Thread.Sleep(1000);
Broadcast(new StartingGameBroadcast(i));
}
scores.Clear();
for (int i = 0; i < Players.Count; i++)
scores.Add(0.0);
Broadcast(new ScoresBroadcast(scores, true));
Broadcast(new BoardDetailsBroadcast(current));
playingAllowed = true;
}
示例2: shard_InitialBoardDataBroadcast
void shard_InitialBoardDataBroadcast(object sender, BoardDataEventArgs args)
{
if (this.InvokeRequired)
{
BeginInvoke(new BoardDataEventHandler(shard_InitialBoardDataBroadcast), sender, args);
return;
}
Mesh res = new Mesh(0, 0, args.MeshType);
res.LoadFromText(args.Lines);
loopDisplay1.Mesh = res;
loopDisplay1.Refresh();
}
示例3: loadToolStripMenuItem_Click
private void loadToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog dialog = new OpenFileDialog();
dialog.DefaultExt = "loop";
dialog.Filter = "Loop-De-Loop files|*.loop|Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
dialog.RestoreDirectory = true;
if (dialog.ShowDialog() == DialogResult.OK)
{
try
{
string[] lines = File.ReadAllLines(dialog.FileName);
if (lines.Length == 0)
throw new Exception("File format invalid");
if (lines[0].Length == 0)
throw new Exception("File format invalid");
// The old 'standard format'. Used for mesh type square.
if (lines[0][0] == '+')
{
LoadSimpleSquare(lines);
labelDepthPatern.Text = string.Empty;
loopDisplay1.Refresh();
}
else if (IsLoopySave(lines))
{
LoadLoopySave(lines);
labelDepthPatern.Text = string.Empty;
loopDisplay1.Refresh();
}
else if (IsLoopy(lines))
{
LoadLoopyPuzzle(lines);
labelDepthPatern.Text = string.Empty;
loopDisplay1.Refresh();
}
else
{
MeshType type = (MeshType)Enum.Parse(typeof(MeshType), lines[0]);
Mesh mesh = new Mesh(0, 0, type);
if (!mesh.LoadFromText(lines))
return;
loopDisplay1.Mesh = mesh;
labelDepthPatern.Text = string.Empty;
loopDisplay1.Refresh();
}
Rate();
secs = 0;
if (Settings.Default.ShowClock)
label2.Text = "Time: 00:00:00";
timer1.Enabled = false;
timer1.Enabled = true;
}
catch
{
MessageBox.Show("Failed to open puzzle, file does not contain valid data.");
}
}
}