Пример #1
0
 internal void EcuReset(ResetType reset)
 {
     byte[] response;
     byte[] request = new byte[] { Services.EcuReset, (byte)reset };
     IoLog.Instance.WirteLine(MethodBase.GetCurrentMethod().Name);
     NetwrorkLayer.Transport(request, out response);
 }
Пример #2
0
        public FormResetCurrentBranch(GitUICommands commands, GitRevision revision, ResetType resetType = ResetType.Mixed)
            : base(commands)
        {
            Revision = revision;

            InitializeComponent();
            InitializeComplete();

            switch (resetType)
            {
            case ResetType.Soft:
                Soft.Checked = true;
                break;

            case ResetType.Mixed:
                Mixed.Checked = true;
                break;

            case ResetType.Keep:
                Keep.Checked = true;
                break;

            case ResetType.Merge:
                Merge.Checked = true;
                break;

            case ResetType.Hard:
                Hard.Checked = true;
                break;
            }
        }
Пример #3
0
        public void ResetData(ResetType type)
        {
            if (data == null)
            {
                return;
            }

            switch (type)
            {
            case ResetType.LevelSpecific:
                data.ResetLevelSpecificData();
                break;

            case ResetType.GameFinishedOrStart:
                data.ResetAfterGameFinish();
                break;

            case ResetType.Progress:
                data.ResetProgress();
                break;

            case ResetType.Full:
                data.ResetFull();
                break;
            }
        }
Пример #4
0
        private void ResetInitControllerMatrices(ResetType res)
        {
            Vector3    initLeftControllerPosition_L;
            Quaternion initLeftControllerRotation_L;

            VRInput.GetControllerTransform(VRInput.secondaryController, out initLeftControllerPosition_L, out initLeftControllerRotation_L);
            Matrix4x4 initLeftControllerMatrix_L = Matrix4x4.TRS(initLeftControllerPosition_L, initLeftControllerRotation_L, Vector3.one);

            initPivotMatrix = Matrix4x4.TRS(pivot.localPosition, pivot.localRotation, pivot.localScale);
            initLeftControllerMatrix_WtoL = (initPivotMatrix * initLeftControllerMatrix_L).inverse;

            if (res == ResetType.LEFT_AND_RIGHT)
            {
                Vector3    initRightControllerPosition_L; // initial right controller position in local space.
                Quaternion initRightControllerRotation_L; // initial right controller rotation in local space.
                VRInput.GetControllerTransform(VRInput.primaryController, out initRightControllerPosition_L, out initRightControllerRotation_L);
                Matrix4x4 initRightControllerMatrix_L = Matrix4x4.TRS(initRightControllerPosition_L, initRightControllerRotation_L, Vector3.one);
                initRightControllerMatrix_WtoL = (initPivotMatrix * initRightControllerMatrix_L).inverse;

                Vector3    initMiddlePosition_L = (initLeftControllerPosition_L + initRightControllerPosition_L) * 0.5f;
                Vector3    middleXVector        = (initRightControllerPosition_L - initLeftControllerPosition_L).normalized;
                Vector3    middleForwardVector  = -Vector3.Cross(middleXVector, pivot.up).normalized;
                Quaternion initMiddleRotation_L = Quaternion.LookRotation(middleForwardVector, pivot.up);
                Matrix4x4  initMiddleMatrix_L   = Matrix4x4.TRS(initMiddlePosition_L, initMiddleRotation_L, Vector3.one);
                initMiddleMatrix_WtoL = (initPivotMatrix * initMiddleMatrix_L).inverse;
            }
        }
Пример #5
0
 private static MutableObjectProbe CreateObjectProbe(ResetType resetType)
 {
     return(new MutableObjectProbe
     {
         ResetType = resetType
     });
 }
Пример #6
0
        /// <summary>
        /// Called by parent class for drawing specific variables at top.
        /// Parent class should automatically check for when it is dirty.
        /// </summary>
        protected override void DrawChildInspector()
        {
            resetType = (ResetType)EditorGUILayout.EnumPopup("Reset Type", resetType);

            bool drawList = true;

            EditorHelper.DrawResizableList <TriggeredBehaviour_Sequencer>
                ("Sequencers", ref drawList, ref sequencers, DrawEntry_ActionBundle);
        }
Пример #7
0
        public async Task ResetCollection(ResetType resetType)
        {
            Locator.MusicPlayerVM.BackgroundTrackRepository.Clear();
#if WINDOWS_PHONE_APP
            ValueSet messageDictionary = new ValueSet();
            messageDictionary.Add(BackgroundAudioConstants.ResetPlaylist, (int)resetType);
            BackgroundMediaPlayer.SendMessageToBackground(messageDictionary);
            await Task.Delay(500);
#endif
        }
Пример #8
0
        public async Task ResetCollection(ResetType resetType)
        {
            Locator.MusicPlayerVM.BackgroundTrackRepository.Clear();
#if WINDOWS_PHONE_APP
            ValueSet messageDictionary = new ValueSet();
            messageDictionary.Add(BackgroundAudioConstants.ResetPlaylist, (int)resetType);
            BackgroundMediaPlayer.SendMessageToBackground(messageDictionary);
            await Task.Delay(500);
#endif
        }
Пример #9
0
        /// <summary>
        /// ECU重启指令
        /// </summary>
        /// <param name="resetType">重启类型</param>
        /// <returns></returns>
        public ApplicationLayerProtocol ECUReset(ResetType resetType, bool priority)
        {
            ParaInfo para;

            para.ByteLen = 1;
            para.Value   = (byte)resetType;
            ApplicationLayerProtocol newFrame = new ApplicationLayerProtocol(ApplicationLayerProtocol.RequestID, ServicesID.ECUReset, priority, para);

            return(newFrame);
        }
Пример #10
0
    public static void Reset(ResetType type = ResetType.Default, string id = null)
    {
        var resetTypeStr = type switch
        {
            ResetType.Default => "",
            ResetType.Soft => "--soft",
            ResetType.Hard => "--hard",
            _ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
        };

        GitTasks.Git($"reset {resetTypeStr} {id.DoubleQuoteIfNeeded()}");
    }
Пример #11
0
    public void Advance()
    {
        resetType = ResetType.ADVANCING;

        _successSound.Play();

        startDoor = startDoors[PickNew(ref startPicker)].transform;
        endDoor   = endDoors[PickNew(ref endPicker)].transform;

        //SetupNewEndDoor();

        StartCoroutine(Fade(FadeType.OUT));
    }
Пример #12
0
        /// <summary>
        /// This constructor is used when triggering a provider reset
        /// </summary>
        /// <param name="providerId">Provider Id</param>
        /// <param name="aigSubscriberId">Subscriber Id</param>
        /// <param name="resetType">Reset Type</param>
        private ProviderChangeMessage(Guid providerId, Guid aigSubscriberId, ResetType resetType) : base(providerId, aigSubscriberId, ChangeType.Insert)
        {
            IsFullUpdate = true;

            switch (resetType)
            {
                case ResetType.ProviderReset:
                    IsProviderReset = true;
                    break;
                case ResetType.AvailabilityReset:
                    IsAvailabilityReset = true;
                    break;
            }
        }
 public void ResetValues(ResetType resetType)
 {
     if (resetType == ResetType.Colours)
     {
         offColour = new Color32(127, 127, 255, 255);
         onColour  = new Color32(255, 192, 76, 255);
     }
     else if (resetType == ResetType.Size)
     {
         size = 60f;
     }
     else if (resetType == ResetType.Delay)
     {
         delay = .5f;
     }
 }
Пример #14
0
    public static void ResetLocals(this Transform transform, ResetType inResetType = ResetType.All)
    {
        if (CheckBit((int)inResetType, (int)ResetType.Position))
        {
            transform.localPosition = Vector3.zero;
        }

        if (CheckBit((int)inResetType, (int)ResetType.Rotation))
        {
            transform.localRotation = Quaternion.identity;
        }

        if (CheckBit((int)inResetType, (int)ResetType.Scale))
        {
            transform.localScale = Vector3.one;
        }
    }
Пример #15
0
            internal Reset(IDictionary <string, object> dict)
            {
                foreach (string key in dict.Keys)
                {
                    object value;
                    dict.TryGetValue(key, out value);
                    if (value == null)
                    {
                        continue;
                    }

                    switch (key)
                    {
                    case "type":
                        String typeString = (string)value;
                        switch (typeString)
                        {
                        case "daily":
                            Type = ResetType.DAILY;
                            break;

                        case "weekly":
                            Type = ResetType.WEEKLY;
                            break;

                        case "monthly":
                            Type = ResetType.MONTHLY;
                            break;
                        }
                        break;

                    case "utc_hour":
                        UtcHour = (long)value;
                        break;

                    case "day_of_week":
                        DayOfWeek = (long)value;
                        break;

                    case "day_of_month":
                        DayOfMonth = (long)value;
                        break;
                    }
                }
            }
Пример #16
0
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            CacheProperty(ref resetType, property, nameof(resetType));
            CacheProperty(ref loop, property, nameof(loop));
            CacheProperty(ref resetValue, property, nameof(resetValue));

            type =
                (ResetType)Enum.GetValues(typeof(ResetType))
                .GetValue(resetType?.enumValueIndex ?? 0);

            float height = ShowLoop
                ? EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing
                : 0;

            height += type == ResetType.ToValue ? EditorGUIUtility.standardVerticalSpacing +
                      EditorGUIUtility.singleLineHeight : 0;

            return(EditorGUIUtility.singleLineHeight + height);
        }
Пример #17
0
        public FormResetCurrentBranch(GitUICommands aCommands, GitRevision Revision, ResetType resetType = ResetType.Mixed)
            : base(aCommands)
        {
            this.Revision = Revision;

            InitializeComponent(); Translate();

            switch (resetType)
            {
                case ResetType.Soft:
                    Soft.Checked = true;
                    break;
                case ResetType.Mixed:
                    Mixed.Checked = true;
                    break;
                case ResetType.Hard:
                    Hard.Checked = true;
                    break;
            }
        }
Пример #18
0
        public bool Reset(ResetType resetType)
        {
            if (!_rs232Device.Enabled)
            {
                return(false);
            }

            string result = null;
            var    resetCommandWaitTime = TimeSpan.FromSeconds(2);

            switch (resetType)
            {
            case ResetType.GlobalPresets:
                result = _rs232Device.WriteWithResponse($"{_cmdEsc}ZG{_cmdCr}", @"^Zpg$", resetCommandWaitTime);
                break;

            case ResetType.AudioInputLevels:
                result = _rs232Device.WriteWithResponse($"{_cmdEsc}ZA{_cmdCr}", @"^Zpa$", resetCommandWaitTime);
                break;

            case ResetType.AudioOutputLevels:
                result = _rs232Device.WriteWithResponse($"{_cmdEsc}ZV{_cmdCr}", @"^Zpv$", resetCommandWaitTime);
                break;

            case ResetType.AllMutes:
                result = _rs232Device.WriteWithResponse($"{_cmdEsc}ZZ{_cmdCr}", @"^Zpz$", resetCommandWaitTime);
                break;

            case ResetType.AllRGBDelaySettings:
                result = _rs232Device.WriteWithResponse($"{_cmdEsc}ZD{_cmdCr}", @"^Zpd$", resetCommandWaitTime);
                break;

            case ResetType.Full:
                result = _rs232Device.WriteWithResponse($"{_cmdEsc}ZXXX{_cmdCr}", @"^Zpx$", resetCommandWaitTime);
                break;
            }

            return(result != null);
        }
Пример #19
0
 internal bool Reset(ResetType how)
 {
     if (how == ResetType.ToDefault)
     {
         // should I also check if the crt value is the default value (default value being
         // recomputed twice in this Reset)?
         if (DefaultValueComputation == null)
         {
             if (Value != DefaultValue)
             {
                 Value = DefaultValue;
                 ResetToDefault?.Invoke(this, EventArgs.Empty);
                 return(true);
             }
         }
         else
         {
             Value = DefaultValueComputation.Compute(this);
             ResetToDefault?.Invoke(this, EventArgs.Empty);
             return(true);
         }
         return(false);
     }
     else if (how == ResetType.ToLastSaved)
     {
         if (Value != LastSavedValue)
         {
             Value = LastSavedValue;
             ResetToLastSaved?.Invoke(this, EventArgs.Empty);
             return(true);
         }
         return(false);
     }
     else
     {
         throw new NotImplementedException();
         return(false);
     }
 }
        public FormResetCurrentBranch(GitUICommands aCommands, GitRevision Revision, ResetType resetType = ResetType.Mixed)
            : base(aCommands)
        {
            this.Revision = Revision;

            InitializeComponent(); Translate();

            switch (resetType)
            {
            case ResetType.Soft:
                Soft.Checked = true;
                break;

            case ResetType.Mixed:
                Mixed.Checked = true;
                break;

            case ResetType.Hard:
                Hard.Checked = true;
                break;
            }
        }
Пример #21
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (TaskID != 0)
            {
                hash ^= TaskID.GetHashCode();
            }
            if (MaxDoneCount != 0)
            {
                hash ^= MaxDoneCount.GetHashCode();
            }
            if (ResetType != 0)
            {
                hash ^= ResetType.GetHashCode();
            }
            if (TaskName.Length != 0)
            {
                hash ^= TaskName.GetHashCode();
            }
            if (TaskDesc.Length != 0)
            {
                hash ^= TaskDesc.GetHashCode();
            }
            if (FinishConditionID != 0)
            {
                hash ^= FinishConditionID.GetHashCode();
            }
            if (TargetProcess != 0)
            {
                hash ^= TargetProcess.GetHashCode();
            }
            hash ^= actCondStageTaskAward_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #22
0
 public static bool Valid(this ResetType resetType)
 {
     return(Enum.IsDefined(typeof(ResetType), resetType));
 }
Пример #23
0
 public static FormResetCurrentBranch Create(GitUICommands commands, GitRevision revision, ResetType resetType = ResetType.Mixed)
 => new FormResetCurrentBranch(commands, revision ?? throw new NotSupportedException(Strings.NoRevision), resetType);
        private void Bw_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker bw = sender as BackgroundWorker;

            while (true)
            {
                if (bw.CancellationPending)
                {
                    break;
                }
                Thread.Sleep(5);

                //如果没有指令,继续等待
                if (CommandsQueue.Count == 0)
                {
                    Thread.Sleep(50);
                    continue;
                }

                //从队列中将指令取出
                CommandInfo info  = CommandsQueue.Dequeue() as CommandInfo;
                string      value = info.Command.Trim('\0');
                //SetValue(value, info.Client.Client);

                //如果设备未连接,通知客户端
                if (testDevice == null || !testDevice.IsOpen)
                {
                    ServerResultMessage _ServerResultMessage = new ServerResultMessage()
                    {
                        CommandType = CommandType.None,
                        ResultCode  = ResultCode.fail,
                        Data        = "device is disconnect.",
                    };
                    SendData(info, JsonConvert.SerializeObject(_ServerResultMessage));
                    Thread.Sleep(1000);
                    continue;
                }

                ResetType result = ResetType.None;
Start:
                try
                {
                    Command(value, info);
                }
                catch (MotorException ex)
                {
                    Loghelper.WriteLog("发送指令:", ex);
                    switch (result)
                    {
                    case ResetType.None:
                        lock (deviceLock)
                            result = device.ResetComUSB();
                        if (result == ResetType.USBSuccess || result == ResetType.Success)
                        {
                            goto Start;
                        }
                        break;

                    case ResetType.USBSuccess:
                        lock (deviceLock)
                            result = device.ResetCom();
                        if (result == ResetType.Success)
                        {
                            goto Start;
                        }
                        break;

                    case ResetType.Error:
                        break;
                    }
                }
                catch (Exception ex)
                {
                    Loghelper.WriteLog("下发错误", ex);
                    ServerResultMessage _ServerResultMessage = new ServerResultMessage()
                    {
                        CommandType = CommandType.None,
                        ResultCode  = ResultCode.fail,
                        Data        = ex.Message,
                    };
                    SendData(info, JsonConvert.SerializeObject(_ServerResultMessage));
                }
                //SetValue(string.Format("队列还剩【{0}】条指令未下发", CommandsQueue.Count), null);
            }
        }
Пример #25
0
    private void Update()
    {
        // TODO: This is just a quick way to implementing this
        switch (_resetType)
        {
        case ResetType.NONE:
            if (Input.GetKeyDown(KeyCode.R))
            {
                _resetType = ResetType.R;
            }
            break;

        case ResetType.R:
            if (Input.GetKeyDown(KeyCode.E))
            {
                _resetType = ResetType.Re;
            }
            break;

        case ResetType.Re:
            if (Input.GetKeyDown(KeyCode.S))
            {
                _resetType = ResetType.Res;
            }
            break;

        case ResetType.Res:
            if (Input.GetKeyDown(KeyCode.E))
            {
                _resetType = ResetType.Rese;
            }
            break;

        case ResetType.Rese:
            if (Input.GetKeyDown(KeyCode.T))
            {
                _resetType = ResetType.Reset;
            }
            break;

        case ResetType.Reset:
            if (Input.GetKeyDown(KeyCode.Space))
            {
                _resetType = ResetType.Reset_;
            }
            break;

        case ResetType.Reset_:
            if (Input.GetKeyDown(KeyCode.G))
            {
                _resetType = ResetType.Reset_G;
            }
            break;

        case ResetType.Reset_G:
            if (Input.GetKeyDown(KeyCode.A))
            {
                _resetType = ResetType.Reset_Ga;
            }
            break;

        case ResetType.Reset_Ga:
            if (Input.GetKeyDown(KeyCode.M))
            {
                _resetType = ResetType.Reset_Gam;
            }
            break;

        case ResetType.Reset_Gam:
            if (Input.GetKeyDown(KeyCode.E))
            {
                _resetType = ResetType.Reset_Game;
            }
            break;

        case ResetType.Reset_Game:
            if (Input.GetKeyDown(KeyCode.Space))
            {
                SaveData.ResetGameData();
                GameObject notification = Instantiate(_resetGamePrefab, transform);
                Destroy(notification, 5f);
            }
            break;
        }
    }
Пример #26
0
 public static void ZeroOut(this Transform transform, ResetType inResetType = ResetType.All)
 {
     ResetLocals(transform, inResetType);
 }
Пример #27
0
 public RES()
     : base(typeof(short))
 {
     Class = ComponentClass.Output;
     Type  = ResetType.Counter;
 }
Пример #28
0
 public void Restart()
 {
     resetType = ResetType.RESTARTING;
     StartCoroutine(Fade(FadeType.OUT));
 }
Пример #29
0
 /// <remarks/>
 public void ResetAsync(ResetType type, object userState)
 {
     if ((this.ResetOperationCompleted == null)) {
         this.ResetOperationCompleted = new System.Threading.SendOrPostCallback(this.OnResetOperationCompleted);
     }
     this.InvokeAsync("Reset", new object[] {
                 type}, this.ResetOperationCompleted, userState);
 }
Пример #30
0
 /// <remarks/>
 public System.IAsyncResult BeginReset(ResetType type, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("Reset", new object[] {
                 type}, callback, asyncState);
 }
Пример #31
0
        public void Reset(ResetType type)
        {
            if (_stopwatch.IsRunning)
            {
                _stopwatch.Restart();
            }
            else
            {
                _stopwatch.Reset();
            }

            if (type == ResetType.ToZero)
            {
                ElapsedAtStart = TimeSpan.Zero;
                ElapsedWhenLastStopped = TimeSpan.Zero;
            }

            if (type == ResetType.ToStartTime)
            {
                ElapsedWhenLastStopped = TimeSpan.Zero;
            }
        }
Пример #32
0
 protected override void ReadData(RdmBinaryReader data)
 {
     Reset = (ResetType)data.ReadByte();
 }
Пример #33
0
 public RES(string name, Node Left)
     : base(typeof(short), name, Left, null)
 {
     Class = ComponentClass.Output;
     Type  = ResetType.Counter;
 }
Пример #34
0
 /// <remarks/>
 public void ResetAsync(ResetType type)
 {
     this.ResetAsync(type, null);
 }
Пример #35
0
 public SysResetMessage(ReadOnlyMemory <byte> data) : base(MsgType.SYS_RESET, data)
 {
     Reset = (ResetType)base.Raw.Span[0];
 }
Пример #36
0
 public ResetStatus Reset(ResetType type)
 {
     object[] results = this.Invoke("Reset", new object[] {
                 type});
     return ((ResetStatus)(results[0]));
 }
Пример #37
0
        public void Reset(ResetType rt)
        {
            var rand = new Random();

            for(int i = 0; i < this.raw.Length; ++i) {
                if ( rt == ResetType.Random ) {
                    this.raw[ i ] = (byte) ( rand.Next() % byte.MaxValue );
                } else {
                    this.raw[ i ] = (byte) 0;
                }
            }

            return;
        }
Пример #38
0
 private void ResetMutableObjects(ResetType resetType)
 {
     var filteredByType = mutableObjects.Where(obj => obj.ResetType == resetType);
     ResetMutableObjects(filteredByType);
 }