コード例 #1
0
ファイル: DistUtility.cs プロジェクト: PouryaSohbati/Arioto
	public static position getDistance (position pos1, position pos2){
		position dist = new position();
		
		dist.x = Mathf.Abs (pos1.x - pos2.x);
		dist.y = Mathf.Abs (pos1.y - pos2.y);
		return dist;
	}
コード例 #2
0
ファイル: classes.cs プロジェクト: rafalima87/Chess
 //public blackPawnBehavior();
 public bool canMove(position from, position to)
 {
     if (to.y - from.y > 2) //if moving more than 2 spots
     {
         return false;
     }
     else if (to.y - from.y == 2)
     {
         if (from.y > 1) //if moving two spots in the middle of the board
             return false;
         else if (from.x - to.x != 0)  //if moving 2 spots and some x
             return false;
         else //if moving 2 spots
             return true;
     }
     else if (to.y - from.y <= 0)//if moving backwards
         return false;
     else if (to.y > 7)//if moving past end
         return false;
     else
     {
         if (from.x - to.x == 0) //if moving 1
             return true;
         else if ((from.x - to.x > 1) || (from.x - to.x < -1))
             return false;
         else if ((to.x < 0) || (to.x > 7)) //if killing out of board
             return false;
         else //if killing
             return true;
     }
 }
コード例 #3
0
ファイル: DistUtility.cs プロジェクト: PouryaSohbati/Arioto
	public static int isInOneLine(position pos1, position pos2, position pos3){
		if (pos1.y == pos2.y && pos1.y == pos3.y) // if on the same row
			return 1;
		if (pos1.x == pos2.x && pos1.x == pos3.x) // if on the same column
			return 2; 
		return 0;
	}
コード例 #4
0
ファイル: DistUtility.cs プロジェクト: PouryaSohbati/Arioto
	public static bool isImmediateDiagonal(position pos1, position pos2){
		position dist;
		
		dist = getDistance (pos1, pos2);
		if (dist.x == 1 && dist.y == 1)
			return true;
		return false;
	}
コード例 #5
0
ファイル: DistUtility.cs プロジェクト: PouryaSohbati/Arioto
	public static bool isInRange(position pos1, position pos2, int range){
		position dist;
		
		dist = getDistance (pos1, pos2);
		if (dist.x + dist.y == range && (dist.x == 0 || dist.y == 0))
			return true;
		return false;
	}
コード例 #6
0
ファイル: DistUtility.cs プロジェクト: PouryaSohbati/Arioto
	/*
	 * Returns true if the two passed in 
	 * possitions are next to each other.
	 */
	public static bool isNextTo(position pos1, position pos2){
		position dist;

		dist = getDistance (pos1, pos2);
		if (dist.x + dist.y == 1)
			return true;
		return false;
	}
コード例 #7
0
ファイル: Player.cs プロジェクト: jstriedinger/last_game
 public void changeState(position newPos, bool switchColor)
 {
     pos = newPos;
     if(switchColor)
     {
         current = (current== myWhite?myBlack:myWhite);
         this.renderer.material.SetColor("_Color",current);
     }
 }
コード例 #8
0
	public playerStateNode(playerStateNode original){
		//index = original.index;
		//name = original.name;
		//type = original.type;
		health = original.health;
		damage = original.damage;
		//range = original.range;
		pos = new position(original.pos.x, original.pos.y);
	}
コード例 #9
0
	//public playerStateNode(string _name, string _type, int _health,
	//                       int _damage, int _range, position _pos, int _index = 0){
	public playerStateNode(int _health, int _damage, position _pos){
		//index = _index;
		//name = _name;
		//type = _type;
		health = _health;
		damage = _damage;
		//range = _range;
		pos = new position(_pos.x, _pos.y);
	}
コード例 #10
0
ファイル: DistUtility.cs プロジェクト: PouryaSohbati/Arioto
	public static int distCategorizer(position pos1, position pos2, int range){
		position dist;
		
		dist = getDistance (pos1, pos2);
		if (dist.x + dist.y == range && (dist.x == 0 || dist.y == 0)) //inRange
			return 1;
		if (dist.x == 1 && dist.y == 1) //diagonal
			return 2;
		return 0;
	}
コード例 #11
0
	public playerStateNode(GameObject obj){
		characters attr = obj.GetComponent<characters> ();

		//index = 0;
		//name = obj.name;
		health = attr.health;
		damage = attr.damage;
		//type = attr.entityType;
		//range = attr.range;
		pos = new position (attr.pos.x, attr.pos.y);
	}
コード例 #12
0
ファイル: Filter.cs プロジェクト: rubymatlab/SearchProject
    public static void Load_BaiduHuiZhou()
    {
        /** 一个装载数据的容器List<position> **/
        List<position> postion_data = new List<position>();
        position tem = null;
        for (int j = count; j > 1; j--)
        {
            string html = Rule.RuleBaiduHuiZhou.GetHtmlString(j - 1);
            //string html = Rule.RuleBaiduHuiZhou.GetHtmlString(0);
            /** 将数据匹配出来 **/
            Regex re = new Regex("class=title><a name=job_title(?:\\s|\\S)*?href=\"(?<pos_positionurl>(?:\\s|\\S)*?)\" target=_blank>(?<pos_position>(?:\\s|\\S)*?)</a><br><span class=job_attr>学历:(?<pos_degree>(?:\\s|\\S)*?)</span><span class=job_attr>经验:(?<pos_workexperience>(?:\\s|\\S)*?)</span><span class=job_attr>薪酬:(?<pos_salary>(?:\\s|\\S)*?)</span></td><td>(?<pos_company>(?:\\s|\\S)*?)</td><td>(?<pos_address>(?:\\s|\\S)*?)</td><td>(?<pos_time>(?:\\s|\\S)*?)</td><td><a href=\"(?<pos_fromurl>(?:\\s|\\S)*?)\" target=_blank class=jobsite>(?<pos_from>(?:\\s|\\S)*?)</a></td></tr>", RegexOptions.None);
            MatchCollection mc = re.Matches(html);
            foreach (Match ma in mc)
            {
                tem = new position();
                tem.pos_position = ma.Groups["pos_position"].Value.Trim().Replace("<em>", String.Empty).Replace("</em>", String.Empty);
                tem.pos_positionurl = ma.Groups["pos_positionurl"].Value.Trim();
                tem.pos_companyurl = ma.Groups["pos_companyurl"].Value.Trim();

                tem.pos_company = ma.Groups["pos_company"].Value.Trim().Replace("<em>", String.Empty).Replace("</em>", String.Empty);

                tem.pos_address = ma.Groups["pos_address"].Value.Trim().Replace("<em>", String.Empty).Replace("</em>", String.Empty);

                tem.pos_salary = ma.Groups["pos_salary"].Value.Trim();

                tem.pos_degree = ma.Groups["pos_degree"].Value.Trim();
                tem.pos_workexperience = ma.Groups["pos_workexperience"].Value.Trim();
                tem.pos_time = Convert.ToDateTime(ma.Groups["pos_time"].Value.Trim());
                tem.pos_fromurl = ma.Groups["pos_fromurl"].Value;
                tem.pos_from = ma.Groups["pos_from"].Value.Trim();
                postion_data.Add(tem);
            }
        }

        /** 插入数据库 **/
        foreach (position obj in postion_data)
        {
            using (BLLPosition a = new BLLPosition())
            {
                if (a.Select_Position(obj.pos_positionurl))
                    continue;
                else
                {
                    if (!a.Insert_Position(obj))
                        Util.MessageBox.ShowMessage(a.error);
                }
            }
        }
        return;
    }
コード例 #13
0
ファイル: GameStateTree.cs プロジェクト: PouryaSohbati/Arioto
	public List<position> diagnoller(position defender){
		List<position> p = new List<position>();
		position newP = new position();

		for (int i = -1; i < 2; ++i) {
			if(i == 0) continue;
			for (int j = -1; j < 2; ++j) {
				if(j == 0) continue;
				newP.x = defender.x + i;
				newP.y = defender.y + j;
				if(isValid (newP))
					p.Add (new position(newP));
			}
		}
		return p;
	}
コード例 #14
0
ファイル: DistUtility.cs プロジェクト: PouryaSohbati/Arioto
	public static bool isInbetween(position pos1, position pos2, position pos3){
		int axis;
		
		if ((axis = isInOneLine(pos1, pos2, pos3)) != 0){
			if (axis == 1){
				if((pos2.x > pos1.x && pos2.x < pos3.x) || (pos2.x > pos3.x && pos2.x < pos1.x)){
					return true;
				}
			}
			else if (axis == 2){
				if((pos2.y > pos1.y && pos2.y < pos3.y) || (pos2.y > pos3.y && pos2.y < pos1.y)){
					return true;
				}
			}
		}
		return false;
	}
コード例 #15
0
ファイル: Grid.cs プロジェクト: PouryaSohbati/Arioto
	public void FindPath(position startPos, position targetPos) {
		path = null;
		Node startNode = grid[startPos.x, startPos.y];
		Node targetNode = grid[targetPos.x, targetPos.y];
		
		List<Node> openSet = new List<Node>();
		HashSet<Node> closedSet = new HashSet<Node>();
		openSet.Add(startNode);
		
		while (openSet.Count > 0) {
			Node currentNode = openSet[0];
			for (int i = 1; i < openSet.Count; i ++) {
				if (openSet[i].fCost < currentNode.fCost || 
				    openSet[i].fCost == currentNode.fCost && openSet[i].hCost < currentNode.hCost) {
					currentNode = openSet[i];
				}
			}
			
			openSet.Remove(currentNode);
			closedSet.Add(currentNode);
			
			if (currentNode == targetNode) {
				RetracePath(startNode,targetNode);
				return;
			}
			
			foreach (Node neighbour in GetNeighbours(currentNode)) {
				if (!neighbour.walkable || closedSet.Contains(neighbour)) {
					continue;
				}
				
				int newMovementCostToNeighbour = currentNode.gCost + GetDistance(currentNode, neighbour);
				if (newMovementCostToNeighbour < neighbour.gCost || !openSet.Contains(neighbour)) {
					neighbour.gCost = newMovementCostToNeighbour;
					neighbour.hCost = GetDistance(neighbour, targetNode);
					neighbour.parent = currentNode;
					
					if (!openSet.Contains(neighbour))
						openSet.Add(neighbour);
				}
			}
		}
	}
コード例 #16
0
ファイル: classes.cs プロジェクト: rafalima87/Chess
        public List<position> possibleMoves(position cur)
        {
            List<position> retList = new List<position>();
            position to = cur;

            to.y = to.y + 1;
            if (canMove(cur, to))
                retList.Add(to);
            to.x = to.x + 1;
            if (canMove(cur, to))
                retList.Add(to);
            to.x = to.x - 2;
            if (canMove(cur, to))
                retList.Add(to);
            to.x = to.x + 1;
            to.y = to.y + 1;
            if (canMove(cur, to))
                retList.Add(to);
            return retList;
        }
コード例 #17
0
ファイル: EKFL5.cs プロジェクト: pochuntsai/navi-service
        private Single[,] Xk, Xke; // state

        #endregion Fields

        #region Constructors

        public class_EKFL5(Single x, Single y, Single theta,int anchor_num)
        {
            tag.X = x;
            tag.Y = y;
            tag.Theta = theta;
            tag_old = tag;
            dim = anchor_num;

            Anchor = new class_Anchors[dim];
            R = new Single[dim, dim];
            Q = new Single[2, 2]{{3f,0f},{0f,3f}};
            for (i = 0; i < dim; i++)
            {
                for (j = 0; j < dim; j++)
                {
                    if (i == j) R[i,j] = 20f;
                    else R[i,j] = 0f;
                }
            }
            Po = new Single[2, 2] { { 1, 0 }, { 0, 1 } };
            ResetVariables();
        }
コード例 #18
0
ファイル: draggable.cs プロジェクト: PouryaSohbati/Arioto
	private bool isValidMove(){
		position pos;

		if((this.transform.localPosition.x > (40*6) || this.transform.localPosition.x < 0) || 
		   (this.transform.localPosition.y > (40*9) || this.transform.localPosition.y < 0)){
			return false;
		}

		if(GM.collisionCheck(this.gameObject)){
			return false;
		}

		pos = new position (Mathf.RoundToInt(this.gameObject.transform.localPosition.x / 40),
		                    Mathf.RoundToInt(this.gameObject.transform.localPosition.y / 40));

		GM.g.FindPath (this.GetComponent<characters> ().pos, pos);

		//GM.g.printPath ();
		if(GM.g.path == null)
			return false;

		return true;
	}
コード例 #19
0
ファイル: Form1.cs プロジェクト: sristy18/car_project
 private void button4_Click(object sender, EventArgs e)
 {
     objpos = position.Down;
     carpanel.Invalidate();
 }
コード例 #20
0
 : base(1, 1, font) => Initialize(position, layer, isWalkable, isTransparent);
コード例 #21
0
 public Worker(position position)
 {
     tasks         = new List <ITask>();
     this.position = position;
 }
コード例 #22
0
 AddPose(position, rotation);
コード例 #23
0
ファイル: el_omnibox.cs プロジェクト: smorey2/litehtml.net
 public override void draw(object hdc, int x, int y, int z, position clip)
 {
     base.draw(hdc, x, y, z, clip);
     _edit.Update();
 }
コード例 #24
0
 var(west, _, _)  = GetNeighborTile(position, WangDirection.West);
コード例 #25
0
        public void draw_text(object hdc, string text, object hFont, web_color color, position pos)
        {
            var root = (GameObject)hdc;
            var font = ((UnityFont)hFont).Font;
            var obj  = new GameObject("Text");

            obj.transform.SetParent(root.transform);
            obj.transform.localPosition = ToUnityVector(new Vector3(pos.left, pos.top, pos.depth));
            //obj.transform.localScale = new Vector3(1, 1, 0);
            var textMesh = obj.AddComponent <TextMesh>();

            textMesh.font  = font;
            textMesh.text  = text;
            textMesh.color = new Color(color.red, color.green, color.blue);
            var mat = obj.GetComponent <MeshRenderer>().material;

            mat.mainTexture = font.material.mainTexture;
            mat.shader      = Shader.Find("GUI/3D Text Shader");
        }
コード例 #26
0
     : super(codeErrorManager, text, position, length, line, column) {
 }
コード例 #27
0
 base.OnGUI(position, property, label, fieldInfo);
コード例 #28
0
 set => SetBit(position, value);
コード例 #29
0
 public bool Exist(position param)
 {
     return(db.position.Any(x => x.position_name == param.position_name));
 }
コード例 #30
0
        //------------------- METHODS ----------------------------------------------------------------------------------------------------
        //This method has to start the generator thread
        public static void StartEngine(Configuration configuration)
        {
            int    i = 0;
            double x, y, minX, minY, maxX, maxY;
            double probability;
            string mac, SSID = "ci piace lo stub", conf_id = configuration.ConfigurationID;
            Random rand = new Random();

            generate_condition = true;

            //Here I generate all the macs to be used by the thread
            while (i < counter)
            {
                mac = MAC_generator();
                if (!MACs.Contains(mac))
                {
                    MACs.Add(mac);
                    i++;
                }
            }

            minX = configuration.Boards.Select(b => b.X).Min();
            minY = configuration.Boards.Select(b => b.Y).Min();
            maxX = configuration.Boards.Select(b => b.X).Max();
            maxY = configuration.Boards.Select(b => b.Y).Max();

            //Here I instanciate and start the thread
            dataGenerator = new Thread(() =>
            {
                while (generate_condition)
                {
                    //Entering in te atomic block
                    Monitor.Enter(_lock);

                    using (var db = new DBmodel())
                    {
                        for (int j = 0; j < counter; j++)
                        {
                            //Generating the data to use
                            probability = rand.NextDouble();
                            if (probability < 0.9)
                            {
                                int index = rand.Next(0, counter);
                                mac       = MACs[index];
                            }
                            else
                            {
                                mac = MACs[j];
                                while (MACs.Contains(mac))
                                {
                                    mac = MAC_generator();
                                }
                            }
                            x = rand.NextDouble() * (maxX - minX) + minX;
                            y = rand.NextDouble() * (maxY - minY) + minY;

                            //inserting the data on the DB
                            position pos = new position
                            {
                                configuration_id = conf_id,
                                MACaddress       = mac,
                                SSID             = SSID,
                                timestamp        = DateTime.Now.Subtract(new TimeSpan(0, 0, rand.Next(0, 60))),
                                x = x,
                                y = y
                            };
                            db.position.AddOrUpdate(pos);
                        }
                        db.SaveChanges();
                    }

                    //Setting the wait for 1 minute
                    Monitor.Wait(_lock, new TimeSpan(0, 1, 0));
                }
            });
            dataGenerator.Start();
        }
コード例 #31
0
ファイル: GameStateTree.cs プロジェクト: PouryaSohbati/Arioto
	public List<position> attacker(int range, position defender){
		List<position> p = new List<position>();
		position newP = new position();
		
		for (int i = -1; i < 2; ++i) {
			for (int j = -1; j < 2; ++j) {
				if (Mathf.Abs(i) == Mathf.Abs(j)) continue;
				newP.x = defender.x + i*range;
				newP.y = defender.y + j*range;
				if(isValid (newP))
					p.Add (new position(newP));
			}
		}
		return p;
	}
コード例 #32
0
 void draw_bmp(GameObject hdc, Texture tex, position pos) => hdc_DrawImage(hdc, tex, pos.left, pos.top, pos.depth);
コード例 #33
0
ファイル: GameStateTree.cs プロジェクト: PouryaSohbati/Arioto
	public bool isValid(position pos){
		if ((pos.x > -1 && pos.x < 7) && (pos.y > -1 && pos.y < 10)) {
			return true;
		} else
			return false;
	}
コード例 #34
0
 public void draw_borders(object hdc, borders borders, position draw_pos, bool root = false)
 {
 }
コード例 #35
0
 private static extern void sendWallMessage(IntPtr port, [MarshalAs(UnmanagedType.LPStr)] String sayit, position pos, mode style,  colour col, specialStyle special, bool dumppkt);
コード例 #36
0
        public void draw_image(object hdc, string src, string baseurl, Dictionary <string, string> attrs, position pos)
        {
            var gdi = (Graphics)hdc;

            apply_clip(gdi);
            make_url(src, baseurl, out var url);
            if (_images.TryGetValue(url, out var img) && img is Bitmap bmp)
            {
                draw_bmp(gdi, bmp, pos);
            }
            release_clip(gdi);
        }
コード例 #37
0
 public void Move(IInteractive target, in Point position, InputModifiers modifiers = default) => Move(target, target, position, modifiers);
コード例 #38
0
 void draw_bmp(Graphics hdc, Bitmap bmp, position pos)
 {
     hdc.InterpolationMode = InterpolationMode.NearestNeighbor;
     hdc.PixelOffsetMode   = PixelOffsetMode.Half;
     hdc.DrawImage(bmp, pos.x, pos.y, pos.width, pos.height);
 }
コード例 #39
0
 dust2           = Main.dust[Dust.NewDust(position, projectile.width, projectile.height, ModContent.DustType <Dusts.ShroomDust>(), 0, 0, 0, default, 1f)];
コード例 #40
0
 public TestClass ReturnValue(position p)
 {
     lock (_syncRoot)
     {
コード例 #41
0
 public CUIInput(Vector2i position, Vector2i size) => new CUIText(position, size, string.Empty);
コード例 #42
0
ファイル: Player.cs プロジェクト: jstriedinger/last_game
 void Start()
 {
     disToGround = collider.bounds.extents.y;
     current = myBlack;
     pos = position.hor_normal;
 }
コード例 #43
0
 : base(foreground, background, glyph) => Initialize(position, layer, isWalkable, isTransparent);
コード例 #44
0
 public static Position ToBusiness(this position item) //for read
 {
     return(AutoMapper.Mapper.Instance.Map <position, Position>(item).CompleteCreate(item));
 }
コード例 #45
0
 : base(animation) => Initialize(position, layer, isWalkable, isTransparent);
コード例 #46
0
 // Functions
 public Cube(position, color); // Constructor
コード例 #47
0
     : super(position, type) {
     this.method = method;
     this.annotations = new ArrayList<AnnotationValue>();
 }
コード例 #48
0
ファイル: Light.cs プロジェクト: Serkket/space-station-14
 get => new LocalCoordinates(position, GridID, MapID);
コード例 #49
0
ファイル: GameStateTree.cs プロジェクト: PouryaSohbati/Arioto
	/*public List<position> attacker(int range, position defender){
		List<position> p = new List<position>();
		position newP = new position();

		for (int i = -1; i < 2; ++i) {
			if(i == 0) continue;
			newP.x = defender.x + i*range;
			newP.y = defender.y;
			if(isValid (newP))
				p.Add (new position(newP));
			newP.y = defender.y + i*range;
			newP.x = defender.x;
			if(isValid (newP))
				p.Add (new position(newP));
		}
		return p;
	}*/

	private bool CanGoTo(position pos, ref ListState states){
		for (int i = 0; i < states.players.Count; ++i) {
			if(pos.Equals(states.players[i].pos))
				return false;
		}
		for (int i = 0; i < states.enemies.Count; ++i) {
			if(pos.Equals(states.enemies[i].pos))
				return false;
		}
		return true;
	}
コード例 #50
0
ファイル: MainForm.cs プロジェクト: Molmed/ChiasmaTools
 public PositionBlock(position first, position last)
 {
     MyFirstPos = first;
     MyLastPos  = last;
 }
コード例 #51
0
ファイル: container_cairo.cs プロジェクト: smorey2/h3ml
 public void set_clip(position pos, border_radiuses bdr_radius, bool valid_x, bool valid_y)
 {
 }
コード例 #52
0
ファイル: Process.cs プロジェクト: Jeuro/inte13s-eye-tracking
        // Reload eye-tracker input at regular interval from timer
        private void t_Tick(object sender, EventArgs e)
        {
            data = comm.GetData();
            if (!eyeSelected)
                timeOffset += Process.clock;

            this.iSaw = this.iSee;
            this.whereIsEye();

            if (!eyeSelected)
            {
                if (this.iSee != position.NONE)
                {
                    if (this.iSee != this.iSaw)
                    {
                        this.Visible = true;
                        this.timeOffset = 0;
                        this.Invalidate();
                    }
                    else if (timeOffset >= Process.timeToSelect)
                    {
                        eyeSelected = true;

                        this.Region = new Region(menuRect);

                        if (this.m[(int)iSee] == null)
                            m[(int)iSee] = new Menu(this.iSee, scrpthndl, items[(int)iSee, 0], items[(int)iSee, 1], items[(int)iSee, 2]);

                        this.Visible = true;
                        timeOffset = 0;
                        this.Controls.Add(m[(int)iSee]);
                        m[(int)iSee].Dock = DockStyle.Fill;
                        this.Invalidate();

                    }
                    if (this.WindowState == FormWindowState.Minimized)
                        this.WindowState = FormWindowState.Maximized;

                }
                else if (this.WindowState == FormWindowState.Maximized)
                {
                    this.WindowState = FormWindowState.Minimized;
                    timeOffset = 0;
                    this.Visible = false;
                    this.Invalidate();
                }
            }
            else if (resetMode)
            {
                eyeSelected = false;
                this.WindowState = FormWindowState.Minimized;
                this.Controls.Remove(this.m[(int)this.iSee]);
                this.Visible = false;
                this.Region = new Region(emptyRect);
                resetMode = false;
                this.Invalidate();
            }
        }
コード例 #53
0
        private void friendlySendWallMessage(String sayit, position pos, mode useMode, colour col, specialStyle useStyle)
        {
            IntPtr portHwd = IntPtr.Zero;
            if (string.IsNullOrEmpty(_options.port))
                throw new NullReferenceException("No Port set for wallboard");
            try
            {
                portHwd = connectWallboard(_options.port);
                sendWallMessage(portHwd, sayit, pos, useMode, col, useStyle, false);

            }
            catch(wallboardException ex)
            {
                errorHandler(ex);
            }
            catch (Exception ex)
            {
                _options.state = wallboardErrorState.Unknown;
                //attempt to get additional info about the error if the handle was successfully opened
                if (portHwd != IntPtr.Zero)
                    _options.state = checkWallboardErrorState(portHwd);
                errorHandler(new wallboardException("An exception occurred while sending " + sayit + " to the wallboard", _options.state, ex));
            }
            finally
            {
                friendlyClosePort(ref portHwd);
            }
        }
コード例 #54
0
ファイル: Process.cs プロジェクト: Jeuro/inte13s-eye-tracking
        // Getting the position of where the user loooks
        private void whereIsEye()
        {
            if (data.x != null)
                this.miraX = (float)data.x * screenW;
            if (data.y != null)
                this.miraY = (float)data.y * screenH;

            if (eyeSelected)
            {
                // Is inside the circle?
                if ((miraY >= screenH / 2 - rectH / 2) && (miraY <= screenH / 2 + rectH / 2))
                {
                    if (miraX <= rectW)
                        m[(int)this.iSee].selected(sel.LEFT);
                    else if (miraX <= screenW / 2 + rectW / 2)
                        m[(int)this.iSee].selected(sel.CENTER);
                    else
                        m[(int)this.iSee].selected(sel.RIGHT);

                    timeOffset = 0;
                }
                else
                {
                    timeOffset += Process.clock;
                    m[(int)this.iSee].selected(sel.NONE);

                    if (timeOffset >= timeToSelect)
                    {
                        eyeSelected = false;
                        this.Region = new Region(emptyRect);
                        this.Controls.Remove(this.m[(int)this.iSee]);
                        this.iSee = position.NONE;
                        timeOffset = 0;
                    }
                }
            }
            else if (data != null)
            {

                if ((miraY <= Process.rectH) && (miraX >= (screenW / 2) - (rectW / 2)) && (miraX <= (screenW / 2) + (rectW / 2)))
                {
                    this.iSee = (int)position.UP;
                    if (this.iSee != this.iSaw)
                        this.Region = new Region(Process.rectU);
                }
                else if ((miraY >= (screenH / 2) - (rectW / 2)) && (miraY <= (screenH / 2) + (rectW / 2)) && (miraX <= rectH))
                {
                    this.iSee = position.LEFT;
                    if (this.iSee != this.iSaw)
                        this.Region = new Region(Process.rectL);
                }
                else if ((miraY >= (screenH / 2) - (rectW / 2)) && (miraY <= (screenH / 2) + (rectW / 2)) && (miraX >= (screenW - rectH)))
                {
                    this.iSee = position.RIGHT;
                    if (this.iSee != this.iSaw)
                        this.Region = new Region(Process.rectR);
                }
                else if ((miraY >= screenH - rectH) && (miraX >= (screenW / 2) - (rectW / 2)) && (miraX <= (screenW / 2) + (rectW / 2)))
                {

                    this.iSee = position.DOWN;
                    if (this.iSee != this.iSaw)
                        this.Region = new Region(Process.rectB);
                }
                else
                {
                    this.iSee = position.NONE;
                    if (this.iSee != this.iSaw)
                        this.Region = new Region(Process.emptyRect);
                }
            }
        }
コード例 #55
0
 public static wallboardErrorState testWallboardConnectivity(string port, position testPos, mode testMode, colour testCol, specialStyle testSpecial)
 {
     if (string.IsNullOrEmpty(port))
         throw new Exception("No port set for wallboard");
     IntPtr portHwd = IntPtr.Zero;
     wallboardErrorState state;
     try
     {
         portHwd = connectWallboard(port);
         if (portHwd == IntPtr.Zero)
             return wallboardErrorState.Unknown;
         state = checkWallboardErrorState(portHwd);
         if (state == wallboardErrorState.None)
         {
             sendWallMessage(portHwd, "Hello World", testPos, testMode, testCol, testSpecial, false);
         }
     }
     finally
     {
         friendlyClosePort(ref portHwd);
     }
     return state;
 }
コード例 #56
0
ファイル: TileFont.cs プロジェクト: egshels/Sources
 DrawChar(position, value, mode);
コード例 #57
0
 public virtual void get_client_rect(out position client) => throw new NotImplementedException();
コード例 #58
0
ファイル: RobotK79.cs プロジェクト: UsachevSergey/Olimp
 private void LeaveAMark(position p)
 {
     ListPosition.Add(p);
 }
コード例 #59
0
 private static position createPosition(int x, int y, direction direction)
 {
     position newPosition = new position();
     newPosition.x = x;
     newPosition.y = y;
     newPosition.direction = direction;
     return newPosition;
 }
コード例 #60
0
        public void draw_text(object hdc, string text, object hFont, web_color color, position pos)
        {
            // https://stackoverflow.com/questions/6391911/c-sharp-winforms-anyone-know-of-a-c-sharp-gdi-library-not-slow-gdi
            var gdi = (Graphics)hdc;

            apply_clip(gdi);
            //var rcText = new Rectangle(pos.left, pos.top, pos.right, pos.bottom);
            TextRenderer.DrawText(gdi, text, (Font)hFont, new Point(pos.left, pos.top), Color.FromArgb(color.red, color.green, color.blue));
            //var rcText = new RectangleF(pos.left, pos.top, pos.right, pos.bottom);
            //var format = new StringFormat();
            //using (var brush = new SolidBrush(Color.FromArgb(color.red, color.green, color.blue)))
            //    gdi.DrawString(text, (Font)hFont, brush, rcText, format);
            release_clip(gdi);
        }