0

Java クラスを C# に変換していますが、適切に変換できたかどうか確信が持てません。以下のコードでは、RewardRequestListener の OnFinishedEvent を呼び出す必要がありますが、ブレークポイントに到達したり、何もログに記録したりしません。

これが私のJavaです:

private RequestListener<Resource> mRequestListener = new RequestListener<Resource>() {
    @Override
    public void onFinished(Kiip manager, Resource response) {
        if (response != null) {
            if (mRewardActionToggle.isChecked()) {
                manager.showResource(response);
            } else {
                toast("Reward Queued");
                mResources.add(response);
            }
        } else {
           toast("No Reward");
        }
    }

    @Override
    public void onError(Kiip manager, KiipException error) {
        toast("error (" + error.getCode() + ") " + error.getMessage());
    }
};

ここに私のC#があります:

    private static readonly string TAG = "example";

    private Button mUnlockAchievement, mSaveLeaderboard, mShowNotification, mShowFullscreen, mGetActivePromos, mNewActivity;

    private EditText mAchievementId, mLeaderboardId;

    private static ToggleButton mPositionToggle, mRewardActionToggle;

    private List<ME.Kiip.Api.Resource> mResources = new List<ME.Kiip.Api.Resource>();

    private RewardRequestListener mRewardsListener;
    private ActivePromosRequestListener mActivePromosListener;

    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        mRewardsListener = new RewardRequestListener(this);
    }

    class RewardRequestListener : Kiip.IRequestListener
    {
        ExampleActivity example = new ExampleActivity();

        public RewardRequestListener(ExampleActivity example)
        {
            this.example = example;
        }

        public void OnError(Kiip p0, KiipException p1)
        {
            example.toast("error (" + p1.Code + ") " + p1.Message);
        }

        public void OnFinished(Kiip p0, Java.Lang.Object p1)
        {
            ME.Kiip.Api.Resource response = p1 as ME.Kiip.Api.Resource;
            if (response != null)
            {
                if (mRewardActionToggle.Checked)
                {
                    p0.ShowResource(response);
                }
                else
                {
                    example.mResources.Add(response);
                }
            }
            else
            {
                example.toast("No Reward");
            }
        }

        public IntPtr Handle { get; set; }

        public void Dispose()
        {

        }
    }

    public void OnClick(View v)
    {
        Kiip manager = Kiip.Instance;

        switch (v.Id)
        {

            case Resource.Id.unlockAchievement:
                manager.UnlockAchievement(mAchievementId.Text, mRewardsListener);
                break;  
        }      
     }
4

0 に答える 0