Exemplo n.º 1
0
Arquivo: Map.cs Projeto: Lenzan/newmmo
 internal Map(MapDefine define)
 {
     this.Define = define;
     this.SpawnManager.Init(this);
     this.MonsterManager.Init(this);
     this.Battle = new Battle.Battle(this);
 }
Exemplo n.º 2
0
 internal Map(MapDefine define, int instanceCount)
 {
     this.Define = define;
     this.SpawnManager.Init(this);
     this.MonsterManager.Init(this);
     this.Battle = new Battle.Battle(this);
     InstanceId  = instanceCount;
 }
Exemplo n.º 3
0
    private void OnEnterMap(MapDefine define)
    {
        mapDefine = define;
        Sprite sp = ResMgr.GetSprite(define.MiniMap);

        Map.overrideSprite = sp;
        Map.SetNativeSize();
    }
Exemplo n.º 4
0
    private void OnEnterMap(MapDefine define)
    {
        mapDefine = define;
        Sprite sp = ResMgr.GetSprite(System.IO.Path.GetFileNameWithoutExtension(define.MiniMap), define.MiniMap);

        Map.overrideSprite = sp;
        Map.SetNativeSize();
    }
Exemplo n.º 5
0
 private void EnterMap(int mapId)
 {
     if (DataManager.Instance.Maps.ContainsKey(mapId))
     {
         MapDefine map = DataManager.Instance.Maps[mapId];
         User.Instance.CurrentMapData = map;
         SceneManager.Instance.LoadScene(map.Resource);
     }
     else
     {
         Debug.LogErrorFormat("EnterMap: Map {0} not existed", mapId);
     }
 }
Exemplo n.º 6
0
    /// <summary>
    /// switch game scene to scene no.mapID
    /// </summary>
    /// <param name="mapID"></param>
    private void SwitchMap(int mapID)
    {
        MapDefine define = DataManager.Instance.Maps[mapID];

        if (define != null)
        {
            ScenesManager.Instance.LoadSceneAsync(define.Resource);
            Models.User.Instance.currentMapInfo = define;
        }
        else
        {
            Debug.LogErrorFormat("map {0} cannot be found", mapID);
        }
    }
Exemplo n.º 7
0
        public void EnterMap(int mapId)
        {
            if (DataManager.Instance.Maps.ContainsKey(mapId))
            {
                loadingDone = false;

                MapDefine map = DataManager.Instance.Maps[mapId];
                User.Instance.CurrentMapData = map;
                SceneManager.Instance.LoadScene(map.Resource);
                SoundManager.Instance.PlayMusic(map.Music);
            }
            else
            {
                Debug.LogErrorFormat("EnterMap: Map {0} not existed", mapId);
            }
        }
Exemplo n.º 8
0
    void _GenMap(Type type, string mapName, MapDefine mapDefine)
    {
        TableType table   = m_systemMap [type];
        MapData   mapData = new MapData();

        mapData.type = type;
        Dictionary <object, object> mapDic = mapData.map;

        m_map [mapName] = mapData;

        foreach (object key in table.Keys)
        {
            Dictionary <object, object> dic = mapDic;
            object entry     = table[key];
            Type   entryType = entry.GetType();
            for (int i = 0; i < mapDefine.keys.Length; ++i)
            {
                string cellName = mapDefine.keys[i];
                System.Reflection.PropertyInfo objProperty = entryType.GetProperty(cellName);
                object cellValue = objProperty.GetValue(entry, null);
                if (i == mapDefine.keys.Length - 1)
                {
                    List <object> list = null;
                    if (dic.ContainsKey(cellValue))
                    {
                        list = (List <object>)dic[cellValue];
                    }
                    else
                    {
                        list           = new List <object>();
                        dic[cellValue] = list;
                    }
                    list.Add(key);
                }
                else
                {
                    if (!dic.ContainsKey(cellValue))
                    {
                        dic[cellValue] = new Dictionary <object, object>();
                    }
                    dic = (Dictionary <object, object>)dic[cellValue];
                }
            }
        }
    }
Exemplo n.º 9
0
 private void EnterMap(int mapId)
 {
     if (DataManager.Instance.Maps.ContainsKey(mapId))
     {
         MapDefine map = DataManager.Instance.Maps[mapId];
         //Models.User.Instance.CurrentMapData = map;
         GameManager.SceneMgr.LoadScene(map.Resource,
                                        delegate
         {
             GameManager.UIMgr.OpenUI <UIMainCity>("Main");
             GameManager.UIMgr.OpenUI <UIMiniMap>("Main");
         });
     }
     else
     {
         Debug.LogError("该地图不存在:" + mapId);
     }
 }
Exemplo n.º 10
0
    public void GenMap <T>(string mapName, string[] keys)
        where T : ProtoBuf.IExtensible
    {
        Type      type      = typeof(T);
        MapDefine mapDefine = new MapDefine();

        mapDefine.keys = keys;
        GetTable <T>();

        if (!m_mapDefines.ContainsKey(type))
        {
            m_mapDefines[type] = new Dictionary <string, MapDefine>();
        }
        m_mapDefines [type] [mapName] = mapDefine;
        if (m_systemMap.ContainsKey(type))
        {
            _GenMap(type, mapName, mapDefine);
        }
    }
Exemplo n.º 11
0
 /// <summary>
 /// constructor function
 /// </summary>
 /// <param name="defn"></param>
 internal Map(MapDefine defn)
 {
     Log.InfoFormat("Map -> Map(): Mapid: {0}, MapName: {1}", defn.ID, defn.Name);
     this.mapDefine = defn;
 }
Exemplo n.º 12
0
 internal Map(MapDefine define)
 {
     this.Define = define;
 }