示例#1
0
        ///// <summary>
        ///// 服务器二维坐标原点对应的unity坐标
        ///// </summary>
        //public Vector2 OriPos
        //{
        //    get
        //    {
        //        if(m_curMapLoader !=null)
        //        {
        //            return m_curMapLoader.OriPos;
        //        }
        //        return Vector2.zero;
        //    }
        //}

        public void Init()
        {
            string testSceneName     = "TestScene";
            string testSceneInfoFile = "TestScene/TestScene.json";
            int    mapAssetId        = 1;

            SceneUnit sceneUnit = new SceneUnit();

            sceneUnit.Init(mapDataDirPath + testSceneInfoFile);
            m_dicMapId.Add(mapAssetId, testSceneName);
            m_dicMapLoader.Add(testSceneName, sceneUnit);
        }
示例#2
0
        public void Init(Dictionary <int, string> mapInfos)
        {
            foreach (var mapInfo in mapInfos)
            {
                //Todo 通过读表方式获取路径
                string mapAssetId = mapInfo.Value;

                if (m_dicMapId.ContainsKey(mapInfo.Key))
                {
#if DEBUG
                    Debug.LogError(string.Format("读取到重复的地图信息 ID:{0}    ,path:{1}", mapInfo.Key, mapAssetId));
#endif
                    continue;
                }
                //地图配置编号 映射 地图数据资源id
                m_dicMapId.Add(mapInfo.Key, mapInfo.Value);

                //如果资源id没有对应的地图加载器,则创建
                if (!m_dicMapLoader.ContainsKey(mapInfo.Value))
                {
                    SceneUnit mapLoader = new SceneUnit();
                    mapLoader.Init(mapAssetId);
                    //mapLoader.BlockMaterial = m_blockMaterial;
                    m_dicMapLoader.Add(mapInfo.Value, mapLoader);
                }
            }
            //注册事件
            //m_eventModule.WatchUnityEvent(
            //    YuUnityEventType.FixedUpdate, OnFixedUpdate);
            //m_eventModule.WatchEvent(
            //    YuUnityEventCode.NetDisconnect, CloseCurMap);

            //YuMapTools.SetMapIDMapping(m_dicMapId);

            //m_eventModule.WatchEvent(YuUnityEventCode.Scene_CameraTranslate, OnCameraTranslate);
        }