Exemplo n.º 1
0
        private void psXY2Logical(int psX, int psY, MiddleMapConfig config, ref int logicalX, ref int logicalY)
        {
            int    height = config.cHeight;
            double scale  = config.cScale;
            double startx = config.cStartx;
            double starty = config.cStarty;

            logicalX = Convert.ToInt32(startx + psX / scale);
            logicalY = Convert.ToInt32(starty + (height - psY) / scale);
        }
Exemplo n.º 2
0
        private MiddleMapConfig GetConfig(string middlemap)
        {
            string configFilePath = string.Format("{0}\\data\\source\\maps\\{1}minimap\\config.ini", RootDir, MapName);
            string Section        = string.Format("middlemap{0}", middlemap);

            string value;
            string key;
            int    height;
            double scale;
            double startx;
            double starty;

            //height
            key   = "height";
            value = IniIO.IniReadValue(Section, key, configFilePath);
            if (value == "" || !Helper.CanConverToNumber(value))
            {
                throw new Exception(string.Format("{0}的{1},{2}配置不对", configFilePath, Section, key));
            }
            height = Convert.ToInt32(value);
            //scale
            key   = "scale";
            value = IniIO.IniReadValue(Section, key, configFilePath);
            if (value == "" || !Helper.CanConverToNumber(value))
            {
                throw new Exception(string.Format("{0}的{1},{2}配置不对", configFilePath, Section, key));
            }
            scale = Convert.ToDouble(value);

            //startx
            key   = "startx";
            value = IniIO.IniReadValue(Section, key, configFilePath);
            if (value == "" || !Helper.CanConverToNumber(value))
            {
                throw new Exception(string.Format("{0}的{1},{2}配置不对", configFilePath, Section, key));
            }
            startx = Convert.ToDouble(value);

            //starty
            key   = "starty";
            value = IniIO.IniReadValue(Section, key, configFilePath);
            if (value == "" || !Helper.CanConverToNumber(value))
            {
                throw new Exception(string.Format("{0}的{1},{2}配置不对", configFilePath, Section, key));
            }
            starty = Convert.ToDouble(value);

            MiddleMapConfig config = new MiddleMapConfig();

            config.Init(height, scale, startx, starty);

            return(config);
        }
Exemplo n.º 3
0
        private MiddleMapConfig GetConfig(string middlemap)
        {
            string configFilePath = string.Format("{0}\\data\\source\\maps\\{1}minimap\\config.ini", RootDir, MapName);
            string Section = string.Format("middlemap{0}", middlemap);

            string value;
            string key;
            int height;
            double scale;
            double startx;
            double starty;

            //height
            key = "height";
            value = IniIO.IniReadValue(Section, key, configFilePath);
            if (value == "" || !Helper.CanConverToNumber(value))
            {
                throw new Exception(string.Format("{0}的{1},{2}配置不对", configFilePath, Section, key));
            }
            height = Convert.ToInt32(value);
            //scale
            key = "scale";
            value = IniIO.IniReadValue(Section, key, configFilePath);
            if (value == "" || !Helper.CanConverToNumber(value))
            {
                throw new Exception(string.Format("{0}的{1},{2}配置不对", configFilePath, Section, key));
            }
            scale = Convert.ToDouble(value);

            //startx
            key = "startx";
            value = IniIO.IniReadValue(Section, key, configFilePath);
            if (value == "" || !Helper.CanConverToNumber(value))
            {
                throw new Exception(string.Format("{0}的{1},{2}配置不对", configFilePath, Section, key));
            }
            startx = Convert.ToDouble(value);

            //starty
            key = "starty";
            value = IniIO.IniReadValue(Section, key, configFilePath);
            if (value == "" || !Helper.CanConverToNumber(value))
            {
                throw new Exception(string.Format("{0}的{1},{2}配置不对", configFilePath, Section, key));
            }
            starty = Convert.ToDouble(value);

            MiddleMapConfig config = new MiddleMapConfig();
            config.Init(height, scale, startx, starty);

            return config;
            
        }        
Exemplo n.º 4
0
        private void psXY2Logical(int psX, int psY, MiddleMapConfig config, ref int logicalX, ref int logicalY)
        {
            int height = config.cHeight;
            double scale = config.cScale;
            double startx = config.cStartx;
            double starty = config.cStarty;

            logicalX = Convert.ToInt32(startx + psX / scale);
            logicalY = Convert.ToInt32(starty + (height - psY) / scale);
        }