void handleConnectionError(DicePlus dpf) { if (dpf.Equals(currentlyConnectedDie)) { if (state == State.CONNECTING) { setState(State.DISCONNECTED); } currentlyConnectedDie = null; } if (connectedDice.Contains(dpf)) { connectedDice.Remove(dpf); } if (state == State.CONNECTED) { if (connectedDice.Count < maxDiceCount) { DicePlusAnimator.Instance.runDisconnectedAnimation(); setState(State.DISCONNECTED); } } else if (state != State.ROLLER) { OrbitingButtonsManager.Instance.showButtons(true); // triedDiceSet.Add(dpf); } }
public void onConnectionEstablished(DicePlus dpe) { if (dpe.Equals(currentlyConnectedDie)) { currentlyConnectedDie = null; } SoftwareVersion sv = dpe.getSoftwareVersion(); if ((sv.getMajor() > major) || (sv.getMajor() == major && sv.getMinor() >= minor)) { connectedDice.Add(dpe); if (connectedDice.Count >= maxDiceCount) { setState(State.CONNECTED); } else { setState(State.DISCONNECTED); } DicePlusAnimator.Instance.runConnectedAnimation(); dpe.subscribeRolls(); dpe.subscribeBatteryState(); dpe.registerListener(this); rssi = dpe.rssi; } else { setState(State.DISCONNECTED); DicePlusAnimator.Instance.runVersionMissmatchAnimation(false); dpe.disconnect(); } }