Example #1
0
    private void OnMsgGetPlayerWorldMap(byte[] buffer)
    {
        PWorldMapInfo ret = Net.Deserialize <PWorldMapInfo>(buffer);

        if (!Net.CheckErrorCode(ret.errorCode, eCommand.GET_PLYAYER_WORLD_MAP))
        {
            return;
        }

        WorldManager.Instance.CityList.Clear();

        //Log.Info("城池数据: {0}  {1}", ret.playerMaps.Count, ret.sourceMaps.Count);

        foreach (var item in ret.playerMaps)
        {
            WorldCityInfo info = new WorldCityInfo();
            info.Deserialize(item);
            WorldManager.Instance.CityList.Add(info);
        }

        // 刷新地图
        UIManager.Instance.RefreshWindow <UIWorldMapView>();
    }
Example #2
0
    // 请求侦查城池
    public void RequestDetect(int mapPos)
    {
        PCMInt data = new PCMInt();

        data.arg = mapPos;
        NetworkManager.Instance.Send(eCommand.SURVEY_CITY, data, (buffer) => {
            PPlayerMapInfo ret = Net.Deserialize <PPlayerMapInfo>(buffer);
            if (!Net.CheckErrorCode(ret.errorCode, eCommand.SURVEY_CITY))
            {
                return;
            }

            WorldCityInfo info = GetCity(mapPos);
            if (info != null)
            {
                info.Deserialize(ret);
            }

            // 刷新地图
            EventDispatcher.TriggerEvent(EventID.EVENT_WORLD_REFRESH_CITY, mapPos);
            UIManager.Instance.RefreshWindow <UIWorldCityInfoView>();
        });
    }