Inheritance: InteractState
Esempio n. 1
0
 private void SendSensorCollectMsg(CollectState state, SensorAcqResult acqResult)
 {
     if (this._sensorCollectMsgHandler != null)
     {
         this._sensorCollectMsgHandler.Invoke(state, acqResult);
     }
 }
Esempio n. 2
0
    void Awake()
    {
        homeSet         = false;
        survivorFood    = 0;
        survivorWater   = 0;
        survivorBandage = 0;
        survivorScrap   = 0;

        survivorHealth    = 100;
        survivorHunger    = 90;
        survivorThirst    = 90;
        survivorTiredness = 90;

        wayPointsList = new List <Vector3>();

        collectState  = new CollectState(this);
        buildState    = new BuildState(this);
        nourrishState = new NourrishState(this);
        fightState    = new FightState(this);
        repairState   = new RepairState(this);
        sleepState    = new SleepState(this);
        homeState     = new HomeState(this);
        healState     = new HealState(this);
        currentMap    = GameObject.Find("Map");
    }
Esempio n. 3
0
 private void Clear()
 {
     cbxType.SelectedValue  = 0;
     cbxState.SelectedValue = 0;
     cbxZaiko.SelectedValue = ZaikoTypes.HiZaiko;
     txtName.Clear();
     txtModelNo.Clear();
     txtInsertTime.Text      = String.Empty;
     txtUpdateTime.Text      = String.Empty;
     txtCollectSchedule.Text = CollectState.GetViewValue(CollectStates.Undecided);
     btnCSCheck.Enabled      = false;
 }
Esempio n. 4
0
        private void dtm_OnSensorCollectMsgHandler(CollectState state, DAC.DAC.SensorAcqResult acqResult)
        {
            switch (state)
            {
            case CollectState.Request:
                Log.InfoFormat("======> Dtu:{4} sensor:{0} p={1},m={2},channel={3}", acqResult.Sensor.SensorID,
                               acqResult.Sensor.ProtocolType, acqResult.Sensor.ModuleNo, acqResult.Sensor.ChannelNo, acqResult.DtuCode);
                return;

            case CollectState.Response:
                Log.InfoFormat("<====== Dtu:{4} result='sensor:{0} m={5},channel={6} [{1}-{2}]', data = [{3}]",
                               acqResult.Sensor.SensorID, acqResult.ErrorCode, acqResult.ErrorMsg,
                               acqResult.Data == null ? "null" : acqResult.Data.JsonResultData, acqResult.DtuCode,
                               acqResult.Sensor.ModuleNo, acqResult.Sensor.ChannelNo);
                break;
            }
        }
Esempio n. 5
0
 private void collectStateHandler(CollectState state, string msg)
 {
     Debug.WriteLine("called MainForm.collectStateHandler():" + state + ", " + msg);
     switch (state)
     {
         case CollectState.START:
             btnUpdate.Enabled = false;
             break;
         case CollectState.END:
             updateView(null, true);
             btnUpdate.Enabled = true;
             break;
         case CollectState.FAILED:
             btnUpdate.Enabled = true;
             break;
         default:
             btnUpdate.Enabled = true;
             break;
     }
 }
 private void collectStateHandler(CollectState state, string msg)
 {
     Debug.WriteLine("called BackgroundForm.collectStateHandler():" + state + ", " + msg);
     switch (state)
     {
         case CollectState.START:
             timerUpdate.Stop();
             miUpdate.Enabled = false;
             notifyIconMain.Icon = Properties.Resources.RefreshIco;
             break;
         case CollectState.END:
             timerUpdate.Start();
             miUpdate.Enabled = true;
             notifyIconMain.Icon = Properties.Resources.MutterIco;
             break;
         case CollectState.FAILED:
             break;
         default:
             break;
     }
 }
Esempio n. 7
0
        private void FormReserveDetail_Activated(object sender, EventArgs e)
        {
            if (ReserveDetail != null)
            {
                cbxType.SelectedValue  = ReserveDetail.ItemTypeCode;
                cbxState.SelectedValue = ReserveDetail.ItemStateCode;
                cbxZaiko.SelectedValue = ReserveDetail.Zaiko.Value;
                txtName.Text           = ReserveDetail.Name;
                txtModelNo.Text        = ReserveDetail.ModelNo;
                txtInsertTime.Text     = ReserveDetail.InsertTimeStr;
                txtUpdateTime.Text     = ReserveDetail.UpdateTimeStr;

                var cs = new CollectState(ReserveDetail);
                txtCollectSchedule.Text = cs.ViewValue;
                btnCSCheck.Enabled      = cs.Value != CollectStates.Undecided;

                var ss = new ShippingState(ReserveDetail);
                txtShipping.Text = ss.ViewValue;
            }
            else
            {
                Clear();
            }
        }
Esempio n. 8
0
 public CollectStateStruct(CollectState _collectState, int _index)
 {
     collectState = _collectState;
     index        = _index;
 }
     public void run()
     {
         taskCollect = Task.Run(() => {
             while (true)
             {
                 autoEvent.WaitOne();
                 try
                 {
                     state = CollectState.RUNNING;
                     frmCtrl.Invoke(multiInvoker, new object[] { CollectState.START, "START" });
                     collect();
                     state = CollectState.END;
                     frmCtrl.Invoke(multiInvoker, new object[] { CollectState.END, "END" });
                 }
                 catch (Exception ex)
                 {
                     state = CollectState.FAILED;
                     frmCtrl.Invoke(multiInvoker, new object[] { CollectState.FAILED,  ex.Message });
                     Trace.WriteLine(ex.Message + "\n" + ex.StackTrace);
                 }
                 // autoEvent.Reset();
             }
         });
 
     }