MapServer.PlayerObject.FlyMap C# (CSharp) Method

FlyMap() public method

public FlyMap ( uint mapid, short x, short y, byte dir ) : void
mapid uint
x short
y short
dir byte
return void
        public void FlyMap(uint mapid, short x, short y, byte dir)
        {
            GameMap map = MapManager.Instance().GetGameMapToID(mapid);
            if (map == null)
            {
                Log.Instance().WriteLog("未找到游戏地图id:" + mapid.ToString());
                return;
            }
            if (GetGameMap() != null)
            {
                GetGameMap().RemoveObj(this);
            }
            this.mGameMap = map;
            this.GetBaseAttr().mapid = mapid;
            this.SetPoint(x, y);
            this.SetDir(dir);
            map.AddObject(this, this.GetGameSession());
            //重新刷新可视列表

            GameStruct.Action act = new GameStruct.Action(GameStruct.Action.MOVE);
            this.PushAction(act);
            //发给玩家
            NetMsg.MsgMapInfo mapinfo = new NetMsg.MsgMapInfo();
            mapinfo.Create(null, GetGamePackKeyEx());
            mapinfo.Init(mapid, x, y, NetMsg.MsgMapInfo.ENTERMAP);
            this.SendData(mapinfo.GetBuffer());
            //发送天气信息
            this.GetGameMap().SendWeatherInfo(this);
        }

Usage Example

Exemplo n.º 1
0
 private void Action_Map_EnterMap(ActionInfo info, PlayerObject play)
 {
     String[] option = info.param.Split(' ');
     if (option.Length < 2)
     {
         Log.Instance().WriteLog("脚本参数错误,id:" + info.id.ToString() + " param:" + info.param);
         return;
     }
     uint mapid = Convert.ToUInt32(option[0]);
     short x = Convert.ToInt16(option[1]);
     short y = Convert.ToInt16(option[2]);
     byte dir = Convert.ToByte(option[3]);
     play.FlyMap(mapid, x, y, dir);
 }