IPet AddPetEntity(PetData petdata) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return(null); } EntityCreateData entityData = new EntityCreateData(); entityData.ID = petdata.id; entityData.PropList = new EntityAttr[(int)PetProp.End - (int)EntityProp.Begin]; RoleUtil.BuildPetPropListByPetData(petdata, ref entityData.PropList); IPet pet = es.CreateEntity(EntityType.EntityType_Pet, entityData) as IPet; if (pet != null) { pet.SetExtraData(petdata); return(pet); } return(null); }
public void SetBlockFashion() { bool value = ClientGlobal.Instance().gameOption.GetInt("SpecialEffects", "BlockFashion", 1) == 1; Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.HIDEFASHION, value); }
public void SetMonsterName() { bool value = ClientGlobal.Instance().gameOption.GetInt("ShowDetail", "MonsterName", 1) == 1; RoleStateBarManager.SetNpcNameVisible(value); }
public void SetHurtDisplay() { bool value = ClientGlobal.Instance().gameOption.GetInt("ShowDetail", "HurtDisplay", 1) == 1; // FlyFontDataManager.Instance.m_bShowFlyFont = value; }
public void SetCameraDistance() { bool value = ClientGlobal.Instance().gameOption.GetInt("Camera", "close", 1) == 1; Client.EntityCreator.Instance().isFarDisCamera = value; }
public void SetPlayerTitle() { bool value = ClientGlobal.Instance().gameOption.GetInt("ShowDetail", "PlayerTitle", 1) == 1; DataManager.Manager <TitleManager>().SetIsShowTitle(value); }
//瞬回血药开关 public void SetHpAtOnce() { int value = ClientGlobal.Instance().gameOption.GetInt("MedicalSetting", "HpAtOnce", 1); }
//自动组队 public void SetSettingTeamInvite() { bool value = ClientGlobal.Instance().gameOption.GetInt("Social", "SettingTeamInvite", 1) == 1; DataManager.Manager <TeamDataManager>().SetAutoRefuseTeamInvite(value); }
//设置自动入队 public void SetIntoTeam() { bool value = ClientGlobal.Instance().gameOption.GetInt("TeamSetting", "IntoTeam", 1) == 1; DataManager.Manager <TeamDataManager>().SetLeaderAutoAgreeTeamApply(value); }
//设置自动跟随 public void SetFollow() { bool value = ClientGlobal.Instance().gameOption.GetInt("TeamSetting", "Follow", 1) == 1; DataManager.Manager <TeamDataManager>().SetMemberAutoAllowTeamFollow(value); }
//------------------------------------------------------------------------------------------------ private void CreateNPC(GameCmd.t_MapNpcDataPos npcdata, uint master_id) { Profiler.BeginSample("CreateNPC"); IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } //MapVector2 mapPos = MapVector2.FromCoordinate(npcdata.cur_pos.x * 0.01f, npcdata.cur_pos*0.01f); Vector3 pos = new Vector3(npcdata.cur_pos.x * 0.01f, 0, -npcdata.cur_pos.y * 0.01f); // 服务器到客户端坐标转换 EntityCreateData data = RoleUtil.BuildCreateEntityData(EntityType.EntityType_NPC, npcdata, master_id); INPC npc = es.FindNPC(npcdata.mapnpcdata.npcdata.dwTempID); if (npc != null) { npc.UpdateProp(data); NpcAscription.Instance.UpdateBelong(npc, npcdata.mapnpcdata.npcdata.owernuserid, npcdata.mapnpcdata.npcdata.owernteamid, npcdata.mapnpcdata.npcdata.owernclanid, npcdata.mapnpcdata.npcdata.ownername); } else { npc = es.CreateEntity(EntityType.EntityType_NPC, data, !m_bDelayLoad) as INPC; // 发送事件 CreateEntity if (npc != null) { NpcAscription.Instance.UpdateBelong(npc, npcdata.mapnpcdata.npcdata.owernuserid, npcdata.mapnpcdata.npcdata.owernteamid, npcdata.mapnpcdata.npcdata.owernclanid, npcdata.mapnpcdata.npcdata.ownername); table.NpcDataBase npctable = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)npcdata.mapnpcdata.npcdata.dwBaseID); if (npctable != null) { //Debug.LogError("********** npctable.dwID = " + npctable.dwID); if (npcdata.mapnpcdata.npcdata.arenanpctype == ArenaNpcType.ArenaNpcType_Player)//离线的真实玩家名字,用服务器的 { npc.SendMessage(EntityMessage.EntityCommond_SetName, npcdata.mapnpcdata.npcdata.name); } else { if (string.IsNullOrEmpty(npcdata.mapnpcdata.npcdata.name)) { npc.SendMessage(EntityMessage.EntityCommond_SetName, npctable.strName); } } if (npctable.dwType == (uint)GameCmd.enumNpcType.NPC_TYPE_TRANSFER)//传送阵 { EntityOnTrigger callback = new EntityOnTrigger(); npc.SetCallback(callback); } } if (npc != null) { PlayAni anim_param = new PlayAni(); anim_param.strAcionName = EntityAction.Stand; anim_param.fSpeed = 1; anim_param.nStartFrame = 0; anim_param.nLoop = -1; anim_param.fBlendTime = 0.2f; npc.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param); } } } if (npc != null) { npc.SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); Vector3 rot = GameUtil.S2CDirection(npcdata.mapnpcdata.npcdata.byDirect); npc.SendMessage(EntityMessage.EntityCommand_SetRotate, (object)rot); IBuffPart buffpart = npc.GetPart(EntityPart.Buff) as IBuffPart; if (buffpart != null) { buffpart.ReceiveBuffList(npcdata.mapnpcdata.statelist.data); } } Profiler.EndSample(); }
void OnLoadSceneCompelete(int nEventID, object param) { // 设置镜头 SetupMainCamera(ClientGlobal.Instance().MainPlayer); if (GameObject.Find("DirectionalLight1") == null) { // 灯光 GameObject pObject = new GameObject(); pObject.name = "DirectionalLight1"; pObject.transform.position = new Vector3(57.74f, 35.87f, -53); Quaternion rot = new Quaternion(); rot.eulerAngles = new Vector3(30f, 145f, 0f); pObject.transform.rotation = rot; Light pLight = pObject.AddComponent <Light>(); pLight.shadows = LightShadows.None; pLight.type = LightType.Directional; pLight.color = new Color(1, 1, 1, 1); pLight.intensity = 0.75f; if (Application.platform == RuntimePlatform.Android) { //pLight.intensity = 0.75f / 2f; } pLight.bounceIntensity = 1; pLight.cullingMask = (1 << LayerMask.NameToLayer("ShowModel")); //阴影 pLight.shadowStrength = 0.39f; pLight.shadowBias = 0.05f; pLight.shadowNormalBias = 0.4f; pLight.shadowNearPlane = 0.2f; pLight.cookieSize = 10; pLight.renderMode = LightRenderMode.Auto; } if (GameObject.Find("DirectionalLight2") == null) { // 灯光 GameObject pObjectLight2 = new GameObject(); pObjectLight2.name = "DirectionalLight2"; pObjectLight2.transform.position = new Vector3(57.74f, 35.87f, -53); Quaternion rot = new Quaternion(); rot.eulerAngles = new Vector3(15f, -95f, 0f); pObjectLight2.transform.rotation = rot; Light pLight = pObjectLight2.AddComponent <Light>(); pLight.shadows = LightShadows.None; pLight.type = LightType.Directional; pLight.color = new Color(74 / 255f, 99f / 255f, 180 / 255f, 1); pLight.intensity = 0.75f; if (Application.platform == RuntimePlatform.Android) { //pLight.intensity = 0.75f / 2f; } pLight.bounceIntensity = 1f; pLight.cullingMask = (1 << LayerMask.NameToLayer("ShowModel")); //阴影 pLight.shadowStrength = 0.39f; pLight.shadowBias = 0.05f; pLight.shadowNormalBias = 0.4f; pLight.shadowNearPlane = 0.2f; pLight.cookieSize = 10; pLight.renderMode = LightRenderMode.Auto; } if (GameObject.Find("DirectionalLight3") == null) { // 灯光 GameObject pObjectLight3 = new GameObject(); pObjectLight3.name = "DirectionalLight3"; pObjectLight3.transform.position = new Vector3(57.74f, 35.87f, -53); Quaternion rot = new Quaternion(); rot.eulerAngles = new Vector3(20f, 10f, 0f); pObjectLight3.transform.rotation = rot; Light pLight = pObjectLight3.AddComponent <Light>(); pLight.shadows = LightShadows.Hard; pLight.type = LightType.Directional; pLight.color = new Color(1, 223f / 255f, 201f / 255f, 1); pLight.intensity = 0.85f; if (Application.platform == RuntimePlatform.Android) { //pLight.intensity = 0.85f / 2f; } pLight.bounceIntensity = 1; pLight.cullingMask = (1 << LayerMask.NameToLayer("ShowModel")); //阴影 pLight.shadowStrength = 0.5f; pLight.shadowBias = 0.05f; pLight.shadowNormalBias = 0.4f; pLight.shadowNearPlane = 0.2f; pLight.cookieSize = 10; pLight.renderMode = LightRenderMode.Auto; } IMapSystem mapSys = ClientGlobal.Instance().GetMapSystem(); if (mapSys != null) { uint uMapID = mapSys.GetMapID(); table.MapDataBase mapDB = GameTableManager.Instance.GetTableItem <table.MapDataBase>(uMapID); if (mapDB == null) { Engine.Utility.Log.Error("MapSystem:找不到地图配置数据{0}", uMapID); return; } if (mapDB.WaveEffect == 1) { Camera cam = Camera.main; if (cam != null) { postHeatDistortionEffect = cam.GetComponent <PostRenderHeatDistortionEffect>(); if (postHeatDistortionEffect == null) { postHeatDistortionEffect = cam.transform.gameObject.AddComponent <PostRenderHeatDistortionEffect>(); } else { postHeatDistortionEffect.enabled = true; } } } else { Camera cam = Camera.main; if (cam != null) { postHeatDistortionEffect = cam.GetComponent <PostRenderHeatDistortionEffect>(); if (postHeatDistortionEffect != null) { postHeatDistortionEffect.enabled = false; } } } } }
////////////////////////////////////////////////////////////////////////////////////////////////////////// private Client.IPlayer CreatePlayer(GameCmd.t_MapUserData userData) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return(null); } EntityCreateData data = RoleUtil.BuildCreateEntityData(EntityType.EntityType_Player, userData); IPlayer player = es.FindPlayer(userData.userdata.dwUserID); if (player != null) { uint clanIdLow = (uint)player.GetProp((int)CreatureProp.ClanIdLow); uint clanIdHigh = (uint)player.GetProp((int)CreatureProp.ClanIdHigh); uint clanid = (clanIdHigh << 16) | clanIdLow; // //uint clanid = (uint)player.GetProp((int)CreatureProp.ClanId); //玩家死亡 服务器会通过这里刷新 所以这里更新下玩家血条 if (userData.userdata.curhp <= 0) { stPropUpdate prop = new stPropUpdate(); prop.uid = player.GetUID(); prop.nPropIndex = (int)CreatureProp.Hp; prop.oldValue = player.GetProp((int)CreatureProp.Hp); player.UpdateProp(data); prop.newValue = player.GetProp((int)CreatureProp.Hp); Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_HPUPDATE, prop); } else { stPropUpdate prop = new stPropUpdate(); prop.uid = player.GetUID(); prop.nPropIndex = (int)CreatureProp.Hp; prop.oldValue = player.GetProp((int)CreatureProp.Hp); player.UpdateProp(data); prop.newValue = player.GetProp((int)CreatureProp.Hp); if (prop.oldValue < prop.newValue) { Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_HPUPDATE, prop); } } if (userData.userdata.clan_id != clanid) { Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.CLANREFRESHID, new Client.stClanUpdate() { uid = player.GetUID(), clanId = userData.userdata.clan_id }); } } else { if (UserData.IsMainRoleID(userData.userdata.dwUserID)) { data.nLayer = LayerMask.NameToLayer("MainPlayer"); data.bMainPlayer = true; // 设置主角标识 player = es.CreateEntity(EntityType.EntityType_Player, data, true) as IPlayer; if (player == null) { Engine.Utility.Log.Error("CreatePlayer:创建角色失败!"); return(null); } Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ENTITYSYSTEM_MAINPLAYERCREATE, new Client.stCreateEntity() { uid = userData.userdata.dwUserID }); // 设置控制对象 Client.IControllerSystem cs = ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { cs.GetActiveCtrl().SetHost(player); } // 补丁 服务器没有金钱没有放在角色属性上 { player.SetProp((int)PlayerProp.Money, (int)UserData.Money); player.SetProp((int)PlayerProp.Coupon, (int)UserData.Coupon); player.SetProp((int)PlayerProp.Cold, (int)UserData.Cold); player.SetProp((int)PlayerProp.Reputation, (int)UserData.Reputation); player.SetProp((int)PlayerProp.Score, (int)UserData.Score); player.SetProp((int)PlayerProp.CampCoin, (int)UserData.CampCoin); player.SetProp((int)PlayerProp.AchievePoint, (int)UserData.AchievePoint); player.SetProp((int)PlayerProp.ShouLieScore, (int)UserData.ShouLieScore); player.SetProp((int)PlayerProp.FishingMoney, (int)UserData.FishingMoney); player.SetProp((int)PlayerProp.YinLiang, (int)UserData.YinLiang); } // 设置主像机参数 SetupMainCamera(player); //玩家成功登陆回调 Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.PLAYER_LOGIN_SUCCESS, null); //Client.stCreateEntity createEntity = new Client.stCreateEntity(); //createEntity.uid = player.GetUID(); //Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_CREATEENTITY, createEntity); //set hp DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MainPanel, UIMsgID.eSetRoleProperty, player); //预加载资源 // PreLoadResource(player.GetProp((int)PlayerProp.Job)); } else { //Profiler.BeginSample("CreatePlayer"); player = es.CreateEntity(EntityType.EntityType_Player, data, !m_bDelayLoad) as IPlayer; //Profiler.EndSample(); Protocol.Instance.RequestName(userData.userdata.dwUserID); } if (player != null) { PlayAni anim_param = new PlayAni(); anim_param.strAcionName = EntityAction.Stand; anim_param.fSpeed = 1; anim_param.nStartFrame = 0; anim_param.nLoop = -1; anim_param.fBlendTime = 0.2f; player.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param); } } IBuffPart buffpart = player.GetPart(EntityPart.Buff) as IBuffPart; if (buffpart != null) { buffpart.ReceiveBuffList(userData.statelist.data); } return(player); }
//技能声音滑动条 public void SetVoiceslider() { float value = ClientGlobal.Instance().gameOption.GetInt("Sound", "Voiceslider", 0) / 100.0f; }
//宠物喂食的物品图 public void SetPetHpitemid() { int value = ClientGlobal.Instance().gameOption.GetInt("MedicalSetting", "PetHpitemid", 1); }
void SetSettingFixedRocker() { bool value = ClientGlobal.Instance().gameOption.GetInt("Operate", "SettingFixedRocker", 1) == 1; Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.EJOYSTICKSTABLE, value); }
//装备耐久低于多少时slider public void SetRepairValue() { float value = ClientGlobal.Instance().gameOption.GetInt("MedicalSetting", "Equipvalue", 1) / 100.0f; }
//自动接收氏族邀请 public void SetSettingClanInvite() { bool value = ClientGlobal.Instance().gameOption.GetInt("Social", "SettingClanInvite", 1) == 1; DataManager.Manager <ClanManger>().AutoRefuseInvite = value; }
//自动回城 public void SetAutoReturn() { int value = ClientGlobal.Instance().gameOption.GetInt("MedicalSetting", "AutoReturn", 1); }
//设置画质效果的等级 包括下面三个SetSettingScreenPriority + SetPerformancePriority + SetSavingPriority void SetPriority() { int type = ClientGlobal.Instance().gameOption.GetInt("PictureEffect", "GriphicSlider", 1); SetSettingScreenPriority((uint)type); }
//生命低于多少时自动回城slider public void SetHpLimtvalue() { float value = ClientGlobal.Instance().gameOption.GetInt("MedicalSetting", "HpLimtvalue", 1) / 100.0f; }
public void SetClanName() { bool value = ClientGlobal.Instance().gameOption.GetInt("ShowDetail", "ClanName", 1) == 1; DataManager.Manager <ClanManger>().ShowClanName = value; }
//自动拾取装备开关 public void SetPickMedecal() { int value = ClientGlobal.Instance().gameOption.GetInt("Pick", "PickMedecal", 1); }
public void SetHpDisplay() { bool value = ClientGlobal.Instance().gameOption.GetInt("ShowDetail", "HpDisplay", 1) == 1; RoleStateBarManager.SetHpSliderVisible(value); }
//拾取装备的等级slider public void SetEquipLevel() { float value = ClientGlobal.Instance().gameOption.GetInt("Pick", "EquipLevel", 1) / 7.0f; }
public void SetotherEffect() { bool value = ClientGlobal.Instance().gameOption.GetInt("SpecialEffects", "otherEffect", 1) == 1; Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.HIDETEXIAO_OTHER, value); }
/// <summary> /// 设置快捷使用道具 固定栏数量 /// </summary> public void SetFixedShortcutItemCount() { FixedShortcutItemCount = ClientGlobal.Instance().gameOption.GetInt("Shortcut", "SetItemCountSlider", 25) / 25; }
public void SetSkillShake() { bool value = ClientGlobal.Instance().gameOption.GetInt("SpecialEffects", "skillShake", 0) == 1; CameraFollow.Instance.BEnableShake = value; }
public void AddPlayer(t_MapUserData data, Vector3 pos, uint dir, List <GameCmd.Pos> lstPos, bool bHavePos = false) { if (data == null) { return; } IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } IPlayer player = null; if (es.FindPlayer(data.userdata.dwUserID) != null) // 更新数据 { player = CreatePlayer(data); if (player != null && bHavePos) { player.SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); //Vector3 rot = GameUtil.S2CDirection(dir); //player.SendMessage(EntityMessage.EntityCommand_SetRotate, (object)rot); } return; } // 主角立即创建 if (UserData.IsMainRoleID(data.userdata.dwUserID)) { player = CreatePlayer(data); if (player != null && bHavePos) { player.SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); //Vector3 rot = GameUtil.S2CDirection(dir); //player.SendMessage(EntityMessage.EntityCommand_SetRotate, (object)rot); } return; } player = CreatePlayer(data); if (player != null && bHavePos) { player.SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); Vector3 rot = GameUtil.S2CDirection(dir); player.SendMessage(EntityMessage.EntityCommand_SetRotate, (object)rot); //m_UserDataPool.Free(iter.Current.Value); // m_dicUserData.Remove(iter.Current.Value.data.userdata.dwUserID); // break; if (lstPos != null) { Move move = new Move(); move.m_speed = player.GetProp((int)WorldObjProp.MoveSpeed) * EntityConst.MOVE_SPEED_RATE; // 速度为测试速度 move.strRunAct = Client.EntityAction.Run; move.path = new List <Vector3>(); // 添加起点 //move.path.Add(new Vector3(cmd.begin_pos_x * 0.01f, 0, -cmd.begin_pos_y * 0.01f)); for (int i = 0; i < lstPos.Count; ++i) { //if (i > 0) //{ // move.path.Add(new Vector3(cmd.poslist[i].x, 0, -cmd.poslist[i].y)); //} //else { move.path.Add(new Vector3(lstPos[i].x * 0.01f, 0, -lstPos[i].y * 0.01f)); } } player.SendMessage(EntityMessage.EntityCommand_MovePath, (object)move); } } }