Exemple #1
0
        private void LoadDebugConfig()
        {
            Ini.IniFile debug_ini = new Ini.IniFile("./debug.ini");

            string[]   allowed_areas_sno_id_str = debug_ini.IniReadValue("Navmesh", "allowed_areas_sno_id").Split(',');
            List <int> allowed_areas_sno_id     = new List <int>();

            foreach (string id in allowed_areas_sno_id_str)
            {
                if (id.Length > 0)
                {
                    allowed_areas_sno_id.Add(int.Parse(id));
                }
            }
            m_Navmesh.AllowedAreasSnoId = allowed_areas_sno_id;

            string[]   allowed_grid_cells_id_str = debug_ini.IniReadValue("Navmesh", "allowed_grid_cells_id").Split(',');
            List <int> allowed_grid_cells_id     = new List <int>();

            foreach (string id in allowed_grid_cells_id_str)
            {
                if (id.Length > 0)
                {
                    allowed_grid_cells_id.Add(int.Parse(id));
                }
            }
            m_Navmesh.AllowedGridCellsId = allowed_grid_cells_id;

            m_Navmesh.Navigator.UpdatePathInterval = int.Parse(debug_ini.IniReadValue("Navigator", "update_path_interval"));
            m_Navmesh.Navigator.MovementFlags      = (MovementFlag)Enum.Parse(typeof(MovementFlag), debug_ini.IniReadValue("Navigator", "movement_flags"));
            m_Navmesh.Navigator.PathNodesShiftDist = float.Parse(debug_ini.IniReadValue("Navigator", "path_nodes_shift_dist"));
        }
Exemple #2
0
        private void LoadDebugConfig()
        {
            Ini.IniFile debug_ini = new Ini.IniFile("./debug.ini");

            string[] allowed_areas_sno_id_str = debug_ini.IniReadValue("Navmesh", "allowed_areas_sno_id").Split(',');
            List<int> allowed_areas_sno_id = new List<int>();
            foreach (string id in allowed_areas_sno_id_str)
            {
                if (id.Length > 0)
                    allowed_areas_sno_id.Add(int.Parse(id));
            }
            m_Navmesh.AllowedAreasSnoId = allowed_areas_sno_id;

            string[] allowed_grid_cells_id_str = debug_ini.IniReadValue("Navmesh", "allowed_grid_cells_id").Split(',');
            List<int> allowed_grid_cells_id = new List<int>();
            foreach (string id in allowed_grid_cells_id_str)
            {
                if (id.Length > 0)
                    allowed_grid_cells_id.Add(int.Parse(id));
            }
            m_Navmesh.AllowedGridCellsId = allowed_grid_cells_id;

            m_Navmesh.Navigator.UpdatePathInterval = int.Parse(debug_ini.IniReadValue("Navigator", "update_path_interval"));
            m_Navmesh.Navigator.MovementFlags = (MovementFlag)Enum.Parse(typeof(MovementFlag), debug_ini.IniReadValue("Navigator", "movement_flags"));
            m_Navmesh.Navigator.PathNodesShiftDist = float.Parse(debug_ini.IniReadValue("Navigator", "path_nodes_shift_dist"));
            
        }
Exemple #3
0
        public void PreloadModels()
        {
            var path  = Path.Combine(Directory.GetCurrentDirectory(), Path.Combine("Data", "Models"));
            var files = new DirectoryInfo(path).GetFiles("*.ini", SearchOption.AllDirectories).ToList();

            for (var i = 0; i < files.Count; i++)
            {
                var modelInfo    = new Ini.IniFile(files[i].FullName);
                var transforms   = new List <Matrix4>();
                var name         = modelInfo.IniReadValue("Global", "Name");
                var num_Pos      = modelInfo.IniReadValue("Global", "Positions");
                var numPositions = int.Parse(num_Pos);

                for (var iP = 0; iP < numPositions; iP++)
                {
                    var positionParts = Functions.SplitString(modelInfo.IniReadValue("Positions", string.Format("Position{0}", iP)), ";");
                    var transform     = Functions.CreateTransformationMatrix(
                        new Vector3(
                            float.Parse(positionParts[0], CultureInfo.InvariantCulture.NumberFormat),
                            float.Parse(positionParts[1], CultureInfo.InvariantCulture.NumberFormat),
                            float.Parse(positionParts[2], CultureInfo.InvariantCulture.NumberFormat)),
                        new Vector3(0.0f),
                        new Vector3(0.01f)
                        );

                    transforms.Add(transform);
                }

                Models.Add(new Models.OBJLoader(name), transforms);
            }
        }
        protected virtual void LoadDebugConfig()
        {
            Ini.IniFile debug_ini = new Ini.IniFile("./debug.ini");

            m_Navigator.UpdatePathInterval = int.Parse(debug_ini.IniReadValue("Navigator", "update_path_interval"));
            m_Navigator.MovementFlags      = (MovementFlag)Enum.Parse(typeof(MovementFlag), debug_ini.IniReadValue("Navigator", "movement_flags"));
            m_Navigator.PathNodesShiftDist = float.Parse(debug_ini.IniReadValue("Navigator", "path_nodes_shift_dist"));
        }
 /// <summary>
 /// 读取地图信息
 /// </summary>
 public void Init_ReadMapInfo()
 {
     try
     {
         #region 读取地图文件信息
         Ini.IniFile ini = new Ini.IniFile(strMapFileIni);
         dblMapInitLon   = double.Parse(ini.IniReadValue("地图信息", "地图初始经度"));
         dblMapInitLat   = double.Parse(ini.IniReadValue("地图信息", "地图初始纬度"));
         intMapInitLevel = int.Parse(ini.IniReadValue("地图信息", "地图初始显示级数"));
         dblMapMinLon    = double.Parse(ini.IniReadValue("地图信息", "最小经度"));
         dblMapMaxLon    = double.Parse(ini.IniReadValue("地图信息", "最大经度"));
         dblMapMinLat    = double.Parse(ini.IniReadValue("地图信息", "最小纬度"));
         dblMapMaxLat    = double.Parse(ini.IniReadValue("地图信息", "最大纬度"));
         intMapMinLevel  = Int32.Parse(ini.IniReadValue("地图信息", "显示最小级数"));
         intMapMaxLevel  = Int32.Parse(ini.IniReadValue("地图信息", "显示最大级数"));
         #endregion
         //地图中心点位置
         pointCurrentMapCenter = new PointD(dblMapInitLon, dblMapInitLat);
         //地图显示等级
         CurrentMapLevel = intMapInitLevel;
     }
     catch (Exception ex)
     {
         Error(ex, "Init_ReadMapInfo");
     }
 }
Exemple #6
0
        private void frmComPortSettings_Load(object sender, EventArgs e)
        {
            lbCurrentPorts.DataSource = System.IO.Ports.SerialPort.GetPortNames();

            Ini.IniFile ini = new Ini.IniFile();
            cbComPorts.Text  = ini.IniReadValue("ComportSettings", "COMPort");
            cbBaudRates.Text = ini.IniReadValue("ComportSettings", "BaudRate");
            cbParities.Text  = ini.IniReadValue("ComportSettings", "Parity");
            cbDataBits.Text  = ini.IniReadValue("ComportSettings", "DataBits");
            cbStopBits.Text  = ini.IniReadValue("ComportSettings", "StopBits");
        }
Exemple #7
0
        protected virtual void LoadDebugConfig()
        {
            if (!File.Exists(DEBUG_CONFIG_FILE))
            {
                return;
            }

            Ini.IniFile debug_ini = new Ini.IniFile(DEBUG_CONFIG_FILE);

            m_Navigator.UpdatePathInterval = int.Parse(debug_ini.IniReadValue("Navigator", "update_path_interval"));
            m_Navigator.MovementFlags      = (MovementFlag)Enum.Parse(typeof(MovementFlag), debug_ini.IniReadValue("Navigator", "movement_flags"));
            m_Navigator.PathNodesShiftDist = float.Parse(debug_ini.IniReadValue("Navigator", "path_nodes_shift_dist"));
        }
Exemple #8
0
 //Form Load
 private void LoadForm_Load(object sender, EventArgs e)
 {
     if (System.IO.File.Exists(RubyCore.SelfPath + @"\settings.ini"))
     {
         var a = new Ini.IniFile(RubyCore.SelfPath + @"\settings.ini");
         textBox1.Text = a.IniReadValue("Graphics", "path");
         recent_file   = a.IniReadValue("Recent", "path");
         if (File.Exists(recent_file))
         {
             button3.Enabled = true;
         }
     }
     loaded = true;
 }
Exemple #9
0
        static void Main(string[] args)
        {
            var ini = new Ini.IniFile(@"C:\twitter.ini");

            // Set up your credentials
            Auth.SetCredentials(new TwitterCredentials
            {
                AccessToken       = ini.IniReadValue("Config", "Access_Token"),
                AccessTokenSecret = ini.IniReadValue("Config", "Access_Secret"),
                ConsumerKey       = ini.IniReadValue("Config", "Consumer_Key"),
                ConsumerSecret    = ini.IniReadValue("Config", "Consumer_Secret")
            });

            var stream = Tweetinvi.Stream.CreateSampleStream();

            stream.TweetReceived += (sender, a) =>
            {
                var tp = new TweetProcessor(a.Tweet);

                tp.Process();
            };
            stream.StartStream();
        }
Exemple #10
0
        protected override void LoadDebugConfig()
        {
            base.LoadDebugConfig();

            Nav.D3.Navmesh navmesh_d3 = (m_Navmesh as Nav.D3.Navmesh);

            if (navmesh_d3 == null)
            {
                return;
            }

            Ini.IniFile debug_ini = new Ini.IniFile("./debug.ini");

            string[]   allowed_areas_sno_id_str = debug_ini.IniReadValue("Navmesh", "allowed_areas_sno_id").Split(',');
            List <int> allowed_areas_sno_id     = new List <int>();

            foreach (string id in allowed_areas_sno_id_str)
            {
                if (id.Length > 0)
                {
                    allowed_areas_sno_id.Add(int.Parse(id));
                }
            }
            navmesh_d3.AllowedAreasSnoId = allowed_areas_sno_id;

            string[]   allowed_grid_cells_id_str = debug_ini.IniReadValue("Navmesh", "allowed_grid_cells_id").Split(',');
            List <int> allowed_grid_cells_id     = new List <int>();

            foreach (string id in allowed_grid_cells_id_str)
            {
                if (id.Length > 0)
                {
                    allowed_grid_cells_id.Add(int.Parse(id));
                }
            }
            navmesh_d3.AllowedGridCellsId = allowed_grid_cells_id;
        }
Exemple #11
0
        //Private Methods

        private string get_initial_dir()
        {
            string str = "";

            if (System.IO.File.Exists(RubyCore.SelfPath + @"\settings.ini"))
            {
                var a = new Ini.IniFile(RubyCore.SelfPath + "/settings.ini");
                str = a.IniReadValue("InitFolder", "path");
            }
            if (str == "")
            {
                return(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
            }
            else
            {
                return(str);
            }
        }
Exemple #12
0
        protected virtual void LoadDebugConfig()
        {
            if (!File.Exists(DEBUG_CONFIG_FILE))
            {
                return;
            }

            Ini.IniFile debug_ini = new Ini.IniFile(DEBUG_CONFIG_FILE);

            m_Navigator.UpdatePathInterval            = int.Parse(debug_ini.IniReadValue("Navigator", "update_path_interval"));
            m_Navigator.MovementFlags                 = (MovementFlag)Enum.Parse(typeof(MovementFlag), debug_ini.IniReadValue("Navigator", "movement_flags"));
            m_Navigator.PathNodesShiftDist            = float.Parse(debug_ini.IniReadValue("Navigator", "path_nodes_shift_dist"));
            m_Navigator.DefaultPrecision              = float.Parse(debug_ini.IniReadValue("Navigator", "default_precision"));
            m_Navigator.GridDestPrecision             = float.Parse(debug_ini.IniReadValue("Navigator", "grid_dest_precision"));
            m_Navigator.PathSmoothingPrecision        = float.Parse(debug_ini.IniReadValue("Navigator", "path_smoothing_precision"));
            m_Navigator.KeepFromEdgePrecision         = float.Parse(debug_ini.IniReadValue("Navigator", "keep_from_edge_precision"));
            m_Navigator.CurrentPosDiffRecalcThreshold = float.Parse(debug_ini.IniReadValue("Navigator", "current_pos_diff_recalc_threshold"));

            m_Explorer.ChangeExploreCellSize(int.Parse(debug_ini.IniReadValue("Explorer", "explore_cell_size")));
            m_Explorer.Enabled = bool.Parse(debug_ini.IniReadValue("Explorer", "enabled"));
            m_Explorer.ExploreDestPrecision = float.Parse(debug_ini.IniReadValue("Explorer", "explore_dest_precision"));

            m_BotSpeed = float.Parse(debug_ini.IniReadValue("Bot", "speed"));
        }