private void update() { if (uguiHitUI.uiHited == true) { return; } if (Input.GetMouseButtonDown(0) == true) { //disView = null; Vector2 v2 = inputCamera.ScreenToWorldPoint(Input.mousePosition); colli = Physics2D.OverlapPoint(v2); } else if (Input.GetMouseButtonUp(0) == true) { if (colli == null) { return; } Vector2 v2 = inputCamera.ScreenToWorldPoint(Input.mousePosition); Collider2D colli2 = Physics2D.OverlapPoint(v2); if (colli2 == colli) { WallView view = colli.GetComponent <WallView>(); if (view != null) { disView = view; view2D.selectGoodsdisedWalldata = view.data; OpenDisInput(); RefreshView(); } } } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "brick") { BrickView _brickView; _brickView = collision.gameObject.GetComponent <BrickView>(); _brickView.PerformDamage(1f); _brickView.addScore(_brickView.getColor()); _brickView.DestroyBrick(); } if (collision.gameObject.tag == "Player") { //collision.gameObject _ballController.AngleChange(_ballController.CalcBallAngleReflect(collision)); _playerView = collision.gameObject.GetComponent <PlayerView>(); _playerView.addJogada(); } else { //_brickView.PerformDamage(1); _ballController.PerfectAngleReflect(collision); } if (collision.gameObject.tag == "Wall") { _wallView = collision.gameObject.GetComponent <WallView>(); SoundController.PlayhitGround(); _wallView.hitLive(); } }
public void Move(float h, float v, Camera camera) { if (_tweening && !Dead) { return; } Vector3 forward = camera.transform.forward; Vector3 velocity = (camera.transform.right * h + new Vector3(forward.x, 0, forward.z) * v); if (Model.OnWall) { Vector3 pos = transform.position; WallView wallView = GameManager.Instance.MapView.WallView; // TODO: bug here, can't turn corners, mrrrrr if (!wallView.OnWall(pos + new Vector3(velocity.x, 0, 0))) { velocity = new Vector3(0, velocity.y, velocity.z); } if (!wallView.OnWall(pos + new Vector3(0, 0, velocity.z))) { velocity = new Vector3(velocity.x, velocity.y, 0); } /* * XY worldCoord = new XY((int)transform.position.x, (int)transform.position.z); * XY mapCoord = GameManager.Instance.MapView.GetMapCoordFromWorldCoord(worldCoord); * * Wall wall = GameManager.Instance.GameModel.Map.Wall; * bool hori = wall.OnHorizontal(mapCoord); * bool vert = wall.OnVertical(mapCoord); * float wallBound = wall.Radius * GameConfig.BLOCK_SIZE; * * SnapToWall(wall, hori, vert); * * // TODO: there HAS to be a better way to handle this...clean it up * if(hori && !vert || (velocity.z < 0 && transform.position.z == -wallBound) || (velocity.z > 0 && transform.position.z == wallBound)) * velocity = new Vector3(velocity.x, velocity.y, 0); * * if(vert && !hori || (velocity.x < 0 && transform.position.x == -wallBound) || (velocity.x > 0 && transform.position.x == wallBound)) * velocity = new Vector3(0, velocity.y, velocity.z); */ } rigidbody.velocity = velocity * 50.0f; }
public IEnumerable <WallView> GetMazeWallsViews() { var walls = new List <WallView>(); for (int i = 0; i < _Maze.QuantityOfSquares; i++) { for (int j = 0; j < _Maze.QuantityOfSquares; j++) { if (ShouldBeWallBetween(i, j)) { var(x1, y1, x2, y2) = GetEndpointsOfWall(i, j); var wall = new WallView(new WallViewModel(x1, y1, x2, y2)); walls.Add(wall); } } } return(walls); }
private void phoneUpdate() { if (uguiHitUI.uiHited == true) { return; } if (Input.touchCount != 1) { oldTouchCount = Input.touchCount; return; } Touch touch = Input.GetTouch(0); if (oldTouchCount > 1 || touch.phase == TouchPhase.Began) { //disView = null; Vector2 v2 = inputCamera.ScreenToWorldPoint(touch.position); colli = Physics2D.OverlapPoint(v2); } else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled) { if (colli == null) { return; } Vector2 v2 = inputCamera.ScreenToWorldPoint(touch.position); Collider2D colli2 = Physics2D.OverlapPoint(v2); if (colli2 == colli) { WallView view = colli.GetComponent <WallView>(); if (view != null) { disView = view; view2D.selectGoodsdisedWalldata = view.data; OpenDisInput(); RefreshView(); } } } oldTouchCount = Input.touchCount; }
private Grid GetBorderWalls() { var borderWalls = new Grid(); //top border var wall = new WallView(new WallViewModel(_Settings.StartXPos, _Settings.StartYPos, _Settings.StartXPos + _Settings.MazeWidth - 1, _Settings.StartYPos)); borderWalls.Children.Add(wall); //bot border wall = new WallView(new WallViewModel(_Settings.StartXPos, _Settings.StartYPos + _Settings.MazeHeight - 1, _Settings.StartXPos + _Settings.MazeWidth - 1, _Settings.StartYPos + _Settings.MazeHeight - 1)); borderWalls.Children.Add(wall); //left border wall = new WallView(new WallViewModel(_Settings.StartXPos, _Settings.StartYPos, _Settings.StartXPos, _Settings.StartYPos + _Settings.MazeHeight - 1)); borderWalls.Children.Add(wall); //right border wall = new WallView(new WallViewModel(_Settings.StartXPos + _Settings.MazeWidth - 1, _Settings.StartYPos, _Settings.StartXPos + _Settings.MazeWidth - 1, _Settings.StartYPos + _Settings.MazeHeight - 1)); borderWalls.Children.Add(wall); return(borderWalls); }
public void SetObjWithData(WallData walldata, GameObject wallbody, GameObject wallLeft, GameObject wallRight, GameObject wallEnd1, GameObject wallEnd2, out List <Vector2> v2s) { //walldata边线形成的 多边形 的 顶点集合 v2s = wallfunc.GetWallVerticesPos(walldata); linefunc.SetLine(v2s[1], v2s[2], wallRight, prefabs.size); linefunc.SetLine(v2s[4], v2s[5], wallLeft, prefabs.size); if (data.GetNearestPoints(walldata.point1).Count == 1) { if (wallEnd1.activeSelf == false) { wallEnd1.SetActive(true); } linefunc.SetLine(v2s[1], v2s[5], wallEnd1, prefabs.size); } else { wallEnd1.SetActive(false); } if (data.GetNearestPoints(walldata.point2).Count == 1) { if (wallEnd2.activeSelf == false) { wallEnd2.SetActive(true); } linefunc.SetLine(v2s[2], v2s[4], wallEnd2, prefabs.size); } else { wallEnd2.SetActive(false); } Vector3 pos = v2s[0]; float angle = linefunc.GetAngle(v2s[3] - v2s[0]); wallbody.transform.localPosition = new Vector3(pos.x, pos.y, wallbody.transform.localPosition.z); wallbody.transform.localRotation = Quaternion.Euler(Vector3.forward * (angle - 90)); WallView view = wallbody.GetComponent <WallView>(); if (view == null) { Debug.LogWarning("wallbody.GetComponent<PointView>() == null"); } view.SetData(walldata); List <Vector2> newV2s = wallfunc.GetWallVerticesLocalPos(v2s, walldata.width, prefabs.size); linefunc.SetMesh(newV2s, wallbody); if (selectObjData == walldata) { if (selectWall == null) { selectWall = prefabs.GetNewInstance_selectWall().gameObject; } linefunc.SetMesh(newV2s, selectWall); selectWall.transform.localPosition = wallbody.transform.localPosition - Vector3.forward; selectWall.transform.localRotation = wallbody.transform.localRotation; selectWall.SetActive(true); } if (selectObjData is ProductData && selectGoodsdisedWalldata == walldata) { if (selectDisedwall == null) { selectDisedwall = prefabs.GetNewInstance_selectWall().gameObject; } linefunc.SetMesh(newV2s, selectDisedwall); selectDisedwall.transform.localPosition = wallbody.transform.localPosition - Vector3.forward; selectDisedwall.transform.localRotation = wallbody.transform.localRotation; selectDisedwall.SetActive(true); } }
public override void OnCreate() { view = ObjectView.Create<WallView> (this, "#", Color.white); }
protected override void OnCreate(Bundle bundle) { this.Window.AddFlags(WindowManagerFlags.Fullscreen); base.OnCreate(bundle); SetContentView(Resource.Layout.MainView); vm = this.ViewModel as MainViewModel; vm.PropertyChanged += Vm_PropertyChanged; loWallView = new WallView(this); currentIndexLO = 0; LinearLayout linearMainLayout = FindViewById<LinearLayout>(Resource.Id.left_drawer); /*scrollIndice = new ScrollView (this); scrollIndice.LayoutParameters = new ScrollView.LayoutParams (-1,400); linearContentIndice = new LinearLayout (this); linearContentIndice.LayoutParameters = new LinearLayout.LayoutParams (-1, 800); linearContentIndice.Orientation = Orientation.Vertical; linearContentIndice.SetBackgroundColor (Color.Red); scrollIndice.AddView (linearContentIndice); */ var metrics = Resources.DisplayMetrics; widthInDp = ((int)metrics.WidthPixels); heightInDp = ((int)metrics.HeightPixels); Configuration.setWidthPixel (widthInDp); Configuration.setHeigthPixel (heightInDp); task = new TaskView (this); iniMenu (); mToolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar); SetSupportActionBar(mToolbar); mToolbar.SetNavigationIcon (Resource.Drawable.hamburger); mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout); mLeftDrawer = FindViewById<LinearLayout>(Resource.Id.left_drawer); mRightDrawer = FindViewById<LinearLayout>(Resource.Id.right_drawer); mLeftDrawer.Tag = 0; mRightDrawer.Tag = 1; frameLayout = FindViewById<FrameLayout> (Resource.Id.content_frame); main_ContentView = new RelativeLayout (this); main_ContentView.LayoutParameters = new RelativeLayout.LayoutParams (-1, -1); // main_ContentView.AddView (scrollIndice); //main_ContentView.AddView(linearContentIndice); LOContainerView LOContainer = new LOContainerView (this); //main_ContentView.AddView (LOContainer); //WallView wallview = new WallView(this); //wallview.OpenLO.Click += Lo_ImagenLO_Click; //lo.OpenTasks.Click += ListTasks_ItemClick; //wallview.OpenChat.Click += imBtn_Chat_Click; //wallview.OpenUnits.Click += imBtn_Units_Click; loWallView.OpenChat.Click += imBtn_Chat_Click; loWallView.OpenUnits.Click += imBtn_Units_Click; main_ContentView.AddView (loWallView); frameLayout.AddView (main_ContentView); RelativeLayout RL = FindViewById<RelativeLayout> (Resource.Id.main_view_relativeLayoutCL); Drawable dr = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/nubeactivity.png"), 768, 1024, true)); RL.SetBackgroundDrawable (dr); dr = null; //seting up chat view content title_view = FindViewById<TextView> (Resource.Id.chat_view_title); info1= FindViewById<TextView> (Resource.Id.chat_view_info1); info2 = FindViewById<TextView> (Resource.Id.chat_view_info2); title_list = FindViewById<TextView> (Resource.Id.chat_list_title); mListViewChat = FindViewById<ListView> (Resource.Id.chat_list_view); title_view.SetX (Configuration.getWidth(74)); title_view.SetY (Configuration.getHeight (202)); title_view.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); title_view.SetTypeface (null, TypefaceStyle.Bold); info1.SetX (Configuration.getWidth (76)); info1.SetY (Configuration.getHeight (250)); info1.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); info2.SetX (Configuration.getWidth (76)); info2.SetY (Configuration.getHeight (285)); info2.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); title_list.SetX (Configuration.getWidth (76)); title_list.SetY (Configuration.getHeight (391)); title_list.Typeface = Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf"); title_list.SetTypeface (null, TypefaceStyle.Bold); mListViewChat.SetX (0); mListViewChat.SetY (Configuration.getHeight (440)); //end setting linearMainLayout.AddView (mainLayout); vm.PropertyChanged += new PropertyChangedEventHandler(logout_propertyChanged); RegisterWithGCM(); mDrawerToggle = new MyActionBarDrawerToggle( this, //Host Activity mDrawerLayout, //DrawerLayout Resource.String.openDrawer, //Opened Message Resource.String.closeDrawer //Closed Message ); mDrawerLayout.SetDrawerListener(mDrawerToggle); SupportActionBar.SetHomeButtonEnabled (true); SupportActionBar.SetDisplayShowTitleEnabled(false); mDrawerToggle.SyncState(); if (bundle != null) { if (bundle.GetString("DrawerState") == "Opened") { SupportActionBar.SetTitle(Resource.String.openDrawer); } else { SupportActionBar.SetTitle(Resource.String.closeDrawer); } } else { SupportActionBar.SetTitle(Resource.String.closeDrawer); } initListCursos (); iniPeoples (); initListTasks (); //main_ContentView.AddView (scrollIndice); }
public void Awake() { _groundView = GameObject.Find("GroundView"); WallView = GameObject.Find("WallView").GetComponent <WallView>(); }
public void Awake() { _groundView = GameObject.Find("GroundView"); WallView = GameObject.Find("WallView").GetComponent<WallView>(); }
private void Form1_Load(object sender, EventArgs e) { _tankView = new TankView(_areaView.TankNumber); _wallView = new WallView(_areaView.AreaSize.Height, _areaView.AreaSize.Width); tankPoint = TankStart(1); }
public Wall(WallView view, Vector2 position) { View = view; Position = position; }
protected override void OnCreate(Bundle bundle) { this.Window.AddFlags(WindowManagerFlags.Fullscreen); base.OnCreate(bundle); SetContentView(Resource.Layout.MainView); player = new Android.Media.MediaPlayer(); _currentCurso = 0; _lectorOpen = false; _mapOpen = false; _playerOn = false; _isHome = false; headersDR.Add (new BitmapDrawable (getBitmapFromAsset("images/header1.png"))); headersDR.Add (new BitmapDrawable (getBitmapFromAsset("images/header2.png"))); headersDR.Add (new BitmapDrawable (getBitmapFromAsset("images/header3.png"))); headersDR.Add (new BitmapDrawable (getBitmapFromAsset("images/header4.png"))); drBack = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("images/fondocondiagonalm.png"), 640, 1136, true)); vm = this.ViewModel as MainViewModel; lo = new WallView(this); frontView = new frontView (this); lector = new FrontContainerViewPager (this); //map = new MapView (this); frontView._listLinearItem [0].Click += delegate {showRutas ();}; frontView._listLinearItem [1].Click += delegate {showServicios ();}; frontView._listLinearItem [2].Click += delegate {showGuiaSilvestre ();}; frontView._listLinearItem [3].Click += delegate {showCifras ();}; LinearLayout linearMainLayout = FindViewById<LinearLayout>(Resource.Id.left_drawer); var metrics = Resources.DisplayMetrics; widthInDp = ((int)metrics.WidthPixels); heightInDp = ((int)metrics.HeightPixels); Configuration.setWidthPixel (widthInDp); Configuration.setHeigthPixel (heightInDp); pausePlayer = Bitmap.CreateScaledBitmap(getBitmapFromAsset("icons/pause.png"),Configuration.getWidth(60),Configuration.getWidth(60),true); task = new TaskView (this); initRutas (); initLinearInfo (); iniMenu (); mToolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar); SetSupportActionBar(mToolbar); mToolbar.SetNavigationIcon (Resource.Drawable.transparent); mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout); mLeftDrawer = FindViewById<LinearLayout>(Resource.Id.left_drawer); //mRightDrawer = FindViewById<LinearLayout>(Resource.Id.right_drawer); mLeftDrawer.Tag = 0; //mRightDrawer.Tag = 1; frameLayout = FindViewById<FrameLayout> (Resource.Id.content_frame); main_ContentView = new RelativeLayout (this); main_ContentView.LayoutParameters = new RelativeLayout.LayoutParams (-1, -1); lo.header.SetBackgroundDrawable (headersDR[1]); main_ContentView.AddView (lo); lo.getWorkSpaceLayout.AddView (frontView); frameLayout.AddView (main_ContentView); //RL.SetBackgroundDrawable (dr); //seting up chat view content //title_view = FindViewById<TextView> (Resource.Id.chat_view_title); linearMainLayout.AddView (mainLayout); vm.PropertyChanged += new PropertyChangedEventHandler(logout_propertyChanged); RegisterWithGCM(); mDrawerToggle = new MyActionBarDrawerToggle( this, //Host Activity mDrawerLayout, //DrawerLayout Resource.String.openDrawer, //Opened Message Resource.String.closeDrawer //Closed Message ); mDrawerLayout.SetDrawerListener(mDrawerToggle); SupportActionBar.SetHomeButtonEnabled (true); SupportActionBar.SetDisplayShowTitleEnabled(false); mDrawerToggle.SyncState(); if (bundle != null) { if (bundle.GetString("DrawerState") == "Opened") { SupportActionBar.SetTitle(Resource.String.openDrawer); } else { SupportActionBar.SetTitle(Resource.String.closeDrawer); } } else { SupportActionBar.SetTitle(Resource.String.closeDrawer); } initListCursos (); initListTaskTop (); initListTaskBotton (); viewPager = new ViewPager (this); viewPager.SetOnPageChangeListener (new MyPageChangeListenerPager (this, listFrontPager)); }
public void AnalyzeCollidedObjects(BallView ballView, WallView wallView) { //AnalyzeCollidedObjects(BallView ballView, wallView); }
static void Main(string[] args) { DummyData myDummyData = new DummyData(); myDummyData.SeedData(); _userService = new UserService(); _users = _userService.Get(); _postService = new PostService(); _posts = _postService.Get(); Console.Write("Please enter your name to log in: "); string loggedInUserName = Console.ReadLine(); var loggedInUser = _userService.GetUserByName(loggedInUserName); if (loggedInUser == null) { Console.WriteLine("No existing users goes by that name."); } else { Console.WriteLine(""); Console.WriteLine("---------------------------------------------------------------------------------------------------------"); Console.WriteLine(""); Console.WriteLine("About - Page"); Console.WriteLine(""); Console.WriteLine("Name: " + loggedInUser.Name + ", Gender: " + loggedInUser.Gender + ", Age: " + loggedInUser.Age); Console.WriteLine(" * Follows:"); foreach (var fu in loggedInUser.FollowedUsers) { Console.WriteLine(" - " + fu.Name); } Console.WriteLine(" * Blocks:"); foreach (var bu in loggedInUser.BlockedUsers) { Console.WriteLine(" - " + bu.Name); } Console.WriteLine(""); Console.WriteLine(" * Circles: "); foreach (var cl in loggedInUser.Circles) { Console.WriteLine(" - " + cl.CircleName); } Console.WriteLine(""); while (true) { Console.WriteLine("Menu - Page"); Console.WriteLine(""); Console.WriteLine(" - Show user-feed (1)"); Console.WriteLine(" - Show user-wall (2)"); Console.WriteLine(" - Make post (3)"); Console.WriteLine(" - Make Comment (4)"); Console.WriteLine(" - Delete all posts (5)"); Console.WriteLine(""); Console.Write("Please 1, 2, 3, 4 or 5 to make use of TheSocialNetworks functionallities: "); string menuNavigation = Console.ReadLine(); Console.WriteLine(""); Console.WriteLine("---------------------------------------------------------------------------------------------------------"); Console.WriteLine(""); FeedView myFeedView = new FeedView(); WallView myWallView = new WallView(); switch (menuNavigation) { case "1": Console.Clear(); Console.WriteLine("user-feed - Page"); myFeedView.UserFeed(loggedInUser); break; case "2": Console.Clear(); Console.Write("Show wall for: "); string showUserName = Console.ReadLine(); var showUser = _userService.GetUserByName(showUserName); if (showUser == null) { Console.WriteLine("No existing users goes by that name."); } else { myWallView.wall(showUser, loggedInUser); } break; case "3": Console.Clear(); Console.WriteLine("Make post - Page"); Console.Write("Content of post: "); string myContent = Console.ReadLine(); Post post = new Post { Author = loggedInUser, Content = myContent, PublicPost = true, Published = DateTime.Now, Circles = new List <Circle>(), Comments = new List <Comment>() }; _postService.Create(post); break; case "4": Console.Clear(); Console.Write("Write the id of the post you would like to comment: "); string id = Console.ReadLine(); Console.Write("Content of comment: "); string myCommentContent = Console.ReadLine(); Comment comment = new Comment { Author = loggedInUser, Content = myCommentContent, Created = DateTime.Now }; Post tempPost = _postService.GetPostById(id); tempPost.Comments.Add(comment); _postService.Update(tempPost.Id, tempPost); break; case "5": Console.Clear(); Console.WriteLine("Are you sure you want to delete all posts? If so, press y"); string awnser = Console.ReadLine(); if (awnser == "y") { _postService.RemoveAll(); Console.WriteLine("All posts have been removed"); } break; default: Console.Write("Please 1, 2, 3, 4 or 5 to make use of TheSocialNetworks functionallities: "); break; } } } }