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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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;
    }
Esempio n. 5
0
        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));
        }
Esempio n. 7
0
        public JPlayer FindPlayerByConnectionId(string connectionId)
        {
            JPlayer result = null;

            foreach (var player in Players)
            {
                if (player.ConnectionId.Equals(connectionId))
                {
                    return(player);
                }
            }

            return(null);
        }
Esempio n. 8
0
        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);
 }
Esempio n. 10
0
 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;
 }
Esempio n. 12
0
 public CreatePlayerEvent(JPlayer player)
 {
     hid  = player.Id;
     name = player.Name;
 }
Esempio n. 13
0
 public bool RemovePlayer(JPlayer connectionPlayer)
 {
     return(Players.Remove(connectionPlayer));
 }
Esempio n. 14
0
 public void Clear()
 {
     Players.Clear();
     LocalPlayer = null;
 }
Esempio n. 15
0
 public void RegisterPlayer(JPlayer playerToRegister)
 {
     Players.Add(playerToRegister);
 }
Esempio n. 16
0
 // 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;
 }