public void moveForward(SerialPortController sp, Master ms, int rpm)
    {
        if (Config.num_of_thrusters != 5 && Config.num_of_thrusters != 3)
        {
            return;
        }

        int[] idx = new int[2];
        if (Config.num_of_thrusters == 5) // select motors to run: lowerleft, lowerright -> motorIdex[3,4]
        {
            idx[0] = Config.motorIdx[3];
            idx[1] = Config.motorIdx[4];
        }
        else if (Config.num_of_thrusters == 3)
        {
            idx[0] = Config.motorIdx[1];
            idx[1] = Config.motorIdx[2];
        }
        int[] rpmToSet = new int[Config.max_num_of_thrusters];
        for (int i = 0; i < Config.max_num_of_thrusters; ++i)
        {
            if (i == idx[0] || i == idx[1])
            {
                rpmToSet[i] = rpm;
            }
            else
            {
                rpmToSet[i] = 0;
            }
        }
        sp.sendDownstreamPacket(ms.setAllRPM(rpmToSet[0], rpmToSet[1], rpmToSet[2], rpmToSet[3], rpmToSet[4], rpmToSet[5]));
        curStatus = OPS.FORWARD;
    }
Beispiel #2
0
 void Awake()
 {
     CheckGo.GetComponent <Button>().onClick.AddListener(OPS.Check);
     CallGo.GetComponent <Button>().onClick.AddListener(() => {
         OPS.Call();
     });
     RaiseGo.GetComponent <Button>().onClick.AddListener(OnRaiseClick);
 }
Beispiel #3
0
        private void StateChanged(States s, int value)
        {
            var o = new OPS
            {
                s = s,
                v = value
            };

            ops.Add(o);
        }
        public override int GetHashCode()
        {
            return(ID.GetHashCode() ^
                   RVK.GetHashCode() ^
                   D_PRIB.GetHashCode() ^

                   NA_UCHETE.GetHashCode() ^
                   SUD.GetHashCode() ^

                   GODN.GetHashCode() ^
                   P_PREDN.GetHashCode() ^
                   TDT.GetHashCode() ^
                   STAT.GetHashCode() ^
                   ZREN.GetHashCode() ^
                   ROST.GetHashCode() ^
                   MASSA.GetHashCode() ^
                   R_G_U.GetHashCode() ^
                   R_O_G.GetHashCode() ^
                   R_OB.GetHashCode() ^
                   IMEET_RAZR.GetHashCode() ^

                   KEM_VIDAN.GetHashCode() ^
                   D_PASPORT.GetHashCode() ^
                   FAM.GetHashCode() ^
                   IM.GetHashCode() ^
                   OTCH.GetHashCode() ^
                   D_ROD.GetHashCode() ^
                   M_ROD.GetHashCode() ^
                   S_PASPORT.GetHashCode() ^
                   N_PASPORT.GetHashCode() ^
                   BRAK.GetHashCode() ^
                   IMEET_REB.GetHashCode() ^

                   LN_SER.GetHashCode() ^
                   LN_NUM.GetHashCode() ^
                   S_V_BIL.GetHashCode() ^
                   N_V_BIL.GetHashCode() ^
                   F_DOP.GetHashCode() ^
                   N_DOP.GetHashCode() ^
                   D_DOP.GetHashCode() ^
                   PROF_P.GetHashCode() ^
                   NPU.GetHashCode() ^
                   OPS.GetHashCode() ^
                   REZH_KOM.GetHashCode() ^

                   OBRAZOV.GetHashCode() ^
                   DO_PRIZ.GetHashCode() ^

                   ODIN_ROD.GetHashCode() ^
                   BEZ_ROD.GetHashCode() ^

                   S_VA.GetHashCode() ^
                   N_VA.GetHashCode() ^
                   SPEC.GetHashCode());
        }
Beispiel #5
0
        public Key(string rawJsonKey, JToken spec)
        {
            _rawKey = rawJsonKey;
            if (rawJsonKey.EndsWith(Defaultr.WildCards.ARRAY))
            {
                _isArrayOutput = true;
                _rawKey        = _rawKey.Replace(Defaultr.WildCards.ARRAY, "");
            }

            _op = OPSUtils.Parse(_rawKey);

            switch (_op)
            {
            case OPS.OR:
                _keyStrings = new List <string>(Regex.Split(_rawKey, Key.OR_INPUT_REGEX));
                _orCount    = _keyStrings.Count;
                break;

            case OPS.LITERAL:
                _keyStrings = new List <string>();
                _keyStrings.Add(_rawKey);
                break;

            case OPS.STAR:
                _keyStrings = new List <string>();
                break;

            default:
                throw new InvalidOperationException("Someone has added an op type without changing this method.");
            }

            // Spec is string -> Map   or   string -> Literal only
            if (spec.Type == JTokenType.Object)
            {
                _children = ProcessSpec(IsArrayOutput(), (JObject)spec);

                if (IsArrayOutput())
                {
                    // loop over children and find the max literal value
                    foreach (Key childKey in _children)
                    {
                        int childValue = childKey.GetLiteralIntKey();
                        if (childValue > _outputArraySize)
                        {
                            _outputArraySize = childValue;
                        }
                    }
                }
            }
            else
            {
                // literal such as string, number, or JSON array
                _literalValue = spec;
            }
        }
Beispiel #6
0
    public void OnSliderOK()
    {
        var value = (int)Slid.value;

        if (value >= range[1] && canAllin)
        {
            OPS.AllIn();
        }
        else
        {
            OPS.raise(value);
        }
    }
Beispiel #7
0
 public void OnFoldClick()
 {
     if (canCheck)
     {
         PokerUI.Alert("当前可以看牌,您确定要弃牌?", () => {
             OPS.Fold();
         }, null);
     }
     else
     {
         OPS.Fold();
     }
 }
Beispiel #8
0
    private void addProperty(GameObject go, string text, int value)
    {
        go.transform.Find("Text").GetComponent <Text>().text   = text;
        go.transform.Find("Number").GetComponent <Text>().text = _.Num2CnDigit(value);
        go.GetComponent <OPColor>().ColorEnabled = true;

        var btn = go.GetComponent <Button>();

        btn.onClick.RemoveAllListeners();
        btn.onClick.AddListener(() => {
            OPS.raise(value);
        });
        btn.interactable = true;
    }
    public void changeSpeed(OPS status, SerialPortController sp, Master ms)
    {
        switch (status)
        {
        case OPS.UP:
            goUp(sp, ms, curRPM);
            break;

        case OPS.DOWN:
            goDown(sp, ms, curRPM);
            break;

        case OPS.FORWARD:
            moveForward(sp, ms, curRPM);
            break;

        case OPS.BACKWARD:
            moveBackward(sp, ms, curRPM);
            break;

        case OPS.LEFT_TURN:
            turnLeft(sp, ms, curRPM);
            break;

        case OPS.RIGHT_TURN:
            turnRight(sp, ms, curRPM);
            break;

        case OPS.LEFT:
            if (Config.num_of_thrusters == 5)
            {
                moveLeft(sp, ms, curRPM);
            }
            break;

        case OPS.RIGHT:
            if (Config.num_of_thrusters == 5)
            {
                moveRight(sp, ms, curRPM);
            }
            break;

        default:
            break;
        }
    }
 public void goDown(SerialPortController sp, Master ms, int rpm)
 {
     int[] rpmToSet = new int[Config.max_num_of_thrusters];
     for (int i = 0; i < Config.max_num_of_thrusters; ++i)
     {
         if (i == Config.motorIdx[0])
         {
             rpmToSet[i] = rpm;
         }
         else
         {
             rpmToSet[i] = 0;
         }
     }
     sp.sendDownstreamPacket(ms.setAllRPM(rpmToSet[0], rpmToSet[1], rpmToSet[2], rpmToSet[3], rpmToSet[4], rpmToSet[5]));
     curStatus = OPS.DOWN;
 }
 public void moveRight(SerialPortController sp, Master ms, int rpm)
 {
     if (Config.num_of_thrusters != 5)
     {
         return;
     }
     // select motors to run: upperleft, lowerleft -> motorIdex[1,3]
     int[] idx      = { Config.motorIdx[1], Config.motorIdx[3] };
     int[] rpmToSet = new int[Config.max_num_of_thrusters];
     for (int i = 0; i < Config.max_num_of_thrusters; ++i)
     {
         if (i == idx[0] || i == idx[1])
         {
             rpmToSet[i] = rpm;
         }
         else
         {
             rpmToSet[i] = 0;
         }
     }
     sp.sendDownstreamPacket(ms.setAllRPM(rpmToSet[0], rpmToSet[1], rpmToSet[2], rpmToSet[3], rpmToSet[4], rpmToSet[5]));
     curStatus = OPS.RIGHT;
 }
Beispiel #12
0
        public void SubmitBulkOperationsAsync(string callingUrl, Guid sessionId, OPS operations, object userState)
        {
            MemoryStream operationsXml = null;
            MemoryStream compressedOperationsStream = null;
            ZlibStream   zipStream = null;

            try
            {
                operationsXml = new MemoryStream();

                DataContractSerializer serializer = new DataContractSerializer(typeof(OPS));

                serializer.WriteObject(operationsXml, operations);

                byte[] operationsXmlBytes = operationsXml.ToArray();
                compressedOperationsStream = new MemoryStream();

                using (zipStream = new ZlibStream(compressedOperationsStream, CompressionMode.Compress))
                {
                    zipStream.Write(operationsXmlBytes, 0, operationsXmlBytes.Length);
                }

                byte[] compressedOperationsXmlBytes = compressedOperationsStream.ToArray();

                string compressedOperations = Convert.ToBase64String(compressedOperationsXmlBytes);

                BOCAsync(callingUrl, sessionId, compressedOperations, userState);
            }
            finally
            {
                if (operationsXml != null)
                {
                    operationsXml.Dispose();
                    operationsXml = null;
                }
            }
        }
        public void SubmitBulkOperationsAsync(string callingUrl, Guid sessionId, OPS operations, object userState)
        {
            MemoryStream operationsXml = null;
            MemoryStream compressedOperationsStream = null;
            ZlibStream zipStream = null;

            try
            {
                operationsXml = new MemoryStream();

                DataContractSerializer serializer = new DataContractSerializer(typeof(OPS));

                serializer.WriteObject(operationsXml, operations);

                byte[] operationsXmlBytes = operationsXml.ToArray();
                compressedOperationsStream = new MemoryStream();

                using (zipStream = new ZlibStream(compressedOperationsStream, CompressionMode.Compress))
                {
                    zipStream.Write(operationsXmlBytes, 0, operationsXmlBytes.Length);
                }

                byte[] compressedOperationsXmlBytes = compressedOperationsStream.ToArray();

                string compressedOperations = Convert.ToBase64String(compressedOperationsXmlBytes);

                BOCAsync(callingUrl, sessionId, compressedOperations, userState);
            }
            finally
            {
                if (operationsXml != null)
                {
                    operationsXml.Dispose();
                    operationsXml = null;
                }
            }
        }
Beispiel #14
0
 public element(double num)
 {
     IsNumber = true;
     Number = num;
     Op = OPS.NUL;
 }
Beispiel #15
0
 public element(OPS op)
 {
     IsNumber = false;
     Op = op;
     Number = 0;
 }
Beispiel #16
0
 public void SubmitBulkOperationsAsync(string callingUrl, Guid sessionId, OPS operations)
 {
     SubmitBulkOperationsAsync(callingUrl, sessionId, operations, null);
 }
 public void SubmitBulkOperationsAsync(string callingUrl, Guid sessionId, OPS operations)
 {
     SubmitBulkOperationsAsync(callingUrl, sessionId, operations, null);
 }
Beispiel #18
0
 public static void Check()
 {
     OPS.invoke("check");
 }
Beispiel #19
0
 public element(double num)
 {
     IsNumber = true;
     Number   = num;
     Op       = OPS.NUL;
 }
 public void turnBackRight(SerialPortController sp, Master ms, int rpm)
 {
     // select motors to run: upperleft, upperright -> motorIdex[1,2]
     curStatus = OPS.BACKWARD_RIGHT_TURN;
 }
Beispiel #21
0
 public void OnAccurateYes()
 {
     OPS.raise(accurateValue);
 }
Beispiel #22
0
 static void Main(string[] args)
 {
     OPS   oPS   = new OPS();
     User1 user1 = new User1(oPS);
 }
Beispiel #23
0
 /// <summary>
 /// Purpose: LBoxOperators Click Event Handler
 /// </summary>
 /// <param name="sender">LBoxOperators</param>
 /// <param name="e">Not used</param>
 private void LBoxOperators_SelectedIndexChanged(object sender, EventArgs e)
 {
     _operator = (OPS)(LBoxOperators.SelectedIndex);
     BtnCalc_Click(sender, e);
 }
Beispiel #24
0
 /// <summary>
 /// Purpose: FrmMain load event handler
 /// </summary>
 /// <param name="sender">FrmMain Load Event</param>
 /// <param name="e">Not used</param>
 private void FrmMain_Load(object sender, EventArgs e)
 {
     _dataLop  = null;
     _dataRop  = null;
     _operator = OPS.ADD;
 }
Beispiel #25
0
 public static void Fold()
 {
     OPS.invoke("fold");
 }
Beispiel #26
0
 public element(OPS op)
 {
     IsNumber = false;
     Op       = op;
     Number   = 0;
 }
Beispiel #27
0
 public static void Call()
 {
     OPS.invoke("call");
 }
Beispiel #28
0
 public void OnAllinClick()
 {
     OPS.AllIn();
 }
Beispiel #29
0
 public static void AllIn()
 {
     OPS.invoke("all_in");
 }