Inheritance: MonoBehaviour
Esempio n. 1
0
        private void SetupControls()
        {
            if (WSIM != null)
            {
                foreach (string StateName in ProviderClass.StateNames)
                {
                    StateClass TempStateClass = new StateClass(StateName);
                    TheStates.Add(TempStateClass);
                }
                for (int i = 0; i < ProviderClass.ProviderNameList.Length; i++)
                {
                    string     MySTate      = ProviderClass.RegionStateName[i];
                    StateClass MyStateClass = TheStates.Find(
                        delegate(StateClass SC) { return(SC.Name == MySTate); });
                    if (MyStateClass != null)
                    {
                        string    RName = ProviderClass.ProviderNameList[i];
                        eProvider Ep    = (eProvider)i;
                        string    RFld  = ProviderClass.FieldNameList[i];
                        MyStateClass.AddRegion(RName, Ep, i, RFld);
                    }
                }

                foreach (StateClass SC in TheStates)
                {
                    TreeNode TempStateNode = new TreeNode(SC.Name);
                    foreach (RegionClass RC in SC.Regions)
                    {
                        TempStateNode.Nodes.Add(new TreeNode(RC.Name));
                    }
                    treeViewRegions.Nodes.Add(TempStateNode);
                }
            }
        }
Esempio n. 2
0
        private void LoopDoingVOID(object sender, object e)
        {
            if (OldWaitTime != WaitTime)
            {
                OldWaitTime = WaitTime;
                dt.Interval = new TimeSpan(0, 0, 0, 0, WaitTime);
            }

            StateSet(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

            if (!Equals(OSTC, STC))
            {
                SPGrid_TR01_SPSet = STC.V;
                SPGrid_TR01_PressSet(STC.MR, STC.ER, STC.BC, STC.BP);
                SPGrid_TR01_TimeSet((byte)STC.Hour, (byte)STC.Minute, (byte)STC.Second);
                SPGrid_TR01_CurrentSet  = STC.I;
                SPGrid_TR01_LocationSet = STC.Z;
                OSTC = STC;
            }
            if (!Equals(OHDC, HDC))
            {
                SPGrid_TR01_ReverserSet = HDC.R;
                SPGrid_TR01_HandleSet(HDC.B, HDC.P);
                OHDC = HDC;
            }
            if (!Equals(oIsDoorClosed, IsDoorClosed))
            {
                SPGrid_TR01_IsDoorClosed = IsDoorClosed;
                oIsDoorClosed            = IsDoorClosed;
            }
        }
Esempio n. 3
0
    public void Init()
    {
        go        = new GameObject();
        behaviour = go.AddComponent <StateClass>();

        fsm = new StateMachine <States, Driver>(behaviour);
    }
Esempio n. 4
0
        protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
        {
            var gridView1DataKey = GridView1.DataKeys[e.NewEditIndex];

            if (gridView1DataKey != null)
            {
                string id = gridView1DataKey.Value.ToString();
                using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["InventoryConnectionString"].ConnectionString))
                {
                    connection.Open();
                    SqlCommand     command = new SqlCommand("select * from State where StateID='" + id + "'", connection);
                    SqlDataAdapter adp     = new SqlDataAdapter(command);
                    DataTable      dt      = new DataTable();
                    adp.Fill(dt);
                    if (dt.Rows.Count > 0)
                    {
                        /*txtStateID.Text = dt.Rows[0]["StateID"].ToString();
                         * txtState.Text = dt.Rows[0]["State"].ToString();*/
                        StateClass sc = new StateClass()
                        {
                            Stateid = dt.Rows[0]["StateID"].ToString(),
                            State   = dt.Rows[0]["State"].ToString()
                        };
                        StateList.Add(sc);
                    }
                    connection.Close();
                    Response.Redirect("~/StateForm.aspx");
                }
            }
        }
        public void Init()
        {
            go        = new GameObject();
            behaviour = go.AddComponent <StateClass>();

            fsm = StateMachine <States> .Initialize(behaviour);
        }
Esempio n. 6
0
        public void Draw(StateClass state)
        {
            backGround.Draw(spriteBatch);
            switch (state.gameState)
            {
            case GameState.LOGO:
                DrawLogo();
                break;

            case GameState.MENU:
            {
                menuButtons[(int)(state.menuState)].HL = true;
                for (int i = 0; i < numberOfGameStates; i++)
                {
                    menuButtons[i].Draw(spriteBatch);
                }
                menuButtons[(int)(state.menuState)].HL = false;
            }
            break;

            case GameState.MORE:
            {
                moreButtons[(int)(state.moreState)].HL = true;
                for (int i = 0; i < numberOfMoreStates; i++)
                {
                    moreButtons[i].Draw(spriteBatch);
                }
                moreButtons[(int)(state.moreState)].HL = false;
            }
            break;

            default:
                break;
            }
        }
Esempio n. 7
0
    public void StartExperience()
    {
        currentState = states[stateindex];
        TriggerStartingEvents();

        EnableNextstateObjects();
    }
Esempio n. 8
0
    public void BindDDL()
    {
        DataTable dtState = StateClass.GetAllState();

        if (dtState.Rows.Count > 0)
        {
            ddlState.DataTextField  = "StateName";
            ddlState.DataValueField = "StateIDP";
            ddlState.DataSource     = dtState;
            ddlState.DataBind();
            ddlState.Items.Insert(0, new ListItem("--Select State--", "-1"));
            ddlState.SelectedIndex = 0;
        }

        DataTable dtCity = CityClass.GetAllCity();

        if (dtCity.Rows.Count > 0)
        {
            ddlCity.DataTextField  = "CityName";
            ddlCity.DataValueField = "CityIDP";
            ddlCity.DataSource     = dtCity;
            ddlCity.DataBind();
            ddlCity.Items.Insert(0, new ListItem("--Select City--", "-1"));
            ddlCity.SelectedIndex = 0;
        }
    }
    protected void rptData_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandArgument != null)
        {
            Int64 StateIDP = Int64.Parse(e.CommandArgument.ToString());
            switch (e.CommandName)
            {
            case "cEdit":
                hfID.Value = StateIDP.ToString();
                DataTable dtGetCity = StateClass.GetState_ByStateIDP(StateIDP);
                if (dtGetCity.Rows.Count > 0)
                {
                    tbStateName.Text   = dtGetCity.Rows[0]["StateName"].ToString();
                    cbIsActive.Checked = bool.Parse(dtGetCity.Rows[0]["IsActive"].ToString());
                    pnC.Visible        = true;
                    pnG.Visible        = false;
                    btAddNew.Visible   = false;
                }
                break;

            case "cDelete":
                MEMBERS.SQLReturnValue mRes = StateClass.DeleteState_ByStateID(StateIDP);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "noti", "setMessage('<b>" + mRes.MessageFromSQL + "</b>',1);", true);
                ClearControls();
                BindData();
                break;
            }
        }
    }
    protected void btSave_Click(object sender, EventArgs e)
    {
        StateClass obj = new StateClass();

        obj.StateName = tbStateName.Text;
        obj.IsActive  = cbIsActive.Checked;
        MEMBERS.SQLReturnValue mRes;
        if (hfID.Value == string.Empty)
        {
            obj.Flag = "ADD";
            mRes     = StateClass.Insert_Update_State(obj);
        }
        else
        {
            obj.Flag     = "EDIT";
            obj.StateIDP = Int64.Parse(hfID.Value);
            mRes         = StateClass.Insert_Update_State(obj);
        }
        ScriptManager.RegisterStartupScript(this, this.GetType(), "noti", "setMessage('<b>" + mRes.MessageFromSQL + "</b>',1);", true);
        ClearControls();
        BindData();
        pnC.Visible      = false;
        pnG.Visible      = true;
        btAddNew.Visible = true;
    }
        // This procedure is where the actual cleanup occurs
        internal void Dispose(bool disposing)
        {
            // Exit now if the object has already been disposed
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                // The object is being disposed, not finalized.
                // It is safe to access other objects (other than the mybase object)
                // only from inside this block
                _pluginSettings.CleanupCheckBox.CheckedChanged -= CleanupCheckBox_CheckedChanged;
                PluginManager.AWBForm.TheSession.StateChanged  -= EditorStatusChanged;
                PluginManager.AWBForm.SaveButton.Click         -= Save_Click;
                PluginManager.AWBForm.SkipButton.Click         -= Skip_Click;
            }

            // Perform cleanup that has to be executed in either case:
            _awbCleanupCheckboxes = null;
            _pluginSettings       = null;
            _state = null;

            // Remember that this object has been disposed of:
            _disposed = true;
        }
Esempio n. 12
0
    //inspector view only works with some types like ints, floats, gameObjects, etc

    // Use this for initialization
    void Start()
    {
        if (mStartState == null)
        {
            Debug.LogError("Each state machine must have a start state set via the inspector view");
        }
        currState_ = mStartState;
    }
Esempio n. 13
0
 public RegionClass(string aName, eProvider AnEProvider, int aIndex, string aFieldName, StateClass owner)
 {
     Fname    = aName;
     FeP      = AnEProvider;
     FIndex   = aIndex;
     FOwner   = owner;
     FFldName = aFieldName;
 }
Esempio n. 14
0
 public override float GetReward(StateClass state, BTTask action)
 {
     if (children[indexOfSelectedAction].GetType().IsSubclassOf(typeof(AttackClass)))
     {
         Debug.Log("attacking");
         return(((AttackClass)children[indexOfSelectedAction]).GetDamageDealt());
     }
     return(-1);
 }
        protected void Button1_Click(object sender, EventArgs e)
        {
            StateClass state1 = new StateClass();

            state1.StateName = txtStateName.Text;
            state1.StateAbbr = txtStateAbbr.Text;
            state1.StateId   = 12;
            Session["State"] = state1;
            Response.Redirect("EmployeePage.aspx");
        }
 private void BindState()
 {
     #region SignUp
     ddstate.DataSource     = StateClass.GetAllState();
     ddstate.DataValueField = "StateIDP";
     ddstate.DataTextField  = "StateName";
     ddstate.DataBind();
     ListItem li = new ListItem("--SELECT STATE--", "0");
     ddstate.Items.Insert(0, li);
     #endregion
 }
Esempio n. 17
0
        private void CreatArray()
        {
            for (int i = 0; i < ThreePhaseStateArray.Length; i++)
            {
                ThreePhaseStateArray[i] = new OneStateUserControl.SetInfo();
            }

            for (int i = 0; i < StateStrArray.Length; i++)
            {
                StateStrArray[i] = new StateClass();
            }
        }
Esempio n. 18
0
 public Sensor CreateSensor(
     DeviceClassDescription deviceClassDescription,
     Device device,
     string deviceClass    = null,
     string sensorIcon     = null,
     string sensorName     = null,
     StateClass stateClass = StateClass.None,
     string stateTopic     = null,
     string uniqueId       = null,
     string unitOfMeasures = null,
     string valueTemplate  = null
     ) => new()
Esempio n. 19
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            if (Convert.ToString(txt_process_name.Tag) == "1" && Convert.ToString(txt_process_ucl.Tag) == "1" && Convert.ToString(txt_process_lcl.Tag) == "1")
            {
                string ucl;
                string lcl;
                if (txt_process_ucl.Text == "")
                {
                    ucl = "absoluteness";
                }
                else
                {
                    ucl = txt_process_ucl.Text;
                }
                if (txt_process_lcl.Text == "")
                {
                    lcl = "absoluteness";
                }
                else
                {
                    lcl = txt_process_lcl.Text;
                }
                switch (Form_Type)
                {
                case 0:
                    SQLClass.getsqlcom("insert into process values ('" + txt_process_name.Text.ToString().Trim() + "','" + cBox_process_product.Tag.ToString() + "','" + ucl + "','" + lcl + "')");
                    break;

                case 1:
                    SQLClass.getsqlcom("update process set process_name = '" + txt_process_name.Text.ToString().Trim() + "', process_product = '" + cBox_process_product.Tag.ToString() + "', process_ucl = '" + ucl + "', process_lcl = '" + lcl + "' where process_id = '" + data_id + "'");
                    break;

                case 2:
                    break;
                }

                StateClass stateclass = new StateClass();
                DataSet    DSet       = SQLClass.getDataSet("select measure_id,measure_data from measure where measure_process = '" + data_id + "'", "数据库信息表");
                DataTable  dt         = DSet.Tables["数据库信息表"]; //创建一个DataTable对象
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        int   measure_id   = Convert.ToInt32(dt.Rows[i][0]);
                        float measure_data = Convert.ToSingle(dt.Rows[i][1]);
                        stateclass.UpdateProcess(measure_id, measure_data, txt_process_ucl.Text, txt_process_lcl.Text);
                    }
                }

                Form_OK = 1;
                this.Close();
            }
        }
 //Dont Destroy on Load
 void Awake()
 {
     if (sc == null)
     {
         DontDestroyOnLoad(gameObject);
         sc = this;
     }
     else if (sc != this)
     {
         Destroy(gameObject);
     }
 }
Esempio n. 21
0
 private void BindState()
 {
     #region SignUp
     ddstate.DataSource     = StateClass.GetAllState();
     ddstate.DataValueField = "StateIDP";
     ddstate.DataTextField  = "StateName";
     ddstate.DataBind();
     ListItem li = new ListItem("Select State", "0");
     ddstate.Items.Insert(0, li);
     ddcity.Items.Insert(0, new ListItem("Select City", "-1"));
     ddcity.SelectedIndex = 0;
     #endregion
 }
Esempio n. 22
0
        public static ResultDiagnostics CalculBearing(Machine machine, float CurrentHead)
        {
            ResultDiagnostics result     = new ResultDiagnostics();
            float             maxBearing = 0;

            StateClass CurrenClass = GetCurrentStateClass(model.StateClass.GetBearingStateClasses(machine), CurrentHead); //Определение подходящий классов состояния

            float fiftyHz = 0;                                                                                            //вычисляем среднее значение при 50Гц
            int   countFL = TempStorage.GetFL().Count;

            foreach (var item in TempStorage.GetFL())
            {
                fiftyHz += item.GetdB(50);
            }
            fiftyHz = fiftyHz / countFL;

            float SpeedHz = machine.Speed / 60; // Находим частоту оборотов в герцах

            float maxAmplitude = 0;             //Находим среднюю максимальную амплитуду в файлах

            foreach (var fl in TempStorage.GetFL())
            {
                maxAmplitude += fl.GetMaxAmplitudeBearing(SpeedHz);
            }
            maxAmplitude = maxAmplitude / countFL;

            maxBearing   = maxAmplitude / fiftyHz;
            result.file  = "В разработке";
            result.value = maxBearing;
            result.date  = DateTime.Now;
            if (maxBearing <= CurrenClass.nicely)
            {
                result.level = "Хорошо";
            }
            else if ((maxBearing <= CurrenClass.acceptably) && (maxBearing > CurrenClass.nicely))
            {
                result.level = "Допустимо";
            }
            else if ((maxBearing <= CurrenClass.limited) && (maxBearing > CurrenClass.acceptably) && (maxBearing > CurrenClass.nicely))
            {
                result.level = "Требует принятия мер";
            }
            else
            {
                result.level = "Недопустимо";
            }
            DiagnosticResultController.AddBearingResult(machine, result);
            return(result);
        }
Esempio n. 23
0
    public override void OnInspectorGUI()
    {
        StateClass stateclass = (StateClass)target;

        base.OnInspectorGUI();

        GUI.backgroundColor = Color.red;
        if (stateclass.endstate == false && GUILayout.Button("EndState", GUILayout.Height(25)))
        {
            if (Application.isPlaying)
            {
                stateclass.EndThisState();
            }
        }
    }
Esempio n. 24
0
    public void UpdateStateinfo()
    {
        stateindex++;
        if (stateindex <= states.Length - 1)
        {
            lastState    = currentState;
            currentState = states[stateindex];
            return;
        }

        if (stateindex > states.Length - 1)
        {
            Debug.Log("end of experience! Out of states");
        }
    }
Esempio n. 25
0
        public static StateClass GetCurrentStateClass(List <StateClass> stateClasses, float CurrentHead) //Находим подходящие значения классов состоняния к текущему напору
        {
            float      MinDifference = Int32.MaxValue;
            StateClass CurrentState  = new StateClass();

            foreach (StateClass item in stateClasses)
            {
                if (Math.Abs(item.PumpHead - CurrentHead) < MinDifference)
                {
                    MinDifference = Math.Abs(item.PumpHead - CurrentHead);
                    CurrentState  = item;
                }
            }
            return(CurrentState);
        }
Esempio n. 26
0
 public ActionResult EditState(int stateId)
 {
     foreach (var data in Bc.GetStateListByStateId(stateId))
     {
         StateClass sc = new StateClass()
         {
             StateId   = data.StateID,
             State     = data.State1,
             CountryId = data.Country.CountryID,
             Country   = data.Country.Country1
         };
         StateClassList.Add(sc);
     }
     return(RedirectToAction("StateForm"));
 }
Esempio n. 27
0
 public Chart(Rectangle clientrectangle, List <ResultDiagnostics> resultDiagnostics, List <ResultForecast> result, StateClass stateclass, List <Repairs> repairs)
 {
     Points            = resultDiagnostics.OrderBy(x => x.date).ToList();
     ResultForecast    = result;
     Repairs           = repairs;
     StateClass        = stateclass;
     MinX              = GetMinX() - 20;
     MaxX              = GetMaxX() + 20;
     MinY              = GetMinY();
     MaxY              = GetMaxY();
     Indent            = 25;
     GridStepX         = 20f;
     GridStepY         = 0.1f;
     InterpolationStep = 0.01f;
     ClientRectangle   = clientrectangle;
 }
        // Friend methods:
        internal void Reset()
        {
            ToggleAWBCleanup(false);

            var listMaker = PluginManager.AWBForm.ListMaker;

            if (listMaker.Count > 1 && _state.IsNextPage(((WikiFunctions.Article)listMaker.Items.Items[1]).Name))
            {
                listMaker.RemoveAt(1);
            }
            else if (listMaker.Count > 0 && _state.IsNextPage(((WikiFunctions.Article)listMaker.Items.Items[0]).Name))
            {
                listMaker.RemoveAt(0);
            }

            _state = new StateClass();
        }
Esempio n. 29
0
 private void StateSet(double TrainLocation, float Speed, float BC, float MR, float ER, float BP, float SAP, float Current, int PNotch, int BNotch, int Reverser, int Door, int TimeHH, int TimeMM, int TimeSS, int TimeMS)
 {
     STC = new StateClass()
     {
         Z = TrainLocation, BC = BC, BP = BP, ER = ER, Hour = TimeHH, I = Current, Minute = TimeMM, MR = MR, MSecond = TimeMS, SAP = SAP, Second = TimeSS, V = Speed
     };
     HDC = new HandleClass()
     {
         B = BNotch, P = PNotch, R = Reverser
     };
     if (Door == 1)
     {
         IsDoorClosed = true;
     }
     else
     {
         IsDoorClosed = false;
     }
 }
Esempio n. 30
0
        public void AddUser()
        {
            GameThread.IgnoreThreadRestrictions = true;
            var id       = 12;
            var username = "******";

            using (var ge = new GameEngine(null))
            {
                ge.EngineInitialized.WaitOne(5000);
                var obj = new StateClass(ge);
                var usr = obj.AddUser(id, username);
                Assert.AreEqual(id, usr.id);
                Assert.AreEqual(username, usr.username);

                Assert.NotNull(ge.Javascript.Script.O.state.users[id]);
                Assert.AreEqual(username, ge.Javascript.Script.O.state.users[id].username);
                Assert.AreEqual(id, ge.Javascript.Script.O.state.users[id].id);
            }
        }
		// This procedure is where the actual cleanup occurs
		internal void Dispose(bool disposing)
		{
			// Exit now if the object has already been disposed
			if (disposed)
				return;

			if (disposing) {
				// The object is being disposed, not finalized.
				// It is safe to access other objects (other than the mybase object)
				// only from inside this block
				PluginSettings.CleanupCheckBox.CheckedChanged -= CleanupCheckBox_CheckedChanged;
				PluginManager.AWBForm.TheSession.StateChanged -= EditorStatusChanged;
				PluginManager.AWBForm.SaveButton.Click -= Save_Click;
				PluginManager.AWBForm.SkipButton.Click -= Skip_Click;
			}

			// Perform cleanup that has to be executed in either case:
			AWBCleanupCheckboxes = null;
			PluginSettings = null;
			State = null;

			// Remember that this object has been disposed of:
			disposed = true;
		}
Esempio n. 32
0
 private void stateChangeHandler( string state )
 {
     StateClass[] scArray = GetComponents<StateClass>();
     foreach(StateClass sc in scArray)
     {
         sc.enabled = false;
     }
     stateClass = (StateClass)GetComponent(_animations[state].state);
     stateClass.enabled = true;
     _cc.SetCurrentState( state );
 }
Esempio n. 33
0
        private void ec_OnEtermConnectionStateChanged(object sender, StateClass.ConnectionState state)
        {
            if (InvokeRequired)
            {
                Invoke(new EtermConnection.EtermConnectionStateHandler(ec_OnEtermConnectionStateChanged), sender, state);
                return;
            }

            switch (state)
            {
                case StateClass.ConnectionState.Connecting:
                    toolStripLogin.Enabled = false;
                    toolStripLogout.Enabled = true;
                    toolStripStatusLabel1.Text = "正在连接";
                    StartProgressBar();
                    break;
                case StateClass.ConnectionState.Connected:
                    break;
                case StateClass.ConnectionState.Logining:
                    break;
                case StateClass.ConnectionState.Logined:
                    toolStripStatusLabel1.Text = "已连接";
                    EndProgressBar();
                    break;
                case StateClass.ConnectionState.DisConnected:
                    toolStripLogin.Enabled =true;
                    toolStripLogout.Enabled = false;
                    toolStripStatusLabel1.Text = "已断开";
                    EndProgressBar();
                    break;

            }
        }
		// Friend methods:
		internal void Reset()
		{
			ToggleAWBCleanup(false);

			var _with1 = PluginManager.AWBForm.ListMaker;
			if (_with1.Count > 1 && State.IsNextPage(((WikiFunctions.Article)_with1.Items.Items[1]).Name)) {
				_with1.RemoveAt(1);
            }
            else if (_with1.Count > 0 && State.IsNextPage(((WikiFunctions.Article)_with1.Items.Items[0]).Name))
			{
			    _with1.RemoveAt(0);
			}

		    State = new StateClass();
		}