{"id":335722,"date":"2022-07-14T15:00:19","date_gmt":"2022-07-14T15:00:19","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=335722"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=335722","title":{"rendered":"<span>\u041a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0433\u0440\u0443 \u043d\u0430 Monogame, \u043d\u0435 \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u0430\u044f \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0441\u0430\u043d\u0438\u0442\u0430\u0440\u043e\u0432. \u0427\u0430\u0441\u0442\u044c 1, \u043e\u0431\u043c\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f\u043c\u0438<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0447\u0430\u0441\u0442\u0438: <a href=\"https:\/\/habr.com\/ru\/post\/676850\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 0<\/a><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1d1\/e2a\/2e7\/1d1e2a2e7ea0c7a8a18ff88db585fbe7.PNG\" width=\"687\" height=\"393\"\/><figcaption><\/figcaption><\/figure>\n<h3>4. \u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h3>\n<h4>4.1 Monogame, MVP \u0438 \u043c\u043e\u044f \u043b\u044e\u0431\u043e\u0432\u044c \u043a \u043d\u0430\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439<\/h4>\n<p>\u041a\u0430\u043a \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437, \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 Monogame \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u2013 Update \u0438 Draw. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0438\u0445. \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, \u0432\u043d\u0443\u0442\u0440\u0438 Update \u043c\u043e\u0436\u043d\u043e \u043b\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u2013 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043a\u043b\u0430\u0432\u0438\u0448, \u043c\u044b\u0448\u043a\u0438 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043c\u0435\u043b\u043a\u0443\u044e \u0438\u0433\u0440\u0443 \u0442\u0438\u043f\u0430 \u0442\u043e\u0439, \u0447\u0442\u043e \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0434\u0438\u043d\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u044b\u043d\u0435\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 Update, \u0438 \u043d\u0430 \u044d\u0442\u043e\u043c \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c. \u041d\u043e \u043c\u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0442\u0430\u043a\u043e\u0439, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u0438 \u0441\u043d\u0430\u0440\u0443\u0436\u0438. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0442\u0430\u043a, \u043a\u0430\u043a \u044f \u044d\u0442\u043e \u0432\u0438\u0436\u0443. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432 \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0438\u0433\u0440\u044b \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u044e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043d\u0435\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d MVP \u2013 Model-View-Presenter. \u041e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c, \u043a\u0430\u043a \u0436\u0435\u043b\u0435\u0437\u043d\u044b\u0439 \u043b\u043e\u043c, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u0442\u0434\u0435\u043b\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0442 \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0410 \u0435\u0449\u0435 \u043e\u043d \u0432\u0435\u0441\u044c \u0437\u0430\u0432\u044f\u0437\u0430\u043d \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u0430 \u044f \u043e\u0447\u0435\u043d\u044c \u043b\u044e\u0431\u043b\u044e \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 C#. \u0421\u0443\u0442\u044c \u0442\u0430\u043a\u043e\u0432\u0430: \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u0442\u0440\u0438 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f \u2013 View (\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435), Model (\u041c\u043e\u0434\u0435\u043b\u044c) \u0438 Presenter (\u0434\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0443 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u041f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0443\u0441\u0441\u043a\u043e\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b). View \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0432\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434 (\u043d\u043e \u043d\u0435 \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443), Model \u0437\u0430\u0432\u0435\u0434\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439, \u0430 Presenter \u2013 \u0441\u0432\u044f\u0437\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0441\u043b\u043e\u0439\u043a\u0430 \u2013 View \u0438 Model \u043d\u0435 \u0437\u043d\u0430\u044e\u0442 \u0434\u0440\u0443\u0433 \u043e \u0434\u0440\u0443\u0433\u0435 \u0438 \u043d\u0438\u043a\u0430\u043a \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u044b.<\/p>\n<p>\u0412 C# \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: View \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0430\u0431\u043e\u0440 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435, Presenter \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u043d\u0438\u0445 \u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f Model. Model \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0447\u0442\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e, \u043d\u0430 \u0447\u0442\u043e \u0441\u043d\u043e\u0432\u0430 \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 Presenter, \u0438 \u0443\u0436\u0435 \u0443 View \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u0432\u043e\u0434\u0438\u043c\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/bae\/08a\/125\/bae08a125346076cef413b13e15f3e78.jpg\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b MVP \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u0434\u0432\u0438\u0433\u0430 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u0432\u043f\u0440\u0430\u0432\u043e\" title=\"\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b MVP \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u0434\u0432\u0438\u0433\u0430 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u0432\u043f\u0440\u0430\u0432\u043e\" width=\"861\" height=\"512\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bae\/08a\/125\/bae08a125346076cef413b13e15f3e78.jpg\" data-blurred=\"true\"\/><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b MVP \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u0434\u0432\u0438\u0433\u0430 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u0432\u043f\u0440\u0430\u0432\u043e<\/figcaption><\/figure>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u041f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440\u0430: View \u0438 Model \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439. \u041e\u043d\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0442\u043e-\u0442\u043e \u0434\u0435\u043b\u0430\u044e\u0442, \u043e \u0447\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0430\u044e\u0442 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0447\u0435\u0440\u0435\u0437 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044e \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u0423\u0436\u0435 \u0441\u0430\u043c Presenter, \u0431\u0443\u0434\u0443\u0447\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u043d\u0430 \u044d\u0442\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u041c\u043e\u0434\u0435\u043b\u044c \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430. \u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435: \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b View \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 &#171;\u0418\u0433\u0440\u043e\u043a \u0434\u0432\u0438\u043d\u0443\u043b\u0441\u044f&#187;, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u043a\u0443\u0434\u0430 \u0438\u043c\u0435\u043d\u043d\u043e. \u0411\u043e\u043b\u044c\u0448\u0435 View \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442. Presenter \u0438\u043c\u0435\u0435\u0442 \u043d\u0430\u0431\u043e\u0440 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 View, \u0438 Model. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043f\u0440\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f &#171;\u0418\u0433\u0440\u043e\u043a \u0434\u0432\u0438\u043d\u0443\u043b\u0441\u044f&#187; Presenter \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0443 \u0438\u0433\u0440\u043e\u043a\u0430 \u0443\u0436\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 Model. \u042d\u0442\u043e\u0442 \u0436\u0435 \u043c\u0435\u0442\u043e\u0434 Model \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0438\u0433\u0440\u043e\u043a \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u0434\u0432\u0438\u043d\u0443\u0442. Presenter \u0441\u043d\u043e\u0432\u0430 \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u044d\u0442\u043e \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 View, \u0447\u0442\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0438\u0433\u0440\u043e\u043a\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0430\u0441\u044c \u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c. \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u043e, \u043d\u043e \u043f\u043e\u0442\u043e\u043c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435.  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434, \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u044b \u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 C#.<\/em><\/p>\n<h4>4.2\u00a0\u041a\u0430\u0440\u043a\u0430\u0441 MVP \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Monogame<\/h4>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e Presenter \u0438\u043c\u0435\u0435\u0442 \u0434\u0435\u043b\u043e \u043d\u0435 \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 View \u0438 Model, \u0430 \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u043c\u0438. \u0410 \u0434\u0430\u043b\u0435\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0443\u0436\u0435 \u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043f\u043e\u043a\u0430, \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0434\u0443\u043c\u0430\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e Monogame \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c Game1, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f Model \u0438 \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e IGameplayModel. \u041f\u043e\u0447\u0435\u043c\u0443 Gameplay, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e Model? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044f \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e \u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0449\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u0447\u043d\u043e\u0435 \u043c\u0435\u043d\u044e, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u0435\u0441\u0442\u0438 \u0441\u0435\u0431\u044f \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443. \u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044f \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043e\u043f\u044b\u0442, \u044f \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u0432\u044b\u0432\u043e\u0434\u0443, \u0447\u0442\u043e \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u0435. \u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u0438 \u0441\u0433\u0443\u0431\u0438\u043b\u043e \u0432\u0442\u043e\u0440\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043c\u043e\u0435\u0439 \u0438\u0433\u0440\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0435\u043f\u0435\u0440\u044c \u044f \u0445\u043e\u0447\u0443 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e, \u043d\u043e\u0432\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043a \u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442.<\/p>\n<pre><code class=\"cs\">public interface IGameplayModel {     event EventHandler&lt;GameplayEventArgs> Updated;      void Update();     void MovePlayer(Direction dir);      public enum Direction : byte     {         forward,         backward,         right,         left     } }  public class GameplayEventArgs : EventArgs {     public Vector2 PlayerPos { get; set; } }<\/code><\/pre>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438, \u0447\u0442\u043e \u0442\u043e\u0442, \u043a\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u041c\u043e\u0434\u0435\u043b\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0441\u0432\u043e\u044e \u043b\u043e\u0433\u0438\u043a\u0443 (\u043c\u0435\u0442\u043e\u0434 Update) \u0438 \u0441\u043e\u043e\u0431\u0449\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u043e\u0431\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f Updated. \u0421\u043e\u0431\u044b\u0442\u0438\u0435 Updated \u0442\u043e\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430 Presenter \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f (\u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0438 \u0433\u0434\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 GameplayEventArgs, \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f. \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0433\u0440\u043e\u043a, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u2013 \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0438\u0433\u0440\u043e\u043a\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0438\u043f\u0430 Vector2. \u042d\u0442\u043e\u0442 \u0442\u0438\u043f\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c \u0432 Monogame \u0438 \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b X \u0438 Y \u0441 \u0442\u0438\u043f\u043e\u043c float.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0437\u043d\u0430\u044f, \u0447\u0442\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0430\u0448\u0438\u043d\u043a\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 Direction \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u0434\u0435 \u0432\u043c\u0435\u0441\u0442\u043e \u0446\u0438\u0444\u0440 1-4 \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430. C# \u0432\u0435\u0440\u0441\u0438\u0438 9.0 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435, \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u043f\u043e\u043c\u043d\u044e &#8212; \u043d\u0435\u0442. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0443\u043d\u0443\u0442\u044c Direction \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0441\u0447\u0430\u0441\u0442\u044c\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0435\u0442\u043e\u0434 MovePlayer, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0434\u0432\u0438\u0433\u0430\u0442\u044c \u0438\u0433\u0440\u043e\u043a\u0430 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a View. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IGameplayView \u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u0435\u043c, \u0447\u0442\u043e \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c. \u041f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0443 \u043d\u0430\u0441 \u0434\u043e\u043b\u0436\u043d\u043e \u0438\u0434\u0442\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u043f\u0440\u0438 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e View \u043f\u043e\u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0446\u0438\u043a\u043b \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d \u0438 \u043f\u043e\u0440\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c. \u0414\u0430\u043b\u0435\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u0438\u0433\u0440\u0430 \u043f\u0440\u043e \u043c\u0430\u0448\u0438\u043d\u043a\u0438, \u0442\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u0445\u043e\u0447\u0435\u0442 \u0435\u0435 \u043f\u043e\u0434\u0432\u0438\u0433\u0430\u0442\u044c \u0432 \u043a\u0430\u043a\u043e\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438. \u042d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e View \u0434\u0430\u0435\u0442 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434. \u0410 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u043c\u0443? \u041f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0440\u0430\u043d \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438. \u0417\u0434\u0435\u0441\u044c \u0443\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 (\u0445\u043e\u0442\u044f, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u043d\u0435 \u0432 Monogame). \u0422\u0430\u043a \u043a\u0430\u043a \u043d\u0430 \u0440\u043e\u043b\u044c View \u044f \u043d\u0430\u0437\u043d\u0430\u0447\u0443 \u043a\u043b\u0430\u0441\u0441 Game, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0438 \u0442\u0430\u043a \u043a\u0430\u0436\u0434\u044b\u0439 \u0446\u0438\u043a\u043b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 Draw, \u0442\u043e \u0437\u0434\u0435\u0441\u044c \u044f \u0441\u0434\u0435\u043b\u0430\u044e \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u043d\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443, \u0430 \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u043d\u043e\u0432\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u043e\u0434 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 (\u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438\u0433\u0440\u043e\u043a\u0430). \u041f\u043e\u043a\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u2013 \u0434\u0432\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434.<\/p>\n<pre><code class=\"cs\">public interface IGameplayView {     \/\/\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c     event EventHandler CycleFinished;     event EventHandler&lt;ControlsEventArgs> PlayerMoved;      void LoadGameCycleParameters(Vector2 pos); }  public class ControlsEventArgs : EventArgs {     public IGameplayModel.Direction Direction { get; set; } }<\/code><\/pre>\n<p>\u0421\u043e\u0431\u044b\u0442\u0438\u0435 PlayerMoved \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u043f\u0440\u0438 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0447\u0435\u0440\u0435\u0437 \u043a\u043b\u0430\u0441\u0441 ControlsEventArgs, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u0435\u0439\u0447\u0430\u0441 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u0430\u0432\u0442\u043e\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u2013 Direction \u0442\u0438\u043f\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438\u0437 \u043c\u043e\u0434\u0435\u043b\u0438 \u2013 Direction. \u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 \u041f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440\u0430 \u0438 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043c\u0435\u0442\u043e\u0434\u044b IView \u0438 IModel.  <\/p>\n<pre><code class=\"cs\">public class GameplayPresenter {     private IGameplayView _gameplayView = null;     private IGameplayModel _gameplayModel = null;      public GameplayPresenter(       IGameplayView gameplayView,       IGameplayModel gameplayModel     )     {         _gameplayView = gameplayView;         _gameplayModel = gameplayModel;          _gameplayView.CycleFinished += ViewModelUpdate;         _gameplayView.PlayerMoved += ViewModelMovePlayer;         _gameplayModel.Updated += ModelViewUpdate;      }      private void ViewModelMovePlayer(object sender, ControlsEventArgs e)     {         _gameplayModel.MovePlayer(e.Direction);     }      private void ModelViewUpdate(object sender, GameplayEventArgs e)     {         _gameplayView.LoadGameCycleParameters(e.PlayerPos);     }      private void ViewModelUpdate(object sender, EventArgs e)     {         _gameplayModel.Update();     } }<\/code><\/pre>\n<p>\u0423 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440\u0430 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043f\u043e\u043b\u044f \u0441 \u0442\u0438\u043f\u0430\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u043d\u0430\u0448\u0438\u0445 IView \u0438 IModel. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0430 \u0438\u0445 \u043c\u0435\u0441\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u043d\u0443\u0436\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u0447\u0442\u043e \u043c\u044b \u0438 \u0434\u0435\u043b\u0430\u0435\u043c \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 View \u0438 Model \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u0445. \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432 \u043d\u0430\u0448\u0435\u043c View \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 CycleFinished \u0432\u044b\u0437\u043e\u0432\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 ViewModelUpdate, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 Update \u0443 \u043c\u043e\u0434\u0435\u043b\u0438. \u041a\u043e\u0433\u0434\u0430 \u0436\u0435 \u0443 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 Updated, \u0442\u043e Presenter \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 ModelViewUpdate, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0432\u043e View \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438\u0433\u0440\u043e\u043a\u0430.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u0448\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432, \u0438 \u043d\u0430\u0447\u043d\u0435\u043c \u043c\u044b \u0441 View.<\/p>\n<h4>\u0418\u0437\u0434\u0435\u0432\u0430\u0435\u043c\u0441\u044f \u043d\u0430\u0434 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h4>\n<p>\u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0441\u043a\u0430\u0437\u0430\u043b, \u043d\u0430 \u0440\u043e\u043b\u044c View \u044f \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u043b \u043a\u043b\u0430\u0441\u0441 Game1, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u043d\u0435\u043c \u0435\u0441\u0442\u044c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438. Game1 \u0443\u0436\u0435 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d \u043e\u0442 Game, \u043e\u0434\u043d\u0430\u043a\u043e C# \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 (\u043f\u043e\u0437\u0434\u043d\u0435\u0435 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 View \u043c\u0435\u043d\u044e\u0448\u0435\u043a). \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0442\u043e\u0433\u043e, \u043c\u0435\u043d\u044f\u0435\u043c \u0443\u0431\u043e\u0433\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 Game1 \u043d\u0430 GameCycleView, \u0430 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IGameplayView. \u0414\u0430\u043b\u0435\u0435, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f \u0438 \u0434\u043b\u044f \u043a\u0440\u0430\u0442\u043a\u043e\u0441\u0442\u0438 \u0431\u0443\u0434\u0443 \u043f\u0440\u043e \u043d\u0430\u0448\u0438 \u043a\u043b\u0430\u0441\u0441\u044b \u043f\u0438\u0441\u0430\u0442\u044c View\/\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 Model\/\u041c\u043e\u0434\u0435\u043b\u044c, \u0430 \u043f\u0440\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b &#8212; IView \u0438 IModel.<\/p>\n<pre><code class=\"cs\">public class GameCycleView : Game, IGameplayView {     private GraphicsDeviceManager _graphics;     private SpriteBatch _spriteBatch;      public event EventHandler CycleFinished = delegate { };     public event EventHandler&lt;ControlsEventArgs> PlayerMoved = delegate { };       public GameCycleView()     {         _graphics = new GraphicsDeviceManager(this);         Content.RootDirectory = \"Content\";         IsMouseVisible = true;      }      protected override void Initialize()     {         base.Initialize();     }      protected override void LoadContent()     {         _spriteBatch = new SpriteBatch(GraphicsDevice);     }      public void LoadGameCycleParameters(Vector2 pos)     {      }      protected override void Update(GameTime gameTime)     {         var keys = Keyboard.GetState().GetPressedKeys();         if (keys.Length > 0)         {             var k = keys[0];             switch (k)             {                 case Keys.Escape:                     {                         Exit();                         break;                     }             }         }          if (GamePad.GetState(PlayerIndex.One).         Buttons.Back == ButtonState.Pressed ||         Keyboard.GetState().IsKeyDown(Keys.Escape))             Exit();          base.Update(gameTime);         CycleFinished.Invoke(this, new EventArgs());     }      protected override void Draw(GameTime gameTime)     {         GraphicsDevice.Clear(Color.CornflowerBlue);         base.Draw(gameTime);     } }<\/code><\/pre>\n<p>\u0412 \u043a\u043b\u0430\u0441\u0441\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u0434\u0432\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f &#8212; CycleFinished \u0438 PlayerMoved. \u0418\u0445 \u043c\u044b \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u0435\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430 \u043d\u0438\u0445 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u041f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440, \u0447\u0442\u043e \u043c\u044b \u0443\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435. \u0412 Update \u043c\u044b \u043f\u043e\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044e \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0446\u0438\u043a\u043b \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u0438 \u043f\u043e\u0440\u0430 \u043e\u0431\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 (\u0441\u0442\u0440\u043e\u043a\u0430 52).<\/p>\n<p>\u041d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 35-47 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430\u0436\u0430\u0442\u044b\u0445 \u043a\u043b\u0430\u0432\u0438\u0448. \u0412 \u043c\u0430\u0441\u0441\u0438\u0432 keys \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435, \u0447\u0442\u043e \u0438\u0433\u0440\u043e\u043a \u043d\u0430\u0436\u0430\u043b, \u0430 \u0434\u0430\u043b\u0435\u0435, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0435 \u043f\u0443\u0441\u0442\u043e\u0439, \u0432 k \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u043d\u0430\u0436\u0430\u0442\u0430\u044f \u043a\u043b\u0430\u0432\u0438\u0448\u0430 \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0435\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430. \u041f\u043e\u043a\u0430 \u044d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u0440\u0438\u0432\u043e, \u043d\u043e \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u044d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u0435\u0442\u0435\u0440\u043f\u0438\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0442\u0430\u043a\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0439, \u0447\u0435\u043c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0439 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434 IsKeyDown (\u0441\u0442\u0440\u043e\u043a\u0430 48, \u043f\u043e\u043a\u0430 \u044f \u0435\u0435 \u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430), \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u0430 \u0434\u0430\u043b\u0435\u0435 \u0432\u0441\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043e\u0434\u0438\u043d switch \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u0443\u0447\u0438 if-\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043b\u0435\u0433\u043a\u043e \u0437\u0430\u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>\u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0448\u0430\u0433\u0435 \u043f\u0438\u0448\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 GameCycle \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0432 \u043d\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IGameplayModel: <\/p>\n<pre><code class=\"cs\">public class GameCycle : IGameplayModel {     public event EventHandler&lt;GameplayEventArgs> Updated = delegate { };      private Vector2 _pos = new Vector2(300, 300);      public void Update()     {         _pos += new Vector2(1, 0);         Updated.Invoke(this, new GameplayEventArgs { PlayerPos = _pos });     }      public void MovePlayer(IGameplayModel.Direction dir)     {      } }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u043e\u043b\u0435 _pos, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438\u0433\u0440\u043e\u043a\u0430. \u0412 Update \u043f\u043e\u043a\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e, \u0447\u0442\u043e \u0438\u0433\u0440\u043e\u043a \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430 1 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0432\u043f\u0440\u0430\u0432\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0448\u0430\u0433 \u0446\u0438\u043a\u043b\u0430. <\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u043e\u0447\u0442\u0438 \u0433\u043e\u0442\u043e\u0432\u0430. \u0422\u0435\u043f\u0435\u0440\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430, \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u041f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440\u0430 \u0438 \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u0442\u044c \u043a \u043d\u0435\u043c\u0443 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b View \u0438 Model. \u0421\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c Presenter \u043d\u0443\u0436\u043d\u043e \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0442\u0440\u0438 \u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0431\u044b\u043b\u0438 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043a\u043e\u0434 \u0432\u043d\u0443\u0442\u0440\u0438 Program, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 Run \u043d\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e:<\/p>\n<pre><code class=\"cs\">public static class Program {     [STAThread]     static void Main()     {         \/\/using (var game = new GameCycleView())         \/\/var game = new GameCycleView();         \/\/game.Run();                  GameplayPresenter g = new GameplayPresenter(           new GameCycleView(), new GameCycle()         );     } }<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c, \u043a\u0430\u043a \u0447\u0435\u0440\u0435\u0437 Presenter \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438\u0433\u0440\u0443, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 Run \u0438\u043c\u0435\u043d\u043d\u043e \u0443 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 Game. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0443 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 IGameplayView \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0435\u0435\u0442 \u0442\u0443 \u0436\u0435 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443, \u0447\u0442\u043e \u0438 \u043c\u0435\u0442\u043e\u0434 Run \u043a\u043b\u0430\u0441\u0441\u0430 Game:<\/p>\n<pre><code class=\"cs\">public interface IGameplayView {     \/\/\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c     event EventHandler CycleFinished;     event EventHandler&lt;ControlsEventArgs> PlayerMoved;      void LoadGameCycleParameters(Vector2 pos);     void Run(); }<\/code><\/pre>\n<p>\u0410 \u0443 \u041f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0435\u0442\u043e\u0434 LaunchGame, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0438 \u0431\u0443\u0434\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c Run: <\/p>\n<pre><code class=\"cs\">private void LaunchGame() {     _gameplayView.Run(); }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043d\u0435 \u043d\u0430\u043c\u0438 Game \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438 \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u0438\u0437 \u041f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440\u0430 \u0432 Program \u043c\u0435\u0442\u043e\u0434 Run \u043d\u0430\u0448\u0435\u0433\u043e View \u0432\u044b\u0437\u043e\u0432\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u043c\u0435\u0442\u043e\u0434 Run \u043a\u043b\u0430\u0441\u0441\u0430 Game:  <\/p>\n<pre><code class=\"cs\">public static class Program {     [STAThread]     static void Main()     {         \/\/using (var game = new GameCycleView())         \/\/var game = new GameCycleView();         \/\/game.Run();                  GameplayPresenter g = new GameplayPresenter(           new GameCycleView(), new GameCycle()         );         g.LaunchGame();     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0438\u0433\u0440\u0443, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c \u0432\u0441\u0435 \u0442\u043e \u0436\u0435 \u0433\u043e\u043b\u0443\u0431\u043e\u0435 \u043e\u043a\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430\u0448 View \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u0438\u0437 \u043c\u043e\u0434\u0435\u043b\u0438. \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u0442\u0432\u043e\u0440\u0438\u0442\u0441\u044f \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c, \u0442\u043e \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0438\u0441\u043f\u0440\u0430\u0432\u043d\u043e \u043a\u0440\u0443\u0442\u0438\u0442 \u0446\u0438\u043a\u043b\u044b \u0438 \u043c\u0435\u043d\u044f\u0435\u0442 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438\u0433\u0440\u043e\u043a\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/0d4\/163\/8c1\/0d41638c1c0f1015b17fa2c19c6c79fe.jpg\" width=\"729\" height=\"338\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0d4\/163\/8c1\/0d41638c1c0f1015b17fa2c19c6c79fe.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435, \u043d\u0430\u0443\u0447\u0438\u043c \u043d\u0430\u0448 View \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u043e\u043a\u0443, \u0447\u0442\u043e \u0442\u0432\u043e\u0440\u0438\u0442\u0441\u044f \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c \u043c\u0438\u0440\u0435 \u043d\u0430\u0448\u0435\u0439 \u0438\u0433\u0440\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0443 \u0432 \u0432\u0438\u0434\u0435 \u0431\u0435\u043b\u043e\u0433\u043e \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430 \u043d\u0430 \u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u0433\u0434\u0435 \u0443 \u043d\u0430\u0441 \u0441\u0435\u0439\u0447\u0430\u0441 \u0438\u0433\u0440\u043e\u043a. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 View \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0433\u0434\u0435 \u0436\u0435 \u043d\u0430\u0448 \u0438\u0433\u0440\u043e\u043a. \u0422\u043e \u0435\u0441\u0442\u044c, \u043f\u043e\u0437\u0438\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 LoadGameCycleParameters \u043d\u0443\u0436\u043d\u043e \u0433\u0434\u0435-\u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0432 Draw \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0443 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u043d\u0435\u0433\u043e \u0442\u043e\u0436\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u043c (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u0437\u043d\u0430\u044e). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u044f\u043c\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0435 View \u043f\u043e\u043b\u0435 \u0441 \u043f\u043e\u0437\u0438\u0446\u0438\u0435\u0439 \u0438\u0433\u0440\u043e\u043a\u0430, \u0430 \u0432 LoadGameCycleParameters \u043d\u0430\u043f\u0438\u0448\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u043b\u0430 \u0432 \u044d\u0442\u043e \u043f\u043e\u043b\u0435 \u043d\u043e\u0432\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438\u0433\u0440\u043e\u043a\u0430:<\/p>\n<pre><code class=\"cs\">public class GameCycleView : Game, IGameplayView {     \/\/ &lt;.................................>      private Vector2 _playerPos = Vector2.Zero;      \/\/ &lt;.................................>      public void LoadGameCycleParameters(Vector2 pos)     {         _playerPos = playerPos;     }     \/\/ &lt;.................................>  }<\/code><\/pre>\n<p>\u0417\u043d\u0430\u043a\u043e\u043c &lt;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;> \u0437\u0434\u0435\u0441\u044c \u0438 \u0434\u0430\u043b\u0435\u0435 \u044f \u0431\u0443\u0434\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0438 \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u043c\u0435\u043d\u044f\u043b\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u0445\u043b\u0430\u043c\u043b\u044f\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e.<\/p>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 Draw, \u0447\u0442\u043e\u0431\u044b \u0432 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0435 _playerPos \u0440\u0438\u0441\u043e\u0432\u0430\u043b\u0441\u044f \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u043e\u0439. \u041d\u0443, \u0442\u043e \u0435\u0441\u0442\u044c, \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u0430 Draw.Rectangle(_playerPos, 20, 20), \u0434\u0430? \u041d\u0435\u0442. \u042f \u043d\u0435 \u0437\u043d\u0430\u044e, \u043f\u043e\u0447\u0435\u043c\u0443, \u043d\u043e Monogame \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0443\u0445\u043c\u0435\u0440\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0430\u0447\u043d\u0435\u0442\u0435 \u0433\u0443\u0433\u043b\u0438\u0442\u044c monogame draw primitives \u0438\u043b\u0438 draw rectangle, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043a\u0443\u0447\u0443 \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0433\u0438\u0445 \u0440\u043e\u043b\u0438\u043a\u043e\u0432, \u0441\u0443\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0441\u043f\u0440\u0430\u0439\u0442 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430 \u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u0435\u0433\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/62cfff50a2414e6229959179\" data-style=\"\" id=\"62cfff50a2414e6229959179\" width=\"\"><\/div>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u041a\u0441\u0442\u0430\u0442\u0438, \u044d\u0442\u043e\u0442 \u043a\u0430\u043d\u0430\u043b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0445 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0445 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432 \u043f\u043e \u0442\u043e\u043c\u0443, \u043a\u0430\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 Monogame \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0432\u0435\u0449\u0438.<\/em><\/p>\n<p>\u041f\u0435\u0447\u0430\u043b\u044c\u043d\u043e, \u043d\u043e \u0444\u0430\u043a\u0442. \u0415\u0441\u043b\u0438 \u044f \u043d\u0435\u043f\u0440\u0430\u0432, \u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u043e\u0449\u0435, \u0442\u043e, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u043e\u043c\u0443, \u043a\u0430\u043a \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0432 Monogame \u0440\u0435\u0441\u0443\u0440\u0441\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c MonoGame Content Builder (MGCB). \u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043c\u043e\u0438\u043c \u0441\u043e\u0432\u0435\u0442\u043e\u043c \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438 \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043f\u0440\u043e\u0435\u043a\u0442 \u0447\u0435\u0440\u0435\u0437 template, \u0442\u043e \u043e\u043d \u0443 \u0432\u0430\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0430\u043f\u043a\u0435 Content \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/395\/194\/a37\/395194a373bd336092edaa476de580cc.png\" width=\"416\" height=\"385\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/395\/194\/a37\/395194a373bd336092edaa476de580cc.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0449\u0435\u043b\u043a\u043d\u0443\u0442\u044c \u043f\u043e \u043d\u0435\u043c\u0443, \u0442\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043e\u043a\u043e\u0448\u043a\u043e \u0441 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u0430 White_Placeholder \u0443 \u0432\u0430\u0441 \u043f\u043e\u043a\u0430 \u0431\u044b\u0442\u044c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e): <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e80\/0b4\/f18\/e800b4f182a454c754549cad94127f2c.png\" width=\"460\" height=\"493\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e80\/0b4\/f18\/e800b4f182a454c754549cad94127f2c.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u0449\u0435\u043b\u043a\u0430\u0439\u0442\u0435 \u043f\u043e \u0437\u043d\u0430\u0447\u043a\u0443 \u0432 \u043e\u0431\u043e\u0437\u0440\u0435\u0432\u0430\u0442\u0435\u043b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439, \u00ab\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u2026\u00bb \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0439\u0442\u0435, \u0447\u0442\u043e\u0431\u044b MGCB \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u043b\u0441\u044f \u0447\u0435\u0440\u0435\u0437 MonoGame Pipeline Tool: <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8a7\/5bf\/711\/8a75bf7114820f1488f967db6ee45e35.png\" width=\"542\" height=\"382\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8a7\/5bf\/711\/8a75bf7114820f1488f967db6ee45e35.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u043a \u043d\u0430\u0448\u0435\u0439 \u0438\u0433\u0440\u0435 \u043d\u0430\u0448 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441 \u2013 \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0443 \u0432 \u0432\u0438\u0434\u0435 \u0431\u0435\u043b\u043e\u0433\u043e \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432 \u043f\u0435\u0438\u043d\u0442\u0435 \u0431\u0435\u043b\u044b\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u043a \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043a\u0430\u043a png \u0438 \u043a\u0438\u0434\u0430\u0435\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 Content \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/09f\/cd9\/f3c\/09fcd9f3c41d087532421e1dcce7b569.jpeg\" width=\"704\" height=\"382\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/09f\/cd9\/f3c\/09fcd9f3c41d087532421e1dcce7b569.jpeg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c MGCB, \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c Add Existing Item, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430\u0448 \u0444\u0430\u0439\u043b \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c Build:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/363\/145\/55b\/36314555be28c779859afeccdb6460c2.png\" width=\"1206\" height=\"599\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/363\/145\/55b\/36314555be28c779859afeccdb6460c2.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/236\/ef5\/a55\/236ef5a55e1541199e9c504354765230.png\" width=\"918\" height=\"652\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/236\/ef5\/a55\/236ef5a55e1541199e9c504354765230.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c Monogame \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430\u0448 \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u0438 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043a\u0430\u043a \u0441\u043f\u0440\u0430\u0439\u0442 \u0432 \u043a\u043e\u0434. \u0421\u043f\u0440\u0430\u0439\u0442\u044b \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0442\u0438\u043f\u0435 Texture2D. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043f\u043e\u043b\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0435 View, \u0430 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 LoadContent \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0432 \u043d\u0435\u0433\u043e \u043d\u0430\u0448\u0443 \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0443:  <\/p>\n<pre><code class=\"cs\">public class GameCycleView : Game, IGameplayView {     \/\/ &lt;.................................>     private Vector2 _playerPos = Vector2.Zero;     private Texture2D _playerImage;      public GameCycleView()     {         _graphics = new GraphicsDeviceManager(this);         Content.RootDirectory = \"Content\";         IsMouseVisible = true;     }      protected override void Initialize()     {         base.Initialize();     }      protected override void LoadContent()     {         _spriteBatch = new SpriteBatch(GraphicsDevice);         _playerImage = Content.Load&lt;Texture2D>(\"White_Placeholder\");     }      \/\/ &lt;.................................> }<\/code><\/pre>\n<p>\u0421\u0432\u043e\u0439\u0441\u0442\u0432 RootDirectory \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a\u0430\u044f \u043f\u0430\u043f\u043a\u0430 \u0434\u043b\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439. \u0422\u0430\u043a \u043a\u0430\u043a \u043d\u0430\u0448\u0430 \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0430 \u043b\u0435\u0436\u0438\u0442 \u043f\u0440\u044f\u043c\u043e \u0432 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u0442\u043e \u0432 Content.Load \u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0431\u0435\u0437 \u0435\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 \u0438\u0433\u0440\u043e\u043a\u0430 \u2013 \u0438\u0434\u0435\u043c \u0432 \u043c\u0435\u0442\u043e\u0434 Draw:<\/p>\n<pre><code class=\"cs\">protected override void Draw(GameTime gameTime) {   GraphicsDevice.Clear(Color.CornflowerBlue);              base.Draw(gameTime);   _spriteBatch.Begin();   _spriteBatch.Draw(_playerImage, _playerPos, Color.White);   _spriteBatch.End();             }        <\/code><\/pre>\n<p> \u0414\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 SpriteBatch. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0443 \u043d\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434 Begin, \u0432 \u043a\u043e\u043d\u0446\u0435 \u043c\u0435\u0442\u043e\u0434 End, \u0430 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 Draw \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u043f\u0440\u0430\u0439\u0442. \u041c\u0435\u0442\u043e\u0434 Draw \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043e\u043a. \u0421\u0430\u043c\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 3 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u2013 \u043a\u0430\u043a\u043e\u0439 \u0441\u043f\u0440\u0430\u0439\u0442 \u043c\u044b \u0440\u0438\u0441\u0443\u0435\u043c, \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0443 \u043b\u0435\u0432\u043e\u0433\u043e \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0443\u0433\u043b\u0430, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0441\u043f\u0440\u0430\u0439\u0442\u0430, \u0438 \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0439 \u0444\u0438\u043b\u044c\u0442\u0440. \u041f\u0440\u0438 \u0431\u0435\u043b\u043e\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u0435 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0435\u0441\u0442\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u0423\u0440\u0430! \u041c\u044b \u0432\u0438\u0434\u0438\u043c \u0431\u0435\u043b\u044b\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0437\u0435\u0442 \u0432\u043f\u0440\u0430\u0432\u043e.  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fb7\/c3c\/0e9\/fb7c3c0e9a3174f1f6782a5881b68bcf.gif\" width=\"544\" height=\"292\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fb7\/c3c\/0e9\/fb7c3c0e9a3174f1f6782a5881b68bcf.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0434\u0435\u0441\u044c, \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0443\u043c\u0435\u0441\u0442\u043d\u043e \u043f\u0440\u0435\u0440\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u0437\u0430\u0434\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441 \u2013 \u0437\u0430\u0447\u0435\u043c \u0442\u0430\u043a \u0441\u043b\u043e\u0436\u043d\u043e? \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438\u0433\u0440\u043e\u043a\u0430 \u043f\u0440\u044f\u043c\u043e \u0438\u0437 Game1 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u0441\u0430\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0435\u0437\u043e \u0432\u0441\u044f\u043a\u0438\u0445 \u043b\u0438\u0448\u043d\u0438\u0445 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439 \u0438 \u0432\u043e\u0437\u043d\u0438 \u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c View, Model \u0438 Presenter \u0434\u0440\u0443\u0433 \u043a \u0434\u0440\u0443\u0433\u0443, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443 5 \u0441\u0442\u0440\u043e\u0447\u0435\u043a. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0447\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0441\u0442\u0430\u0442\u044c\u0441\u044f, \u0442\u0435\u043c \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441 \u043d\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0447\u0442\u043e-\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c. \u041a\u043e\u0433\u0434\u0430 \u044f \u0434\u0435\u043b\u0430\u043b \u044d\u0442\u0443 \u0438\u0433\u0440\u0443 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437, \u0442\u043e \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c.<\/p>\n<h4>4.2 \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>\u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0441\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0443\u0436\u0435 \u0432\u0441\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043e. \u0423\u0431\u0435\u0440\u0435\u043c \u0438\u0437 Update \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432\u043f\u0440\u0430\u0432\u043e \u0438 \u0434\u043e\u043f\u0438\u0448\u0435\u043c \u043c\u0435\u0442\u043e\u0434 MovePlayer:<\/p>\n<pre><code class=\"cs\">public class GameCycle : IGameplayModel { public event EventHandler&lt;GameplayEventArgs> Updated = delegate { };            private Vector2 _pos = new Vector2(300,300);            public void Update()   {   _pos += new Vector2(1,0);     Updated.Invoke(this, new GameplayEventArgs { PlayerPos = _pos });                     }          public void MovePlayer(IGameplayModel.Direction dir)   {   switch (dir)     {     case IGameplayModel.Direction.forward:     {     _pos += new Vector2(0, -1);     break;    }     case IGameplayModel.Direction.backward:     {     _pos += new Vector2(0, 1);     break;     }     case IGameplayModel.Direction.right:     {     _pos += new Vector2(1, 0);     break;     }     case IGameplayModel.Direction.left:     {      _pos += new Vector2(-1, 0);     break;     }    }             }        }<\/code><\/pre>\n<p>\u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u043e View \u0440\u0430\u043d\u0435\u0435 \u043d\u0435\u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u2013 PlayerMoved. \u041b\u043e\u0432\u0438\u0442\u044c \u0432\u043e\u0437\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0431\u0443\u0434\u0435\u043c \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Update \u043d\u0430\u0448\u0435\u0439 View. <\/p>\n<pre><code class=\"cs\">protected override void Update(GameTime gameTime) {     var keys = Keyboard.GetState().GetPressedKeys();     if (keys.Length > 0)     {         var k = keys[0];         switch (k)         {             case Keys.W:                 {                     PlayerMoved.Invoke(                       this,                        new ControlsEventArgs {                          Direction = IGameplayModel.Direction.forward }                     );                     break;                 }             case Keys.S:                 {                   PlayerMoved.Invoke(                       this,                        new ControlsEventArgs {                          Direction = IGameplayModel.Direction.backward }                     );                     break;                                     }             case Keys.D:                 {                   PlayerMoved.Invoke(                       this,                        new ControlsEventArgs {                          Direction = IGameplayModel.Direction.right }                     );                                         break;                 }             case Keys.A:                 {                   PlayerMoved.Invoke(                       this,                        new ControlsEventArgs {                          Direction = IGameplayModel.Direction.left }                     );                     break;                                     }             case Keys.Escape:                 {                   Exit();                   break;                 }         }     }       base.Update(gameTime);         CycleFinished.Invoke(this, new EventArgs()); }<\/code><\/pre>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430\u0436\u0438\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u043a\u043e\u043c:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/77e\/381\/994\/77e381994ea07e1f0ee27e4a4ba072f3.gif\" width=\"544\" height=\"292\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/77e\/381\/994\/77e381994ea07e1f0ee27e4a4ba072f3.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u043a\u0430\u044f \u043a\u0440\u0430\u0441\u043e\u0442\u0430! \u041e\u043d\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u0431\u044f, \u043d\u043e \u0438 \u043c\u043e\u0436\u0435\u0442 \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0430\u0448\u0435 \u0432\u043e\u0437\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435.<\/p>\n<h4>4.3 \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/h4>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u0438\u043d\u043d\u043e\u0439, \u043d\u043e, \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u044f \u0445\u043e\u0447\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u0435-\u0447\u0442\u043e \u0435\u0449\u0435. \u0422\u0430\u043a \u043a\u0430\u043a \u0438\u0433\u0440\u0430 \u0443 \u043d\u0430\u0441 \u043f\u0440\u043e \u043c\u0430\u0448\u0438\u043d\u043a\u0438, \u0442\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u0435\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043c\u0430\u0448\u0438\u043d\u043a\u0430\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0438 \u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435. \u0410 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u043e \u0431\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0446\u0438\u043a\u043b\u0435. \u0422\u043e\u0433\u0434\u0430 \u043c\u0430\u0448\u0438\u043d\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043e\u0442\u043f\u0443\u0441\u0442\u0438\u043c \u043a\u043d\u043e\u043f\u043a\u0443. \u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 MovePlayer \u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 PlayerMoved \u0432 ChangePlayerSpeed \u0438 PlayerSpeedChanged \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u043c\u044b \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043c\u0430\u0448\u0438\u043d. \u0418\u0445 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0443 \u0438\u0433\u0440\u043e\u043a\u0430, \u0441 \u0442\u043e\u0439 \u043b\u0438\u0448\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0435\u0439, \u0447\u0442\u043e \u0435\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0437\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u043c. \u041b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0431\u044b\u043b\u043e \u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u043c\u0430\u0448\u0438\u043d\u044b \u0441 \u043f\u043e\u043b\u0435\u043c Speed \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u043c\u0430\u0448\u0438\u043d, \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e \u0446\u0438\u043a\u043b\u0443. \u041d\u043e \u0443 \u043d\u0430\u0441 \u0432 \u0438\u0433\u0440\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0430\u0448\u0438\u043d\u044b, \u0430 \u043c\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IObject, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0443\u0442 \u0435\u0433\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u043a\u043b\u044e\u0447 \u0435\u0433\u043e \u0441\u043f\u0440\u0430\u0439\u0442\u0430 (\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043a\u0430\u0436\u0443 \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435) \u0438 \u043c\u0435\u0442\u043e\u0434 Update, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u043e\u0433\u043b\u0430 \u043f\u043e \u0446\u0438\u043a\u043b\u0443 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0432\u043e\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0430 \u043a\u0430\u043a \u044d\u0442\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043e\u043d\u0438 \u0440\u0435\u0448\u0430\u043b\u0438 \u0431\u044b \u0441\u0430\u043c\u0438. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0437\u0434\u043d\u0435\u0435 \u0441\u044e\u0434\u0430 \u0442\u043e\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439, \u043d\u043e \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u0445\u043b\u0430\u043c\u043b\u044f\u0442\u044c \u043a\u043e\u0434. <\/p>\n<pre><code class=\"cs\">public interface IObject {   int ImageId { get; set; }         Vector2 Pos { get; }          void Update();   }<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441 Car, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IObject:<\/p>\n<pre><code class=\"cs\">public class Car : IObject {     public int ImageId { get; set; }      public Vector2 Pos { get; set; }     public Vector2 Speed { get; set; }       public void Update()     {     Pos += Speed             }    }<\/code><\/pre>\n<p>\u0423 \u043c\u0430\u0448\u0438\u043d\u044b \u0435\u0441\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438, \u0438 \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u0443\u0436\u043d\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438. \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043c\u043e\u0434\u0435\u043b\u0438 IModel \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u2013 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0435\u0433\u043e \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043a\u043b\u044e\u0447 \u0438\u0433\u0440\u043e\u043a\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434 Initialize, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438:  <\/p>\n<pre><code class=\"cs\">public interface IGameplayModel {     int PlayerId { get; set; }     Dictionary&lt;int, IObject> Objects { get; set; }     event EventHandler&lt;GameplayEventArgs> Updated;      void Update();     void ChangePlayerSpeed(Direction dir);     void Initialize((int width, int height) resolution);          public enum Direction : byte     {         forward,         backward,         right,         left     } } public class GameplayEventArgs : EventArgs {     public Dictionary&lt;int, IObject> Objects { get; set; }     }<\/code><\/pre>\n<p>\u041a\u043b\u0430\u0441\u0441 GamePlayEventArgs \u0442\u043e\u0436\u0435 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0441\u044f \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u043d\u0435 \u043e\u0434\u043d\u0443 \u043f\u043e\u0437\u0438\u0446\u0438\u044e, \u0430 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0438. \u041a\u043b\u0430\u0441\u0441 \u041c\u043e\u0434\u0435\u043b\u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cs\">public class GameCycle : IGameplayModel { public event EventHandler&lt;GameplayEventArgs> Updated = delegate { };      public int PlayerId { get; set; }            public Dictionary&lt;int, IObject> Objects { get; set; }      public void Initialize()   {   Objects = new Dictionary&lt;int, IObjects>();     Car player = new Car();     player.Pos = new Vector2 (250, 250);     player.ImageId = 1;     player.Speed = new Vector2 (0, 0);     Objects.Add(1, player);     PlayerId = 1;   }      public void Update()   {   foreach (var o in Objects.Values)     {     o.Update();     }     Updated.Invoke(this, new GameplayEventArgs { Objects = this.Objects });                     }          public void MovePlayer(IGameplayModel.Direction dir)   {   Car p = (Car)Objects[PlayerId];   switch (dir)     {     case IGameplayModel.Direction.forward:     {     p.Speed += new Vector2(0, -1);     break;    }     case IGameplayModel.Direction.backward:     {     p.Speed += new Vector2(0, 1);     break;     }     case IGameplayModel.Direction.right:     {     p.Speed += new Vector2(1, 0);     break;     }     case IGameplayModel.Direction.left:     {      p.Speed += new Vector2(-1, 0);     break;     }    }             }        }<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0432\u044b\u0446\u0435\u043f\u0438\u0442\u044c \u0438\u0437 \u043e\u0431\u0449\u0435\u0439 \u043c\u0430\u0441\u0441\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430\u0448\u0435\u0433\u043e \u0438\u0433\u0440\u043e\u043a\u0430 \u043c\u044b \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u043c, \u043a\u0430\u043a\u043e\u0439 id \u0434\u0430\u043b\u0438 \u0435\u043c\u0443 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u043d\u0435\u043c\u0443.  <\/p>\n<p>\u0412\u043e View \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438\u0433\u0440\u043e\u043a\u0430 \u0438 \u0435\u0433\u043e \u0441\u043f\u0440\u0430\u0439\u0442, \u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u0438. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0430\u0448 \u0431\u0435\u043b\u044b\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u043a \u043c\u044b \u043a\u043b\u0430\u0434\u0435\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441\u043f\u0440\u0430\u0439\u0442\u043e\u0432. \u041c\u0435\u0442\u043e\u0434\u044b LoadgameCycleParameters \u0438 Draw \u0442\u043e\u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u0441\u044f \u043f\u043e\u0434 \u043d\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443.<\/p>\n<pre><code class=\"cs\">public class GameCycleView : Game, IGameplayView {     \/\/ &lt;.................................>     private Dictionary&lt;int, IObject> _objects = new Dictionary&lt;int, IObject>();     private Dictionary&lt;int, Texture2D> _textures = new Dictionary&lt;int, Texture2D>();      \/\/ &lt;.................................>      protected override void LoadContent()     {         _spriteBatch = new SpriteBatch(GraphicsDevice);         _textures.Add(1, Content.Load&lt;Texture2D>(\"White_Placeholder\"));     }     public void LoadGameCycleParameters(Dictionary&lt;int, IObject> Objects)     {         _objects = Objects;             }     \/\/ &lt;.................................>     protected override void Draw(GameTime gameTime) {   GraphicsDevice.Clear(Color.CornflowerBlue);              base.Draw(gameTime);   _spriteBatch.Begin();       foreach (var o in _objects.Values)       {       _spriteBatch.Draw(_textures[o.ImageId], _playerPos, Color.White);       }     _spriteBatch.End();             }     }<\/code><\/pre>\n<p>\u041a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u043f\u0440\u0430\u0439\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u043e \u043a\u043b\u044e\u0447\u0443 ImageId \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u041f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440\u0435 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043c\u0435\u0442\u043e\u0434 ModelViewUpdate \u043f\u043e\u0434 \u043d\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0438 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c:<\/p>\n<pre><code class=\"cs\">private void ModelViewUpdate(object sender, GameplayEventArgs e) { _gameplayView.LoadGameCycleParameters(e.Objects); }<\/code><\/pre>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u043e View \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u043d\u044b\u043c \u2013 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0442\u0430\u043c \u0442\u0435 \u0436\u0435, \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432 \u043c\u043e\u0434\u0435\u043b\u0438. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/610\/368\/d0c\/610368d0c670cdddf5511ab22e92ffcb.gif\" width=\"474\" height=\"306\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/610\/368\/d0c\/610368d0c670cdddf5511ab22e92ffcb.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0427\u0442\u043e \u0436, \u043d\u0430\u0448 \u043c\u0438\u043b\u044b\u0439 \u0431\u0435\u043b\u044b\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u043a \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e, \u043c\u044b \u043b\u0438\u0448\u044c \u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435. \u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0441\u043a\u0430\u0437\u0430\u043b, \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0434\u043b\u0438\u043d\u043d\u043e\u0439, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u043f\u043e\u0434 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0443\u044e \u0438\u0433\u0440\u0443, \u0447\u0442\u043e\u0431\u044b \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437 \u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432\u043d\u0438\u043a\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c. \u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0433\u0447\u0435 \u0434\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u044f. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438 \u0434\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438!    <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/676998\/\"> https:\/\/habr.com\/ru\/post\/676998\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0447\u0430\u0441\u0442\u0438: <a href=\"https:\/\/habr.com\/ru\/post\/676850\/\" rel=\"noopener noreferrer nofollow\">\u0427\u0430\u0441\u0442\u044c 0<\/a><\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h3>4. \u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h3>\n<h4>4.1 Monogame, MVP \u0438 \u043c\u043e\u044f \u043b\u044e\u0431\u043e\u0432\u044c \u043a \u043d\u0430\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439<\/h4>\n<p>\u041a\u0430\u043a \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437, \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 Monogame \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u2013 Update \u0438 Draw. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0438\u0445. \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, \u0432\u043d\u0443\u0442\u0440\u0438 Update \u043c\u043e\u0436\u043d\u043e \u043b\u043e\u0432\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u2013 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043a\u043b\u0430\u0432\u0438\u0448, \u043c\u044b\u0448\u043a\u0438 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043c\u0435\u043b\u043a\u0443\u044e \u0438\u0433\u0440\u0443 \u0442\u0438\u043f\u0430 \u0442\u043e\u0439, \u0447\u0442\u043e \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0434\u0438\u043d\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u044b\u043d\u0435\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 Update, \u0438 \u043d\u0430 \u044d\u0442\u043e\u043c \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c. \u041d\u043e \u043c\u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0442\u0430\u043a\u043e\u0439, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u0438 \u0441\u043d\u0430\u0440\u0443\u0436\u0438. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0442\u0430\u043a, \u043a\u0430\u043a \u044f \u044d\u0442\u043e \u0432\u0438\u0436\u0443. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432 \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0438\u0433\u0440\u044b \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u044e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043d\u0435\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d MVP \u2013 Model-View-Presenter. \u041e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c, \u043a\u0430\u043a \u0436\u0435\u043b\u0435\u0437\u043d\u044b\u0439 \u043b\u043e\u043c, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u0442\u0434\u0435\u043b\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0442 \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0410 \u0435\u0449\u0435 \u043e\u043d \u0432\u0435\u0441\u044c \u0437\u0430\u0432\u044f\u0437\u0430\u043d \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u0430 \u044f \u043e\u0447\u0435\u043d\u044c \u043b\u044e\u0431\u043b\u044e \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 C#. \u0421\u0443\u0442\u044c \u0442\u0430\u043a\u043e\u0432\u0430: \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u0442\u0440\u0438 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f \u2013 View (\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435), Model (\u041c\u043e\u0434\u0435\u043b\u044c) \u0438 Presenter (\u0434\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0443 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u041f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0443\u0441\u0441\u043a\u043e\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b). View \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0432\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434 (\u043d\u043e \u043d\u0435 \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443), Model \u0437\u0430\u0432\u0435\u0434\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439, \u0430 Presenter \u2013 \u0441\u0432\u044f\u0437\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0441\u043b\u043e\u0439\u043a\u0430 \u2013 View \u0438 Model \u043d\u0435 \u0437\u043d\u0430\u044e\u0442 \u0434\u0440\u0443\u0433 \u043e \u0434\u0440\u0443\u0433\u0435 \u0438 \u043d\u0438\u043a\u0430\u043a \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u044b.<\/p>\n<p>\u0412 C# \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: View \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0430\u0431\u043e\u0440 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435, Presenter \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u043d\u0438\u0445 \u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f Model. Model \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0447\u0442\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e, \u043d\u0430 \u0447\u0442\u043e \u0441\u043d\u043e\u0432\u0430 \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 Presenter, \u0438 \u0443\u0436\u0435 \u0443 View \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u0432\u043e\u0434\u0438\u043c\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<figure class=\"full-width\"><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b MVP \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u0434\u0432\u0438\u0433\u0430 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u0432\u043f\u0440\u0430\u0432\u043e<\/figcaption><\/figure>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u041f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440\u0430: View \u0438 Model \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439. \u041e\u043d\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0442\u043e-\u0442\u043e \u0434\u0435\u043b\u0430\u044e\u0442, \u043e \u0447\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0430\u044e\u0442 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0447\u0435\u0440\u0435\u0437 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044e \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u0423\u0436\u0435 \u0441\u0430\u043c Presenter, \u0431\u0443\u0434\u0443\u0447\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u043d\u0430 \u044d\u0442\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u041c\u043e\u0434\u0435\u043b\u044c \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430. \u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435: \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b View \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 &#171;\u0418\u0433\u0440\u043e\u043a \u0434\u0432\u0438\u043d\u0443\u043b\u0441\u044f&#187;, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u043a\u0443\u0434\u0430 \u0438\u043c\u0435\u043d\u043d\u043e. \u0411\u043e\u043b\u044c\u0448\u0435 View \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442. Presenter \u0438\u043c\u0435\u0435\u0442 \u043d\u0430\u0431\u043e\u0440 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 View, \u0438 Model. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043f\u0440\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f &#171;\u0418\u0433\u0440\u043e\u043a \u0434\u0432\u0438\u043d\u0443\u043b\u0441\u044f&#187; Presenter \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0443 \u0438\u0433\u0440\u043e\u043a\u0430 \u0443\u0436\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 Model. \u042d\u0442\u043e\u0442 \u0436\u0435 \u043c\u0435\u0442\u043e\u0434 Model \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0438\u0433\u0440\u043e\u043a \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u0434\u0432\u0438\u043d\u0443\u0442. Presenter \u0441\u043d\u043e\u0432\u0430 \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u044d\u0442\u043e \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 View, \u0447\u0442\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0438\u0433\u0440\u043e\u043a\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0430\u0441\u044c \u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c. \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u043e, \u043d\u043e \u043f\u043e\u0442\u043e\u043c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435.  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434, \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u044b \u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 C#.<\/em><\/p>\n<h4>4.2\u00a0\u041a\u0430\u0440\u043a\u0430\u0441 MVP \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Monogame<\/h4>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e Presenter \u0438\u043c\u0435\u0435\u0442 \u0434\u0435\u043b\u043e \u043d\u0435 \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 View \u0438 Model, \u0430 \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u043c\u0438. \u0410 \u0434\u0430\u043b\u0435\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0443\u0436\u0435 \u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043f\u043e\u043a\u0430, \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0434\u0443\u043c\u0430\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e Monogame \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c Game1, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f Model \u0438 \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e IGameplayModel. \u041f\u043e\u0447\u0435\u043c\u0443 Gameplay, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e Model? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044f \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e \u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0449\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u0447\u043d\u043e\u0435 \u043c\u0435\u043d\u044e, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u0435\u0441\u0442\u0438 \u0441\u0435\u0431\u044f \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443. \u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044f \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043e\u043f\u044b\u0442, \u044f \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u0432\u044b\u0432\u043e\u0434\u0443, \u0447\u0442\u043e \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u0435. \u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u0438 \u0441\u0433\u0443\u0431\u0438\u043b\u043e \u0432\u0442\u043e\u0440\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043c\u043e\u0435\u0439 \u0438\u0433\u0440\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0435\u043f\u0435\u0440\u044c \u044f \u0445\u043e\u0447\u0443 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e, \u043d\u043e\u0432\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043a \u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442.<\/p>\n<pre><code class=\"cs\">public interface IGameplayModel {     event EventHandler&lt;GameplayEventArgs> Updated;      void Update();     void MovePlayer(Direction dir);      public enum Direction : byte     {         forward,         backward,         right,         left     } }  public class GameplayEventArgs : EventArgs {     public Vector2 PlayerPos { get; set; } }<\/code><\/pre>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438, \u0447\u0442\u043e \u0442\u043e\u0442, \u043a\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u041c\u043e\u0434\u0435\u043b\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0441\u0432\u043e\u044e \u043b\u043e\u0433\u0438\u043a\u0443 (\u043c\u0435\u0442\u043e\u0434 Update) \u0438 \u0441\u043e\u043e\u0431\u0449\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d \u043e\u0431\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f Updated. \u0421\u043e\u0431\u044b\u0442\u0438\u0435 Updated \u0442\u043e\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430 Presenter \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f (\u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0438 \u0433\u0434\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 GameplayEventArgs, \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f. \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430 \u043d\u0430 \u043a\u0430\u0440\u0442\u0435 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0433\u0440\u043e\u043a, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u2013 \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0438\u0433\u0440\u043e\u043a\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0438\u043f\u0430 Vector2. \u042d\u0442\u043e\u0442 \u0442\u0438\u043f\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c \u0432 Monogame \u0438 \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b X \u0438 Y \u0441 \u0442\u0438\u043f\u043e\u043c float.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0437\u043d\u0430\u044f, \u0447\u0442\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0430\u0448\u0438\u043d\u043a\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 Direction \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u0434\u0435 \u0432\u043c\u0435\u0441\u0442\u043e \u0446\u0438\u0444\u0440 1-4 \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430. C# \u0432\u0435\u0440\u0441\u0438\u0438 9.0 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435, \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u043f\u043e\u043c\u043d\u044e &#8212; \u043d\u0435\u0442. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0443\u043d\u0443\u0442\u044c Direction \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0441\u0447\u0430\u0441\u0442\u044c\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0435\u0442\u043e\u0434 MovePlayer, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0434\u0432\u0438\u0433\u0430\u0442\u044c \u0438\u0433\u0440\u043e\u043a\u0430 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a View. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IGameplayView \u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u0435\u043c, \u0447\u0442\u043e \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c. \u041f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0443 \u043d\u0430\u0441 \u0434\u043e\u043b\u0436\u043d\u043e \u0438\u0434\u0442\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u043f\u0440\u0438 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e View \u043f\u043e\u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0446\u0438\u043a\u043b \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d \u0438 \u043f\u043e\u0440\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c. \u0414\u0430\u043b\u0435\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u0438\u0433\u0440\u0430 \u043f\u0440\u043e \u043c\u0430\u0448\u0438\u043d\u043a\u0438, \u0442\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u0445\u043e\u0447\u0435\u0442 \u0435\u0435 \u043f\u043e\u0434\u0432\u0438\u0433\u0430\u0442\u044c \u0432 \u043a\u0430\u043a\u043e\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438. \u042d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e View \u0434\u0430\u0435\u0442 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434. \u0410 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u043c\u0443? \u041f\u0435\u0440\u0435\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0440\u0430\u043d \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438. \u0417\u0434\u0435\u0441\u044c \u0443\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 (\u0445\u043e\u0442\u044f, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u043d\u0435 \u0432 Monogame). \u0422\u0430\u043a \u043a\u0430\u043a \u043d\u0430 \u0440\u043e\u043b\u044c View \u044f \u043d\u0430\u0437\u043d\u0430\u0447\u0443 \u043a\u043b\u0430\u0441\u0441 Game, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0438 \u0442\u0430\u043a \u043a\u0430\u0436\u0434\u044b\u0439 \u0446\u0438\u043a\u043b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 Draw, \u0442\u043e \u0437\u0434\u0435\u0441\u044c \u044f \u0441\u0434\u0435\u043b\u0430\u044e \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u043d\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443, \u0430 \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u043d\u043e\u0432\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u043e\u0434 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 (\u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438\u0433\u0440\u043e\u043a\u0430). \u041f\u043e\u043a\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u2013 \u0434\u0432\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434.<\/p>\n<pre><code class=\"cs\">public interface IGameplayView {     \/\/\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c     event EventHandler CycleFinished;     event EventHandler&lt;ControlsEventArgs> PlayerMoved;      void LoadGameCycleParameters(Vector2 pos); }  public class ControlsEventArgs : EventArgs {     public IGameplayModel.Direction Direction { get; set; } }<\/code><\/pre>\n<p>\u0421\u043e\u0431\u044b\u0442\u0438\u0435 PlayerMoved \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u043f\u0440\u0438 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0447\u0435\u0440\u0435\u0437 \u043a\u043b\u0430\u0441\u0441 ControlsEventArgs, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u0435\u0439\u0447\u0430\u0441 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u0430\u0432\u0442\u043e\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u2013 Direction \u0442\u0438\u043f\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438\u0437 \u043c\u043e\u0434\u0435\u043b\u0438 \u2013 Direction. \u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 \u041f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440\u0430 \u0438 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043c\u0435\u0442\u043e\u0434\u044b IView \u0438 IModel.  <\/p>\n<pre><code class=\"cs\">public class GameplayPresenter {     private IGameplayView _gameplayView = null;     private IGameplayModel _gameplayModel = null;      public GameplayPresenter(       IGameplayView gameplayView,       IGameplayModel gameplayModel     )     {         _gameplayView = gameplayView;         _gameplayModel = gameplayModel;          _gameplayView.CycleFinished += ViewModelUpdate;         _gameplayView.PlayerMoved += ViewModelMovePlayer;         _gameplayModel.Updated += ModelViewUpdate;      }      private void ViewModelMovePlayer(object sender, ControlsEventArgs e)     {         _gameplayModel.MovePlayer(e.Direction);     }      private void ModelViewUpdate(object sender, GameplayEventArgs e)     {         _gameplayView.LoadGameCycleParameters(e.PlayerPos);     }      private void ViewModelUpdate(object sender, EventArgs e)     {         _gameplayModel.Update();     } }<\/code><\/pre>\n<p>\u0423 \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0435\u0440\u0430 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043f\u043e\u043b\u044f \u0441 \u0442\u0438\u043f\u0430\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u043d\u0430\u0448\u0438\u0445 IView \u0438 IModel. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0430 \u0438\u0445 \u043c\u0435\u0441\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u043d\u0443\u0436\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u0447\u0442\u043e \u043c\u044b \u0438 \u0434\u0435\u043b\u0430\u0435\u043c \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 View \u0438 Model \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u0445. \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432 \u043d\u0430\u0448\u0435\u043c View \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 CycleFinished \u0432\u044b\u0437\u043e\u0432\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 ViewModelUpdate, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 Update \u0443 \u043c\u043e\u0434\u0435\u043b\u0438. \u041a\u043e\u0433\u0434\u0430 \u0436\u0435 \u0443 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 Updated, \u0442\u043e Presenter \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 ModelViewUpdate, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0432\u043e View \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0438\u0433\u0440\u043e\u043a\u0430.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u0448\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432, \u0438 \u043d\u0430\u0447\u043d\u0435\u043c \u043c\u044b \u0441 View.<\/p>\n<h4>\u0418\u0437\u0434\u0435\u0432\u0430\u0435\u043c\u0441\u044f \u043d\u0430\u0434 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h4>\n<p>\u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0441\u043a\u0430\u0437\u0430\u043b, \u043d\u0430 \u0440\u043e\u043b\u044c View \u044f \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u043b \u043a\u043b\u0430\u0441\u0441 Game1, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u043d\u0435\u043c \u0435\u0441\u0442\u044c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438. Game1 \u0443\u0436\u0435 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d \u043e\u0442 Game, \u043e\u0434\u043d\u0430\u043a\u043e C# \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 (\u043f\u043e\u0437\u0434\u043d\u0435\u0435 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 View \u043c\u0435\u043d\u044e\u0448\u0435\u043a). \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0442\u043e\u0433\u043e, \u043c\u0435\u043d\u044f\u0435\u043c \u0443\u0431\u043e\u0433\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 Game1 \u043d\u0430 GameCycleView, \u0430 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IGameplayView. \u0414\u0430\u043b\u0435\u0435, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f \u0438 \u0434\u043b\u044f \u043a\u0440\u0430\u0442\u043a\u043e\u0441\u0442\u0438 \u0431\u0443\u0434\u0443 \u043f\u0440\u043e \u043d\u0430\u0448\u0438 \u043a\u043b\u0430\u0441\u0441\u044b \u043f\u0438\u0441\u0430\u0442\u044c View\/\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 Model\/\u041c\u043e\u0434\u0435\u043b\u044c, \u0430 \u043f\u0440\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b &#8212; IView \u0438 IModel.<\/p>\n<pre><code class=\"cs\">public class GameCycleView : Game, IGameplayView {     private GraphicsDeviceManager _graphics;     private SpriteBatch _spriteBatch;      public event EventHandler CycleFinished = delegate { };     public event EventHandler&lt;ControlsEventArgs> PlayerMoved = delegate { };       public GameCycleView()     {         _graphics = new GraphicsDeviceManager(this);         Content.RootDirectory = \"Content\";         IsMouseVisible = true;      }      protected override void Initialize()     {         base.Initialize();     }      protected override void LoadContent()     {         _spriteBatch = new SpriteBatch(GraphicsDevice);     }      public void LoadGameCycleParameters(Vector2 pos)     {      }      protected override void Update(GameTime gameTime)     {         var keys = Keyboard.GetState().GetPressedKeys();         if (keys.Length > 0)         {             var k = keys[0];<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-335722","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/335722","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=335722"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/335722\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=335722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=335722"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=335722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}