Exemple #1
0
        //----------------------------------//

        /// <summary>
        /// Initialize a new action sequence.
        /// </summary>
        public ActionSequence(Needle needle = null)
        {
            _pair         = new ActionPair();
            _pair.ActionB = new ActionSet(Next);
            _queue        = new SafeQueue <IAction>();
            _needle       = needle ?? ManagerUpdate.Control;
        }
    //---------------------------------------------------------------
    private void SkillShootingFromNeedle()
    {
        Needle needle = GameObject.FindObjectOfType <Needle> ();

        if (!needle)
        {
            return;
        }
        GameObject needleGameObj      = needle.gameObject;
        Transform  needleGameObjTrans = needleGameObj.GetComponent <Transform> ();

        //Fire shot and attach the shot to the needle parent
        GameObject shot = Instantiate(skillShotToPlay) as GameObject;

        shot.transform.position = needleGameObjTrans.GetChild(0).position;
        if (skillShotContainer)
        {
            shot.transform.parent = skillShotContainer.transform;
        }
        else
        {
            Debug.LogWarning("No shot container exists");
        }
        //reset cooldown for limitting use of skill
        skillCoolDownTime = maxCoolDownTime;
        //Hide shootable notification
        ToggleShootableNotif(false);
        bIsSkillUsedThisCharge = true;
        Destroy(GameObject.FindObjectOfType <GaugeMeter> ().gameObject);
    }
Exemple #3
0
        //static AutoItX3 _autoit = new AutoItX3();
        static void Main(string[] args)
        {
            Console.WriteLine("Hello world!");
            //Needle needle = new Needle("C:\\#GitHub\\TobiSharp\\TobiSharp\\_TestBilder\\02needleLeftTopRed.png");
            //Needle needle = new Needle("C:\\#GitHub\\TobiSharp\\TobiSharp\\_TestBilder\\02needleRightBottomYellow.png");
            //Needle needle = new Needle("C:\\#GitHub\\TobiSharp\\TobiSharp\\_TestBilder\\02needleOneOne.png");
            //Needle needle = new Needle("C:\\#GitHub\\TobiSharp\\TobiSharp\\_TestBilder\\02needleFalse.png");
            Needle needle = new Needle("C:\\#GitHub\\TobiSharp\\TobiSharp\\_TestBilder\\04needle40kF.png");

            string cout = "Needle:";

            cout += " a" + needle.StrongestPixel.A;
            cout += " r" + needle.StrongestPixel.R;
            cout += " g" + needle.StrongestPixel.G;
            cout += " b" + needle.StrongestPixel.B;
            cout += " x" + needle.StrongestPoint.X;
            cout += " y" + needle.StrongestPoint.Y;
            cout += " x" + needle.StrongestRearPoint.X;
            cout += " y" + needle.StrongestRearPoint.Y;
            cout += " w" + needle.Size.Width;
            cout += " h" + needle.Size.Height;
            cout += " l" + needle.Pixels.Length;
            Console.WriteLine(cout);

            Haystack haystack = new Haystack("C:\\#GitHub\\TobiSharp\\TobiSharp\\_TestBilder\\04haystackPexelF.png");
            Point    test     = haystack.Locate(needle);

            Console.WriteLine("x" + test.X + " y" + test.Y);

            Console.ReadLine();
            //_autoit.WinActivate("Untitled - Notepad2");
            //_autoit.Send("Hello World");
        }
        private ImageInfo SaveImage(HayStackStoreFile storeFile, string image)
        {
            var data = File.ReadAllBytes(image);

            var tobesaved = new Needle
            {
                Key               = 1L,
                AlternateKey      = 1,
                Cookie            = 1,
                Data              = data,
                DataCheckSum      = 1,
                DataSize          = data.Length,
                Flags             = 0,
                FooterMagicNumber = 0,
                HeaderMagicNumber = 0,
                Padding           = 0
            };

            var offset = storeFile.Append(tobesaved);

            return(new ImageInfo
            {
                Offset = offset,
                Size = data.Length
            });
        }
Exemple #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ZeroitCircularGauge"/> class.
        /// </summary>
        public ZeroitCircularGauge()
            : base(false)
        {
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.DoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);

            DoubleBuffered = true;


            m_axis   = new CircularAxis();
            m_needle = new Needle();

            m_axis.AppearanceChanged += new EventHandler(OnItemAppearanceChanged);
            m_axis.LayoutChanged     += new EventHandler(OnItemLayoutChanged);

            m_needle.AppearanceChanged += new EventHandler(OnItemAppearanceChanged);
            m_needle.LayoutChanged     += new EventHandler(OnItemLayoutChanged);

            m_needle.CalculatePaths(ClientRectangle);
            m_axis.CalculatePaths(ClientRectangle);

            InitializeComponent();

            Value             = 0;
            Animate           = true;
            EaseFunction      = EaseFunctionType.Linear;
            AnimationLength   = 1000;
            AnimationInterval = 100;
            EaseMode          = EaseMode.InOut;
        }
Exemple #6
0
        /// <summary>
        /// Get if this match can be found in a stack
        /// </summary>
        /// <param name="stack">List of strings to search for the given content</param>
        /// <returns>Tuple of success and matched item</returns>
        public (bool, string) Match(IEnumerable <string> stack)
        {
            // If either array is null or empty, we can't do anything
            if (stack == null || !stack.Any() || Needle == null || Needle.Length == 0)
            {
                return(false, null);
            }

            // Preprocess the needle, if necessary
            string procNeedle = MatchExact ? Needle : Needle.ToLowerInvariant();

            foreach (string stackItem in stack)
            {
                // Preprocess the stack item, if necessary
                string procStackItem = MatchExact ? stackItem : stackItem.ToLowerInvariant();

                if (UseEndsWith && procStackItem.EndsWith(procNeedle))
                {
                    return(true, stackItem);
                }
                else if (!UseEndsWith && procStackItem.Contains(procNeedle))
                {
                    return(true, stackItem);
                }
            }

            return(false, null);
        }
Exemple #7
0
        private void RadTileList_AutoGeneratingTile(object sender, AutoGeneratingTileEventArgs e)
        {
            Sensor sensor = e.Tile.Content as Sensor;

            if (sensor is HumiditySensor)
            {
                RadialScale scale = new RadialScale
                {
                    Min     = 0,
                    Max     = 100,
                    ToolTip = "Humidity"
                };

                Needle needle = new Needle
                {
                    Value = 20
                };
                scale.Indicators.Add(needle);
                RadRadialGauge rad = new RadRadialGauge();
                rad.Items.Add(scale);
                e.Tile.Content    = rad;
                e.Tile.Background = new SolidColorBrush(Colors.Teal);
                e.Tile.TileType   = TileType.Single;
            }
        }
Exemple #8
0
        static int Main(string[] args)
        {
            if (args.Length != 4)
            {
                Console.WriteLine("<Target PID>, <Assembly>, <Method>, <Source PID>");
                return(-1);
            }
            else
            {
                //Console.WriteLine(args[0]);
                //Console.WriteLine(args[1]);
                //Console.WriteLine(args[2]);
                //Console.WriteLine(args[3]);

                int    TargetPID = int.Parse(args[0]);
                string Assembly  = args[1];
                string Method    = args[2];
                int    SourcePID = int.Parse(args[3]);

                Process     p   = Process.GetProcessById(TargetPID);
                RegistryKey key = Registry.CurrentUser.CreateSubKey("Software").CreateSubKey("APE", RegistryKeyPermissionCheck.Default, RegistryOptions.Volatile);
                key.SetValue(SourcePID + "_Attach_Status", "In_Process");
                int result = (int)Needle.Inject(p, SourcePID, Assembly, Method);
                key.SetValue(SourcePID + "_Attach_Status", "Success");
                return(result);
            }
        }
 public GlideGauge()
     : base(Constants.WINDOW_ID_GAUGE_GLIDE, SKIN, SCALE)
 {
     this.DmeDisplay           = new DigitalDisplay(this);
     this.yellowNeedle         = new Needle(this, NEEDLE_YELLOW);
     this.yellowNeedle.enabled = true;
 }
Exemple #10
0
        public IDisposable Subscribe(IObserver <T> observer)
        {
            var needle = new Needle <IObserver <T> >(observer);

            _observers.AddNew(needle);
            return(Disposable.Create(() => _observers.Remove(needle)));
        }
Exemple #11
0
        public Watch(long milliseconds, bool repeat, IAction onDone, bool run = true, Needle needle = null)
        {
            _time    = CurrentTime = milliseconds;
            Repeat   = repeat;
            OnDone   = onDone;
            _updater = new ActionAct(Update);
            _running = run;

            // was the needle specified?
            if (needle == null)
            {
                // no, derive the correct needle
                _needle = _time % 1000 == 0 ?
                          ManagerUpdate.Iterant :
                          ManagerUpdate.Polling;
            }
            else
            {
                // yes, persist the needle
                _needleSpecified = true;
                _needle          = needle;
            }

            if (_running && _time > 0)
            {
                _needle.AddUpdate(_updater);
            }
        }
Exemple #12
0
    public static void GrabNeedleWhenAttachedItemIsGrabbed(ItemConnector connector, Transform target, Interactable addTo)
    {
        Needle needle = addTo as Needle;

        if (needle == null)
        {
            throw new System.Exception("Needle is null");
        }

        Interactable otherItem = needle.Connector.AttachedInteractable;

        Hand otherHand = Hand.GrabbingHand(otherItem);

        otherHand.Connector.Connection.Remove();

        HandSmoother smooth     = target.GetComponent <Hand>().Smooth;
        Transform    handOffset = smooth?.transform;

        target = handOffset ?? target;

        connector.Connection = ItemConnection.AddJointConnection(connector, target, addTo);
        smooth?.DisableInitMode();

        otherHand.InteractWith(otherItem, false);
    }
Exemple #13
0
    void Fire()
    {
        Needle currentNeedle = GetComponentInChildren <Needle>();

        currentNeedle.GetComponent <Needle>().triggered = true;
        currentNeedle.transform.parent = null;
    }
Exemple #14
0
 public void SaveUnitsConfiguration()
 {
     Needle.SaveConfiguration("NeedleConfiguration");
     Conveyor.SaveConfiguration("ConveyorConfiguration");
     Charger.SaveConfiguration("ChargerConfiguration");
     Rotor.SaveConfiguration("RotorConfiguration");
     Pomp.SaveConfiguration("PompConfiguration");
 }
Exemple #15
0
 public void LoadUnitsConfiguration()
 {
     Needle.LoadConfiguration("NeedleConfiguration");
     Conveyor.LoadConfiguration("ConveyorConfiguration");
     Charger.LoadConfiguration("ChargerConfiguration");
     Rotor.LoadConfiguration("RotorConfiguration");
     Pomp.LoadConfiguration("PompConfiguration");
 }
Exemple #16
0
        private void WriteFooter(Needle needle)
        {
            _writer.Write(needle.FooterMagicNumber); // 4 byte

            _writer.Write(needle.DataCheckSum);      // 4 byte

            _writer.Write(needle.Padding);           // 4 byte
        }
 public void SetNeedle(Needle needle)
 {
     if (needle == null)
     {
         Logger.Error("Needle value was null. Problem with SetInteractors cast?");
     }
     this.Needle = needle;
 }
Exemple #18
0
        public void IsIntersect_IntersectsAtMiddle_True()
        {
            var needle = new Needle(10, 2, 5, 0);

            var intersectsAbscissa = needle.IntersectsHorizontalLine(4);

            intersectsAbscissa.Should().BeTrue();
        }
Exemple #19
0
        public void IsIntersect_NoIntersection_False()
        {
            var needle = new Needle(10, 2, 5, 0);

            var intersectsAbscissa = needle.IntersectsHorizontalLine(-4);

            intersectsAbscissa.Should().BeFalse();
        }
Exemple #20
0
        public void IsIntersect_Intersects1p0_False()
        {
            var needle = new Needle(10, 2, 5, 0);

            var intersectsAbscissa = needle.ContainsPoint(1, 0);

            intersectsAbscissa.Should().BeFalse();
        }
Exemple #21
0
    // 指定位置に針を生成
    private void bindNeedle(Vector2 position)
    {
        var instance = Needle.instance(position);

        NeedleList.Add(instance);
        Debug.Log("針で綴じた。");
        Debug.Log(string.Format("position.x:{0} position.y:{1}", position.x, position.y));
    }
Exemple #22
0
 public void needstop()
 {
     foreach (Transform child in transform)
     {
         Needle ne1 = child.GetComponent <Needle>();
         ne1.moveNe = false;
     }
 }
Exemple #23
0
    private void StopNeedle()
    {
        Needle needle = needleGameObject.GetComponent <Needle>();

        needle.Stop();
        needles.ForEach(obj => obj.GetComponent <Needle>().Stop());
        angle = needle.GetCurrentAngle() + 90;
    }
Exemple #24
0
        private void ReadFooter(Needle needle)
        {
            needle.FooterMagicNumber = _reader.ReadInt();

            needle.DataCheckSum = _reader.ReadInt();

            // TODO need to fix padding
            needle.Padding = _reader.ReadInt();
        }
Exemple #25
0
        public void Remove(Needle <T> obj = null)
        {
            T _obj;

            if (obj.TryGetValue(out _obj))
            {
                Remove(_obj);
            }
        }
        private void ReadFooter(Needle needle)
        {
            needle.FooterMagicNumber = _reader.ReadInt();

            needle.DataCheckSum = _reader.ReadInt();

            // TODO need to fix padding
            needle.Padding = _reader.ReadInt();
        }
Exemple #27
0
    public static void ReleaseNeedleWhenNeedleAttachedItemIsGrabbed(Needle needle)
    {
        Interactable otherInteractable = needle.Connector.AttachedInteractable;

        Hand otherHand = Hand.GrabbingHand(otherInteractable);

        otherHand.Connector.Connection.Remove();
        otherHand.InteractWith(otherInteractable, false);
    }
Exemple #28
0
        public void judge_error(int xCode, int yCode)
        {
            // 針を生成し、当たり判定許容範囲を取得する
            var instance = Needle.instance(new Vector2(0, 0));
            var range    = getRange(instance);
            // 当たり判定(xとyに1か-1を掛けた上で加算し上限超過と下限未満を調べる)
            var result = instance.isCollision(new Vector2(range * xCode + xCode, range * yCode + yCode));

            Assert.IsFalse(result);
        }
Exemple #29
0
        public void judge_normal(int xCode, int yCode)
        {
            // 針を生成し、当たり判定許容範囲を取得する
            var instance = Needle.instance(new Vector2(0, 0));
            var range    = getRange(instance);
            // 当たり判定(xとyに1か-1を掛けて上限と下限を調べる)
            var result = instance.isCollision(new Vector2(range * xCode, range * yCode));

            Assert.IsTrue(result);
        }
            public AbstractCompassGauge(int id, Texture2D skin)
                : base(id, skin, SCALE00, SCALE0B)
            {
                relativeFlag = new RFlag(this);

                this.blueNeedle        = new Needle(this, NEEDLE_BLUE);
                this.redNeedle         = new Needle(this, NEEDLE_RED);
                this.yellowNeedle      = new Needle(this, NEEDLE_YELLOW);
                this.yellowNeedle.mode = Needle.MODE.INDEPENDET;
            }
Exemple #31
0
        public IEnumerable <Tuple <T> > Read(Needle <T> obj = null)
        {
            T _obj;

            if (obj.TryGetValue(out _obj))
            {
                return(new[] { Read(_obj) });
            }
            throw new ArgumentException();
        }
        private void ReadHeader(Needle needle)
        {
            needle.HeaderMagicNumber = _reader.ReadInt();

            needle.Cookie = _reader.ReadInt();

            needle.Key = _reader.ReadLong();

            needle.AlternateKey = _reader.ReadInt();

            needle.Flags = _reader.ReadInt();

            needle.DataSize = _reader.ReadInt();
        }
        public Needle Read(int offset, int size)
        {
            _reader.Seek(offset);

            var needle = new Needle();

            ReadHeader(needle);

            ReadData(needle);

            ReadFooter(needle);

            return needle;
        }
        // TODO should check concurrency
        public int Append(Needle needle)
        {
            // wrapper in the file

            var offset = _writer.Position;

            WriteHeader(needle);

            WriteData(needle);

            WriteFooter(needle);

            _writer.Flush();

            return offset;
        }
		/// <summary>
		/// Create a RoundGauge object
		/// </summary>
		public RoundGauge()
		{			
			// set defaults
			updating = true;

			BackColor = Color.Cornsilk;
			ValueArc = 300;
			currentValue = 0;
			
			valueFont = new Font(FontFamily.GenericMonospace, valueFontSize, FontStyle.Regular);
			face = new Rectangle(bezelWidth, bezelWidth, diameter - (2 * bezelWidth), diameter - (2 * bezelWidth));
			bufferBitmap = new Bitmap(diameter, diameter);	
			needle = new Needle(this.Width, valueAngle, (Width / 2 - bezelWidth - lineBezelSpacing));
			needle.Width = needleWidth;
			needle.NeedleColor = needleColor;

			#if DESIGN
			lamps.LampsChanged += new ChangeHandler(lamps_LampChanged);
			#endif

			UpdateNeedleLength();
			unitsPerDegree = (double)ValueArc /  (double)(maxValue - minValue);

			updating = false;
			this.Refresh();
		}
 private void ReadData(Needle needle)
 {
     needle.Data = _reader.ReadData(needle.DataSize);
 }
        private void WriteFooter(Needle needle)
        {
            _writer.Write(needle.FooterMagicNumber); // 4 byte

            _writer.Write(needle.DataCheckSum); // 4 byte

            _writer.Write(needle.Padding); // 4 byte
        }
        private void WriteHeader(Needle needle)
        {
            _writer.Write(needle.HeaderMagicNumber); // 4 byte

            _writer.Write(needle.Cookie); // 4 byte

            _writer.Write(needle.Key); // 8 byte

            _writer.Write(needle.AlternateKey); // 4 byte

            _writer.Write(needle.Flags); // 4 byte

            _writer.Write(needle.DataSize); // 4 byte
        }
		/// <summary>
		/// Fired when the RoundGauge is resized
		/// </summary>
		/// <param name="e"></param>
		protected override void OnResize(EventArgs e)
		{
			diameter = Width = Height;

			face = new Rectangle(bezelWidth, bezelWidth, diameter - (2 * bezelWidth), diameter - (2 * bezelWidth));
			bufferBitmap = new Bitmap(diameter, diameter);
			DetermineValueRect(ref valueRect, ref valueBorder);
			needle = new Needle(this.Width, valueAngle, (Width / 2 - bezelWidth - lineBezelSpacing));
			needle.Width = needleWidth;

			// update lamp data
			int lampx = 0, lampy = 0;
			lampdiameter = (int)((this.Width / 2)  - ((this.Width / 2) / 1.4142135623730950488016887242097));

			foreach(Lamp l in lamps)
			{
				switch(l.Position)
				{
					case LampPosition.UpperLeft:
						lampx = lampdiameter + 1;
						lampy = lampdiameter + 1;
						break;
					case LampPosition.UpperRight:
						lampx = this.Width - 1;
						lampy = lampdiameter + 1;
						break;
					case LampPosition.LowerLeft:
						lampx = lampdiameter + 1;
						lampy = this.Height - 1;
						break;
					case LampPosition.LowerRight:
						lampx = this.Width - 1;
						lampy = this.Height - 1;
						break;
				}
				l.UpperRight = new Point(lampx, lampy);
				l.Diameter = lampdiameter;
			}

			base.OnResize (e);

			if(!updating)
				this.Refresh();
		}
 private void WriteData(Needle needle)
 {
     _writer.Write(needle.Data);
 }