Skip to content

Commit

Permalink
๐Ÿ‘ ๅ›žใ—ใŸ็žฌ้–“ใซ็ขบๅฎšใ•ใ›ใฆๆป‘ใ‚Šใ‚’ๅฎŸ่ฃ…
Browse files Browse the repository at this point in the history
  • Loading branch information
dicenull committed Sep 7, 2023
1 parent ff3a19b commit 8591cd0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 7 additions & 4 deletions lib/feature_slot/reel_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ class ReelComponent extends PositionComponent with HasGameRef<SlotGame> {

// state
bool isRoll = false;
int stopIndex = -1;
final speed = 800;

int get length => _symbols.length;

bool onCheckStopCurrent = false;
_SuberiState? _suberiState;
double reelPosition = 0;
int stopIndex = -1;
ReelComponent(this._symbols, this.symbolSize)
: _reel = <_SymbolState>[],
reelHeight = symbolSize * _symbols.length {
Expand Down Expand Up @@ -66,7 +68,8 @@ class ReelComponent extends PositionComponent with HasGameRef<SlotGame> {
});
}

void roll() {
void roll(int index) {
stopIndex = index;
isRoll = true;
}

Expand Down Expand Up @@ -140,9 +143,9 @@ class ReelComponent extends PositionComponent with HasGameRef<SlotGame> {
void _stopCurrent() {
if (!isRoll) return;

final index = _calcCenterIndex();
var symbol = _reel[index].symbol;
var symbol = _reel[stopIndex].symbol;
_suberiState = _SuberiState(symbol, 1);
print(_suberiState?.symbol.toString());
}
}

Expand Down
5 changes: 4 additions & 1 deletion lib/feature_slot/slot_component.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:math' as math;

import 'package:app/feature_slot/reel_component.dart';
import 'package:app/feature_slot/slot_core.dart';
Expand Down Expand Up @@ -47,7 +48,9 @@ class SlotComponent extends PositionComponent with HasGameRef<SlotGame> {
}

for (var reel in reels) {
reel.roll();
// ใฉใ“ใซๆญขใพใ‚‹ใ‹ใ‚’็ขบๅฎšใ•ใ›ใ‚‹
final index = math.Random().nextInt(reel.length);
reel.roll(index);
}
inBet = true;
}
Expand Down

0 comments on commit 8591cd0

Please sign in to comment.