Double-ATM-Simulator

Introduction
介绍

This project is a Unity-based simulator that demonstrates account data consistency under concurrent access by implementing two independent ATM interfaces operating on the same shared bank account. It is developed for an assignment of DI22004 - Computer Systems 2B.

本项目是一个基于 Unity 的模拟器,通过两个独立 ATM 界面同时操作同一共享银行账户,直观展示并发访问下的数据一致性问题。该项目是为 DI22004 - Computer Systems 2B(计算机系统 2B)的一个作业而开发的。

The core concurrency control uses a simple mutual-exclusion mechanism: when one ATM starts a transaction (withdrawal/transfer), the other ATM — if logged into the same account — displays an “Account Occupied” page and blocks further operations until the first transaction completes or logs out.

核心并发控制采用简单的互斥机制:当一台 ATM 开始交易(取款/转账)时,另一台 ATM 若登录同一账户,则显示“账户已被占用”页面,并阻止后续操作,直至前一交易完成或登出。

Key technical components include: AtmDataManager (central singleton-like account state holder), per-page UI scripts (LoginPage, MainPage, WithdrawPage, TransferPage, RecordPage, OccupiedPage), and AtmTerminal (coordinates dual-ATM logic and triggers occupation check). Artificial short delays are intentionally kept in transaction code paths to make race-condition windows more observable.

主要技术组件包括:AtmDataManager(中心化的账户状态持有者,类似单例)、各页面脚本(LoginPageMainPageWithdrawPageTransferPageRecordPageOccupiedPage)以及 AtmTerminal(协调双 ATM 逻辑并触发占用检查)。交易代码路径中故意保留人工短延迟,以便更容易观察到竞争窗口。

The project focuses on UI-driven synchronization rather than low-level threading primitives (no explicit Monitor/Lock/Semaphore usage is described), making it suitable for demonstrating concurrency concepts.

项目强调 UI 驱动的同步而非底层线程原语(未描述显式 Monitor/Lock/Semaphore 使用),适合演示并发概念。

This project was developed using Unity and C#, incorporating key press sound effects, backlit key illumination for the numeric keypad, transaction animation sequences, and pre-configured test accounts.

本项目采用 Unity 及 C# 实现,包含按键音效、数字键盘按压光效、交易动画流程,以及预设测试账号等。

Accessing
访问

This project has been open-sourced on GitHub.

本项目已在 GitHub 上开源。

🔗 Double-ATM-Simulator on GitHub

Found an issue, bug, or want to make a suggestion?
发现问题、bug,或希望提出建议?

Please report in the “Issues” section of this GitHub project:
请您在本 GitHub 项目的 “Issues” 区内提出:

  1. Click “New issue”.
    点击 “New issue”。
  2. Write a title and description as required.
    按要求撰写标题(title)和描述(description)。
  3. Click “Create”. You can also press Ctrl + Enter on Windows PC or ⌘ ⏎ on Mac.
    点击 “Create”。您也可以在 Windows 电脑上按下 Ctrl + Enter 或在 Mac 上按下 ⌘ ⏎。