This commit is contained in:
Andrey Sharshov
2025-11-16 18:45:28 +01:00
commit dfa72178d5
187 changed files with 39934 additions and 0 deletions

View File

@@ -0,0 +1,217 @@
import { Assets, Ticker } from 'pixi.js';
import { argTypes, getDefaultArgs } from 'src/stories/utils/argTypes';
import { createScreenInputMap } from 'src/stories/utils/createScreenInputMap';
import MachineContainer from 'src/stories/utils/MachineContainer';
import { centerView } from 'src/stories/utils/resize';
import ReelsSpinSystem from 'src/systems/ReelsSpinSystem';
import { SlotMachineConfig } from 'src/types/SlotMachineConfig';
import { Meta, PixiStory, StoryFn } from '@pixi/storybook-renderer';
import ReelsMachine from '../slotMachines/ReelsMachine';
import MockSystem from "../systems/MockSystem";
const args = {
key: 'A', // skin '10'
accelerationTime: 1,
backCoef: 1.1,
maxSpeed: 40,
reelStartDelay: 0.2,
reelStopDelay: 0.5,
spinningDuration: 2,
blur: true,
bounce: true
};
const meta: Meta<typeof ReelsSpinSystem> = {
title: 'Systems/WinSymbolSystem', // Путь для отображения в Storybook
tags: ['autodocs'], // Включает автоматическую генерацию документации
parameters: {
docs: {
story: {
height: 600
},
description: {
component: 'Animation of win symbols and winlines, all and individual loop'
},
}
},
argTypes: argTypes(args),
args: getDefaultArgs(args),
};
export default meta;
const rawLines = [
[0, 1, 0, 1, 0],
[0, 1, 1, 1, 0]
]
const lines = {
get: (index: number) => {
return rawLines[index]
},
numberOfLines: () => 2,
lines: rawLines
}
export const WinSymbolStory: StoryFn<typeof args> = (_params, context) => new PixiStory({
context, init: async (view) =>
{
Assets.reset();
await Assets.init({
manifest: 'area69/manifest.json',
});
await Assets.loadBundle('configs');
await Assets.loadBundle('symbols');
const config: SlotMachineConfig = Assets.get('slot_machine_config');
const machine = new ReelsMachine({...config, lines: lines.lines});
machine.systems.spin.setSettings(_params);
const container = new MachineContainer(machine);
machine.systems.blockExitState = new MockSystem(machine)
view.addChild(container);
context.machine = machine;
machine.inputs.initMap = createScreenInputMap(config);
machine.inputs.screenMap = createScreenInputMap(config);
machine.inputs.wins = {
totalWin: 200,
totalWinString: '2.00 USD',
wins: [
{
type: 'line',
amount: 100,
amountString: '1.00 USD',
lineSlotsIndexMap: [0, 1, 0],
lineIndex: 0
},
{
type: 'line',
amount: 100,
amountString: '1.00 USD',
lineSlotsIndexMap: [0, 1, 1],
lineIndex: 1
}
]
};
console.log(machine)
console.log(machine.inputs)
machine.inputs.spin = true;
centerView(view);
},
resize: centerView,
update: () =>
{
context.machine && context.machine.update(Ticker.shared.deltaMS);
}
});
// export const WinStickSymbolStory: StoryFn<typeof args> = (_params, context) => new PixiStory({
// context, init: async (view) =>
// {
// Assets.reset();
// await Assets.init({
// manifest: 'area69/manifest.json',
// });
// await Assets.loadBundle('configs');
// await Assets.loadBundle('symbols');
// const config: SlotMachineConfig = Assets.get('slot_machine_config');
// const machine = new ReelsMachine({...config, lines: [
// [0, 1, 0, 1, 0],
// [0, 1, 1, 1, 0]
// ] });
// const container = new MachineContainer(machine);
//
//
// view.addChild(container);
// context.machine = machine;
// machine.inputs.initMap = createScreenInputMap(config);
// machine.inputs.screenMap = createScreenInputMap(config);
// machine.inputs.wins = [
// {
// type: 'line',
// amount: 100,
// amountString: '1.00 USD',
// lineSlotsIndexMap: [0, 1, 0],
// lineIndex: 0
// },
// {
// type: 'line',
// amount: 100,
// amountString: '1.00 USD',
// lineSlotsIndexMap: [0, 1, 1],
// lineIndex: 1
// }
// ]
// machine.stateMachine.states[STATES.SPINNING].systems = ['spin', 'layering', 'stick'];
// machine.systems.stick = new StickySymbolsSystem(machine);
// machine.systems.stick.setSettings(_params);
// machine.systems.spin.setSettings(_params);
// // machine.systems.allWinSymbols.setSettings(winSymbolSettings);
// // machine.systems.winningLinesLoop.setSettings(winSymbolSettings);
//
// machine.inputs.blockExitState = true;
// setTimeout(() => {
// machine.inputs.blockExitState = false;
// }, 250);
//
// centerView(view);
// },
// resize: centerView,
// update: () =>
// {
// context.machine && context.machine.update(Ticker.shared.deltaMS);
// }
// });
//
// export const WinStickExpandingSymbolStory: StoryFn<typeof args> = (_params, context) => new PixiStory({
// context, init: async (view) =>
// {
// Assets.reset();
// await Assets.init({
// manifest: 'area69/manifest.json',
// });
// await Assets.loadBundle('configs');
// await Assets.loadBundle('symbols');
// const config: SlotMachineConfig = Assets.get('slot_machine_config');
// const machine = new ReelsMachine(config);
// const container = new MachineContainer(machine);
// const winSymbolSettings = {
// lines: [[0, 1, 0, 1, 0], [3, 2, 3, 2, 3]],
// hideWinline: false,
// winlineAnimationClass: WinLine,
// basicWinClass: BasicWin,
// };
// const spin = () =>
// {
// machine.inputs.spin = true;
// setTimeout(() => { machine.inputs.spin = false; }, 1000);
// setTimeout(spin, 10000);
// };
//
// view.addChild(container);
// context.machine = machine;
// machine.inputs.initMap = createScreenInputMap(config);
// machine.inputs.screenMap = createScreenInputMap(config);
// machine.inputs.wins = [['line', 100, [0, 1, 0], 0], ['line', 100, [3, 2, 3], 1]];
// machine.inputs.celebrateSymbolIndexes = [0, 1, 5];
// machine.stateMachine.states[STATES.SPINNING].systems = ['spin', 'layering', 'stick', 'expanding'];
// machine.systems.expanding = new ExpandedSymbolsSpinSystem(machine);
// machine.systems.stick = new StickySymbolsSystem(machine);
// machine.systems.expanding.setSettings(_params);
// machine.systems.stick.setSettings(_params);
// machine.systems.spin.setSettings(_params);
// machine.systems.allWinSymbols.setSettings(winSymbolSettings);
// machine.systems.winningLinesLoop.setSettings(winSymbolSettings);
// machine.inputs.blockExitState = true;
// setTimeout(() => {
// machine.inputs.blockExitState = false;
// }, 250);
// centerView(view);
// spin();
// },
// resize: centerView,
// update: () =>
// {
// context.machine && context.machine.update(Ticker.shared.deltaMS);
// }
// });