当前位置: 首页>>代码示例>>C#>>正文


C# Mesh.LoadFromText方法代码示例

本文整理汇总了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;
 }
开发者ID:Tilps,项目名称:LoopDeLoop,代码行数:25,代码来源:ServerGame.cs

示例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();
 }
开发者ID:Tilps,项目名称:LoopDeLoop,代码行数:12,代码来源:GameForm.cs

示例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.");
                }
            }
        }
开发者ID:Tilps,项目名称:LoopDeLoop,代码行数:58,代码来源:LoopDeLoopForm.cs


注:本文中的Mesh.LoadFromText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。