示例#1
0
 /// <summary>
 /// Starts the server
 /// </summary>
 private void ServerStart()
 {
     level = LevelIO.ReadJSON(levelLocation);
     level.SetupLevel(protagonistWeight, enemyWeight);
     //Update levelLocation to include weights
     ServerDataManager.Instance.levelJson = JsonConvert.SerializeObject(level);
     SetupExits();
     SetupRotationTimer();
     ServerDataManager.Instance.Level = level;
     this.listener = new TcpListener(IPAddress.Any, PORT_NO);
     //Run Client listining on a different thread so that it does not block the main thread
     this.listenThread = new Thread(new ThreadStart(ClientConnection));
     listenThread.Start();
 }
示例#2
0
        private void BtnPlay_OnClick(object sender, RoutedEventArgs e)
        {
            //Check to see if the user has selected an item
            if (lstLevels.SelectedIndex == -1)
            {
                MessageBox.Show("Please select a level");
                return;
            }

            //Convert selected string to Level file
            string fullFileName = string.Format("{0}\\{1}.level", App.AppDir, lstLevels.SelectedItem);

            selectedLevel      = LevelIO.ReadJSON(fullFileName);
            selectedLevel.Name = lstLevels.SelectedItem.ToString();
            //Send back to previous page
            goBack = true;
        }