コード例 #1
0
ファイル: ClientCreator.cs プロジェクト: wxl-007/ShadowDota
        public void CreateMap(MapInfo map)
        {
            //设置当前配置信息
            if (map.type == ConfigType.PVEChapter)
            {
                ChapterModel chatperModel = Core.Data.getIModelConfig <ChapterModel>();
                curChapConfig = chatperModel.get(map.ID);
            }
            else
            {
                PVPBattleModel pvpModel = Core.Data.getIModelConfig <PVPBattleModel>();
                curChapConfig = pvpModel.get(map.ID);
            }

            //加载配表
            reader.loadSceneConfig(map.ID);

            //TODO : According to the type of map, we should make up the right path
            StringBuilder strBld = new StringBuilder("Scenes/Stage_");

            strBld.Append(map.ID.ToString());
            GameObject go = Maploader.loadFromUnPack(strBld.ToString(), false);

            UnityUtils.AddChild_Reverse(go, ScenePoint);

            MapInSceneData[] mapdata = reader.GetSceneEditorElementData <MapInSceneData>();
            if (mapdata != null && mapdata.Length > 0)
            {
                go.transform.localPosition    = new Vector3(mapdata [0].pos [0], mapdata [0].pos [1], mapdata [0].pos [2]);
                go.transform.localScale       = new Vector3(mapdata [0].scale [0], mapdata [0].scale [1], mapdata [0].scale [2]);
                go.transform.localEulerAngles = new Vector3(mapdata [0].rotation [0], mapdata [0].rotation [1], mapdata [0].rotation [2]);
            }

            strBld.Append("Graph");
            string    strPath = System.IO.Path.Combine(ResourceSetting.UNPACKROOT, strBld.ToString());
            TextAsset mapTxt  = UnityEngine.Resources.Load(strPath) as TextAsset;

            if (mapTxt == null)
            {
                Debug.LogError("scene textAsseet data is null ::  " + strPath);
            }

            AstarPath.active.astarData.DeserializeGraphs(mapTxt.bytes);

            CreateUnVision();

            GameObject helper = new GameObject("helper");

            helper.AddComponent <TileHandlerHelper>();
        }
コード例 #2
0
        /// <summary>
        /// 创建地图
        /// </summary>
        public void CreateMap()
        {
            Charactors = WarSMgr.realServer.monitor.CharactorPool;

            MapInfo map = WarSMgr.realServer.mWar.Map;

            //将数据发给客户端
            WarSMgr.realServer.proxyCli.CtorEnv(map);

            if (map.type == ConfigType.PVEChapter)
            {
                ChapterModel chatperModel = Core.Data.getIModelConfig <ChapterModel>();
                curChapConfig = chatperModel.get(map.ID);
            }
            else
            {
                PVPBattleModel pvpModel = Core.Data.getIModelConfig <PVPBattleModel>();
                curChapConfig = pvpModel.get(map.ID);
            }
        }