Ejemplo n.º 1
0
        public void OnButton02Call()
        {
            lc_ObjViewer objviewer = MainMapScene.Instance.objviewer;
            int          pop = 0, ems = 0;


            lc_Country[] countrys = objviewer.viewAllObject <lc_Country>();
            Debug.Log("length=[" + countrys.Length + "]");
            for (int i = 0; i < countrys.Length; i++)
            {
                pop = 0; ems = 0;
                List <uint> citys = objviewer.ViewCountryCity(countrys[i].obj_id);
                Debug.Log("country[" + countrys[i].m_name + "] have [" + citys.Count + "] citys");
                for (int j = 0; j < citys.Count; j++)
                {
                    lc_City      city    = objviewer.ViewObject <lc_City>(citys[j]);
                    STU_CITY_INF citystu = objviewer.viewRelShep <STU_CITY_INF>(city.obj_id);
                    pop += citystu.city_peonum;
                    ems += city.m_ems;
                    Debug.Log("city[" + city.m_name + "] pop=" + city.m_pop);
                }
                Debug.Log("country[" + countrys[i].m_name + "] pop=[" + pop + "]");
                countrys[i].m_pop = pop;
                countrys[i].m_ems = ems;
            }

            if (countrys != null)
            {
                Singleton <ContextManager> .Instance.Push(new CountryPanelContext(countrys));
            }
        }
Ejemplo n.º 2
0
    public override void OnSceneLoaded()
    {
        Debug.Log("MainMapScene load activescene=[" + SceneManager.GetActiveScene().name + "]");
        //创建场景消息管理中心
        MapSceneMsgCenter = new NotifacitionCenter();
        //创建UI管理器管理UI
        Singleton <UIManager> .Create();

        Singleton <ContextManager> .Create();

        //string mappath = Application.dataPath + "/StreamingAssets/AssetBundles/maptile";
        //string mapuipath = Application.dataPath + "/StreamingAssets/AssetBundles/mapsceneui";
        //string rolepath = Application.dataPath + "/StreamingAssets/AssetBundles/role";

        ResourceManger.Instance.LoadRes(Application.streamingAssetsPath + @"/AssetBundles/AssetBundles");
        ResourceManger.Instance.LoadRes(Application.streamingAssetsPath + @"/AssetBundles/maptile");
        ResourceManger.Instance.LoadRes(Application.streamingAssetsPath + @"/AssetBundles/mapsceneui");
        ResourceManger.Instance.LoadRes(Application.streamingAssetsPath + @"/AssetBundles/role");



        //AssetBundle mapBundle = AssetBundle.LoadFromFile(Application.dataPath + "/StreamingAssets/AssetBundles/maptile");
        //AssetBundle mapUiBundle= AssetBundle.LoadFromFile(Application.dataPath + "/StreamingAssets/AssetBundles/mapsceneui");
        //AssetBundle roleBundle=AssetBundle.LoadFromFile(Application.dataPath + "/StreamingAssets/AssetBundles/role");



        //创建地图实例
        Singleton <TiledMapInfo> .Create();

        objgather  = Singleton <lc_ObjGather> .Instance;
        objmanager = new lc_ObjManager(objgather);
        objviewer  = new lc_ObjViewer(objgather);


        //加载游戏地图及游戏脚本文件
        string mapfilepath  = Application.dataPath + @"/StreamingAssets/Map/MapInfo.tmx";
        string gamefilepath = Application.dataPath + @"/StreamingAssets/Game/GameData.xml";

        XmlLoad.MapTileXmlLoad(mapfilepath, Singleton <TiledMapInfo> .Instance);
        XmlLoad.GameXmlLoad(gamefilepath, objgather, Singleton <TiledMapInfo> .Instance);

        //UI初始化
        Singleton <ContextManager> .Instance.Push(new ActiveMenuContext());

        Singleton <ContextManager> .Instance.Push(new OptionPanelContext());

        Singleton <ContextManager> .Instance.Push(new PopInterFacePanelContext());

        Singleton <ContextManager> .Instance.NoStackPush(new CityInfoSignContext());

        //创建地图生成器生成地图
        GameObject go = new GameObject("MapMaker");

        go.AddComponent <hexgrid>();

        CreateGameTest();
    }
Ejemplo n.º 3
0
        public void OnButton00Call()
        {
            lc_ObjViewer objviewer = MainMapScene.Instance.objviewer;
            uint         playerid  = objviewer.ViewPlayerId();
            lc_Seer      seer      = objviewer.ViewObject <lc_Seer>(playerid);

            if (seer != null)
            {
                Singleton <ContextManager> .Instance.Push(new LeadPanelContext(seer));
            }
        }
Ejemplo n.º 4
0
        public void OnButton01Call()
        {
            lc_ObjViewer objviewer    = MainMapScene.Instance.objviewer;
            uint         playerRel_id = objviewer.ViewPlayerRel();
            lc_Religion  rel          = objviewer.ViewObject <lc_Religion>(playerRel_id);
            int          rel_count    = objviewer.ViewRelCount(playerRel_id);

            rel.m_count = rel_count;
            if (rel != null)
            {
                Singleton <ContextManager> .Instance.Push(new RelPanelContext(rel));
            }
        }