Exemplo n.º 1
0
        //初始化世界点
        private void InitWorldPoint(Transform worldPoint, CopyVo worldPointVo)
        {
            Transform   name;
            UISprite    sprite;
            BoxCollider boxCollider;

            worldPoint.name = "btn_world_" + worldPointVo.mapId;
            //初始化世界点的属性
            worldPoint.localPosition = new Vector3(worldPointVo.x, worldPointVo.y, 0);
            sprite            = worldPoint.GetComponent <UISprite> ();
            sprite.spriteName = worldPointVo.icon;
            sprite.MakePixelPerfect();

            boxCollider        = worldPoint.GetComponent <BoxCollider>();
            boxCollider.size   = new Vector3(sprite.width, sprite.height + 30, 0);
            boxCollider.center = new Vector3(0, -15, 0);

            name = worldPoint.FindChild("name");
            name.localPosition = new Vector3(0, -sprite.height / 2 + 30, 0);
            name.FindChild("value").GetComponent <UILabel>().text = worldPointVo.name;

            worldPoint.gameObject.SetActive(false);

            worldPoint.GetComponent <Button> ().onClick = this.WorldPointOnClick;
        }
Exemplo n.º 2
0
 //从配置表读取世界地图信息。只在首次打开副本地图时执行
 public void InitWorldMapInfo()
 {
     //从配置表读取全部世界点的初始信息
     string[] worldIds = StringUtils.GetValueListFromString(BaseDataMgr.instance.GetSysDungeonTree(0).list);
     for (int i = 0; i < worldIds.Length; ++i)
     {
         CopyVo worldInfo = new CopyVo();
         worldInfo.mapId  = uint.Parse(worldIds[i]);
         worldInfo.name   = BaseDataMgr.instance.GetSysDungeonTree(uint.Parse(worldIds[i])).name;
         worldInfo.x      = this.AdjustPosX(BaseDataMgr.instance.GetSysDungeonTree(uint.Parse(worldIds[i])).x);
         worldInfo.y      = this.AdjustPosY(BaseDataMgr.instance.GetSysDungeonTree(uint.Parse(worldIds[i])).y);
         worldInfo.icon   = BaseDataMgr.instance.GetSysDungeonTree(uint.Parse(worldIds[i])).icon;
         worldInfo.remark = BaseDataMgr.instance.GetSysDungeonTree(uint.Parse(worldIds[i])).remark;
         _worldMapInitInfo.WorldPointInfoList.Add(worldInfo);
     }
 }