Exemplo 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));
            }
        }
Exemplo n.º 2
0
        private static void CityLoad(TiledMapInfo tiledmapinfo, lc_ObjGather objgather)
        {
            lc_ObjManager tmpmanager = new lc_ObjManager(objgather);

            for (int i = 0; i < tiledmapinfo.baselayertiled.Count; i++)
            {
                if (tiledmapinfo.baselayertiled[i].iscity == true)
                {
                    lc_City city = objgather.AddObject <lc_City>(tiledmapinfo.baselayertiled[i].name);
                    city.user_id = tiledmapinfo.baselayertiled[i].id;
                    tiledmapinfo.baselayertiled[i].obj_id = city.obj_id;
                    tmpmanager.SetCityRelNum(city.obj_id, tiledmapinfo.baselayertiled[i].citynum);
                    lc_Country country = tmpmanager.GetObjectByUserId <lc_Country>(tiledmapinfo.baselayertiled[i].countryid);
                    if (country != null)
                    {
                        //Debug.Log("set city[" + city.m_name + "] belong country[" + country_objid + "]");
                        tmpmanager.SetCityBel(city.obj_id, country.obj_id);
                    }
                    else
                    {
                        Debug.Log("map_id " + tiledmapinfo.baselayertiled[i].countryid + " not mapping city id=[" + city.user_id + "]");
                    }
                }
            }



            tmpmanager = null;
        }
Exemplo n.º 3
0
        private void ShowData(lc_City city)
        {
            Transform transform = this.gameObject.transform;

            transform.Find("NAME_VALUE").GetComponent <Text>().text = city.m_name;
            transform.Find("POP_VALUE").GetComponent <Text>().text  = city.m_pop.ToString();
            transform.Find("EMS_VALUE").GetComponent <Text>().text  = city.m_ems.ToString();
        }
Exemplo n.º 4
0
        private void OnMouseIn(NotifyEvent evt)
        {
            //Debug.Log("Mouse IN");
            string strobjid;
            uint   obj_id = 0;

            this.gameObject.SetActive(true);
            evt.Params.TryGetValue("OBJID", out strobjid);
            obj_id = (uint)int.Parse(strobjid);
            lc_City      city     = objmanager.GetObject <lc_City>(obj_id);
            STU_CITY_INF city_inf = objmanager.GetRelShip <STU_CITY_INF>(obj_id);

            city.m_pop = city_inf.city_peonum;
            ShowData(city);
        }
Exemplo n.º 5
0
        public override void OnEnter(BaseContext context)
        {
            base.OnEnter(context);
            CityInContext            cityContext = (CityInContext)context;
            lc_City                  city        = MainMapScene.Instance.objviewer.ViewObjectByUserId <lc_City>(cityContext.map_id);
            List <STU_CITY_BUILDING> stulist     = MainMapScene.Instance.objviewer.viewAllRelShep <STU_CITY_BUILDING>(city.obj_id);

            Debug.Log("city " + city.m_name + " has [" + stulist.Count + "] building");
            for (int i = 0; i < stulist.Count; i++)
            {
                lc_Building building = MainMapScene.Instance.objviewer.ViewObject <lc_Building>(stulist[i].building_id);
                Debug.Log("BUILDING NAME=[" + building.m_name + "]");
            }
            Debug.Log(cityContext.map_id);
            ShowData(city);
        }
Exemplo n.º 6
0
    private void CreateGameTest()
    {
        //创建GAME数据
        lc_Religion rel    = objmanager.AddObject <lc_Religion>("万法教");
        lc_Seer     player = objmanager.AddObject <lc_Seer>("主角1");

        lc_Building market = objmanager.AddObject <lc_Building>("market");

        market.user_id = 1;
        market.m_cost  = 0;
        lc_Building castle = objmanager.AddObject <lc_Building>("castle");

        castle.user_id = 2;
        castle.m_cost  = 0;

        lc_City city = objmanager.GetObjectByUserId <lc_City>(2);

        objmanager.CityAddBuilding(city.obj_id, 0, market.obj_id);
        objmanager.CityAddBuilding(city.obj_id, 0, castle.obj_id);



        player.m_age          = 17;
        player.m_life         = 55;
        player.m_eloquence    = 50;
        player.m_intelligence = 50;
        player.m_leadership   = 50;
        player.m_willpower    = 50;
        player.m_fame         = 10;
        player.m_wealth       = 100;



        rel.m_relType      = 1;
        rel.m_attraction   = 50;
        rel.m_piety        = 50;
        rel.m_organization = 50;
        rel.m_theorypt     = 2;
        objmanager.setPlayerRelId(rel.obj_id);
        objmanager.setPlayerId(player.obj_id);

        Debug.Log("测试");
    }