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

آموزش جامع یونیتی Unity 5 2D Window keyboard window buttons

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

دانلود آموزش جامع یونیتی اکنون آماده هستیم تا صفحهکلید ما را خاتمه دهیم. ما باید برخی از دکمه ها را اضافه کنیم تا ما بتوانیم متن را حذف کنیم، به عقب برگردیم به صفحه قبلی، و همچنین به جلو به صفحه بعدی برویم. برای شروع، ابتدا کلاس کلاس صفحه کلید را باز کنید. و چند روش جدید اضافه کنید. درست زیر روش OnKeyPress، با روش حذف ما شروع می شود. ما این را عموم خواهیم کرد، ما آن را از بین می بریم؛ زیرا هیچ چیزی را باز نمی گرداند. و آن را به نام OnDelete هنگامی که ما OnDelete تماس می گیریم، می خواهیم تست کنیم که طول متن ها بیشتر از صفر است. به این ترتیب سعی نکنیم کاراکترهایی را که وجود ندارند پاک کنیم. اگر ما می بینیم که چیزی برای پاک کردن وجود دارد، ما به سادگی متن را دوباره تنظیم می کنیم تا ارزش متن را در مقایسه با آخرین نویسه برابر کند. و این به روش حذف ما نگاه می کند. روش بعدی که میخواهیم اضافه کنیم OnAccept است. بعد از انجام ویرایش این ورودی، این را بزنید. اجازه دهید این تنظیم را برای باز کردن صفحه شروع با گفتن مدیر برای باز کردن ID پنجره صفر. و در نهایت، یک دکمه OnCancel را اضافه کنید اگر ما نمی خواهیم یک نام با صفحه کلید مجازی خود اضافه کنیم. ما از مدیر می خواهیم پنجره ای باز کند که بازی روی صفحه نمایش باشد. ما قصد داریم پنجره صفحه کلید خود را تنظیم کنیم تا به عنوان یک فیلد ورودی عمل کنیم، اگر امتیاز بیشتری کسب کنید. بنابراین اجازه دهید به پنجره بازی ما برویم و مقدار OnNext را به دو تغییر دهیم که پنجره ای از صفحه کلید در آرایه مدیریت پنجره ما خواهد بود. ما تغییرات را ذخیره می کنیم و به یگانگی می رویم. در حال حاضر در گروه صفحه کلید، یک شی جدید بازی اضافه کنیم و ما قصد داریم با این دکمه ها تماس بگیریم و درست مانند قبل ما، یک گروه طرح افقی را اضافه کنیم. در اینجا ما عنوان بالا را به پنج تنظیم می کنیم و فاصله را به 5 نیز تنظیم می کنیم. بعد، بیایید به پوشه prefabs ما برویم و سه دکمه را به گروه ما بکشیم. ما با اولین دکمه شروع میکنیم. نام این یکی را لغو کنیم.

 We'll also want to change the text, so let's make this say Cancel as well. And while we're in this, let's change the navigation for this button. We're going to set button one to the right position. And then we're going to set, on row three, Z to the up position. Let's also select the Z and make cancel the down position. Next let's change the second button and we'll call this Delete. We'll want to change the text and we'll set Cancel as the left selection, button two is the right selection, and we'll make V as the up selection. On V we'll set Delete as the down selection. And for the final button let's call this Accept. We'll change the text and let's change the navigation. We'll make Delete the left selection, we'll make M the up selection. And on M we'll make Accept the down selection. And also while we have Accept, let's go to the keyboard window and drag Accept into the first selected. The last thing we're going to want to do is connect up all these buttons to the new methods. So let's select each one, go down to the On Click event handler, add a new event and set it to the keyboard window. On Cancel we'll set this to the OnCancel method. On Delete we'll set this to OnDelete and let's do the same thing for Accept. Now if we run our game, and now we should be able to get to the keyboard by simply going through each of the menus you'll see Accept is automatically highlighted and we can go through and start using the keyboard. We can also Delete and hit Cancel. If we go back, you'll see that it saves the last value which is okay if you want to clear it you can simply override the OnClose to clear the underscore text value. If you hit Accept you should go back to the start screen and now all of our windows are connected and our keyboard screen is complete.

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

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