Ejemplo n.º 1
0
        public static ActionInfoWithDynamicImageMapCollection GetImageMaps(IEnumerable <MapAreaInfo> mapAreaInfoList, ActionInfoWithDynamicImageMapCollection actions, ReportItem reportItem)
        {
            List <ActionInfoWithDynamicImageMap> list = new List <ActionInfoWithDynamicImageMap>();

            bool[] array = new bool[actions.Count];
            foreach (MapAreaInfo mapAreaInfo in mapAreaInfoList)
            {
                MapAreaInfo current = mapAreaInfo;
                int         num     = MappingHelper.AddMapArea(current, actions, reportItem);
                if (num > -1 && !array[num])
                {
                    list.Add(((ReportElementCollectionBase <ActionInfoWithDynamicImageMap>)actions)[num]);
                    array[num] = true;
                }
                else if (!string.IsNullOrEmpty(current.ToolTip))
                {
                    string text = default(string);
                    ActionInfoWithDynamicImageMap actionInfoWithDynamicImageMap = MappingHelper.CreateActionInfoDynamic(reportItem, (ActionInfo)null, current.ToolTip, out text);
                    if (actionInfoWithDynamicImageMap != null)
                    {
                        actionInfoWithDynamicImageMap.CreateImageMapAreaInstance(current.MapAreaShape, current.Coordinates, current.ToolTip);
                        list.Add(actionInfoWithDynamicImageMap);
                    }
                }
            }
            actions.InternalList.Clear();
            actions.InternalList.AddRange(list);
            if (actions.Count == 0)
            {
                return(null);
            }
            return(actions);
        }
Ejemplo n.º 2
0
        public void LoadARFile(string filePath)
        {
            if (!string.IsNullOrEmpty(m_strFilePath) && m_strFilePath == filePath)
            {
                Engine.Utility.Log.Error("Reload Error {0}", m_strFilePath);
                return;
            }
            m_MapAreaInfoArrar = null;

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }
            m_strFilePath = filePath;
            try
            {
                byte[] bytes = Engine.Utility.FileUtils.Instance().ReadFile(filePath);
                if (bytes != null)
                {
                    MemoryStream ms = new MemoryStream(bytes);
                    BinaryReader br = new BinaryReader(ms);

                    uint ar_magic = br.ReadUInt32();
                    uint ar_ver   = br.ReadUInt32();
                    ar_width  = br.ReadUInt32(); //X
                    ar_height = br.ReadUInt32(); //Z

                    m_MapAreaInfoArrar = new MapAreaInfo[ar_height * ar_width];
                    for (int z = 0; z < ar_height; z++)
                    {
                        for (int x = 0; x < ar_width; x++) //x
                        {
                            byte ar_resid0 = br.ReadByte();
                            byte ar_resid1 = br.ReadByte();
                            uint ar_type   = br.ReadUInt32();
                            m_MapAreaInfoArrar[x + z * ar_width] = new MapAreaInfo()
                            {
                                x = (ushort)x, z = (ushort)z, areaType = (byte)ar_type
                            };
                        }
                    }
                }
                else
                {
                    Engine.Utility.Log.Error("Load AR FILE {0} Failed ", filePath);
                }
                bytes = null;
            }
            catch (System.Exception ex)
            {
                Engine.Utility.Log.Error("Load AR FILE {0} :{1} ", filePath, ex.ToString());
            }
        }
Ejemplo n.º 3
0
        private static int AddMapArea(MapAreaInfo mapAreaInfo, ActionInfoWithDynamicImageMapCollection actions, ReportItem reportItem)
        {
            if (mapAreaInfo.Tag == null)
            {
                return(-1);
            }
            int num = (int)mapAreaInfo.Tag;
            ActionInfoWithDynamicImageMap actionInfoWithDynamicImageMap = actions.InternalList[num];

            if (actionInfoWithDynamicImageMap.Actions.Count > 0 || !string.IsNullOrEmpty(mapAreaInfo.ToolTip))
            {
                actionInfoWithDynamicImageMap.CreateImageMapAreaInstance(mapAreaInfo.MapAreaShape, mapAreaInfo.Coordinates, mapAreaInfo.ToolTip);
                return(num);
            }
            return(-1);
        }
Ejemplo n.º 4
0
        public MapAreaType GetAreaTypeByPos(Vector3 pos, Vector2 mapSize)
        {
            int x     = (int)pos.x;
            int z     = -(int)pos.z;
            int index = x + z * (int)ar_width;

            if (m_MapAreaInfoArrar != null && index >= 0 && index < m_MapAreaInfoArrar.Length)
            {
                MapAreaInfo mapArea = m_MapAreaInfoArrar[index];
                //if (mapArea != null)
                {
                    return((MapAreaType)mapArea.areaType);
                }
                Engine.Utility.Log.Error("获取区域类型失败");
            }
            return(MapAreaType.Normal);
        }
Ejemplo n.º 5
0
 public SortieStatisticAreaViewModel(MapAreaInfo rpArea)
 {
     Area = rpArea;
 }
 public SortieStatisticAreaViewModel(MapAreaInfo rpArea)
 {
     Area = rpArea;
 }