Exemplo n.º 1
0
        private void ChangeRequest(EntityWorkData workData, RequestId reqId, ParamData paramData)
        {
            if (workData.CurrReqId == RequestId.None)
            {
                workData.ChangeRequestId(reqId);
                workData.AddParam(paramData);
            }
            else
            {
                int pushSort = GetRequestSort(reqId);
                int curSort  = GetRequestSort(workData.CurrReqId);

                //强制置换(覆盖)
                if (pushSort == ECSDefinition.REForceSwithWeight)
                {
                    workData.ChangeRequestId(reqId);
                    workData.AddParam(paramData);
                }
                else
                {
                    //判断当前的
                    if (pushSort < curSort)
                    {
                        workData.ChangeRequestId(reqId);
                        workData.AddParam(paramData);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void PushRequest(int entityId, RequestId reqId, ParamData paramData)
        {
            //数据
            EntityWorkData workData = ECSLayerLocate.Info.GetEntityWorkData(entityId);

            if (workData == null)
            {
                return;
            }

            if (workData.CurrReqId == reqId)
            {
                workData.AddParam(paramData);
                return;
            }

            //请求
            IRequest  pushRequest = GetEntityRequest(reqId);
            RequestId oldReqId    = workData.CurrReqId;

            //请求不需要自身处理
            if (pushRequest == null)
            {
                ChangeRequest(workData, reqId, paramData);
            }
            else
            {
                RequestId selfSwId = reqId;
                //请求内部置换
                int rule = pushRequest.SwitchRequest(reqId, ref selfSwId);
                //只需要自身判断
                if (rule == ECSDefinition.RESwithRuleSelf)
                {
                    if (workData.CurrReqId != selfSwId)
                    {
                        workData.ChangeRequestId(reqId);
                        workData.AddParam(paramData);
                    }
                }
                else
                {
                    //自身判断也需要权重置换规则
                    ChangeRequest(workData, reqId, paramData);
                }
            }

            if (workData.CurrReqId == oldReqId)
            {
                return;
            }

            //执行请求
            ECSLayerLocate.Behavior.ReqBev(workData, oldReqId);
        }