public bool CanHandle(ServerRoom room, PlayerEntity player, SimpleProto message)
        {
            if (message.Key != FreeMessageConstant.PlayerSprayPaint)
            {
                return(false);
            }
            int serverTime = room.RoomContexts.session.currentTimeObject.CurrentTime;
            var config     = IndividuationConfigManager.GetInstance().GetConfigById(message.Ins[0]);
            int intervalCD = 0;

            if (null == config)
            {
                intervalCD = 0;
            }
            else
            {
                intervalCD = config.IntervalCD;
            }

            if (player.playerSpray.mLastCreateTime + intervalCD < serverTime)
            {
                return(true);
            }
            else
            {
                //TODO 喷漆CD提示
                return(false);
            }
        }
Example #2
0
        private Individuation GetIndividuationByIndex(int i)
        {
            var list = _adapter.PaintIdList;

            if (list == null || list.Count <= i || list[i] == 0)
            {
                return(null);
            }
            var id     = list[i];
            var config = IndividuationConfigManager.GetInstance().GetConfigById(id);

            return(config);
        }
Example #3
0
        private void SendMarkMessage(Vector3 position, Vector3 forward, Vector3 head, int SprayPrintSpriteId)
        {
            SimpleProto sprayPaint = FreePool.Allocate();

            sprayPaint.Key = FreeMessageConstant.PlayerSprayPaint;
            /*位置*/
            sprayPaint.Fs.Add(position.x);
            sprayPaint.Fs.Add(position.y);
            sprayPaint.Fs.Add(position.z);
            /*朝向*/
            sprayPaint.Fs.Add(forward.x);
            sprayPaint.Fs.Add(forward.y);
            sprayPaint.Fs.Add(forward.z);
            /*方向*/
            sprayPaint.Fs.Add(head.x);
            sprayPaint.Fs.Add(head.y);
            sprayPaint.Fs.Add(head.z);
            /*ID*/
            sprayPaint.Ins.Add(SprayPrintSpriteId);
            var config = IndividuationConfigManager.GetInstance().GetConfigById(SprayPrintSpriteId);
            int lifeTime;

            if (null == config || 0 == config.LifeTime)
            {
                lifeTime = int.MaxValue;
            }
            else
            {
                lifeTime = config.LifeTime;
            }
            /*LifeTime*/
            sprayPaint.Ins.Add(lifeTime);
            if (_contexts.session.clientSessionObjects.NetworkChannel != null)
            {
                _contexts.session.clientSessionObjects.NetworkChannel.SendReliable((int)EClient2ServerMessage.FreeEvent, sprayPaint);
            }
        }