示例#1
0
 public bool AddFubenMap(GameMap map)
 {
     if (mGameMap.Count >= GameBase.Config.Define.MAX_FUBEN_CLONE_COUNT)
     {
         return false;
     }
     mGameMap.Add(map);
     return true;
 }
示例#2
0
        //复制地图对象- 用于做副本使用
        public GameMap Clone()
        {
            GameMap new_map = new GameMap(this.info);
            new_map.mnWidth = this.mnWidth;
            new_map.mnHeight = this.mnHeight;
            new_map.mPath = new MapPath(mnHeight, mnWidth);

            for (uint i = 0; i < mnHeight; i++)
            {
                for (uint j = 0; j < mnWidth; j++)
                {
                    new_map.GetMapGridInfo()[j, i] = this.mMapGridInfo[j, i];
                    if (new_map.GetMapGridInfo()[j, i].Mask > 0)
                    {
                        new_map.mPath.SetPointMask((short)j, (short)i, MapPath.MASK_CLOSE);
                    }
                }
            }
            foreach (BaseObject obj in this.GetAllObject().Values)
            {
                new_map.AddObject(obj, obj.GetGameSession());
            }
            return new_map;
        }
示例#3
0
        private bool LoadGameMapInfo()
        {
            String text = mPacket.LoadFileToText(TextDefine.CONFIG_FILE_MAP);
            CsvFile csv = new CsvFile(text);

            String v;
            if (text == "") return false;
            for (int i = 0; i < csv.GetLine(); i++)
            {
                GameStruct.MapInfo info = new GameStruct.MapInfo();
                v = csv.GetFieldInfoToValue(i, "id");
                info.id = Convert.ToUInt32(v);
                info.name = csv.GetFieldInfoToValue(i, "name");
                info.dmappath = csv.GetFieldInfoToValue(i, "dmap");
                v = csv.GetFieldInfoToValue(i, "recallid");
                info.recallid = Convert.ToUInt32(v);
                v = csv.GetFieldInfoToValue(i, "recallx");
                info.recallx = Convert.ToUInt16(v);
                v = csv.GetFieldInfoToValue(i, "recally");
                info.recally = Convert.ToUInt16(v);
                v = csv.GetFieldInfoToValue(i, "snows");
                info.issnows = Convert.ToBoolean(v);
                //加入到地图
                GameMap map = new GameMap(info);
                if (!map.Create())
                {
                    Log.Instance().WriteLog("加载地图失败.." + info.name);
                }
                MapManager.Instance().AddMap(map);

            }
            return true;
        }
示例#4
0
        //更换地图 用于副本场景
        public void ChangeFubenMap(GameMap map, short x, short y)
        {
            if (map == null) return;
            this.GetGameMap().RemoveObj(this);
            //召回所有幻兽-
            this.GetEudemonSystem().Eudemon_ReCallAll(true);
            map.AddObject(this, this.GetGameSession());

            //先清除自身对象
            this.ClearThis();

            this.SetPoint(x, y);
            //要发二个包
            NetMsg.MsgReCall1 msg = new NetMsg.MsgReCall1();
            msg.Create(null, GetGamePackKeyEx());
            msg.roleid = this.GetTypeId();
            msg.mapid = (int)this.GetGameMap().GetMapInfo().id;
            msg.x = this.GetCurrentX();
            msg.y = this.GetCurrentY();
            this.SendData(msg.GetBuffer());

            NetMsg.MsgReCall2 msg1 = new NetMsg.MsgReCall2();
            msg1.Create(null, GetGamePackKeyEx());
            msg1.roleid = this.GetTypeId();
            msg1.x = this.GetCurrentX();
            msg1.y = this.GetCurrentY();
            this.SendData(msg1.GetBuffer());

            this.GetVisibleList().Clear();

            GameStruct.Action act = new GameStruct.Action(GameStruct.Action.MOVE);
            this.PushAction(act);

            GetBaseAttr().mapid = map.GetMapInfo().id;

            this.SendJueweiNotice();
            this.SetTransmitIng(true);
        }
示例#5
0
 public bool AddMap(GameMap map)
 {
     if (m_DicMap.ContainsKey(map.GetID()))
     {
         Log.Instance().WriteLog("增加地图失败,已经存在该地图--地图ID:" + map.GetID().ToString());
         return false;
     }
     m_DicMap[map.GetID()] = map;
     return true;
 }