private bool ProcessInternal(object incomingRealObject) { if (incomingRealObject is YourConnectionIdEvent yourConnectionId) { _playerInfo = new JPlayer(); PlayerInfo.ConnectionId = yourConnectionId.ConnectionId; _connected = true; connectWatcher.Signal(); } else if (incomingRealObject is YourPlayerEvent yourPlayerEvent) { PlayerInfo.Id = yourPlayerEvent.PlayerId; PlayerInfo.Name = yourPlayerEvent.PlayerName; _signup = true; Debug.WriteLine("Zwalniam SIGNUP"); signupWatcher.Signal(); } else { ProcessWaiters(incomingRealObject); return(false); } return(true); }
public override void OnPlayerEnterOver(ObjPlayer player) { if (player == null) { return; } base.OnPlayerEnterOver(player); int idx = _playerList.FindIndex(r => r.objId == player.ObjId); if (idx >= 0) { _playerList.RemoveAt(idx); } JPlayer p = new JPlayer(); p.objId = player.ObjId; p.name = player.GetName(); p.lv = 1; _playerList.Add(p); var tb = Table.GetCheckenLv(p.lv); if (tb != null) {//buff player.AddBuff(tb.BaseBuff, 1, player); } SendRadius(player); }
public JPlayer CreatePlayer() { JPlayer player = new JPlayer(); player.ConnectionId = Guid.NewGuid().ToString(); RegisterPlayer(player); return(player); }
public Transform target; // target to aim for private void Start() { // get the components on the object we need ( should not be null due to require component so no need to check ) agent = GetComponentInChildren <UnityEngine.AI.NavMeshAgent>(); character = GetComponent <JPlayer>(); agent.updateRotation = false; agent.updatePosition = true; }
public Tuple <JPlayer, Request.ResponseInfo> GetPlayerById(string id) { var uri = new Uri(URL.base_url + URL.base_extension + az.GetRegionF() + "/" + URL.player + id); HttpStatusCode status; int requestsRemaining; var raw_match = Request.DoRequest(uri, az.GetAPIKey()); return(new Tuple <JPlayer, Request.ResponseInfo>(JPlayer.FromJson(raw_match.response), raw_match)); }
protected override void OnOpen() { Debug.WriteLine("WS Player Connected"); SendPersistentMessages(); JEventBus.GetDefault().Register(this); _player = PlayerManager.Instance.CreatePlayer(); _player.Connected = true; _player.PlayerWsService = this; var yourConnectionId = new YourConnectionIdEvent(_player); Send(WsMessageBuilder.CreateWsText("private", yourConnectionId)); }
public JPlayer FindPlayerByConnectionId(string connectionId) { JPlayer result = null; foreach (var player in Players) { if (player.ConnectionId.Equals(connectionId)) { return(player); } } return(null); }
private void OnPlayerGetExp(ObjPlayer player, JPlayer jp, int exp) { var tb = Table.GetCheckenLv(jp.lv); if (tb == null) { return; } jp.exp += exp; Dict_int_int_Data data = new Dict_int_int_Data(); if (tb.NeedExp <= jp.exp) { var tbnew = Table.GetCheckenLv(jp.lv + 1); if (tbnew == null)//达到最大等级 { jp.exp = tb.NeedExp; } else { //删除旧的buff var tbold = Table.GetCheckenLv(jp.lv); if (tbold != null) {//buff player.DeleteBuff(tbold.BaseBuff, eCleanBuffType.Clear); } jp.exp -= tb.NeedExp; jp.lv++; player.AddBuff(tbnew.BaseBuff, 1, player); var ids = RandBuffList(tb.BuffGroup, 3); foreach (var id in ids) { int lv = 0; jp.buf.TryGetValue(id, out lv); data.Data.Add(id, lv + 1); } } } player.Proxy.CK_NotifyClientLevelup(player.mObjId, jp.lv, jp.exp, data); }
private JPlayer CreatePlayer(LoginPlayerEvent loginPlayerEvent, JPlayer connectionPlayer) { connectionPlayer.Id = Guid.NewGuid().ToString(); connectionPlayer.Name = loginPlayerEvent.Name; return(connectionPlayer); }
public YourPlayerEvent(JPlayer player) { ConnectionId = player.ConnectionId; PlayerId = player.Id; PlayerName = player.Name; }
public LoginPlayerEvent(JPlayer player) { PlayerId = player.Id; ConnectionId = player.ConnectionId; Name = player.Name; }
public CreatePlayerEvent(JPlayer player) { hid = player.Id; name = player.Name; }
public bool RemovePlayer(JPlayer connectionPlayer) { return(Players.Remove(connectionPlayer)); }
public void Clear() { Players.Clear(); LocalPlayer = null; }
public void RegisterPlayer(JPlayer playerToRegister) { Players.Add(playerToRegister); }
// Use this for initialization void Start() { m_player = GetComponent <JPlayer>(); m_player.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotation; }
public YourConnectionIdEvent(JPlayer player) { this.ConnectionId = player.ConnectionId; }