Ejemplo n.º 1
0
	public StationInfo()
	{
		type = StationType.Unknown;
		state = StationState.Normal;
		
		tradingStock = new List<TradingGoods>();
	}
Ejemplo n.º 2
0
 public void SetQuitOnStationState(StationState state)
 {
     if (Station is IStatefulModel <StationState> )
     {
         UseAdditionalQuitCondition(new DynamicConstraint <IStatefulModel <StationState> >("StationState==" + state, Station as IStatefulModel <StationState>, s => s.State == state));
     }
 }
Ejemplo n.º 3
0
    public void ChangeState(StationState newState)
    {
        debug("-- State Change from: " + currentState.ToString() + "to: " + newState.ToString());

        switch (newState)
        {
        case StationState.IDLE:
            Idle();
            break;

        case StationState.WELCOME:
            Welcome();
            break;

        case StationState.PLAYING:
            Play();
            break;

        case StationState.PLAYERMISSING:
            PlayerMissing();
            break;

        case StationState.FINAL_SCORE:
            FinalScore();
            break;

        case StationState.GOODBYE:
            GoodBye();
            break;
        }

        currentState    = newState;
        TextObject.text = StateTextPrompts[(int)currentState];
    }
 public void TransitionToState(StationState nextState)
 {
     if (currentState != nextState)
     {
         CameraManager.Instance.Reset();
         currentState = nextState;
     }
 }
 public void SetActivityPowerOffOnStatus(StationState safeToPowerOffStatus)
 {
     if (TrayProcessor == null)
     {
         LogService.Log(GetType().Name, "Can't power off station this is not a tray processor.");
         return;
     }
     SetActivityOnStationState(_station.Name + ".TurnPowerOff", safeToPowerOffStatus, s => (s as IStation).PowerOff());
 }
Ejemplo n.º 6
0
        private void ActivityBtn_OnClick(object sender, RoutedEventArgs e)
        {
            switch (state)
            {
            case StationState.Paused:
                _readerRunner.Start();
                ActivityBtn.Content = "Start";
                state = StationState.Active;
                break;

            case StationState.Active:
                _readerRunner.Pause();
                ActivityBtn.Content = "Pause";
                state = StationState.Paused;
                break;
            }
        }
Ejemplo n.º 7
0
        private void StationStateChangedHandler(StationState currState)
        {
            if (InvokeRequired)
            {
                this.BeginInvoke(new Action(() => StationStateChangedHandler(currState)));
            }
            else
            {
                switch (currState)
                {
                case StationState.StationStatePause:
                    MachineStateEmg.State   = false;
                    MachineStateStop.State  = false;
                    MachineStateAuto.State  = false;
                    MachineStatePause.State = true;
                    break;

                case StationState.StationStateRun:
                    MachineStateEmg.State   = false;
                    MachineStateStop.State  = false;
                    MachineStateAuto.State  = true;
                    MachineStatePause.State = false;
                    break;

                case StationState.StationStateStop:
                    MachineStateEmg.State   = false;
                    MachineStateStop.State  = true;
                    MachineStateAuto.State  = false;
                    MachineStatePause.State = false;
                    break;

                case StationState.StationStateEmg:
                    MachineStateEmg.State   = true;
                    MachineStateStop.State  = false;
                    MachineStateAuto.State  = false;
                    MachineStatePause.State = false;
                    break;
                }
            }
        }
Ejemplo n.º 8
0
    public void SwitchState(StationState state)
    {
        switch (state)
        {
        case StationState.Idle:
        {
            currentColor = idleColor;
            currentRate  = idleRate;
            break;
        }

        case StationState.Proximity:
        {
            currentColor = proximityColor;
            currentRate  = proximityRate;
            break;
        }

        case StationState.Charging:
        {
            currentColor = chargingColor;
            currentRate  = chargingRate;
            break;
        }

        case StationState.Off:
        {
            break;
        }

        default:
        {
            break;
        }
        }
        ToggleIdleSystems(state == StationState.Idle);
        ToggleChargingSystems(state == StationState.Charging);
        currentState = state;
    }
Ejemplo n.º 9
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            state         = StationState.Initializing;
            _readerRunner = new SensorReaderRunner(deviceId)
                            .WithTemperature(TemperatureSensorType.BME280);
            //.WithTemperature(TemperatureSensorType.DHT22);
            //.WithCO2(CO2SensorType.SenseAirS8);

            _readerRunner.OnReading += async data => { await SensorDataList.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => PrintReadings(data)); };
            _readerRunner.OnError   += async exception =>
            {
                await SensorDataList.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => SensorDataList.Items.Add($"Exception: Type {exception.GetType()}; Message: {exception.Message}"));
            };

            await _readerRunner.Initialize();

            _readerRunner.Start();

            state = StationState.Active;
            ActivityBtn.IsEnabled = true;
        }
Ejemplo n.º 10
0
 public StationStateSessionNotExist(StationStateContext context, StationState oldState)
     : base(context, StationStateEnum.SessionNotExist)
 {
     this.oldState = oldState;
 }
Ejemplo n.º 11
0
 public void SetPauseUntilTrayHandlerState(StationState state)
 {
     SetPauseUntilConditionOfStation(string.Format(CultureInfo.InvariantCulture, "Wait for {0} state", state), d => d.State == state);
 }
Ejemplo n.º 12
0
 public void SetPauseUntilTransportState(StationState state)
 {
     SetPauseUntilConditionOfTransport(string.Format(CultureInfo.InvariantCulture, "Wait for {0} state", state), t => t.State == state);
 }
Ejemplo n.º 13
0
 public void SetFinishOnTransportState(StationState state)
 {
     UseAdditionalFinishCondition(new DynamicConstraint <ITransport>("TransportState==" + state, Transport, s => s.State == state));
 }
Ejemplo n.º 14
0
 //    void LoadShipBoxs()
 //    {
 //        Ships.AttributesPreLoad factionShips = Ships.shipDictionary[BoxOne.value];
 //        
 //        int count = 0;
 //        BoxTwo.items.Clear();
 //        foreach (var pair in factionShips.factionShipDictionary)
 //        {
 //            BoxTwo.items.Add(pair.Key);
 //            count++;
 //        }
 //    }
 public void DeathSwap(Ship inShip)
 {
     holdingPlayer = (PlayerShip)inShip;
     player =(PlayerShip) inShip;
     SwitchToStation();
     HideAndClearUI();
     state = StationState.SWITCH;
     //PopulateFactions();
     //LoadDefaultShip();
     //SwitchShips();
 }
 public void SetActivityDisableOnStatus(StationState safeToDisableStatus, bool allowReenable)
 {
     // Changed from IStation to ISupportsDisabling interface as enable/disable removed from IStation. (J. Lawrence)
     SetActivityOnStationState(_station.Name + ".Disable", safeToDisableStatus,
                               s => (s as ISupportsDisabling).Disable(allowReenable));
 }
 public void SetQuitOnStationState(StationState state)
 {
     UseAdditionalFinishCondition(new DynamicConstraint <ITrayProcessor>("StationState==" + state, TrayProcessor, s => s.State == state));
     //SetQuitCondition(() => Station.State == status);
 }
 public void SetPauseUntilContinueOrFinish(StationState continueState, StationState finishState)
 {
     AddFinishOrContinueCondition(new DynamicConstraint <ITrayProcessor>("StationState==" + finishState, TrayProcessor, s => s.State == finishState),
                                  new DynamicConstraint <ITrayProcessor>("StationState==" + continueState, TrayProcessor, s => s.State == continueState));
 }
Ejemplo n.º 18
0
    public void OnClickMode()
    {
        string clicked = UIButton.current.name;

        switch(clicked)
        {
        case "Exit":
            SwitchFromStation();
            break;
        case "Ships":
            state = StationState.SWITCH;
            break;
        case "Upgrades":
            state = StationState.UPGRADE;
            break;
        case "Weapons":
            state = StationState.WEAPONS;
            break;
        }

        SwitchModes();
    }
Ejemplo n.º 19
0
    void SwitchFromStation()
    {
        List<MeshCollider> meshes = new List<MeshCollider>(holdingPlayer.transform.root.GetComponentsInChildren<MeshCollider>());

        foreach (MeshCollider meshCol in meshes)
            meshCol.enabled = true;

        // Allows players to reneter staiton.
        enterCheck = false;
        // No more mouse view
        orbitView.enabled = false;
        // Disable station cam.
        cam.enabled = false;

        // Disables station UI
        userInterface.DisableUI();
        // Enables player camera
        holdingPlayer.GetCurrentCamera().enabled = true;
        holdingPlayer.GetCurrentCamera().GetComponent<SU_CameraFollow>().enabled = true;
        // tells station we have left.
        state = StationState.NONE;
        // Enables player scripts.

        swapped = false;

        // Sets player to be able to move.
        flManager.playerShips.Add(holdingPlayer);
        holdingPlayer.rigidbody.isKinematic = false;
        holdingPlayer.transform.parent = null;

        if (swapped)
            holdingPlayer.EnableNewShipSCripts();
        else
            holdingPlayer.EnableScripts();

        enterCheck = false;
        player = null;
        flManager.CheckBadPlayers();
        // TODO: change scale back to 1 after.
    }
Ejemplo n.º 20
0
        void StationStateChangedHandler(StationState currState)
        {
            if (InvokeRequired)
            {
                this.BeginInvoke(new Action(() => StationStateChangedHandler(currState)));
            }
            else
            {
                switch (currState)
                {
                case StationState.StationStatePause:
                    button_start.ImageIndex           = 0;
                    button_start.Text                 = "恢复";
                    this.button_start.BackgroundImage = global::StationDemo.Properties.Resources.resume;
                    if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣"))
                    {
                        IOMgr.GetInstace().WriteIoBit("蜂鸣", false);
                    }
                    if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯"))
                    {
                        IOMgr.GetInstace().WriteIoBit("红灯", false);
                    }
                    if (IOMgr.GetInstace().GetOutputDic().ContainsKey("绿灯"))
                    {
                        IOMgr.GetInstace().WriteIoBit("绿灯", false);
                    }
                    if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯"))
                    {
                        IOMgr.GetInstace().WriteIoBit("黄灯", true);
                    }

                    break;

                case StationState.StationStateRun:
                    button_start.ImageIndex           = 1;
                    button_start.Text                 = "暂停";
                    this.button_start.BackgroundImage = global::StationDemo.Properties.Resources.pause;
                    if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣"))
                    {
                        IOMgr.GetInstace().WriteIoBit("蜂鸣", false);
                    }
                    if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯"))
                    {
                        IOMgr.GetInstace().WriteIoBit("红灯", false);
                    }
                    if (IOMgr.GetInstace().GetOutputDic().ContainsKey("绿灯"))
                    {
                        IOMgr.GetInstace().WriteIoBit("绿灯", true);
                    }
                    if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯"))
                    {
                        IOMgr.GetInstace().WriteIoBit("黄灯", false);
                    }
                    break;

                case StationState.StationStateStop:
                    button_start.ImageIndex           = 0;
                    this.button_start.BackgroundImage = global::StationDemo.Properties.Resources.Start;
                    button_start.Text = "开始";
                    if (IOMgr.GetInstace().GetOutputDic().ContainsKey("蜂鸣"))
                    {
                        IOMgr.GetInstace().WriteIoBit("蜂鸣", false);
                    }
                    if (IOMgr.GetInstace().GetOutputDic().ContainsKey("红灯"))
                    {
                        IOMgr.GetInstace().WriteIoBit("红灯", false);
                    }
                    if (IOMgr.GetInstace().GetOutputDic().ContainsKey("绿灯"))
                    {
                        IOMgr.GetInstace().WriteIoBit("绿灯", true);
                    }
                    if (IOMgr.GetInstace().GetOutputDic().ContainsKey("黄灯"))
                    {
                        IOMgr.GetInstace().WriteIoBit("黄灯", true);
                    }
                    break;
                }
            }
        }
 public void SetPauseUntilStationStatus(StationState state)
 {
     AddContinueCondition(new DynamicConstraint <ITrayProcessor>("StationState==" + state, TrayProcessor, s => s.State == state));
     //SetPauseCondition(Station, s => s.State == status);
 }
 /// <summary>
 /// Set the next  IActivity as a ConditionalActivity to be triggered for evaluation by a station status change.
 /// </summary>
 /// <param name="activityName">The name to give to the activity</param>
 /// <param name="state">StationState</param>
 /// <param name="action">An action with no return value.</param>
 protected void SetActivityOnStationState(string activityName, StationState state, Action <ITrayProcessor> action)
 {
     AddConditionalActivity(new DynamicConstraint <ITrayProcessor>("StationState==" + state, TrayProcessor, s => s.State == state),
                            new DynamicActivity(activityName, () => action(TrayProcessor)));
 }
Ejemplo n.º 23
0
    void SwitchToStation()
    {
        if (flManager == null)
            flManager = GameObject.Find("_Required").GetComponent<FleetManager>();

        cam.enabled = true;
        // If there user interface is null - get it.
        if (userInterface == null)
            userInterface = Game.uiManager.GetComponentInChildren<SpaceStationUI>();

        //TODO: Enable Mouse Orbit here.

        // Dont allow player ship to move.
        player.rigidbody.isKinematic = true;

        List<MeshCollider> meshes = new List<MeshCollider>(player.transform.root.GetComponentsInChildren<MeshCollider>());

        foreach (MeshCollider meshCol in meshes)
            meshCol.enabled = false;

        // Disables all player ship scripts
        player.DisableScripts();

        // Disables current player camera and sets position to construction area
        player.GetCurrentCamera().enabled = false;
        player.transform.position = constructionArea.position;
        //player.transform.root.parent = constructionArea.transform;
        player.transform.rotation = transform.rotation;

        // Activates the UI Camera and UI
        userInterface.EnableUI(this);
        userInterface.UICamera.gameObject.SetActive(true);
        HideAndClearUI();

        // Tells station is is entered.
        state = StationState.ENTERED;

        // Copys player data to station
        holdingPlayer = player;
        flManager.playerShips.Remove(player);
        foreach (Weapon wpn in holdingPlayer.Weapons)
        {
            wpn.Target = null;
        }
        // Populates Rig Points
        //PopulateUpgradePoints();

        // Enables Mouse Camera Movement.
        orbitView.enabled = true;
    }
 /// <summary>
 /// Set the next IActivity as a ConditionalQuitActivity to be triggered for evaluation by a station status change.
 /// </summary>
 /// <param name="activityName">The name to give to the activity</param>
 /// <param name="status">StationState</param>
 /// <param name="actionWithResult">An action that returns a boolean value.</param>
 /// <param name="quitForThisResult">Tells the QuitActivity to request a machine quit if its result matches this boolean value.</param>
 protected void SetConditionalQuitActivityOnStationStatus(string activityName, StationState status, Func <IStation, bool> actionWithResult, bool quitForThisResult)
 {
     AddConditionalActivity(new DynamicConstraint <ITrayProcessor>(_station.Name, TrayProcessor, s => (s as IStation).State == status),
                            new DynamicActivity(activityName, () => actionWithResult(TrayProcessor as IStation)));
 }
Ejemplo n.º 25
0
 public void SetState(StationState state)
 {
     stateHasChanged = true;
     nextState       = state;
 }