/// <summary> /// 创建当前玩家英雄后设置 /// </summary> /// <param name="_heroID">当前英雄ID</param> private void SetCurrentHeroRecommendGoods(CreateMainHeroEntityEventArgs e) { if (MobaRecommendGoodsReader == null) { return; } int SchemesHeroID = 0; for (int i = 0; i < MobaRecommendGoodsReader.GetRecordCount(); i++) { // 判断英雄ID SchemesHeroID = MobaRecommendGoodsReader.GetInt(i, (int)EMobaRecommendGoods.EMRG_HeroID, 0); if (SchemesHeroID == e.MainHeroID) { // 判断比赛类型 string strMatchType = MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_MatchTypes, ""); char[] charSeparator = new char[] { MobaSchemesConfig.separator }; List <int> intArray = ScpReader.ConvertStringToIntArray(strMatchType, charSeparator); if (!intArray.Contains((int)e.nMatchTypeID)) { continue; } // 获取装备配置 SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_EerlyList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_EerlyStage, "0")); SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_MiddleList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_MiddleStage, "0")); SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_DownWindList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_DownWindStage, "0")); SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_UpWindList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_UpWindStage, "0")); SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_ConsumeGoodsList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_ConsumeGoods, "0")); SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_DefaultGoodsTypeList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_DefaultTypes, "0")); SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_UsedStageList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_UsedStage, "0")); SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_DispositionStageList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_DispositionStage, "0")); CurrentHeroRecommendGoods.RecommendGoods_SummerID = MobaRecommendGoodsReader.GetInt(i, (int)EMobaRecommendGoods.EMRG_SummerID, 0); SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_SummerEerlyList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_SummerEerlyStage, "0")); SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_SummerMiddleList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_SummerMiddleStage, "0")); SetRecommendGoodsStage(CurrentHeroRecommendGoods.RecommendGoods_SummerDownWindList, MobaRecommendGoodsReader.GetString(i, (int)EMobaRecommendGoods.EMRG_SummerDownWindStage, "0")); } } MobaRecommendGoodsReader.Dispose(); MobaRecommendGoodsReader = null; EntityFactory.CreateMainHeroEntityEvent -= SetCurrentHeroRecommendGoods; if (MobaGoodsSchemesInitEndEvent != null) { MobaGoodsSchemesEventArgs a = new MobaGoodsSchemesEventArgs(); a.RecommendGoods = CurrentHeroRecommendGoods; a.LabelDescirptionTable = labelDescirptionTable; MobaGoodsSchemesInitEndEvent(a); } }
private static GameObject entry_loadEntry(EntityView objev) { ENTITY_ID id = objev.ID; //已经被卸载了. if (EntityFactory.Instance.m_entityContainer.Get(id) == null) { return(null); } EntityViewItem evItem = objev.createinfo; ENTITY_TYPE entityType = (ENTITY_TYPE)evItem.EntityType; UnityEngine.Object objPrefab = PrefabManager.GetPrefab(entityType); if (null == objPrefab) { Trace.LogError("找不到对应的类型的prefab,请检查PrefabManager中的Init函数,是否忘记加载? " + entityType.ToString()); return(null); } GameObject entity = null; entity = objPrefab as GameObject; if (entity == null) { Trace.LogError("实例预设体对象失败! " + entityType.ToString()); return(null); } entity.name += "-" + id.ToString(); if (entity.transform.childCount > 0) { Trace.LogWarning("EntityView GameObject 有子节点!" + entity.transform.GetChild(0).name); } // 设置游戏对象 objev.SetGameObject(entity); // 设置创建数据 if (!objev.InitBuildeData(evItem)) { Trace.LogError("初始化实体对象数据失败! id=" + id.ToString()); return(null); } //如果是队友,则加入队友列表, if (objev.Type == ENTITY_TYPE.TYPE_PLAYER_ROLE && objev.CampFlag == CampFlag.CampFlag_Friend) { if (!m_friendPlayerList.Contains((uint)objev.ID)) { m_friendPlayerList.Add((uint)objev.ID); } } //string entityname = "UnKnow"; //Skin sk = SkinManager.GetSkin(objev.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_SKIN)); //if (sk != null) //{ // entityname = sk.ResSkinObj.AssetName; //} //entity.name = entityname; //entity.name += "(entity" + evItem.EntityID.ToString() + ")"; if (id == MainHeroID) { entity.transform.parent = null; MainHeroView = objev; if (CreateMainHeroEntityEvent != null) { CreateMainHeroEntityEventArgs e = new CreateMainHeroEntityEventArgs(); e.MainHeroID = evItem.nHeroID; e.MainHeroUID = MainHeroID; e.nMatchTypeID = GameLogicAPI.getCurRoomMatchType(); CreateMainHeroEntityEvent(e); LogicDataCenter.playerSystemDataManager.Reset(); } ViewEventHelper.Instance.SendCommand(GameLogicDef.GVIEWCMD_MASTER_VIEW_LOADED); Trace.Log("Load Hero Entry:" + entity.name); } else { entity.transform.parent = Instance.transform; } objPrefab = null; if (ENTITY_TYPE.TYPE_PLAYER_ROLE == entityType) { // 发送人物加载完指令到逻辑层 EntityEventHelper.Instance.SendCommand(id, EntityLogicDef.ENTITY_CMD_LOAD_COMPLETED); } BaseStateMachine bs = entity.GetComponent <BaseStateMachine>(); //已经有位置信息,创建模型时立即同步瞬移过去,之后的同步消息是走过去 if (objev.data.nActorID == evItem.EntityID) { Vector3 pos; pos.x = objev.data.fPosition_x; pos.y = objev.data.fPosition_y; pos.z = objev.data.fPosition_z; Vector3 rot; rot.x = objev.data.fRotation_x; rot.y = objev.data.fRotation_y; rot.z = objev.data.fRotation_z; //怪物要走传送,不能直接设置位置 if (entityType == ENTITY_TYPE.TYPE_MONSTER) { if (bs) { cmd_creature_transport data = new cmd_creature_transport(); data.fPosition_x = pos.x; data.fPosition_y = pos.y; data.fPosition_z = pos.z; data.fRotation_x = rot.x; data.fRotation_y = rot.y; data.fRotation_z = rot.z; data.bUseAngle = 1; bs.Transport(data); } } else { entity.transform.SetPosition(pos); entity.transform.eulerAngles = rot; } } CheckEntityMaskToRangeSearch(objev); //执行延迟处理的消息 EntityViewCommandHandler.onCommandsDelay(objev); return(entity); }
/// <summary> /// 延迟一定时间启用新手引导 /// </summary> /// <param name="e"></param> private void WaitForMainPlayerCreate(CreateMainHeroEntityEventArgs e) { TimerManager.SetTimer(this, 0, 1, 1); }
EntitySkinControl m_SkinControl = null; //模型管理 /// <summary> /// 实体加载完成回调 /// </summary> /// <param name="ev">实体</param> public void OnHeroEntityLoadComplete(CreateMainHeroEntityEventArgs e) { EntityFactory.CreateMainHeroEntityEvent -= OnHeroEntityLoadComplete; OnHeroEntityLoadCompleteLoacl(EntityFactory.getEntityViewByID(e.MainHeroUID)); }
private void EntityFactory_CreateMainHeroEntityEvent(CreateMainHeroEntityEventArgs e) { TimerManager.SetTimer(this, (int)ETimerHandlerID.GoodsDispositionList, 0.5f, 10); //SetDispositionListViewData(); }