예제 #1
0
    void UseProp(int ItemNum)
    {
        ComLoading.Open();
        HttpTask     task  = new HttpTask(ThreadType.MainThread, TaskResponse.Default_Response);
        UsePropParam param = new UsePropParam();

        param.gid     = Core.Data.playerManager.PlayerID;
        param.propid  = Core.Data.itemManager.GetBagItemPid(ItemNum);
        param.nm      = 1;
        param.propNum = ItemNum;

        task.AppendCommonParam(RequestType.USE_PROP, param);



        task.ErrorOccured   += testHttpResp_Error;
        task.afterCompleted += testHttpResp_UI;

        task.DispatchToRealHandler();
    }
예제 #2
0
    public void UseItem(BaseHttpRequest r, BaseResponse response)
    {
        if (response != null && response.status != BaseResponse.ERROR)
        {
            HttpRequest  htReq = r as HttpRequest;
            UsePropParam req   = htReq.ParamMem as UsePropParam;

            UseItem(req.propid, req.nm);
            UsePropResponse propResp = response as UsePropResponse;
            if (propResp.data.p != null)
            {
                for (int i = 0; i < propResp.data.p.Length; i++)
                {
                    if (propResp.data.p[i].getCurType() == ConfigDataType.Item)
                    {
                        AddRewardToBag(propResp.data.p[i]);
                    }
                }
            }
        }
    }