示例#1
0
    // Factoryパターンもどき?
    DisplayHandler CreateDisplayHandler(int apikind)
    {
        DisplayHandler displayhandler;

        // switchの中で代入したdisplayhandlerは外から参照できないのでswitch内でreturn
        switch (apikind)
        {
        case WALLET:
            displayhandler = new DisplayWalletInfoHandler();
            return(displayhandler);

            break;

        case MONSTER:
            displayhandler = new DisplayMonsterInfoHandler();
            return(displayhandler);

            break;

        case USERNAME:
            displayhandler = new DisplayUsernameInfoHandler();
            return(displayhandler);

            break;

        case GACHA:
            displayhandler = new DisplayGachaInfoHandler();
            return(displayhandler);

            break;

        case PARTY:
            displayhandler = new DisplayPartyInfoHandler();
            return(displayhandler);

            break;

        case RECIPE:
            displayhandler = new DisplayRecipeInfoHandler();
            return(displayhandler);

            break;

        case QUEST:
            displayhandler = new DisplayQuestInfoHandler();
            return(displayhandler);

            break;

        default:
            displayhandler = new DisplayDummyHandler();
            return(displayhandler);
        }
    }
示例#2
0
    // int型の引数が来たとき用のオーバーロード(こういう使い方で合ってるのか?
    DisplayHandler CreateDisplayHandler(int apikind, int optionarg)
    {
        DisplayHandler displayhandler;

        // switchの中で代入したdisplayhandlerは外から参照できないのでswitch内でreturn
        switch (apikind)
        {
        case WALLET:
            displayhandler = new DisplayWalletInfoHandler();
            return(displayhandler);

            break;

        case MONSTER:
            displayhandler = new DisplayMonsterInfoHandler(optionarg);
            return(displayhandler);

            break;

        case USERNAME:
            displayhandler = new DisplayUsernameInfoHandler();
            return(displayhandler);

            break;

        case GACHA:
            displayhandler = new DisplayGachaInfoHandler();
            return(displayhandler);

            break;

        default:
            displayhandler = new DisplayDummyHandler();
            return(displayhandler);
        }
    }