/// <summary> /// 根据场景的信息显示NPC /// </summary> private IEnumerator ShowNpc() { string[] npcList = StringUtils.SplitVoString(MapVo.npcList, "],["); for (int i = 0; i < npcList.Length; i++) { string[] npcInfo = StringUtils.SplitVoString(npcList[i]); if (npcInfo.Length == 1) { continue; } if (npcInfo.Length < 3) { Log.error(this, "地图NPC信息配置错误,地图id" + MapVo.id); continue; } uint id = uint.Parse(npcInfo[0]); var npcVo = new DisplayVo { Id = id, X = float.Parse(npcInfo[1]), Y = float.Parse(npcInfo[2]), ModelLoadCallBack = LoadNpcBack, Type = DisplayType.NPC }; AppMap.Instance.CreateNpc(npcVo); yield return(0); } }
private int roleType = -1; //先暂时限制下 public void CreateRole(int roleType, ModelControl loadInitCallBack) { this.roleType = roleType; vo = new DisplayVo(); vo.Type = DisplayType.ROLE_MODE; var _SysRoleBaseInfoVo = BaseDataMgr.instance.GetSysRoleBaseInfo((uint)roleType); vo.ClothUrl = "Model/Role/" + _SysRoleBaseInfoVo.Model + "/Model/" + _SysRoleBaseInfoVo.Model + ".assetbundle"; this.modelControl = loadInitCallBack; SetVo(vo); }
/**创建场景跳转点**/ public MapPointDisplay CreateWorldMapPoint(DisplayVo vo) { if (vo == null) { return(null); } vo.Type = DisplayType.MAP_POINT; var display = new MapPointDisplay(); objectList.Add(display); display.SetVo(vo); return(display); }
/**创建副本跳转点**/ public CopyPointDisplay CreateCopyPoint(DisplayVo vo) { if (vo == null) { return(null); } vo.Type = DisplayType.COPY_POINT; var display = new CopyPointDisplay(); objectList.Add(display); display.SetVo(vo); return(display); }
/**创建副本陷阱**/ public TrapDisplay CreateTrap(DisplayVo vo) { if (vo == null) { return(null); } vo.Type = DisplayType.Trap; var display = new TrapDisplay(); objectList.Add(display); SysTrap sysTrapVo = BaseDataMgr.instance.GetTrapVoById(vo.Id); vo.ClothUrl = "Model/Trap/" + sysTrapVo.Model + "/Model/BIP.assetbundle"; display.SetVo(vo); return(display); }
/// <summary> /// 创建传送点 /// </summary> /// <param name="mapId"></param> private void CreateMapPoint(string mapId) { if (Convert.ToInt32(mapId) > 10000 && Convert.ToInt32(mapId) < 20000) { SysMapVo map = BaseDataMgr.instance.GetMapVo(uint.Parse(mapId)); string[] worldTransPos = StringUtils.GetValueListFromString(map.world_trans_pos); AppMap.Instance.mapParser.WorldTransPosX = float.Parse(worldTransPos[0]) * GameConst.PositionUnit; AppMap.Instance.mapParser.WorldTransPosY = float.Parse(worldTransPos[1]) * GameConst.PositionUnit; string[] TransPos = StringUtils.GetValueListFromString(map.trans_pos); AppMap.Instance.mapParser.TransPosX = float.Parse(TransPos[0]) * GameConst.PositionUnit; AppMap.Instance.mapParser.TransPosY = float.Parse(TransPos[1]) * GameConst.PositionUnit; //创建副本传送点 var vo = new DisplayVo { X = AppMap.Instance.mapParser.TransPosX, Y = AppMap.Instance.mapParser.TransPosY, ClothUrl = "Model/Teleport/Empty.assetbundle", ModelLoadCallBack = LoadMapPointCallBack }; BaseDisplay display = AppMap.Instance.CreateMapPoint(vo); var mapPointDisplay = display as MapPointDisplay; if (mapPointDisplay != null) { mapPointDisplay.jumpMapId = 20001; } //创建世界传送点 var voWorld = new DisplayVo { X = AppMap.Instance.mapParser.WorldTransPosX, Y = AppMap.Instance.mapParser.WorldTransPosY, ClothUrl = "Model/Teleport/Empty.assetbundle", ModelLoadCallBack = LoadMapPointCallBack }; BaseDisplay displayWorld = AppMap.Instance.CreateWorldMapPoint(voWorld); var mapPointDisplayWorld = displayWorld as MapPointDisplay; if (mapPointDisplayWorld != null) { mapPointDisplayWorld.jumpMapId = 20001; } } }
/**创建怪物**/ public MonsterDisplay CreateMonster(DisplayVo vo) { if (vo == null) { return(null); } vo.Type = DisplayType.MONSTER; var display = new MonsterDisplay(); objectList.Add(display); var monsterVo = vo as MonsterVo; if (monsterVo != null) { vo.ClothUrl = "Model/Monster/" + monsterVo.MonsterVO.res + "/Model/BIP.assetbundle"; UnityEngine.Debug.Log("****加载怪物BIP, BIP.assetbundle, id = ,vo.ClothUrl = " + vo.Id + ", " + vo.ClothUrl); } display.SetVo(vo); return(display); }
/**创建NPC**/ public NpcDisplay CreateNpc(DisplayVo vo) { if (vo == null) { return(null); } vo.Type = DisplayType.NPC; var display = new NpcDisplay(); NpcDisplayList.Add(display); objectList.Add(display); SysNpcVo sysNpcVo = BaseDataMgr.instance.GetNpcVoById(vo.Id); if (sysNpcVo == null) { Log.error(this, "NPC表不存在NPC,Id:" + vo.Id); return(null); } vo.ClothUrl = "Model/Npc/" + sysNpcVo.model + "/Model/BIP.assetbundle"; display.SetVo(vo); return(display); }
/**创建宠物**/ public PetDisplay CreatePet(DisplayVo vo) { if (vo == null) { return(null); } vo.Type = DisplayType.PET; var display = new PetDisplay(); _petDisplayList.Add(display); objectList.Add(display); PetVo pet = (PetVo)vo; string res = pet.SysPet.res; if (res.Equals("0")) { res = "10004"; } vo.ClothUrl = "Model/Pet/" + res + "/Model/" + res + ".assetbundle"; display.SetVo(vo); return(display); }
/**使用对象时初始化**/ protected virtual void ResetWhileNew() { Vo = null; GoCloth = null; IsUsing = true; }
internal virtual void SetVo(DisplayVo vo) { ResetWhileNew(); Vo = vo; CreateMode(vo.ClothUrl); }