public static void loadPlayerJob(int source) { Player player = new PlayerList()[source]; string job = "unemployed"; string grade = "unemployed"; var licenseIdentifier = player.Identifiers["steam"]; MYSQL.FetchAll($"SELECT * FROM playerjob WHERE steamid = '{licenseIdentifier}'", null, (List <dynamic> list) => { int count = (list == null) ? 0 : list.Count; if (count == 0) { MYSQL.execute($"INSERT INTO playerjob (name,grade,steamid) VALUES ('{job}','{grade}','{licenseIdentifier}');"); Debug.WriteLine("Zapisuju nového hráče do tabulky 'PlayerJob'"); } else { job = list[0].name; grade = list[0].grade; } player.TriggerEvent("xCore:client:LoadJob", job, grade); PlayerJob pJob = new PlayerJob(); pJob.setPlayer(player); pJob.setPlayerJob(job, grade); PlayerJobHolder.savePlayerToList(source, pJob); }); }
public void getJobName(int source, dynamic value) { PlayerJob job = PlayerJobHolder.getPlayerJob(source); var args = new List <object>() { job.getJobName().ToString(), job.getJobGrade().ToString() }; value(args); }
public static void playerDisconnectFromGame([FromSource] Player player, string reason) { var licenseIdentifier = player.Identifiers["steam"]; //===================== PlayerJob job = PlayerJobHolder.getPlayerJob(player); if (job != null) { MYSQL.execute($"UPDATE playerjob " + $"SET name = '{job.getJobName()}'," + $"grade = '{job.getJobGrade()}' " + $"WHERE steamid = '{licenseIdentifier}'; "); PlayerJobHolder.removePlayerFromJobList(player); } //===================== PlayerMoney money = PlayerMoneyHolder.getPlayerMoney(player); if (money != null) { MYSQL.execute($"UPDATE playermoney " + $"SET money = '{money.getMoney()}'," + $"bank = '{money.getBankMoney()}'," + $"dirty_money='{money.getDirtyMoney()}'" + $"WHERE steamid = '{licenseIdentifier}'; "); PlayerMoneyHolder.removePlayerFromMoneyList(player); } //===================== PlayerGroup group = PlayerGroupHolder.getPlayerGroup(player); if (group != null) { List <string> gp = group.playerGroups(); StringBuilder sb = new StringBuilder(); if (gp.Count != 0) { for (int i = 0; i < gp.Count; i++) { sb.Append($"('{licenseIdentifier}', '{gp[i]}'),"); } MYSQL.execute($"DELETE FROM `groupusers` WHERE steamid = '{licenseIdentifier}';" + $"INSERT INTO `groupusers` (`steamid`, `group`) VALUES {sb.ToString().Remove(sb.Length - 1)}"); } PlayerGroupHolder.removePlayerFromGroupList(player); } //===================== //===================== //===================== Debug.WriteLine($"Player {player.Name} has disconnected! ================================== :("); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var translationType = GetArchetypeChunkComponentType <Translation>(); var playerType = GetArchetypeChunkComponentType <PlayerComponent>(); var job = new PlayerJob() { DeltaTime = Time.DeltaTime, TranslationType = translationType, PlayerComponentType = playerType, }; return(job.Schedule(entityQuery, inputDeps)); }
public static async Task SaveMarkers() { while (true) { await Delay(500); show.Clear(); playerPos = Game.Player.Character.Position; for (int i = 0; i < MarkerHolder.MarkerList.Count; i++) { mark = MarkerHolder.MarkerList[i]; if (mark.getJobList().Count != 0) { if (!mark.getJobs(PlayerJob.getJobName(), PlayerJob.getJobGrade())) { continue; } } if (World.GetDistance(playerPos, mark.getPosition()) < mark.getDistance()) { show.Add(mark); } if (World.GetDistance(playerPos, mark.getPosition()) < (mark.getScale().X + 0.3f)) { if (!callbacks.Contains(mark)) { callbacks.Add(mark); mark.onEnterDelegate().DynamicInvoke(); } } } for (int i = 0; i < callbacks.Count; i++) { mark = callbacks[i]; if (!(World.GetDistance(playerPos, mark.getPosition()) < (mark.getScale().X + 0.3f))) { if (callbacks.Contains(mark)) { callbacks.Remove(mark); mark.onExitDelegate().DynamicInvoke(); } } } } }
public virtual void Start() { CursorLock(true); pressButton.SetActive(false); if (LeftWeapon != null) { uiController.SlotUpdate(LeftWeapon, 2); LeftWeapon.isHave = false; } if (jobs.Count > 0) { jobIndex = -1; playerJob = null; } if (playerJob != null) { playerJob.player = this; playerJob._Start(); } HP = MaxHP; }
protected override JobHandle OnUpdate(JobHandle inputDeps) { CursorSystem.Sync(); game_camera_update_system_.Sync(); handle_ = inputDeps; if (lockon_limit_.IsCreated) { lockon_limit_.Dispose(); } // for (var i = 0; i < player_group_.Length; ++i) { int i = 0; // only one player now. { var entity = player_group_.entity_list_[i]; var player = player_group_.player_list_[i]; var player_position = player_group_.position_list_[i]; var player_rotation = player_group_.rotation_list_[i]; // Debug.Log(player.life_.get()); var pc = player_controller_list_from_entity_[entity]; if (pc.lockon_ != 0) { lockon_limit_ = new NativeLimitedCounter(Allocator.TempJob); var sumup_job = new SumupJob { time_ = Time.GetCurrent(), locktarget_list_ = lockon_group_.locktarget_list_, lockon_limit_ = lockon_limit_, }; handle_ = sumup_job.Schedule(lockon_group_.Length, 8, handle_); var lockon_job = new LockonJob { time_ = Time.GetCurrent(), locktarget_entity_list_ = lockon_group_.entity_list_, locktarget_list_ = lockon_group_.locktarget_list_, locktarget_local_to_world_list_ = lockon_group_.local_to_world_list_, player_position_ = player_position, player_normal_ = math.mul(player_rotation.Value, new float3(0f, 0f, 1f)), lockon_limit_ = lockon_limit_, sight_spawner_ = ECSSightManager.GetSightSpawnDataQueue(), }; handle_ = lockon_job.Schedule(lockon_group_.Length, 8, handle_); } if (pc.fire_laser_ != 0) { var fire_laser_job = new FireLaserJob { time_ = Time.GetCurrent(), command_buffer_ = barrier_.CreateCommandBuffer(), entity_list_ = lockon_group_.entity_list_, player_position_ = player_position, player_rotation_ = player_rotation, player_ = player, locktarget_list_ = lockon_group_.locktarget_list_, random_list_ = lockon_group_.random_list_, }; handle_ = fire_laser_job.Schedule(lockon_group_.Length, 8, handle_); } if (pc.fire_bullet_ != 0) { player.fire_bullet_time_ = Time.GetCurrent(); player.fire_bullet_count_ = 0; } const int RENSYA_NUM = 16; if (Time.GetCurrent() - player.fire_bullet_time_ >= 0f && player.fire_bullet_count_ < RENSYA_NUM) { var vel = math.mul(player_rotation.Value, new float3(0f, 0f, 48f)); var pos0 = math.mul(player_rotation.Value, new float3(0.3f, 0.1f, 0.8f)) + player_position.Value; ECSBulletManager.spawnBullet(barrier_.CreateCommandBuffer(), Time.GetCurrent(), ref pos0, ref vel); var pos1 = math.mul(player_rotation.Value, new float3(-0.3f, 0.1f, 0.8f)) + player_position.Value; ECSBulletManager.spawnBullet(barrier_.CreateCommandBuffer(), Time.GetCurrent(), ref pos1, ref vel); const float INTERVAL = 0.05f; player.fire_bullet_time_ = Time.GetCurrent() + INTERVAL; ++player.fire_bullet_count_; } player_group_.player_list_[i] = player; } var job = new PlayerJob { dt_ = Time.GetDT(), position_list_ = player_group_.position_list_, rotation_list_ = player_group_.rotation_list_, rb_position_list_ = player_group_.rb_position_list_, player_list_ = player_group_.player_list_, player_controller_list_ = player_group_.player_controller_list_, position_list_from_entity_ = position_list_from_entity_, }; handle_ = job.Schedule(player_group_.Length, 8, handle_); return(handle_); }
private string TranslateJob(PlayerJob job) { if (job == PlayerJob.HUNTER) { return "헌터"; }else { return "뱀파이어"; } }
public void setJob(int source, string jobName, string grade) { PlayerJob job = PlayerJobHolder.getPlayerJob(source); job.setPlayerJob(jobName, grade); }
public virtual void Update() { //int onObject = 3 << 9; RaycastHit objectHit; bool isHit = Physics.Raycast(transform.position, transform.TransformDirection(Vector3.down), out objectHit, OnFloorHeight); if (isHit) { //chargeTimeCnt += Time.deltaTime; //if (chargeTimeCnt > 0.1) //{ // if(Energy<MaxEnergy) // Energy += 1; // chargeTimeCnt = 0; //} if (Energy < MaxEnergy) { Energy += 10 * Time.deltaTime; } if (secondJumpFlg) { secondJumpFlg = false; } } else { if (Energy < MaxEnergy) { Energy += 1 * Time.deltaTime; } } //ChangeEnergyText(); if (Input.GetButtonDown("Jump")) { isJumpPressed = true; } if (Input.GetKeyDown(KeyCode.Q)) { isSwitchWeaponPressed = true; } if (Input.GetKeyDown(KeyCode.E)) { isPickWeaponPressed = true; } mouseScrollWheel = Input.GetAxis("Mouse ScrollWheel"); //gravity,速度制限付き! if (rb.velocity.y > -8) { rb.AddForce(-rb.transform.up * 50, ForceMode.Acceleration); } if (Input.GetKeyDown(KeyCode.J)) { jobIndex++; if (playerJob != null) { playerJob._End(); } if (jobIndex >= jobs.Count) { jobIndex = -1; playerJob = null; } else { playerJob = jobs[jobIndex]; playerJob.player = this; playerJob._Start(); } } if (playerJob != null) { playerJob._Update(); } }
public override string ToString() { string str = $"{ID}-{Name}-{Sex.ToString()}-{PlayerJob.ToString()}-{Character.ToString()}-{Gold}-{Level}-{Exp}-{MapNum}-{Pos.X}-{Pos.Y}-{Pos.Z}"; return(str); }
public BaseJobStep(PlayerJob job) { Job = job; }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var neighbors = new NeighborsDetectionJob { prodThresh = math.cos(math.radians(Bootstrap.Param.neighborFov)), distThresh = Bootstrap.Param.neighborDistance, neighborsFromEntity = GetBufferFromEntity <NeighborsEntityBuffer>(false), positionFromEntity = GetComponentDataFromEntity <Translation>(true), entities = group.ToEntityArray(Allocator.TempJob), }; var wall = new WallJob { scale = Bootstrap.Param.wallScale * 0.5f, thresh = Bootstrap.Param.wallDistance, weight = Bootstrap.Param.wallWeight, }; var separation = new SeparationJob { separationWeight = Bootstrap.Param.separationWeight, neighborsFromEntity = GetBufferFromEntity <NeighborsEntityBuffer>(true), positionFromEntity = GetComponentDataFromEntity <Translation>(true), }; var alignment = new AlignmentJob { alignmentWeight = Bootstrap.Param.alignmentWeight, neighborsFromEntity = GetBufferFromEntity <NeighborsEntityBuffer>(true), velocityFromEntity = GetComponentDataFromEntity <Velocity>(true), }; var cohesion = new CohesionJob { cohesionWeight = Bootstrap.Param.cohesionWeight, neighborsFromEntity = GetBufferFromEntity <NeighborsEntityBuffer>(true), positionFromEntity = GetComponentDataFromEntity <Translation>(true), }; var player = new PlayerJob() { separationWeight = Bootstrap.Param.separationWeight, playerEntities = playerGroup.ToComponentDataArray <Translation>(Allocator.TempJob), }; var move = new MoveJob { dt = Time.DeltaTime, minSpeed = Bootstrap.Param.minSpeed, maxSpeed = Bootstrap.Param.maxSpeed, }; inputDeps = neighbors.Schedule(this, inputDeps); inputDeps = wall.Schedule(this, inputDeps); inputDeps = separation.Schedule(this, inputDeps); inputDeps = alignment.Schedule(this, inputDeps); inputDeps = cohesion.Schedule(this, inputDeps); inputDeps = player.Schedule(this, inputDeps); //inputDeps = move.Schedule(this, inputDeps); return(inputDeps); }
public MoveToJobStep(PlayerJob job) : base(job) { }