Exemplo n.º 1
0
        private bool GetLogicalCoordinate(int mapid, float scalex, float scaley, ref int logicalx, ref int logicaly)
        {
            int   cfgWidth  = 0;
            int   cfgHeight = 0;
            float cfgScale  = 0.0f;
            float cfgStartx = 0;
            float cfgStarty = 0;

            MapConfig config = htMapConfig[mapid] as MapConfig;

            if (config == null)
            {
                return(false);
            }
            config.GetConfig(ref cfgWidth, ref cfgHeight, ref cfgStartx, ref cfgStarty, ref cfgScale);
            logicalx = Convert.ToInt32((cfgWidth * scalex / cfgScale) + cfgStartx);
            logicaly = Convert.ToInt32((cfgHeight * (1 - scaley) / cfgScale) + cfgStarty);
            return(true);
        }
Exemplo n.º 2
0
        private void SetMoreInfo(ref OneNode node)
        {
            int       mapid  = node.MapId;
            MapConfig config = htMapConfig[mapid] as MapConfig;

            if (config == null)
            {
                node.imageMap = null;
                node.fScaleX  = 0.5f;
                node.fScaleY  = 0.5f;
                return;
            }
            int   cfgWidth  = 0;
            int   cfgHeight = 0;
            float cfgScale  = 0.0f;
            float cfgStartx = 0;
            float cfgStarty = 0;

            config.GetConfig(ref cfgWidth, ref cfgHeight, ref cfgStartx, ref cfgStarty, ref cfgScale);
            node.fScaleX  = (node.nX - cfgStartx) / (cfgWidth / cfgScale);
            node.fScaleY  = 1 - (node.nY - cfgStarty) / (cfgHeight / cfgScale);
            node.imageMap = config.TagImage;
        }