private void DoPickUpItem() { if (m_nPickItemId != 0) { uint itemid = m_nPickItemId; Client.IEntitySystem es = ControllerSystem.m_ClientGlobal.GetEntitySystem(); if (es != null) { Client.IBox box = es.FindBox(itemid); if (box == null) { if (TryPickUpNow() == false) { OnCombat(); } } else if (box.CanAutoPick()) { if (m_ActiveCtrl != null) { m_ActiveCtrl.MoveToTarget(box.GetPos()); } } } } else { UnityEngine.Debug.LogError("pick up item OnCombat"); OnCombat(); } }
public Client.INPC GetNPCByTraceInfo(QuestTraceInfo questInfo) { if (null == questInfo) { return(null); } Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("实体系统为null"); return(null); } GameCmd.TaskProcess process = questInfo.GetTaskProcess(); uint npcid = 0; uint effectID = 0; if (process == GameCmd.TaskProcess.TaskProcess_None)//可接 { npcid = questInfo.beginNpc; } else if (process == GameCmd.TaskProcess.TaskProcess_CanDone) { npcid = questInfo.endNpc; } else if (process == GameCmd.TaskProcess.TaskProcess_Doing) { npcid = questInfo.endNpc; } Client.INPC npc = es.FindNPCByBaseId((int)npcid); return(npc); }
private bool TryPickUpNow() { m_nPickItemId = 0; if (m_ActiveCtrl == null) { return(false); } int skillStatus = m_skillPart.GetCurSkillState(); //暂停期间不能拾取 if (m_status == CombatRobotStatus.PAUSE) { return(false); } Client.IEntitySystem es = ControllerSystem.m_ClientGlobal.GetEntitySystem(); es.FindAllEntity <IBox>(ref lstBox); if ((skillStatus == (int)Client.SkillState.None) && (lstBox.Count > 1 ? true : IsMoving() == false)) { for (int i = 0; i < lstBox.Count; i++) { if (lstBox[i].CanAutoPick()) { m_nPickItemId = lstBox[i].GetID(); return(true); } } lstBox.Clear(); } return(false); }
/// <summary> /// 背包已满提示 /// </summary> /// <param name="itemId"></param> void ShowBoxTips(uint itemId) { Client.IEntitySystem es = ControllerSystem.m_ClientGlobal.GetEntitySystem(); IBox box = es.FindBox(itemId); if (box == null) { return; } Client.IControllerHelper controllerhelper = GetControllerHelper(); if (controllerhelper != null) { int itemBaseId = box.GetProp((int)EntityProp.BaseID); int itemNum = box.GetProp((int)BoxProp.Number); //1、捡到的item 为金币 if (itemBaseId == 60001) { return; } //2、不可放入背包 if (false == controllerhelper.CanPutInKanpsack((uint)itemBaseId, (uint)itemNum)) { Client.ITipsManager tip = ControllerSystem.m_ClientGlobal.GetTipsManager(); if (tip != null) { tip.ShowTips("背包空间不足"); } } } }
public void OnSelectTitle(stSelectTitlePropertyUserCmd_CS cmd) { //如果是玩家自己 if (Client.ClientGlobal.Instance().IsMainPlayer(cmd.dwUserID)) { this.WearTitleId = cmd.wdTitleID; TitleDataBase titleDataBase = GameTableManager.Instance.GetTableItem <TitleDataBase>(this.WearTitleId); if (titleDataBase != null) { TipsManager.Instance.ShowLocalFormatTips(LocalTextType.Title_Commond_peidaichenghao, titleDataBase.strName);//佩戴称号{0} } } Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es != null) { //设置人物身上称号 Client.IPlayer player = es.FindPlayer(cmd.dwUserID); if (player != null) { player.SetProp((int)PlayerProp.TitleId, (int)cmd.wdTitleID); } } //处理文字特效 Client.stTitleWear data = new Client.stTitleWear { uid = cmd.dwUserID, titleId = cmd.wdTitleID }; EventEngine.Instance().DispatchEvent((int)GameEventID.TITLE_WEAR, data);//抛出现在佩戴的称号 }
void PlayAni(uint uid, string entityAction) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IPlayer player = es.FindPlayer(uid); if (player == null) { return; } //处理 PlayAni anim_param = new PlayAni(); anim_param.strAcionName = entityAction; anim_param.fSpeed = 1; anim_param.nStartFrame = 0; anim_param.nLoop = -1; anim_param.fBlendTime = 0.2f; player.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param); }
/// <summary> /// 获取圆形范围内的monster /// </summary> /// <param name="radius">半径</param> /// <param name="list">monsterlist集合</param> public static void GetMonsterListByCricle(float radius, ref List <IMonster> list) { Client.IEntitySystem es = EntitySystem.m_ClientGlobal.GetEntitySystem(); if (es == null) { return; } monstercon.m_radius = radius; es.FindEntityRange <IMonster>(monstercon, ref list); }
/// <summary> /// 获取圆形范围内的robot /// </summary> /// <param name="radius">半径</param> /// <param name="list">robotlist集合</param> public static void GetRobotListByCricle(float radius, ref List <IRobot> list) { Client.IEntitySystem es = EntitySystem.m_ClientGlobal.GetEntitySystem(); if (es == null) { return; } robotcon.m_radius = radius; es.FindEntityRange <IRobot>(robotcon, ref list); }
/// <summary> /// 获取圆形范围内的npc /// </summary> /// <param name="radius">半径</param> /// <param name="list">npclist集合</param> public static void GetNpcListByCricle(float radius, ref List <INPC> list) { Client.IEntitySystem es = EntitySystem.m_ClientGlobal.GetEntitySystem(); if (es == null) { return; } npccon.m_radius = radius; es.FindEntityRange <INPC>(npccon, ref list); }
void OnEvent(int nEventid, object param) { if (nEventid == (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY) { Client.stCreateEntity createEntity = (Client.stCreateEntity)param; Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es != null) { Client.IEntity e = es.FindEntity(createEntity.uid); if (e == null) { return; } if (e.GetEntityType() != Client.EntityType.EntityType_Box) { return; } if (!m_dicBoxTime.ContainsKey(createEntity.uid)) { m_dicBoxTime.Add(createEntity.uid, createEntity.boxTime); } else { Engine.Utility.Log.Error("重复添加box{0}", createEntity.uid); } } } else if (nEventid == (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY) { Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param; Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es != null) { Client.IEntity e = es.FindEntity(removeEntiy.uid); if (e == null) { return; } if (e.GetEntityType() != Client.EntityType.EntityType_Box) { return; } if (m_dicBoxTime.ContainsKey(removeEntiy.uid)) { m_dicBoxTime.Remove(removeEntiy.uid); } } } }
private void OnTitleWear(uint uid) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IPlayer entity = es.FindPlayer(uid); if (entity != null) { RoleStateBar bar = GetRoleBarByUID(entity.GetUID()); if (bar != null) { bar.UpdateWidget(new HeadTipData(entity, HeadTipType.Title, m_bPlayerTitleVisible)); } } }
public void Excute(stUnTransfigurationScriptUserCmd_S cmd) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IEntity player = es.FindPlayer(cmd.userid); if (player != null) { player.SetProp((int)Client.PlayerProp.TransModelResId, 0); player.SendMessage(Client.EntityMessage.EntityCommand_Restore, new Client.ChangeBody() { param = cmd.taskid, callback = null, modleScale = 1 }); } }
private void OnClanNameRefresh(uint clanID, uint uid) { RoleStateBar bar = GetRoleBarByUID(uid); if (bar != null) { if (clanID != 0) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } } else { bar.SetWidgetState(HeadTipType.Clan, false); } } }
// 根据服务器类型和id获取实体对象 public static IEntity GetEntity(GameCmd.SceneEntryType type, uint id) { Client.EntityType t = GetEntityEtype(type); Client.IEntitySystem es = EntitySystem.m_ClientGlobal.GetEntitySystem(); if (es == null) { return(null); } switch (t) { case EntityType.EntityType_Player: { return(es.FindPlayer(id)); } case EntityType.EntityType_NPC: { IEntity en = es.FindNPC(id); if (en == null) { en = es.FindRobot(id); } return(en); } case EntityType.EntityType_Monster: { return(es.FindMonster(id)); } case EntityType.EntityType_Item: { return(es.FindItem(id)); } } return(null); }
/// <summary> /// 为采集物添加特效 /// </summary> /// <param name="taskInfo"></param> void AddCollectNpcEffect(QuestTraceInfo taskInfo) { if (taskInfo.taskSubType != TaskSubType.Collection) { return; } Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.INPC npc = es.FindNPCByBaseId((int)taskInfo.QuestTable.collect_npc); if (npc == null) { return; } DataManager.Manager <TaskDataManager>().AddCollectNpcEffect(npc.GetID(), 9002); DataManager.Manager <TaskDataManager>().AddCollectNpcEffect(npc.GetID(), 9003); }
//------------------------------------------------------------------------------------------------------- public bool Create(Client.IPlayer player, int nSize, GameObject parentObj, Client.SkillSettingState eState = Client.SkillSettingState.StateOne) { if (player == null) { return(false); } Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem(); if (rs == null) { Engine.Utility.Log.Error("获取RenderSystem失败!"); return(false); } // 对象创建 if (m_Root == null) { m_Root = new GameObject("RTObj"); if (parentObj != null) { m_Root.transform.parent = parentObj.transform; } } // m_RenderObj = null; Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return(false); } List <GameCmd.SuitData> lstSuit = null; player.GetSuit(out lstSuit); return(Create(lstSuit, player.GetProp((int)PlayerProp.Job), player.GetProp((int)PlayerProp.Sex), nSize, parentObj, eState)); }
public void Execute(GameCmd.stRobotLevelUpMagicUserCmd_S cmd) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IRobot robot = es.FindRobot(cmd.npc_id); if (robot == null) { return; } uint baseID = (uint)robot.GetProp((int)Client.EntityProp.BaseID); uint job = (uint)robot.GetProp((int)Client.RobotProp.Job); uint level = (uint)robot.GetProp((int)Client.CreatureProp.Level); string name = robot.GetName(); EntityCreateData createData = RoleUtil.BuildRobotEntityData(cmd.npc_id, baseID, job, level, name); stPropUpdate lvprop = new stPropUpdate(); stPropUpdate prop = new stPropUpdate(); prop.uid = robot.GetUID(); lvprop.uid = robot.GetUID(); prop.nPropIndex = (int)CreatureProp.Hp; lvprop.nPropIndex = (int)CreatureProp.Level; prop.oldValue = robot.GetProp((int)CreatureProp.Hp); lvprop.oldValue = robot.GetProp((int)CreatureProp.Level); robot.UpdateProp(createData); prop.newValue = robot.GetProp((int)CreatureProp.Hp); lvprop.newValue = robot.GetProp((int)CreatureProp.Level); Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_HPUPDATE, prop); Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, lvprop); }
//----------------------------------------------------------------------------------------------- private void OnStartCollectSlider(ref Client.stUninterruptMagic uninterrupt) { if (ShowCollectTip(uninterrupt.type)) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IEntity entity = es.FindEntity(uninterrupt.uid); if (entity != null && Client.ClientGlobal.Instance().IsMainPlayer(entity.GetUID()) == false) { RoleStateBar bar = GetRoleBarByUID(uninterrupt.uid); if (bar != null) { HeadTipData data = new HeadTipData(entity, HeadTipType.Collect, true); data.SetCollectType(uninterrupt.type); bar.UpdateWidget(data); } } } }
public void Excute(stTransfigurationScriptUserCmd_S cmd) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IEntity player = es.FindPlayer(cmd.userid); if (player != null) { DataManager.Manager <RideManager>().TryUnRide((obj) => { player.SendMessage(Client.EntityMessage.EntityCommand_Change, new Client.ChangeBody() { resId = (int)cmd.modelid, param = cmd.taskid, callback = null, modleScale = 1 }); }, null); } }
void SkillEvent(int eventID, object param) { if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSSTART) { Client.stUninterruptMagic evenparam = (Client.stUninterruptMagic)param; if (ClientGlobal.Instance().IsMainPlayer(evenparam.uid)) { if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.SliderPanel) == false) { DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.SliderPanel, panelShowAction: (panel) => { DispatchValueUpdateEvent(new ValueUpdateEventArgs() { key = SliderDataEnum.Begin.ToString() }); }); } float dur = (float)(evenparam.time * 1f / 1000); if (dur > 0) { DataManager.Manager <SliderDataManager>().StartSliderByEvent(dur, evenparam.type); } else { Log.Error("进度条时间小于 0"); } } if (evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_CJ || evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_CampCJ || evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_SYDJ) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IEntity player = es.FindEntity(evenparam.uid); if (player == null) { return; } bool moving = (bool)player.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null); if (moving) { player.SendMessage(EntityMessage.EntityCommand_StopMove); } Client.INPC npc = es.FindNPC(evenparam.npcId); if (npc != null) { player.SendMessage(EntityMessage.EntityCommand_LookTarget, npc.GetPos()); } PlayAni(player, EntityAction.Collect); } else if (evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_CangBaoTuCJ) { //采集 Log.Info("开始挖宝..."); Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IEntity player = es.FindEntity(evenparam.uid); if (player == null) { return; } bool moving = (bool)player.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null); if (moving) { player.SendMessage(EntityMessage.EntityCommand_StopMove); } Client.INPC npc = es.FindNPC(evenparam.npcId); if (npc != null) { player.SendMessage(EntityMessage.EntityCommand_LookTarget, npc.GetPos()); } // PlayAni(player, EntityAction.Collect); //播放挖宝动作 PlayAni(player, EntityAction.Mining); //更换武器模型 DataManager.Manager <SuitDataManager>().OnMiningTreasureMapToChangeWeapon(player); } } else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSBREAK) { if (param != null) { stGuildBreak guildBreak = (stGuildBreak)param; if (ClientGlobal.Instance().IsMainPlayer(guildBreak.uid)) { DataManager.Manager <SliderDataManager>().HideSlider(guildBreak.action); DataManager.Manager <SliderDataManager>().IsBreak = true; DataManager.Manager <SliderDataManager>().IsReadingSlider = false; //DataManager.Manager<TaskDataManager>().IsShowSlider = false; } if (guildBreak.action == GameCmd.UninterruptActionType.UninterruptActionType_CJ || guildBreak.action == GameCmd.UninterruptActionType.UninterruptActionType_CampCJ) { //打断采集 Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IEntity entity = es.FindPlayer(guildBreak.uid); if (entity != null) { bool moving = (bool)entity.SendMessage(EntityMessage.EntityCommand_IsMove, null); if (!moving) { PlayAni(guildBreak.uid, EntityAction.Stand); } } } } } else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSEND) { DataManager.Manager <SliderDataManager>().IsReadingSlider = false; //DataManager.Manager<TaskDataManager>().IsShowSlider = false; stGuildEnd guildEnd = (stGuildEnd)param; if (ClientGlobal.Instance().IsMainPlayer(guildEnd.uid)) { //坐骑读条完毕后上马 if (guildEnd.action == GameCmd.UninterruptActionType.UninterruptActionType_DEMON) { DataManager.Instance.Sender.RideUsingRide(); } else { if (guildEnd.action != GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ) { PlayStand(); } } } else { //播站立动作 PlayAni(guildEnd.uid, EntityAction.Stand); } } else if (eventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD) { stEntityDead ed = (stEntityDead)param; if (ClientGlobal.Instance().IsMainPlayer(ed.uid)) { // HideSprite(); DispatchValueUpdateEvent(new ValueUpdateEventArgs() { key = SliderDataEnum.End.ToString(), oldValue = m_UninterruptActionType }); DataManager.Manager <SliderDataManager>().IsBreak = true; DataManager.Manager <SliderDataManager>().IsReadingSlider = false; } } }
/// <summary> /// 事件处理 /// </summary> /// <param name="nEventID"></param> /// <param name="param"></param> public void GlobalEventHandler(int eventID, object param) { if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_NPCHEADSTATUSCHANGED) { if (null != param && param is Client.INPC) { UpdateNpcHeadMask((Client.INPC)param); } } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY) { Client.stCreateEntity ce = (Client.stCreateEntity)param; OnCretateEntity(ref ce); } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY) { Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param; RemoveBar(removeEntiy); } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE) { stPropUpdate prop = (stPropUpdate)param; OnPropUpdate(ref prop); } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_HPUPDATE) { stPropUpdate prop = (stPropUpdate)param; OnPropUpdate(ref prop); } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME) { stEntityChangename e = (stEntityChangename)param; OnChangeName(e.uid); } else if (eventID == (int)(int)Client.GameEventID.ENTITYSYSTEM_SETHIDE) { stEntityHide st = (stEntityHide)param; OnSetEntityHide(ref st); return; } else if (eventID == (int)(int)Client.GameEventID.TITLE_WEAR)//佩戴称号 { Client.stTitleWear data = (Client.stTitleWear)param; OnTitleWear(data.uid); } else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSSTART) { Client.stUninterruptMagic uninterrupt = (Client.stUninterruptMagic)param; OnStartCollectSlider(ref uninterrupt); } else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSBREAK) { if (param != null) { stGuildBreak guildbreak = (stGuildBreak)param; if (ShowCollectTip(guildbreak.action)) { long uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, guildbreak.uid); RoleStateBar bar = GetRoleBarByUID(uid); if (bar != null) { bar.SetWidgetState(HeadTipType.Collect, false); } } } } else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSEND) { if (param != null) { stGuildEnd guildEnd = (stGuildEnd)param; if (ShowCollectTip(guildEnd.action)) { long uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, guildEnd.uid); RoleStateBar bar = GetRoleBarByUID(uid); if (bar != null) { bar.SetWidgetState(HeadTipType.Collect, false); } } } } else if (eventID == (int)Client.GameEventID.CLANQUIT || eventID == (int)Client.GameEventID.CLANJOIN || eventID == (int)Client.GameEventID.CLANREFRESHID || eventID == (int)Client.GameEventID.CITYWARWINERCLANID || eventID == (int)Client.GameEventID.CLANDeclareInfoAdd || eventID == (int)Client.GameEventID.CLANDeclareInfoRemove) { OnRefreshAllClanTitile(); } else if (eventID == (int)Client.GameEventID.CITYWARTOTEMCLANNAMECHANGE) { long uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_NPC, (uint)param); RoleStateBar bar = GetRoleBarByUID(uid); if (bar != null) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } RefreshClanName(es.FindEntity(uid), bar); } } else if (eventID == (int)Client.GameEventID.SYSTEM_GAME_READY) { OnRefreshAllHpSlider(); } }
public bool Create(List <GameCmd.SuitData> lstSuit, int nJob, int nSex, int nSize, GameObject parentObj, SkillSettingState eState = SkillSettingState.StateOne) { Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem(); if (rs == null) { Engine.Utility.Log.Error("获取RenderSystem失败!"); return(false); } // 对象创建 if (m_Root == null) { m_Root = new GameObject("RTObj"); if (parentObj != null) { m_Root.transform.parent = parentObj.transform; } } // m_RenderObj = null; Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return(false); } Client.EntityCreateData data = new Client.EntityCreateData(); data.ID = ++s_uPuppetID; data.strName = ""; //int speed = player.GetProp((int)WorldObjProp.MoveSpeed); data.PropList = new EntityAttr[(int)PuppetProp.End - (int)EntityProp.Begin]; int index = 0; data.PropList[index++] = new EntityAttr((int)PuppetProp.Job, nJob); data.PropList[index++] = new EntityAttr((int)PuppetProp.Sex, nSex); //data.PropList[index++] = new EntityAttr((int)EntityProp.BaseID, 0); //data.PropList[index++] = new EntityAttr((int)WorldObjProp.MoveSpeed, speed); data.eSkillState = eState; data.bViewModel = true; // 处理时装外观数据 EntityViewProp[] propList = new EntityViewProp[(int)Client.EquipPos.EquipPos_Max]; index = 0; propList[index++] = new EntityViewProp((int)Client.EquipPos.EquipPos_Body, 0); propList[index++] = new EntityViewProp((int)Client.EquipPos.EquipPos_Weapon, 0); if (lstSuit.Count > 0) { for (int i = 0; i < lstSuit.Count; ++i) { if (lstSuit[i] == null) { continue; } int pos = GetPropPos((Client.EquipPos)lstSuit[i].suit_type, propList); if (pos >= 0) { propList[pos] = new EntityViewProp((int)lstSuit[i].suit_type, (int)lstSuit[i].baseid); } else { Client.EquipPos equipPos = (Client.EquipPos)lstSuit[i].suit_type; propList[index++] = new EntityViewProp((int)equipPos, (int)lstSuit[i].baseid); } } } data.ViewList = propList; data.nLayer = LayerMask.NameToLayer("ShowModel"); m_PuppetObj = es.CreateEntity(Client.EntityType.EntityType_Puppet, data, true) as Client.IPuppet; if (m_PuppetObj == null) { Engine.Utility.Log.Error("创建Renderobj失败{0}!", ""); return(false); } m_RenderObj = m_PuppetObj.renderObj; if (m_RenderObj == null) { return(false); } // 默认播放站立动作 m_RenderObj.Play(Client.EntityAction.Stand); m_RenderObj.SetLayer((int)Engine.RenderLayer.ShowModel); // showModel // CreateCamera Camera cam = CreateCamera(); m_RenderText = new RenderTexture(nSize, nSize, 24, RenderTextureFormat.ARGB32); if (m_RenderText == null) { return(false); } cam.targetTexture = m_RenderText; // 对象挂在父节点上 if (m_Root != null) { m_RenderObj.GetNode().GetTransForm().parent = m_Root.transform; m_Camera.transform.parent = m_Root.transform; } return(true); }
void ShowItemInfo(MainUsePanelData data) { /* * List<BaseItem> lstItems = DataManager.Manager<ItemManager>().GetItemByBaseId(itemBaseid); * if (lstItems.Count <= 0) * { * m_nitemThisId = 0; * m_nitemBaseId = 0; * return; * } * m_nitemThisId = lstItems[0].QWThisID; * m_nitemBaseId = itemBaseid; */ //npc if (data.type == 1) { m__icon.gameObject.SetActive(false); m_sprite_iconCollect.gameObject.SetActive(true); Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } INPC npc = es.FindNPC(data.Id); if (npc == null) { return; } //this.name = npc.GetName(); this.name = "采集"; m_label_item_name.text = string.Format("{0}[ffd966]({1})[-]", this.name, CLOSE_TIME); } //item else if (data.type == 2) { m__icon.gameObject.SetActive(true); m_sprite_iconCollect.gameObject.SetActive(false); table.ItemDataBase itemdata = GameTableManager.Instance.GetTableItem <table.ItemDataBase>(data.Id); if (itemdata != null) { UIManager.GetTextureAsyn(itemdata.itemIcon, ref m_iconCASD, () => { if (null != m__icon) { m__icon.mainTexture = null; } }, m__icon); //this.name = itemdata.itemName; this.name = "使用"; m_label_item_name.text = string.Format("{0}[ffd966]({1})[-]", this.name, CLOSE_TIME); } } //特效 UIParticleWidget wight = m_sprite_iconBg.GetComponent <UIParticleWidget>(); if (null == wight) { wight = m_sprite_iconBg.gameObject.AddComponent <UIParticleWidget>(); wight.depth = 100; } if (wight != null) { UIParticleWidget p = wight.GetComponent <UIParticleWidget>(); if (p == null) { p = wight.gameObject.AddComponent <UIParticleWidget>(); p.depth = 20; } if (p != null) { p.SetDimensions(1, 1); p.ReleaseParticle(); p.AddParticle(50019); } } StartCoroutine(WaitToClose()); }
void OnEvent(int eventID, object param) { if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY) { Client.stCreateEntity ce = (Client.stCreateEntity)param; Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IEntity en = es.FindEntity(ce.uid); if (en != null) { int rideId = en.GetProp((int)Client.PlayerProp.RideBaseId); if (rideId != 0) { //if (Client.ClientGlobal.Instance().IsMainPlayer(en)) //{ // UsingRide = (uint)rideId; //} bool isride = (bool)en.SendMessage(Client.EntityMessage.EntityCommond_IsRide, null); if (!isride) { en.SendMessage(Client.EntityMessage.EntityCommond_Ride, rideId); } // Engine.Utility.Log.LogGroup("ZCX", "EntityCommond_Ride {0}",en.GetID()); } //int transModelId = en.GetProp((int)Client.PlayerProp.TransModelResId); //if (transModelId != 0) //{ // en.SendMessage(Client.EntityMessage.EntityCommand_Change, new Client.ChangeBody() { resId = transModelId}); //} } } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_RIDE) { Client.stEntityRide ride = (Client.stEntityRide)param; if (Client.ClientGlobal.Instance().IsMainPlayer(ride.uid)) { if (UsingRideCallback != null) { UsingRideCallback(UsingRideCallbackParam); UsingRideCallback = null; UsingRideCallbackParam = null; } } } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_UNRIDE) { Client.stEntityUnRide ride = (Client.stEntityUnRide)param; if (Client.ClientGlobal.Instance().IsMainPlayer(ride.uid)) { if (UnRideCallback != null) { UnRideCallback(UnRideCallbackParam); UnRideCallback = null; UnRideCallbackParam = null; } } } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_MAINPLAYERCREATE) { Client.IEntity mainPlayer = Client.ClientGlobal.Instance().MainPlayer; if (mainPlayer == null) { return; } //int rideId = mainPlayer.GetProp((int)Client.PlayerProp.RideBaseId); //if (rideId != 0) //{ // UsingRide = (uint)rideId; // bool isride = (bool)mainPlayer.SendMessage(Client.EntityMessage.EntityCommond_IsRide, null); // if (!isride) // { // mainPlayer.SendMessage(Client.EntityMessage.EntityCommond_Ride, rideId); // } //} } else if (eventID == (int)Client.GameEventID.UIEVENT_UPDATEITEM) { List <string> tempIDList = GameTableManager.Instance.GetGlobalConfigKeyList("Knight_ExpItem"); uint breakItemID = GameTableManager.Instance.GetGlobalConfig <uint>("KngithRankItem"); ItemDefine.UpdateItemPassData data = (ItemDefine.UpdateItemPassData)param; if (data != null) { if (data.BaseId == breakItemID || tempIDList.Contains(data.BaseId.ToString())) { DisPatchRideRedPoint(); } } } }
private void OnEvent(int nEventID, object param) { GameEventID eventId = (GameEventID)nEventID; switch (eventId) { case GameEventID.ENTITYSYSTEM_MAINPLAYERCREATE: { SetTimer(MEDICAL_TIMEID, MEDICAL_TIME_INTERVAL); SetTimer(ATONCE_TIMERID, ATONCE_LEN); } break; case GameEventID.ENTITYSYSTEM_RELIVE: { stEntityRelive er = (stEntityRelive)param; if (ControllerSystem.m_ClientGlobal.IsMainPlayer(er.uid)) { SetTimer(MEDICAL_TIMEID, MEDICAL_TIME_INTERVAL); SetTimer(ATONCE_TIMERID, ATONCE_LEN); } } break; case GameEventID.ENTITYSYSTEM_ENTITYDEAD: { stEntityDead ed = (stEntityDead)param; if (ControllerSystem.m_ClientGlobal.IsMainPlayer(ed.uid)) { KillTimer(MEDICAL_TIMEID); KillTimer(ATONCE_TIMERID); } } break; case GameEventID.SKILLSYSTEM_SKILLLISTCHANE: case GameEventID.SKILLSYSTEM_ADDSKILL: InitSkill(); break; case GameEventID.SKILLNONESTATE_ENTER: { NextSkill = 0; OnCombat(); } break; //case GameEventID.ROBOTCOMBAT_NEXTCMD: // { // if (param != null) // { // Client.stSkillDoubleHit skillDhHit = (Client.stSkillDoubleHit)param; // OnUseDoubleHitSkill(skillDhHit); // } // } // break; case GameEventID.SKILLSYSTEM_STIFFTIMEOVER: { //挂机状态下 硬直结束(并且没有插入技能)只处理普攻前两招,第三招释放时如果有插入 就不播放收招 stNextSkill st = (stNextSkill)param; NextSkill = st.nextSkillID; if (m_status == CombatRobotStatus.RUNNING && NextSkill != 0) { DoAttack(); } if (m_status == CombatRobotStatus.RUNNING && NextSkill == 0 && InsertSkillID != 0) { DoAttack(); } } break; case GameEventID.SKILLGUIDE_PROGRESSBREAK: { if (param != null) { stGuildBreak skillFailed = (stGuildBreak)param; if (skillFailed.action == GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ) { if (ControllerSystem.m_ClientGlobal.IsMainPlayer(skillFailed.uid)) { m_nIgnoreSkillid = skillFailed.skillid; // AddTips(string.Format("使用技能失败id:{0} ret{1}", skillFailed.skillid, skillFailed.msg)); } ChangeRoleAction(RoleAction.NONE); } } //ChangeRoleAction(RoleAction.USESKILL); //DoNextCMD(); } break; case GameEventID.JOYSTICK_UNPRESS: m_fStopTime = UnityEngine.Time.realtimeSinceStartup; break; case GameEventID.JOYSTICK_PRESS: m_fStopTime = 0; OnPause(true); break; case GameEventID.ENTITYSYSTEM_CREATEENTITY: { Client.stCreateEntity createEntity = (Client.stCreateEntity)param; Client.IEntitySystem es = ControllerSystem.m_ClientGlobal.GetEntitySystem(); Client.IEntity entity = es.FindEntity(createEntity.uid); if (entity != null) { if (entity.GetEntityType() == EntityType.EntityType_Box) { ShowBoxTips(entity.GetID()); OnPickUpItem(); } } } break; case GameEventID.ENTITYSYSTEM_REMOVEENTITY: { Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param; Client.IEntitySystem es = ControllerSystem.m_ClientGlobal.GetEntitySystem(); Client.IEntity entity = es.FindEntity(removeEntiy.uid); if (entity != null) { if (entity.GetEntityType() == EntityType.EntityType_Box) { OnPickUpItem(); } } } break; case GameEventID.ROBOTCOMBAT_COPYKILLWAVE: { if (param != null) { stCopySkillWave copyWave = (stCopySkillWave)param; if (m_bInCopy) { m_nLaskKillWave = copyWave.waveId; m_nLaskMovePosIndex = copyWave.posIndex; // AddTips(string.Format("副本wave{0} posIndex{1}", m_nLaskKillWave, m_nLaskMovePosIndex)); if (m_nLaskMovePosIndex != 0) { // SetTimer(COPYCOMBAT_TIMEID, 1600); //OnPause(false); } //DoNextCMD(); } } } break; case GameEventID.NETWORK_CONNECTE_CLOSE: { m_disconnectStatus = m_status; if (m_disconnectStatus != CombatRobotStatus.STOP) { Stop(); Engine.Utility.Log.Error("掉线了 挂机停止!!!"); } } break; case GameEventID.RECONNECT_SUCESS: { if (m_disconnectStatus != CombatRobotStatus.STOP) { Start(); if (m_disconnectStatus == CombatRobotStatus.PAUSE) { Pause(); } m_disconnectStatus = CombatRobotStatus.STOP; } } break; default: break; } }