示例#1
0
        /// <summary>
        /// 创建格子模型建筑
        /// </summary>
        /// <param name="scene"></param>
        public void CreateTerrainBuildings(CScene scene)
        {
            foreach (var XYAndNode in scene.DicMapData)
            {
                foreach (var YAndNode in XYAndNode.Value)
                {
                    MapNode         node            = YAndNode.Value;
                    MapNodeBuilding mapNodeBuilding = new MapNodeBuilding();
                    mapNodeBuilding.MapNodeType = node.m_eMapNodeType;
                    mapNodeBuilding.HexPos      = new CVector3(node.nIndexX, node.nIndexY, node.nIndexU);
                    //从服务器收到动态地图的消息,里面存储不同格子坐标上的不同建筑
                    if (this.m_ListNodeData != null)
                    {
                        for (int i = 0; i < this.m_ListNodeData.Count; i++)
                        {
                            if (mapNodeBuilding.HexPos.Equals(this.m_ListNodeData[i].m_oPos))
                            {
                                EMapNodeType eMapNodeType = (EMapNodeType)this.m_ListNodeData[i].m_nType;
                                mapNodeBuilding.MapNodeType = eMapNodeType;
                                mapNodeBuilding.ChangeNodeType(eMapNodeType);
                                this.m_sceneCurrent.ChangeMapNodeType(this.m_ListNodeData[i].m_oPos, MapCfg.MapNodeType2String(eMapNodeType));
                                break;
                            }
                        }
                    }

                    //DataTerrain_node dataByType = DataTerrain_nodeManager.Instance.GetDataByType(MapCfg.MapNodeType2String(node.m_eMapNodeType));
                    DataTerrainNode dataByType = GameData <DataTerrainNode> .dataMap[MapCfg.MapNodeTypeToInt(node.m_eMapNodeType)];
                    if (null != dataByType)
                    {
                        mapNodeBuilding.EffectId        = dataByType.EffectId;
                        mapNodeBuilding.TriggerEffectId = dataByType.TriggerEffectId;
                    }
                    //初始化基地模型
                    MapNodeTypeInfo mapNodeTypeInfo = null;
                    if (scene.DicMapNodeTypeInfo.TryGetValue(node.m_eMapNodeType, out mapNodeTypeInfo))
                    {
                        mapNodeBuilding.ModelFile       = mapNodeTypeInfo.ModelFile;
                        mapNodeBuilding.OriginModelFile = mapNodeTypeInfo.ModelFile;
                        mapNodeBuilding.ChangeModel();
                    }
                    this.m_listMapNodeBuilding.Add(mapNodeBuilding);
                }
            }
        }
示例#2
0
        /// <summary>
        /// 创建游戏地图场景
        /// </summary>
        /// <param name="dwMapID">地图id</param>
        /// <returns></returns>
        public CScene CreateScene(uint dwMapID)
        {
            this.m_bLoadSceneFinished    = false;
            this.m_bMapBehaviourPrepared = false;
            this.RegisterLoadSceneFinishCallback(new Action(this.OnLoadSceneFinish));
            this.m_log.Debug("CreateScene:" + dwMapID);
            this.m_sceneCurrent = new CScene();
            CScene result;

            if (!this.m_sceneCurrent.Init(dwMapID))
            {
                result = null;
            }
            else
            {
                this.ResetCamera();
                result = this.m_sceneCurrent;
            }
            return(result);
        }