Beispiel #1
0
    public MachineTestOutput Run(MachineTestInput input)
    {
        CoreSpinResult             spinResult      = Spin(input);
        MachineTestIndieGameResult indieGameResult = _indieGameManager.Run(input);
        MachineTestOutput          output          = ConstructOutput(input, spinResult, indieGameResult);

        return(output);
    }
Beispiel #2
0
    private CoreSpinResult Spin(MachineTestInput input)
    {
        CoreSpinInput spinInput = new CoreSpinInput(input._betAmount, _machine.MachineConfig.BasicConfig.ReelCount, input._isRespin);

        spinInput.IsPayProtectionTest = input._isPayProtection;
        CoreSpinResult spinResult = _machine.Spin(spinInput);

        _machine.CheckSwitchSmallGameState(spinResult, SmallGameMomentType.Front);
        _machine.CheckSwitchSmallGameState(spinResult, SmallGameMomentType.Behind);

        return(spinResult);
    }
Beispiel #3
0
    private string ConstructResult(int id, MachineTestInput input, MachineTestOutput output)
    {
        CoreSpinResult spinResult     = output._spinResult;
        SpinResultType spinResultType = spinResult.Type;

        List <string> symbolNames = ListUtility.MapList(spinResult.SymbolList, (CoreSymbol s) => {
            return(s.SymbolData.Name);
        });
        string symbolNameStr = string.Join(_delimiter, symbolNames.ToArray());

        int resultType = CoreUtility.SpinResultTypeToInt(spinResultType);

        int resultId = 0;

        if (spinResultType == SpinResultType.Win)
        {
            resultId = spinResult.GetPayoutId();
        }
        else if (spinResultType == SpinResultType.NearHit)
        {
            resultId = spinResult.GetNearHitId();
        }

        int           lucky             = CoreUtility.LuckyModeToInt(spinResult.LuckyMode);
        long          curCredit         = input._credit;
        int           consumedBetAmount = (int)spinResult.ConsumedBetAmount;
        float         winRatio          = spinResult.WinRatio;
        long          creditChange      = output._creditChange;
        long          remainCredit      = output._remainCredit;
        int           luckyChange       = output._luckyChange;
        int           remainLucky       = output._remainLucky;
        int           isRespin          = spinResult.IsRespin ? 1 : 0;
        List <string> isFixedStrList    = ListUtility.MapList(spinResult.IsFixedList, (bool b) => {
            return(b ? "1" : "0");
        });
        string isFixedStr          = string.Join(_delimiter, isFixedStrList.ToArray());
        int    isTriggerIndieGame  = output._isTriggerIndieGame ? 1 : 0;
        ulong  indieGameWinAmount  = output._indieGameWinAmount;
        string indieGameCustomData = output._indieGameCustomData;

        string result = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16}",
                                      id, symbolNameStr, resultType, resultId, lucky, curCredit, consumedBetAmount, winRatio,
                                      creditChange, remainCredit, luckyChange, remainLucky, isRespin, isFixedStr, isTriggerIndieGame,
                                      indieGameWinAmount, indieGameCustomData);

        return(result);
    }
Beispiel #4
0
    private MachineTestOutput ConstructOutput(MachineTestInput input, CoreSpinResult spinResult,
                                              MachineTestIndieGameResult indieGameResult)
    {
        MachineTestOutput output = new MachineTestOutput();

        output._spinResult = spinResult;

        //when respin, not subtract
        output._creditChange = (input._isRespin) ? 0 : -(int)input._betAmount;

        if (spinResult.Type == SpinResultType.Win)
        {
            output._creditChange += (int)spinResult.WinAmount;
        }

        //consider indie game
        if (indieGameResult != null)
        {
            output._creditChange += (long)indieGameResult._winAmount;
        }

        output._remainCredit = input._credit + output._creditChange;

        output._luckyChange = _machine.LuckyManager.LongLuckyManager.GetSubtractLongLucky(spinResult);
        output._remainLucky = input._lucky - output._luckyChange;
        if (output._remainLucky < 0)
        {
            output._remainLucky = 0;
        }

        output._shouldRespin = _machine.ShouldRespin();
        if (_machine.LastSmallGameState == SmallGameState.None && _machine.SmallGameState != SmallGameState.None)
        {
            output._isChangeToSpecialSmallGameState = true;
        }

        output._isPayProtection = input._isPayProtection;

        if (indieGameResult != null)
        {
            output._isTriggerIndieGame  = true;
            output._indieGameWinAmount  = indieGameResult._winAmount;
            output._indieGameCustomData = indieGameResult._customData;
        }

        return(output);
    }