loading...
آموزش کامل نقشه کشی اتوکد مدلسازی سه بعدی به زبان فارسی
3d Rener بازدید : 115 چهارشنبه 15 آذر 1396 نظرات (0)

 

آموزش یونیتی دو بعدی پنجره مدیریت unity 5 2d create window manager

دانلود آموزش تصویری یونیتی به زبان فارسی Unity

 

 

دانلود رایگان فیلم و آموزش تصویری به صورت آموزش یونیتی دو بعدی پنجره مدیریت در حال حاضر دو پنجره در داخل صحنه وجود دارد. ما برای راه اندازی این پنجره ها و پنجره های جدید نیازمند راهی هستیم که ما همچنان به آنها اضافه کنیم. بیایید به پوشه اسکریپت ما برویم و یک پوشه جدید به نام Managers ایجاد کنیم. در داخل پوشه Managers، ما یک اسکریپت جدید C # ایجاد خواهیم کرد و ما این WindowManager را می خواهیم. هنگامی که شما آن را ایجاد کرده اید، روی آن دوبار کلیک کنید تا آن را درون ویرایشگر کد خود باز کنید. بیایید جلو برویم و روش های شروع و به روز را حذف کنیم. در جای خود، ما در حال ایجاد برخی از زمینه های است که کمک خواهد کرد که ما پیگیری کل پنجره ها در بازی ما، و همچنین پنجره ای که ما در حال حاضر، و پنجره است که باید به طور خودکار باز شود. ما با یک آرایه عمومی که به پنجره های عمومی تایپ شده است شروع می کنیم و این پنجره ها را فراخوانی می کنیم. بعد، بیایید یک int int را ایجاد کنیم که پنجره فعلی را که در سیستم باز است نشان می دهد. ما این currentWindowID را می نامیم. و بالاخره، اجازه دهید یک int int برای defaultWindowID بسازیم تا زمانی که مدیر را باز کنیم. بعد، ما نیاز به یک راه برای دریافت مرجع به یک پنجره در آرایه ما. از آنجایی که ما این کار را انجام خواهیم داد، به شما کمک خواهد کرد تا یک روش را داشته باشید که دسترسی به آرایه پنجره کمی ساده تر می شود. بیایید یک روش عمومی ایجاد کنیم که یک نوع GenericWindow را برمی گرداند و ما آن را GetWindow نامگذاری می کنیم و آن را مقدار int نگه می داریم و روش ما یک پنجره را بر اساس شاخص ارزش آرایه ویندوز باز می گرداند. بعدا میخواهیم مطمئن شویم که تنها یک پنجره در یک زمان قابل مشاهده است.

 Let's create a private method called ToggleVisibility and it'll be typed to void. Our method will accept an int that will be value which we'll use to find the right window. We're gonna need a reference to all of the windows in the array. Let's create a variable called total, and we'll set its value to the windows.Length. Now let's create a for loop that goes through and loops through each window, testing whether it needs to be open or closed. We'll create for of var i equals zero, i is less that total, and i++ to increment the value. Next, we'll need a reference to the current window so we'll create a variable called window and we'll use the windows array and pass in i as the index. Now we can test if i equals value. We can call window.Open. Let's add an else condition and test if the windows gameObject.activeSelf is true. This will tell us that the window isn't the one we're looking for, but it still is open. So we'll go ahead and we'll close it. Finally, we'll need to create a method that allows us to open a window based on the ID. We'll create a public method that returns a generic window and we'll call it Open. Here it'll accept an int called value which will represent the window ID. We wanna make sure that the value is within range of the array. So if the value is less than zero or value is greater that or equals to windows.Length, we're gonna return null since no window can be activated. If we pass this test, we're gonna set the currentWindowID to equal value. Next, we'll call ToggleVisibility, and we'll pass in the currentWindowID. Finally, we'll return the window by simply calling GetWindow on the currentWindowID. The last thing we wanna do is add in the Start method and call Open and pass in the defaultWindowID. But save this, go back in Unity, and make sure we don't have any errors. At this point, we have the basic foundation for our WindowManager.

تعداد صفحات : 136

اطلاعات کاربری