Beispiel #1
0
    /// <summary>
    /// シングルバトル終了通信
    /// </summary>
    public static void CallClearApi(
        ClearResult clearResult,
        Rank clearRank,
        Action <ClearResponseData> onCompleted)
    {
        var request = new SharkWebRequest <ClearResponseData>("single/clear");

        request.SetRequestHeader("AccessToken", UserData.Get().hash);

        request.SetRequestParameter(new Dictionary <string, object>
        {
            { "playingStatus", (int)PlayingStatus.Finish },
            { "result", (int)clearResult },
            { "clearRank", (int)clearRank },
        });

        request.onSuccess = (response) =>
        {
            foreach (var reward in response.firstReward)
            {
                if (reward.directFlg > 0)
                {
                    UserData.Get().AddItem((ItemType)reward.itemType, reward.itemId, reward.itemNum);
                }
            }

            foreach (var reward in response.normalReward)
            {
                reward.Set();
                if (reward.directFlg > 0)
                {
                    UserData.Get().AddItem((ItemType)reward.itemType, reward.itemId, reward.itemNum);
                }
            }

            HomeScene.isMaxPossession = response.isMaxPossession;

            onCompleted?.Invoke(response);
        };

        request.Send();
    }
Beispiel #2
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        waitingEntities.Clear();
        var fetchJob = new FetchRequest
        {
            waitingEntities = waitingEntities,
            requests        = requesters.requestDatas,
            entities        = requesters.entities,
            counter         = counter
        };
        var fetchFence = fetchJob.Schedule(requesters.Length, SimulationState.TinyBatchSize, inputDeps);

        var fillFence = fetchFence;

        for (var i = 0; i < MAX_QUERIES; ++i)
        {
            var fillJob = new FillQuery
            {
                batch           = batches[i],
                waitingEntities = waitingEntities,
                requests        = requestDatas,
                counter         = counter,
                ID = i
            };
            fillFence = fillJob.Schedule(fillFence);
        }
        var fences = new NativeArray <JobHandle>(MAX_QUERIES, Allocator.Temp);

        for (var i = 0; i < MAX_QUERIES; ++i)
        {
            var processJob = new ProcessRequest {
                batch = batches[i]
            };
            fences[i] = processJob.Schedule(fillFence);
        }
        var processFence = JobHandle.CombineDependencies(fences);
        var getFence     = processFence;

        for (var i = 0; i < MAX_QUERIES; ++i)
        {
            var getJob = new GetResult
            {
                batch    = batches[i],
                paths    = paths,
                requests = requestDatas,
                counter  = counter
            };
            getFence = getJob.Schedule(getFence);
        }

        for (var i = 0; i < MAX_QUERIES; ++i)
        {
            var clearResultJob = new ClearResult
            {
                batch = batches[i]
            };
            fences[i] = clearResultJob.Schedule(getFence);
        }
        endFence = JobHandle.CombineDependencies(fences);

        fences.Dispose();

        return(endFence);
    }