├── CloudSleepEngine.yyp ├── Count Lines Of GameMaker Project.bat ├── LICENSE ├── Manual.txt ├── README.md ├── animcurves └── animcurve_cameralinear │ └── animcurve_cameralinear.yy ├── datafiles ├── LICENSE │ ├── SourceHanSansSC │ │ └── LICENSE.txt │ └── Textbox - Single line │ │ └── LICENSE ├── api-ms-win-core-file-l1-2-0.dll ├── api-ms-win-core-file-l2-1-0.dll ├── api-ms-win-core-localization-l1-2-0.dll ├── api-ms-win-core-processthreads-l1-1-1.dll ├── api-ms-win-core-synch-l1-2-0.dll ├── api-ms-win-core-timezone-l1-1-0.dll ├── api-ms-win-crt-convert-l1-1-0.dll ├── api-ms-win-crt-environment-l1-1-0.dll ├── api-ms-win-crt-filesystem-l1-1-0.dll ├── api-ms-win-crt-heap-l1-1-0.dll ├── api-ms-win-crt-locale-l1-1-0.dll ├── api-ms-win-crt-math-l1-1-0.dll ├── api-ms-win-crt-runtime-l1-1-0.dll ├── api-ms-win-crt-stdio-l1-1-0.dll ├── api-ms-win-crt-string-l1-1-0.dll ├── api-ms-win-crt-time-l1-1-0.dll ├── api-ms-win-crt-utility-l1-1-0.dll ├── dll │ ├── StringConverter.dll │ ├── file_dll.dll │ └── systemCmd.dll ├── fonts │ └── SourceHanSansSC-Medium.otf ├── kernel32.dll ├── msvcp140.dll ├── ucrtbase.dll └── vcruntime140.dll ├── icon.ico ├── icon.png ├── icon.sai2 ├── objects ├── obj_GuiElement_BedSleepSetter │ ├── Alarm_0.gml │ ├── CleanUp_0.gml │ ├── Create_0.gml │ ├── Draw_64.gml │ ├── Step_0.gml │ └── obj_GuiElement_BedSleepSetter.yy ├── obj_GuiElement_Message │ ├── CleanUp_0.gml │ ├── Create_0.gml │ ├── Draw_75.gml │ └── obj_GuiElement_Message.yy ├── obj_GuiElement_SleeperEmoteSetter │ ├── Alarm_0.gml │ ├── CleanUp_0.gml │ ├── Create_0.gml │ ├── Draw_64.gml │ ├── Step_0.gml │ └── obj_GuiElement_SleeperEmoteSetter.yy ├── obj_GuiElement_SlidingRod │ ├── Create_0.gml │ ├── Draw_64.gml │ └── obj_GuiElement_SlidingRod.yy ├── obj_SceneDefaultBackground │ ├── Create_0.gml │ ├── Draw_0.gml │ └── obj_SceneDefaultBackground.yy ├── obj_SceneElementSleeper │ ├── Step_0.gml │ └── obj_SceneElementSleeper.yy ├── obj_camera │ ├── Create_0.gml │ ├── Step_0.gml │ ├── Step_1.gml │ └── obj_camera.yy ├── obj_dragcheck │ ├── Create_0.gml │ ├── Draw_64.gml │ ├── Step_0.gml │ └── obj_dragcheck.yy ├── obj_guielement_button │ ├── Create_0.gml │ ├── Draw_64.gml │ ├── Step_0.gml │ └── obj_guielement_button.yy ├── obj_guielement_dragobj │ ├── Create_0.gml │ ├── Draw_0.gml │ ├── Draw_64.gml │ ├── Step_0.gml │ └── obj_guielement_dragobj.yy ├── obj_guielement_hitboxsetter │ ├── Alarm_0.gml │ ├── CleanUp_0.gml │ ├── Create_0.gml │ ├── Draw_64.gml │ ├── Step_0.gml │ └── obj_guielement_hitboxsetter.yy ├── obj_guielement_offsetsetter │ ├── Alarm_0.gml │ ├── CleanUp_0.gml │ ├── Create_0.gml │ ├── Draw_64.gml │ ├── Step_0.gml │ └── obj_guielement_offsetsetter.yy ├── obj_guielement_page │ ├── CleanUp_0.gml │ ├── Create_0.gml │ ├── Draw_64.gml │ ├── Draw_75.gml │ ├── Step_0.gml │ └── obj_guielement_page.yy ├── obj_mainmenu │ ├── Create_0.gml │ ├── Step_1.gml │ └── obj_mainmenu.yy ├── obj_sandboxbuttons │ ├── Create_0.gml │ ├── Draw_64.gml │ ├── Draw_73.gml │ ├── Step_0.gml │ └── obj_sandboxbuttons.yy ├── obj_sandboxgrid │ ├── Create_0.gml │ ├── Draw_0.gml │ ├── Draw_64.gml │ ├── Draw_74.gml │ ├── Step_0.gml │ └── obj_sandboxgrid.yy ├── obj_sandboxinitsceneelements │ ├── Create_0.gml │ └── obj_sandboxinitsceneelements.yy ├── obj_sandboxsceneelementsdeletearea │ ├── Create_0.gml │ ├── Draw_64.gml │ └── obj_sandboxsceneelementsdeletearea.yy ├── obj_sandboxsceneelementspages │ ├── Alarm_0.gml │ ├── CleanUp_0.gml │ ├── Create_0.gml │ ├── Draw_64.gml │ ├── Step_0.gml │ └── obj_sandboxsceneelementspages.yy ├── obj_sceneelement │ ├── Alarm_0.gml │ ├── Create_0.gml │ ├── Draw_0.gml │ ├── Step_0.gml │ └── obj_sceneelement.yy ├── obj_sceneelementbackground │ ├── Destroy_0.gml │ ├── Step_0.gml │ └── obj_sceneelementbackground.yy ├── obj_sceneelementbed │ ├── Alarm_0.gml │ ├── Destroy_0.gml │ ├── Step_0.gml │ └── obj_sceneelementbed.yy ├── obj_sceneelementdecorate │ ├── Step_0.gml │ └── obj_sceneelementdecorate.yy └── textbox │ ├── CleanUp_0.gml │ ├── Create_0.gml │ ├── Draw_64.gml │ ├── Step_0.gml │ └── textbox.yy ├── options ├── linux │ └── options_linux.yy ├── mac │ └── options_mac.yy ├── main │ └── options_main.yy ├── operagx │ └── options_operagx.yy └── windows │ ├── icons │ └── icon.ico │ └── options_windows.yy ├── rooms ├── rm_mainmenu │ └── rm_mainmenu.yy └── rm_sandbox │ └── rm_sandbox.yy └── scripts ├── GetNthPower2Tier_ ├── GetNthPower2Tier_.gml └── GetNthPower2Tier_.yy ├── HEX_DEC ├── HEX_DEC.gml └── HEX_DEC.yy ├── __init ├── __init.gml └── __init.yy ├── camera ├── camera.gml └── camera.yy ├── file_dll ├── file_dll.gml └── file_dll.yy ├── files ├── files.gml └── files.yy ├── font ├── font.gml └── font.yy ├── getpositionongui ├── getpositionongui.gml └── getpositionongui.yy ├── gui ├── gui.gml └── gui.yy ├── guielementpage ├── guielementpage.gml └── guielementpage.yy ├── guielements ├── guielements.gml └── guielements.yy ├── mouse ├── mouse.gml └── mouse.yy ├── others ├── others.gml └── others.yy ├── scene ├── scene.gml └── scene.yy ├── sceneelements ├── sceneelements.gml └── sceneelements.yy ├── setsize_ ├── setsize_.gml └── setsize_.yy ├── stlvector ├── stlvector.gml └── stlvector.yy ├── textbox_fns ├── textbox_fns.gml └── textbox_fns.yy └── wheat_ptr_ ├── wheat_ptr_.gml └── wheat_ptr_.yy /Count Lines Of GameMaker Project.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :CountLines 4 | setlocal 5 | set /a totalNumLines = 0 6 | for /r %1 %%F in (*.gml) do ( 7 | for /f %%N in ('find /v /c "" ^<"%%F"') do set /a totalNumLines+=%%N 8 | echo|set /p= "." 9 | ) 10 | 11 | echo . 12 | echo Total number of code lines = %totalNumLines% 13 | echo Making progress! 14 | pause -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 WheatBox 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Manual.txt: -------------------------------------------------------------------------------- 1 | 背景、不可互动物体、床……拖拽出来后为实际场景 2 | 睡客拖拽出来后为设置出生点,如果一个睡客皮肤有多次拖拽,那么就是设置多个随机出生点 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CloudSleepEngine 2 | 3 | ## 这是一款可以自由创作云睡觉场景包的编辑器,但是“引擎”听起来更高大上,就起名"Engine"了 4 | 5 | 可以让大家零代码创作出自己的“云睡觉”、“云温泉”、“云旅馆”、“云校园”、“云太空空间站”…… 6 | 7 | 可执行文件如果下载太慢了的话,可以去这里下载: 8 | 9 | https://wheatbox.lanzoue.com/b018awyde 10 | 11 | 密码:d34y 12 | -------------------------------------------------------------------------------- /animcurves/animcurve_cameralinear/animcurve_cameralinear.yy: -------------------------------------------------------------------------------- 1 | { 2 | "function": 2, 3 | "channels": [ 4 | {"colour":4290799884,"visible":true,"points":[ 5 | {"th0":-0.05,"th1":0.49522895,"tv0":0.0,"tv1":0.0,"x":0.0,"y":0.0,}, 6 | {"th0":-0.504771,"th1":0.05,"tv0":0.0,"tv1":0.0,"x":1.0,"y":1.0,}, 7 | ],"resourceVersion":"1.0","name":"curve1","tags":[],"resourceType":"GMAnimCurveChannel",}, 8 | ], 9 | "parent": { 10 | "name": "Animation Curves", 11 | "path": "folders/Animation Curves.yy", 12 | }, 13 | "resourceVersion": "1.2", 14 | "name": "animcurve_cameraLinear", 15 | "tags": [], 16 | "resourceType": "GMAnimCurve", 17 | } -------------------------------------------------------------------------------- /datafiles/LICENSE/SourceHanSansSC/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font 2 | Name 'Source'. Source is a trademark of Adobe in the United States 3 | and/or other countries. 4 | 5 | This Font Software is licensed under the SIL Open Font License, 6 | Version 1.1. 7 | 8 | This license is copied below, and is also available with a FAQ at: 9 | http://scripts.sil.org/OFL 10 | 11 | ----------------------------------------------------------- 12 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 13 | ----------------------------------------------------------- 14 | 15 | PREAMBLE 16 | The goals of the Open Font License (OFL) are to stimulate worldwide 17 | development of collaborative font projects, to support the font 18 | creation efforts of academic and linguistic communities, and to 19 | provide a free and open framework in which fonts may be shared and 20 | improved in partnership with others. 21 | 22 | The OFL allows the licensed fonts to be used, studied, modified and 23 | redistributed freely as long as they are not sold by themselves. The 24 | fonts, including any derivative works, can be bundled, embedded, 25 | redistributed and/or sold with any software provided that any reserved 26 | names are not used by derivative works. The fonts and derivatives, 27 | however, cannot be released under any other type of license. The 28 | requirement for fonts to remain under this license does not apply to 29 | any document created using the fonts or their derivatives. 30 | 31 | DEFINITIONS 32 | "Font Software" refers to the set of files released by the Copyright 33 | Holder(s) under this license and clearly marked as such. This may 34 | include source files, build scripts and documentation. 35 | 36 | "Reserved Font Name" refers to any names specified as such after the 37 | copyright statement(s). 38 | 39 | "Original Version" refers to the collection of Font Software 40 | components as distributed by the Copyright Holder(s). 41 | 42 | "Modified Version" refers to any derivative made by adding to, 43 | deleting, or substituting -- in part or in whole -- any of the 44 | components of the Original Version, by changing formats or by porting 45 | the Font Software to a new environment. 46 | 47 | "Author" refers to any designer, engineer, programmer, technical 48 | writer or other person who contributed to the Font Software. 49 | 50 | PERMISSION & CONDITIONS 51 | Permission is hereby granted, free of charge, to any person obtaining 52 | a copy of the Font Software, to use, study, copy, merge, embed, 53 | modify, redistribute, and sell modified and unmodified copies of the 54 | Font Software, subject to the following conditions: 55 | 56 | 1) Neither the Font Software nor any of its individual components, in 57 | Original or Modified Versions, may be sold by itself. 58 | 59 | 2) Original or Modified Versions of the Font Software may be bundled, 60 | redistributed and/or sold with any software, provided that each copy 61 | contains the above copyright notice and this license. These can be 62 | included either as stand-alone text files, human-readable headers or 63 | in the appropriate machine-readable metadata fields within text or 64 | binary files as long as those fields can be easily viewed by the user. 65 | 66 | 3) No Modified Version of the Font Software may use the Reserved Font 67 | Name(s) unless explicit written permission is granted by the 68 | corresponding Copyright Holder. This restriction only applies to the 69 | primary font name as presented to the users. 70 | 71 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 72 | Software shall not be used to promote, endorse or advertise any 73 | Modified Version, except to acknowledge the contribution(s) of the 74 | Copyright Holder(s) and the Author(s) or with their explicit written 75 | permission. 76 | 77 | 5) The Font Software, modified or unmodified, in part or in whole, 78 | must be distributed entirely under this license, and must not be 79 | distributed under any other license. The requirement for fonts to 80 | remain under this license does not apply to any document created using 81 | the Font Software. 82 | 83 | TERMINATION 84 | This license becomes null and void if any of the above conditions are 85 | not met. 86 | 87 | DISCLAIMER 88 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 89 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 90 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 91 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 92 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 93 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 94 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 95 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 96 | OTHER DEALINGS IN THE FONT SOFTWARE. 97 | -------------------------------------------------------------------------------- /datafiles/api-ms-win-core-file-l1-2-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/api-ms-win-core-file-l1-2-0.dll -------------------------------------------------------------------------------- /datafiles/api-ms-win-core-file-l2-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/api-ms-win-core-file-l2-1-0.dll -------------------------------------------------------------------------------- /datafiles/api-ms-win-core-localization-l1-2-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/api-ms-win-core-localization-l1-2-0.dll -------------------------------------------------------------------------------- /datafiles/api-ms-win-core-processthreads-l1-1-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/api-ms-win-core-processthreads-l1-1-1.dll -------------------------------------------------------------------------------- /datafiles/api-ms-win-core-synch-l1-2-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/api-ms-win-core-synch-l1-2-0.dll -------------------------------------------------------------------------------- /datafiles/api-ms-win-core-timezone-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/api-ms-win-core-timezone-l1-1-0.dll -------------------------------------------------------------------------------- /datafiles/api-ms-win-crt-convert-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/api-ms-win-crt-convert-l1-1-0.dll -------------------------------------------------------------------------------- /datafiles/api-ms-win-crt-environment-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/api-ms-win-crt-environment-l1-1-0.dll -------------------------------------------------------------------------------- /datafiles/api-ms-win-crt-filesystem-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/api-ms-win-crt-filesystem-l1-1-0.dll -------------------------------------------------------------------------------- /datafiles/api-ms-win-crt-heap-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/api-ms-win-crt-heap-l1-1-0.dll -------------------------------------------------------------------------------- /datafiles/api-ms-win-crt-locale-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/api-ms-win-crt-locale-l1-1-0.dll -------------------------------------------------------------------------------- /datafiles/api-ms-win-crt-math-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/api-ms-win-crt-math-l1-1-0.dll -------------------------------------------------------------------------------- /datafiles/api-ms-win-crt-runtime-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/api-ms-win-crt-runtime-l1-1-0.dll -------------------------------------------------------------------------------- /datafiles/api-ms-win-crt-stdio-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/api-ms-win-crt-stdio-l1-1-0.dll -------------------------------------------------------------------------------- /datafiles/api-ms-win-crt-string-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/api-ms-win-crt-string-l1-1-0.dll -------------------------------------------------------------------------------- /datafiles/api-ms-win-crt-time-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/api-ms-win-crt-time-l1-1-0.dll -------------------------------------------------------------------------------- /datafiles/api-ms-win-crt-utility-l1-1-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/api-ms-win-crt-utility-l1-1-0.dll -------------------------------------------------------------------------------- /datafiles/dll/StringConverter.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/dll/StringConverter.dll -------------------------------------------------------------------------------- /datafiles/dll/file_dll.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/dll/file_dll.dll -------------------------------------------------------------------------------- /datafiles/dll/systemCmd.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/dll/systemCmd.dll -------------------------------------------------------------------------------- /datafiles/fonts/SourceHanSansSC-Medium.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/fonts/SourceHanSansSC-Medium.otf -------------------------------------------------------------------------------- /datafiles/kernel32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/kernel32.dll -------------------------------------------------------------------------------- /datafiles/msvcp140.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/msvcp140.dll -------------------------------------------------------------------------------- /datafiles/ucrtbase.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/ucrtbase.dll -------------------------------------------------------------------------------- /datafiles/vcruntime140.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/datafiles/vcruntime140.dll -------------------------------------------------------------------------------- /icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/icon.ico -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/icon.png -------------------------------------------------------------------------------- /icon.sai2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/icon.sai2 -------------------------------------------------------------------------------- /objects/obj_GuiElement_BedSleepSetter/Alarm_0.gml: -------------------------------------------------------------------------------- 1 | myImportCopyToFilenameHead = WORKFILEPATH + FILEPATH_beds_bedsleep + gBedsStruct.materials[materialId].filename + "\\"; 2 | 3 | var bedSleepFilesNum = array_length(gBedsStruct.materials[materialId].sleepfilenames); 4 | for(var iii = 0; iii < bedSleepFilesNum; iii++) { 5 | var _fnameTemp = gBedsStruct.materials[materialId].sleepfilenames[iii]; 6 | if(is_string(_fnameTemp)) 7 | if(_fnameTemp != "") { 8 | MyLoadSprite(iii, myImportCopyToFilenameHead + _fnameTemp); 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /objects/obj_GuiElement_BedSleepSetter/CleanUp_0.gml: -------------------------------------------------------------------------------- 1 | if(surface_exists(surfSleepersSprites)) { 2 | surface_free(surfSleepersSprites); 3 | } 4 | for(var i = 0; i < array_length(arrBedSleepStructs); i++) { 5 | if(CheckStructCanBeUse(arrBedSleepStructs[i])) { 6 | if(sprite_exists(arrBedSleepStructs[i].sprite)) { 7 | sprite_delete(arrBedSleepStructs[i].sprite); 8 | } 9 | delete arrBedSleepStructs[i]; 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /objects/obj_GuiElement_BedSleepSetter/Create_0.gml: -------------------------------------------------------------------------------- 1 | // materialMasterArr = []; 2 | materialId = -1; 3 | 4 | sprite = undefined; 5 | 6 | MySBedSleepStruct = function(_fname, _spr) constructor { 7 | filename = _fname; // 注意该处的 filename 将会包含从盘符开始的文件路径和文件名 8 | sprite = _spr; 9 | }; 10 | arrBedSleepStructs = []; 11 | for(var iii = 0; iii < array_length(gSleepersStruct.materials); iii++) { 12 | arrBedSleepStructs[iii] = undefined; 13 | } 14 | 15 | mouseOnBedSleepIndex = 0; // 当前鼠标在哪一个导入按钮上 16 | 17 | myImportCopyToFilenameHead = ""; 18 | 19 | myDeleteButtonIns = noone; 20 | 21 | 22 | sleepersSpritesSpacing = 16; 23 | 24 | 25 | mouseOnMe = false; 26 | 27 | myImageMinimumWidthHeight = 128; 28 | 29 | width = 768; 30 | 31 | left = GuiWidth() - width; 32 | top = 0; 33 | right = left + width; 34 | bottom = GuiHeight(); 35 | 36 | scrollYSpeed = 50; 37 | scrollY = 0; 38 | 39 | 40 | arrowXAddBegin = 16; 41 | arrowXAddEnd = 48; 42 | 43 | 44 | 45 | MyCreateSurfSleepersSprites = function() { 46 | var len = array_length(gSleepersStruct.materials); 47 | if(len <= 0) { 48 | return surface_create(1, 1); 49 | } 50 | 51 | 52 | var surfTemp = surface_create( 53 | myImageMinimumWidthHeight + arrowXAddEnd, 54 | (myImageMinimumWidthHeight + sleepersSpritesSpacing) * len 55 | ); 56 | 57 | SaveDrawSettings(); 58 | 59 | draw_set_alpha(1); 60 | draw_set_color(c_white); 61 | surface_set_target(surfTemp); 62 | for(var i = 0; i < len; i++) { 63 | var _sprTemp = gSleepersSpritesStruct.sprites[i]; 64 | 65 | var _scalesTemp; 66 | if(sprite_get_width(_sprTemp) > sprite_get_height(_sprTemp)) { 67 | _scalesTemp = SetSizeLockAspect_Width_Generic(myImageMinimumWidthHeight, sprite_get_width(_sprTemp)); 68 | } else { 69 | _scalesTemp = SetSizeLockAspect_Height_Generic(myImageMinimumWidthHeight, sprite_get_height(_sprTemp)); 70 | } 71 | 72 | var _yTemp = (i * (myImageMinimumWidthHeight + sleepersSpritesSpacing)) + myImageMinimumWidthHeight / 2; 73 | draw_sprite_ext( 74 | _sprTemp, 0 75 | , myImageMinimumWidthHeight / 2 76 | , _yTemp 77 | , _scalesTemp[0] 78 | , _scalesTemp[1] 79 | , 0, c_white, 1.0 80 | ); 81 | 82 | draw_arrow(myImageMinimumWidthHeight + arrowXAddBegin, _yTemp, myImageMinimumWidthHeight + arrowXAddEnd, _yTemp, 16); 83 | } 84 | surface_reset_target(); 85 | 86 | LoadDrawSettings(); 87 | 88 | return surfTemp; 89 | } 90 | surfSleepersSprites = MyCreateSurfSleepersSprites(); 91 | 92 | 93 | MyImportBedSleep = function(i_arrBedSleepStructs) { 94 | var _fnameLongTemp = FileNameGetPicture(); 95 | if(_fnameLongTemp == "") { 96 | return false; 97 | } 98 | 99 | var _fnameTemp = GetNameFromFileName(_fnameLongTemp, true); 100 | 101 | var _copyToFilename = myImportCopyToFilenameHead + _fnameTemp; 102 | var _copyRes = FileCopy(_fnameLongTemp, _copyToFilename); 103 | DebugMes([_fnameLongTemp, " copy to ", _copyToFilename]); 104 | 105 | if(_copyRes != 0) { 106 | show_message("文件复制失败!"); 107 | return false; 108 | } 109 | 110 | gBedsStruct.materials[materialId].sleepfilenames[i_arrBedSleepStructs] = _fnameTemp; 111 | SaveCloudPack(); 112 | 113 | MyLoadSprite(i_arrBedSleepStructs, _copyToFilename); 114 | 115 | return true; 116 | } 117 | 118 | MyLoadSprite = function(i_arrBedSleepStructs, _fname) { 119 | var _sprTemp = sprite_add(_fname, 1, false, true, 0, 0); 120 | sprite_set_offset(_sprTemp, sprite_get_width(_sprTemp) / 2, sprite_get_height(_sprTemp) / 2); 121 | // sprite_set_bbox_mode(_sprTemp, DragObjBboxMode); 122 | 123 | if(CheckStructCanBeUse(arrBedSleepStructs[i_arrBedSleepStructs])) { 124 | delete arrBedSleepStructs[i_arrBedSleepStructs]; 125 | } 126 | arrBedSleepStructs[i_arrBedSleepStructs] = new MySBedSleepStruct(_fname, _sprTemp); 127 | } 128 | 129 | MyDeleteSprite = function(i_arrBedSleepStructs) { 130 | if(CheckStructCanBeUse(arrBedSleepStructs[i_arrBedSleepStructs])) { 131 | FileRemove(myImportCopyToFilenameHead + gBedsStruct.materials[materialId].sleepfilenames[i_arrBedSleepStructs]); 132 | 133 | sprite_delete(arrBedSleepStructs[i_arrBedSleepStructs].sprite); 134 | gBedsStruct.materials[materialId].sleepfilenames[i_arrBedSleepStructs] = NULL; 135 | 136 | SaveCloudPack(); 137 | 138 | delete arrBedSleepStructs[i_arrBedSleepStructs]; 139 | } 140 | } 141 | 142 | 143 | alarm_set(0, 1); 144 | 145 | -------------------------------------------------------------------------------- /objects/obj_GuiElement_BedSleepSetter/Draw_64.gml: -------------------------------------------------------------------------------- 1 | draw_set_color(GUIDefaultColor); 2 | draw_set_alpha(GUIDefaultAlpha); 3 | 4 | GUI_DrawRectangle(left, top, right, bottom, false); 5 | 6 | draw_set_color(c_white); 7 | draw_set_alpha(1.0); 8 | 9 | var xoff = left + myImageMinimumWidthHeight / 2 + 64; 10 | 11 | if(sprite != undefined && sprite_exists(sprite)) { 12 | var scaleTemp = SetSizeLockAspect_Width_Generic(myImageMinimumWidthHeight, sprite_get_width(sprite)); 13 | GUI_DrawSprite_ext(sprite, 0, xoff, (top + bottom) / 2, scaleTemp[0], scaleTemp[1], 0, c_white, 1); 14 | xoff += 128; 15 | } 16 | 17 | if(surface_exists(surfSleepersSprites) == false) { 18 | surfSleepersSprites = MyCreateSurfSleepersSprites(); 19 | } 20 | GUI_DrawSurface(surfSleepersSprites, xoff, 0 - scrollY); 21 | 22 | 23 | 24 | xoff += myImageMinimumWidthHeight + arrowXAddBegin + arrowXAddEnd + 16 + myImageMinimumWidthHeight / 2; 25 | 26 | mouseOnBedSleepIndex = -1; 27 | 28 | var _bedSleepArrLen = array_length(arrBedSleepStructs); 29 | for(var i = 0; i < _bedSleepArrLen; i++) { 30 | var _yTemp = 0 - scrollY + (i * (myImageMinimumWidthHeight + sleepersSpritesSpacing)) + myImageMinimumWidthHeight / 2; 31 | 32 | if(mouseOnBedSleepIndex == -1) { 33 | if(GUI_MouseGuiOnMe(xoff - myImageMinimumWidthHeight / 2, _yTemp - myImageMinimumWidthHeight / 2, xoff + myImageMinimumWidthHeight / 2, _yTemp + myImageMinimumWidthHeight / 2)) { 34 | mouseOnBedSleepIndex = i; 35 | } 36 | } 37 | 38 | var _canDrawImportBt = true; 39 | if(CheckStructCanBeUse(arrBedSleepStructs[i])) { 40 | var _sprTemp = arrBedSleepStructs[i].sprite; 41 | if(sprite_exists(_sprTemp)) { 42 | _canDrawImportBt = false; 43 | 44 | var _scalesTemp; 45 | if(sprite_get_width(_sprTemp) > sprite_get_height(_sprTemp)) { 46 | _scalesTemp = SetSizeLockAspect_Width_Generic(myImageMinimumWidthHeight, sprite_get_width(_sprTemp)); 47 | } else { 48 | _scalesTemp = SetSizeLockAspect_Height_Generic(myImageMinimumWidthHeight, sprite_get_height(_sprTemp)); 49 | } 50 | GUI_DrawSprite_ext(_sprTemp, 0, xoff, _yTemp, _scalesTemp[0], _scalesTemp[1], 0, c_white, 1.0); 51 | } 52 | } 53 | if(_canDrawImportBt) { 54 | GUI_DrawLabel_ext("未定义\n点我导入", xoff, _yTemp, myImageMinimumWidthHeight / 2, myImageMinimumWidthHeight / 2, i == mouseOnBedSleepIndex); 55 | } 56 | } 57 | 58 | -------------------------------------------------------------------------------- /objects/obj_GuiElement_BedSleepSetter/Step_0.gml: -------------------------------------------------------------------------------- 1 | left = GuiWidth() - width; 2 | right = left + width; 3 | bottom = GuiHeight(); 4 | 5 | if(GUI_MouseGuiOnMe(left, top, right, bottom)) { 6 | mouseOnMe = true; 7 | gMouseOnGUI = true; 8 | } else { 9 | mouseOnMe = false; 10 | 11 | if(MouseLeftPressed() || MouseRightPressed()) { 12 | instance_destroy(id); 13 | } 14 | } 15 | 16 | if(mouseOnMe) { 17 | if(mouse_wheel_up()) { 18 | if(scrollY > 0) { 19 | scrollY -= scrollYSpeed; 20 | } 21 | } else if(mouse_wheel_down()) { 22 | if(CheckStructCanBeUse(gSleepersStruct)) 23 | if(scrollY + scrollYSpeed * 1 < (array_length(gSleepersStruct.materials) - 1) * (myImageMinimumWidthHeight + sleepersSpritesSpacing)) { 24 | scrollY += scrollYSpeed; 25 | } 26 | } 27 | } 28 | 29 | if(mouseOnBedSleepIndex != -1) { 30 | var _canImport = true; 31 | if(CheckStructCanBeUse(arrBedSleepStructs[mouseOnBedSleepIndex])) { 32 | if(sprite_exists(arrBedSleepStructs[mouseOnBedSleepIndex].sprite)) { 33 | _canImport = false; 34 | } 35 | } 36 | if(_canImport) { 37 | if(MouseLeftPressed()) { 38 | MyImportBedSleep(mouseOnBedSleepIndex); 39 | } 40 | } else { 41 | if(MouseRightPressed()) { 42 | var buttonsOffsetX = GetPositionXOnGUI(mouse_x) + 12; 43 | var buttonsOffsetY = GetPositionYOnGUI(mouse_y) + 12; 44 | 45 | var _btDeleteStr = "删除 " + GetNameFromFileName(arrBedSleepStructs[mouseOnBedSleepIndex].filename, true); 46 | myDeleteButtonIns = GuiElement_CreateButton_ext( 47 | buttonsOffsetX - string_width(_btDeleteStr) / 2 48 | , buttonsOffsetY + string_height(_btDeleteStr) / 2 49 | , _btDeleteStr 50 | , , 51 | , [mouseOnBedSleepIndex] 52 | , function(args) { 53 | MyDeleteSprite(args[0]); 54 | gSandboxGuiElementsDragObjIsOnRightClick = false; 55 | } 56 | , true, GUIDangerousColor 57 | ); 58 | // myDeleteButtonIns.depth = depth - 1; 59 | myDeleteButtonIns.depth = GUIDragObjDepth - 1; 60 | } 61 | } 62 | } 63 | 64 | if(myDeleteButtonIns != noone) { 65 | if(InstanceExists(myDeleteButtonIns) == false) { 66 | myDeleteButtonIns = noone; 67 | gSandboxGuiElementsDragObjIsOnRightClick = false; 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /objects/obj_GuiElement_BedSleepSetter/obj_GuiElement_BedSleepSetter.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_GuiElement_BedSleepSetter", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,}, 27 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 28 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":2,"collisionObjectId":null,}, 29 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":12,"collisionObjectId":null,}, 30 | ], 31 | "properties": [], 32 | "overriddenProperties": [], 33 | "parent": { 34 | "name": "GuiElements", 35 | "path": "folders/Objects/GuiElements.yy", 36 | }, 37 | } -------------------------------------------------------------------------------- /objects/obj_GuiElement_Message/CleanUp_0.gml: -------------------------------------------------------------------------------- 1 | if(CheckStructCanBeUse(vecMessages)) { 2 | for(var i = 0; i < vecMessages.size(); i++) { 3 | if(CheckStructCanBeUse(vecMessages.Container[i])) { 4 | delete vecMessages.Container[i]; 5 | } 6 | } 7 | delete vecMessages; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /objects/obj_GuiElement_Message/Create_0.gml: -------------------------------------------------------------------------------- 1 | depth = GUIMessageDepth; 2 | 3 | mySMessage = function(_text) constructor { 4 | text = _text; 5 | life = 5 * 60; 6 | }; 7 | 8 | vecMessages = new vector(); 9 | 10 | MyAdd = function(_text) { 11 | vecMessages.push_back(new mySMessage(_text)); 12 | } 13 | 14 | MyDelete = function(i) { 15 | if(CheckStructCanBeUse(vecMessages.Container[i])) { 16 | delete vecMessages.Container[i]; 17 | } 18 | array_delete(vecMessages.Container, 0, 1); 19 | } 20 | 21 | -------------------------------------------------------------------------------- /objects/obj_GuiElement_Message/Draw_75.gml: -------------------------------------------------------------------------------- 1 | for(var i = 0; i < vecMessages.size(); i++) { 2 | vecMessages.Container[i].life--; 3 | if(vecMessages.Container[i].life < 0) { 4 | MyDelete(i); 5 | continue; 6 | } 7 | 8 | var _mesText = vecMessages.Container[i].text; 9 | GUI_DrawLabel_ext( 10 | _mesText 11 | , GuiWidth() - 160 - string_length(_mesText) / 2 12 | , (string_height(_mesText) + 1) * (i + 0.5) 13 | , , 14 | , false 15 | , c_black 16 | , GUIDefaultAlpha 17 | ); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /objects/obj_GuiElement_Message/obj_GuiElement_Message.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_GuiElement_Message", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":75,"eventType":8,"collisionObjectId":null,}, 27 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":12,"collisionObjectId":null,}, 28 | ], 29 | "properties": [], 30 | "overriddenProperties": [], 31 | "parent": { 32 | "name": "GuiElements", 33 | "path": "folders/Objects/GuiElements.yy", 34 | }, 35 | } -------------------------------------------------------------------------------- /objects/obj_GuiElement_SleeperEmoteSetter/Alarm_0.gml: -------------------------------------------------------------------------------- 1 | myImportCopyToFilenameHead = WORKFILEPATH + FILEPATH_sleepers_emotes + gSleepersStruct.materials[materialId].filename + "\\"; 2 | 3 | var sleeperEmoteFilesNum = array_length(gSleepersStruct.materials[materialId].emotefilenames); 4 | for(var iii = 0; iii < sleeperEmoteFilesNum; iii++) { 5 | var _fnameTemp = gSleepersStruct.materials[materialId].emotefilenames[iii]; 6 | if(is_string(_fnameTemp)) 7 | if(_fnameTemp != "") { 8 | MyLoadSprite(iii, myImportCopyToFilenameHead + _fnameTemp); 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /objects/obj_GuiElement_SleeperEmoteSetter/CleanUp_0.gml: -------------------------------------------------------------------------------- 1 | for(var i = 0; i < array_length(arrSleeperEmoteStructs); i++) { 2 | if(CheckStructCanBeUse(arrSleeperEmoteStructs[i])) { 3 | if(sprite_exists(arrSleeperEmoteStructs[i].sprite)) { 4 | sprite_delete(arrSleeperEmoteStructs[i].sprite); 5 | } 6 | delete arrSleeperEmoteStructs[i]; 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /objects/obj_GuiElement_SleeperEmoteSetter/Create_0.gml: -------------------------------------------------------------------------------- 1 | // materialMasterArr = []; 2 | materialId = -1; 3 | 4 | sprite = undefined; 5 | 6 | MySSleeperEmoteStruct = function(_fname, _spr) constructor { 7 | filename = _fname; // 注意该处的 filename 将会包含从盘符开始的文件路径和文件名 8 | sprite = _spr; 9 | }; 10 | arrSleeperEmoteStructs = []; 11 | //for(var iii = 0; iii < array_length(gSleepersStruct.materials); iii++) { 12 | // arrSleeperEmoteStructs[iii] = undefined; 13 | //} 14 | 15 | mouseOnSleeperEmoteIndex = 0; // 当前鼠标在哪一个导入按钮上 16 | 17 | myImportCopyToFilenameHead = ""; 18 | 19 | myDeleteButtonIns = noone; 20 | 21 | 22 | emotesSpritesSpacing = 16; 23 | 24 | 25 | mouseOnMe = false; 26 | 27 | myImageMinimumWidthHeight = 128; 28 | 29 | width = 512; 30 | 31 | left = GuiWidth() - width; 32 | top = 0; 33 | right = left + width; 34 | bottom = GuiHeight(); 35 | 36 | scrollYSpeed = 50; 37 | scrollY = 0; 38 | 39 | 40 | arrowXAddBegin = 16; 41 | arrowXAddEnd = 48; 42 | 43 | 44 | 45 | MyImportSleeperEmote = function(i_arrSleeperEmoteStructs) { 46 | var _fnameLongTemp = FileNameGetPicture(); 47 | if(_fnameLongTemp == "") { 48 | return false; 49 | } 50 | 51 | var _fnameTemp = GetNameFromFileName(_fnameLongTemp, true); 52 | 53 | var _copyToFilename = myImportCopyToFilenameHead + _fnameTemp; 54 | var _copyRes = FileCopy(_fnameLongTemp, _copyToFilename); 55 | DebugMes([_fnameLongTemp, " copy to ", _copyToFilename]); 56 | 57 | if(_copyRes != 0) { 58 | show_message("文件复制失败!"); 59 | return false; 60 | } 61 | 62 | gSleepersStruct.materials[materialId].emotefilenames[i_arrSleeperEmoteStructs] = _fnameTemp; 63 | SaveCloudPack(); 64 | 65 | MyLoadSprite(i_arrSleeperEmoteStructs, _copyToFilename); 66 | 67 | return true; 68 | } 69 | 70 | MyLoadSprite = function(i_arrSleeperEmoteStructs, _fname) { 71 | var _sprTemp = sprite_add(_fname, 1, false, true, 0, 0); 72 | sprite_set_offset(_sprTemp, sprite_get_width(_sprTemp) / 2, sprite_get_height(_sprTemp) / 2); 73 | // sprite_set_bbox_mode(_sprTemp, DragObjBboxMode); 74 | 75 | //if(CheckStructCanBeUse(arrSleeperEmoteStructs[i_arrSleeperEmoteStructs])) { 76 | // delete arrSleeperEmoteStructs[i_arrSleeperEmoteStructs]; 77 | //} 78 | arrSleeperEmoteStructs[i_arrSleeperEmoteStructs] = new MySSleeperEmoteStruct(_fname, _sprTemp); 79 | } 80 | 81 | MyDeleteSprite = function(i_arrSleeperEmoteStructs) { 82 | if(CheckStructCanBeUse(arrSleeperEmoteStructs[i_arrSleeperEmoteStructs])) { 83 | FileRemove(myImportCopyToFilenameHead + gSleepersStruct.materials[materialId].emotefilenames[i_arrSleeperEmoteStructs]); 84 | 85 | sprite_delete(arrSleeperEmoteStructs[i_arrSleeperEmoteStructs].sprite); 86 | gSleepersStruct.materials[materialId].emotefilenames[i_arrSleeperEmoteStructs] = NULL; 87 | 88 | array_delete(gSleepersStruct.materials[materialId].emotefilenames, i_arrSleeperEmoteStructs, 1); 89 | 90 | SaveCloudPack(); 91 | 92 | delete arrSleeperEmoteStructs[i_arrSleeperEmoteStructs]; 93 | array_delete(arrSleeperEmoteStructs, i_arrSleeperEmoteStructs, 1); 94 | } 95 | } 96 | 97 | 98 | alarm_set(0, 1); 99 | 100 | -------------------------------------------------------------------------------- /objects/obj_GuiElement_SleeperEmoteSetter/Draw_64.gml: -------------------------------------------------------------------------------- 1 | draw_set_color(GUIDefaultColor); 2 | draw_set_alpha(GUIDefaultAlpha); 3 | 4 | GUI_DrawRectangle(left, top, right, bottom, false); 5 | 6 | draw_set_color(c_white); 7 | draw_set_alpha(1.0); 8 | 9 | var xoff = left + myImageMinimumWidthHeight / 2 + 64; 10 | 11 | if(sprite != undefined && sprite_exists(sprite)) { 12 | var scaleTemp = SetSizeLockAspect_Width_Generic(myImageMinimumWidthHeight, sprite_get_width(sprite)); 13 | GUI_DrawSprite_ext(sprite, 0, xoff, (top + bottom) / 2, scaleTemp[0], scaleTemp[1], 0, c_white, 1); 14 | xoff += 128; 15 | } 16 | 17 | 18 | 19 | xoff += 16 + myImageMinimumWidthHeight / 2; 20 | 21 | mouseOnSleeperEmoteIndex = -1; 22 | 23 | var _sleeperEmoteArrLen = array_length(arrSleeperEmoteStructs); 24 | for(var i = 0; i <= _sleeperEmoteArrLen; i++) { 25 | var _yTemp = 0 - scrollY + (i * (myImageMinimumWidthHeight + emotesSpritesSpacing)) + myImageMinimumWidthHeight / 2; 26 | 27 | if(mouseOnSleeperEmoteIndex == -1) { 28 | if(GUI_MouseGuiOnMe(xoff - myImageMinimumWidthHeight / 2, _yTemp - myImageMinimumWidthHeight / 2, xoff + myImageMinimumWidthHeight / 2, _yTemp + myImageMinimumWidthHeight / 2)) { 29 | mouseOnSleeperEmoteIndex = i; 30 | } 31 | } 32 | 33 | if(i == _sleeperEmoteArrLen) { 34 | GUI_DrawLabel_ext("未定义\n点我导入", xoff, _yTemp, myImageMinimumWidthHeight / 2, myImageMinimumWidthHeight / 2, i == mouseOnSleeperEmoteIndex); 35 | break; 36 | } 37 | 38 | if(CheckStructCanBeUse(arrSleeperEmoteStructs[i])) { 39 | var _sprTemp = arrSleeperEmoteStructs[i].sprite; 40 | if(sprite_exists(_sprTemp)) { 41 | var _scalesTemp; 42 | if(sprite_get_width(_sprTemp) > sprite_get_height(_sprTemp)) { 43 | _scalesTemp = SetSizeLockAspect_Width_Generic(myImageMinimumWidthHeight, sprite_get_width(_sprTemp)); 44 | } else { 45 | _scalesTemp = SetSizeLockAspect_Height_Generic(myImageMinimumWidthHeight, sprite_get_height(_sprTemp)); 46 | } 47 | GUI_DrawSprite_ext(_sprTemp, 0, xoff, _yTemp, _scalesTemp[0], _scalesTemp[1], 0, c_white, 1.0); 48 | } 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /objects/obj_GuiElement_SleeperEmoteSetter/Step_0.gml: -------------------------------------------------------------------------------- 1 | left = GuiWidth() - width; 2 | right = left + width; 3 | bottom = GuiHeight(); 4 | 5 | if(GUI_MouseGuiOnMe(left, top, right, bottom)) { 6 | mouseOnMe = true; 7 | gMouseOnGUI = true; 8 | } else { 9 | mouseOnMe = false; 10 | 11 | if(MouseLeftPressed() || MouseRightPressed()) { 12 | instance_destroy(id); 13 | } 14 | } 15 | 16 | if(mouseOnMe) { 17 | if(mouse_wheel_up()) { 18 | if(scrollY > 0) { 19 | scrollY -= scrollYSpeed; 20 | } 21 | } else if(mouse_wheel_down()) { 22 | if(CheckStructCanBeUse(gSleepersStruct)) 23 | if(materialId >= 0 && materialId < array_length(gSleepersStruct.materials)) 24 | if(CheckStructCanBeUse(gSleepersStruct.materials[materialId])) 25 | if(scrollY + scrollYSpeed * 1 < (array_length(gSleepersStruct.materials[materialId].emotefilenames) - 1) * (myImageMinimumWidthHeight + emotesSpritesSpacing)) { 26 | scrollY += scrollYSpeed; 27 | } 28 | } 29 | } 30 | 31 | if(mouseOnSleeperEmoteIndex != -1) { 32 | var _canImport = (mouseOnSleeperEmoteIndex == array_length(gSleepersStruct.materials[materialId].emotefilenames)); 33 | //var _canImport = true; 34 | //if(CheckStructCanBeUse(arrSleeperEmoteStructs[mouseOnSleeperEmoteIndex])) { 35 | // if(sprite_exists(arrSleeperEmoteStructs[mouseOnSleeperEmoteIndex].sprite)) { 36 | // _canImport = false; 37 | // } 38 | //} 39 | if(_canImport) { 40 | if(MouseLeftPressed()) { 41 | MyImportSleeperEmote(mouseOnSleeperEmoteIndex); 42 | } 43 | } else { 44 | if(MouseRightPressed()) { 45 | var buttonsOffsetX = GetPositionXOnGUI(mouse_x) + 12; 46 | var buttonsOffsetY = GetPositionYOnGUI(mouse_y) + 12; 47 | 48 | var _btDeleteStr = "删除 " + GetNameFromFileName(arrSleeperEmoteStructs[mouseOnSleeperEmoteIndex].filename, true); 49 | myDeleteButtonIns = GuiElement_CreateButton_ext( 50 | buttonsOffsetX - string_width(_btDeleteStr) / 2 51 | , buttonsOffsetY + string_height(_btDeleteStr) / 2 52 | , _btDeleteStr 53 | , , 54 | , [mouseOnSleeperEmoteIndex] 55 | , function(args) { 56 | MyDeleteSprite(args[0]); 57 | gSandboxGuiElementsDragObjIsOnRightClick = false; 58 | } 59 | , true, GUIDangerousColor 60 | ); 61 | // myDeleteButtonIns.depth = depth - 1; 62 | myDeleteButtonIns.depth = GUIDragObjDepth - 1; 63 | } 64 | } 65 | } 66 | 67 | if(myDeleteButtonIns != noone) { 68 | if(InstanceExists(myDeleteButtonIns) == false) { 69 | myDeleteButtonIns = noone; 70 | gSandboxGuiElementsDragObjIsOnRightClick = false; 71 | } 72 | } 73 | 74 | -------------------------------------------------------------------------------- /objects/obj_GuiElement_SleeperEmoteSetter/obj_GuiElement_SleeperEmoteSetter.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_GuiElement_SleeperEmoteSetter", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,}, 27 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 28 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":2,"collisionObjectId":null,}, 29 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":12,"collisionObjectId":null,}, 30 | ], 31 | "properties": [], 32 | "overriddenProperties": [], 33 | "parent": { 34 | "name": "GuiElements", 35 | "path": "folders/Objects/GuiElements.yy", 36 | }, 37 | } -------------------------------------------------------------------------------- /objects/obj_GuiElement_SlidingRod/Create_0.gml: -------------------------------------------------------------------------------- 1 | labelText = ""; 2 | 3 | pMyVar = {}; 4 | 5 | variableMin = 0; 6 | variableMax = 0; 7 | 8 | handleWidth = 16; 9 | handleHeight = 24; 10 | 11 | width = 256; 12 | height = 48; // 该组件的该值不会变动 13 | 14 | color = GUIDefaultColor; 15 | 16 | // 取整函数,记得要在结尾写入 return 17 | MyIntFunc = function(n) {} 18 | -------------------------------------------------------------------------------- /objects/obj_GuiElement_SlidingRod/Draw_64.gml: -------------------------------------------------------------------------------- 1 | draw_set_color(color); 2 | draw_set_alpha(GUIDefaultAlpha); 3 | 4 | GUI_DrawRectangle(x, y, x + width, y + height, false); 5 | 6 | draw_set_color(c_black); 7 | 8 | var rodY = y + height - handleHeight / 2; 9 | var rodLeft = x + handleWidth / 2; 10 | var rodTop = rodY - 4; 11 | var rodRight = x + width - handleWidth / 2; 12 | var rodBottom = rodY + 4; 13 | GUI_DrawRectangle(rodLeft, rodTop, rodRight, rodBottom, false); 14 | 15 | var _mouseXGui = GetPositionXOnGUI(mouse_x); 16 | 17 | var _draggingVarNum = undefined; 18 | var _handleHightlight = false; 19 | if((gMouseDraggingSlidingRodIns == id || gMouseDraggingSlidingRodIns == noone) && GUI_MouseGuiOnMe(x, rodTop - handleHeight / 2, x + width, rodBottom + handleHeight / 2)) { 20 | gMouseOnGUI = true; 21 | gMouseDraggingSlidingRodIns = id; 22 | 23 | _handleHightlight = true; 24 | 25 | if(MouseLeftHold()) { 26 | _draggingVarNum = variableMin + (_mouseXGui - rodLeft) / (rodRight - rodLeft) * (variableMax - variableMin); 27 | 28 | var _draggingVarNumAfterMyIntFunc = MyIntFunc(_draggingVarNum); 29 | _draggingVarNumAfterMyIntFunc ??= _draggingVarNum; 30 | _draggingVarNum = clamp(_draggingVarNumAfterMyIntFunc, variableMin, variableMax); 31 | } else { 32 | GUI_SetCursorHandpoint(); 33 | 34 | gMouseDraggingSlidingRodIns = noone; 35 | } 36 | } else if(gMouseDraggingSlidingRodIns == id) 37 | if(MouseLeftHold() == false) 38 | gMouseDraggingSlidingRodIns = noone; 39 | 40 | var _varNum = pMyVar.value(); 41 | _varNum ??= 0; 42 | if(_draggingVarNum != undefined) { 43 | pMyVar.set(_draggingVarNum); 44 | } 45 | 46 | var handleX = rodLeft + (_varNum - variableMin) / (variableMax - variableMin) * (rodRight - rodLeft); 47 | draw_set_color(color); 48 | GUI_DrawRectangle(handleX - handleWidth / 2, rodY - handleHeight / 2, handleX + handleWidth / 2, rodY + handleHeight / 2); 49 | 50 | if(gMouseDraggingSlidingRodIns == id) { 51 | var _windowMouseX = window_mouse_get_x(); 52 | 53 | window_mouse_set(_windowMouseX, rodY); 54 | 55 | if(_windowMouseX < rodLeft) 56 | window_mouse_set(rodLeft, rodY); 57 | else if(_windowMouseX > rodRight) 58 | window_mouse_set(rodRight, rodY); 59 | } 60 | 61 | draw_set_color(c_white); 62 | if(_handleHightlight) { 63 | draw_set_alpha(GUIHighLightAlpha); 64 | GUI_DrawRectangle(handleX - handleWidth / 2, rodY - handleHeight / 2, handleX + handleWidth / 2, rodY + handleHeight / 2); 65 | } 66 | 67 | draw_set_alpha(1.0); 68 | 69 | GUI_DrawTextTransformed(x + 2, y, labelText + " " + string(_varNum) + "∈[" + string(variableMin) + "," + string(variableMax) + "]", 0.8, 0.8, 0, false); 70 | -------------------------------------------------------------------------------- /objects/obj_GuiElement_SlidingRod/obj_GuiElement_SlidingRod.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_GuiElement_SlidingRod", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,}, 27 | ], 28 | "properties": [], 29 | "overriddenProperties": [], 30 | "parent": { 31 | "name": "GuiElements", 32 | "path": "folders/Objects/GuiElements.yy", 33 | }, 34 | } -------------------------------------------------------------------------------- /objects/obj_SceneDefaultBackground/Create_0.gml: -------------------------------------------------------------------------------- 1 | depth = SceneDepthBackgrounds + 100; 2 | 3 | camxPrevious = undefined; 4 | camyPrevious = undefined; 5 | 6 | myDefaultBackground = -1; 7 | 8 | mysurf = -1; 9 | MySurfCheckAndRemake = function() { 10 | var _willFreeSurf = false; 11 | 12 | if(gSceneStruct.defaultBackground < 0 || gSceneStruct.defaultBackground >= array_length(gBackgroundsStruct.materials)) { 13 | _willFreeSurf = true; 14 | } else if(sprite_exists(gBackgroundsSpritesStruct.sprites[gSceneStruct.defaultBackground]) == false) { 15 | _willFreeSurf = true; 16 | } 17 | 18 | if(_willFreeSurf) { 19 | MyFreeSurf(); 20 | return; 21 | } 22 | 23 | if(mysurf != -1) { 24 | if(surface_exists(mysurf)) { 25 | return; 26 | } 27 | } 28 | 29 | mysurf = surface_create(GuiWidth(), GuiHeight()); 30 | 31 | surface_set_target(mysurf); 32 | 33 | var _spr = gBackgroundsSpritesStruct.sprites[gSceneStruct.defaultBackground]; 34 | 35 | var _camScale = CameraScale(); 36 | 37 | var _sprW = sprite_get_width(_spr); 38 | var _sprH = sprite_get_height(_spr); 39 | 40 | var _xoff = GetPositionXGridStandardization(CameraX(), _sprW); 41 | var _yoff = GetPositionYGridStandardization(CameraY(), _sprH); 42 | 43 | var _ixlen = ceil(CameraWidth() / _sprW) + 1; 44 | var _iylen = ceil(CameraHeight() / _sprH) + 1; 45 | 46 | for(var iy = 0; iy < _iylen; iy++) { 47 | for(var ix = 0; ix < _ixlen; ix++) { 48 | draw_sprite_ext(_spr, 0 49 | , GetPositionXOnGUI(_xoff + ix * _sprW) 50 | , GetPositionYOnGUI(_yoff + iy * _sprH) 51 | , 1 / _camScale, 1 / _camScale, 0, c_white, 1.0 52 | ); 53 | } 54 | } 55 | 56 | surface_reset_target(); 57 | } 58 | 59 | MyFreeSurf = function() { 60 | if(mysurf != -1) { 61 | if(surface_exists(mysurf)) { 62 | surface_free(mysurf); 63 | mysurf = -1; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /objects/obj_SceneDefaultBackground/Draw_0.gml: -------------------------------------------------------------------------------- 1 | var _camx = CameraX(); 2 | var _camy = CameraY(); 3 | var _camScale = CameraScale(); 4 | 5 | if(gSceneStruct[$ "defaultBackground"] != undefined && myDefaultBackground != gSceneStruct.defaultBackground) { 6 | myDefaultBackground = gSceneStruct.defaultBackground; 7 | MyFreeSurf(); 8 | } else 9 | if(camxPrevious != _camx || camyPrevious != _camy) { 10 | MyFreeSurf(); 11 | 12 | camxPrevious = _camx; 13 | camyPrevious = _camy; 14 | } 15 | 16 | MySurfCheckAndRemake(); 17 | 18 | if(mysurf != -1) { 19 | if(surface_exists(mysurf)) { 20 | var _alpha = 1.0; 21 | if(gSandboxSceneElementsLayer != ESandboxSceneElementsLayers.nothing) { 22 | _alpha = gOutFocusLayerAlpha; 23 | } 24 | draw_surface_ext(mysurf, _camx, _camy, _camScale, _camScale, 0, c_white, _alpha); 25 | } 26 | } -------------------------------------------------------------------------------- /objects/obj_SceneDefaultBackground/obj_SceneDefaultBackground.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_SceneDefaultBackground", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":8,"collisionObjectId":null,}, 27 | ], 28 | "properties": [], 29 | "overriddenProperties": [], 30 | "parent": { 31 | "name": "Objects", 32 | "path": "folders/Objects.yy", 33 | }, 34 | } -------------------------------------------------------------------------------- /objects/obj_SceneElementSleeper/Step_0.gml: -------------------------------------------------------------------------------- 1 | event_inherited(); 2 | 3 | SynchDepth(basey); 4 | 5 | switch(gSandboxSceneElementsLayer) { 6 | case ESandboxSceneElementsLayers.nothing: 7 | case ESandboxSceneElementsLayers.sleepers: 8 | image_alpha = 1.0; 9 | break; 10 | default: 11 | image_alpha = gOutFocusLayerAlpha; 12 | } 13 | 14 | if(inited == false) { 15 | inited = true; 16 | } 17 | 18 | if(array_length(gSleepersStruct.materials) > materialId) 19 | if(array_length(gSleepersStruct.materials[materialId].offset) >= 2) { 20 | offsetx = gSleepersStruct.materials[materialId].offset[0]; 21 | offsety = gSleepersStruct.materials[materialId].offset[1]; 22 | } 23 | -------------------------------------------------------------------------------- /objects/obj_SceneElementSleeper/obj_SceneElementSleeper.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_SceneElementSleeper", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": { 12 | "name": "obj_SceneElement", 13 | "path": "objects/obj_SceneElement/obj_SceneElement.yy", 14 | }, 15 | "physicsObject": false, 16 | "physicsSensor": false, 17 | "physicsShape": 1, 18 | "physicsGroup": 1, 19 | "physicsDensity": 0.5, 20 | "physicsRestitution": 0.1, 21 | "physicsLinearDamping": 0.1, 22 | "physicsAngularDamping": 0.1, 23 | "physicsFriction": 0.2, 24 | "physicsStartAwake": true, 25 | "physicsKinematic": false, 26 | "physicsShapePoints": [], 27 | "eventList": [ 28 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 29 | ], 30 | "properties": [], 31 | "overriddenProperties": [], 32 | "parent": { 33 | "name": "SceneElements", 34 | "path": "folders/Objects/SceneElements.yy", 35 | }, 36 | } -------------------------------------------------------------------------------- /objects/obj_camera/Create_0.gml: -------------------------------------------------------------------------------- 1 | cameraCenterX = InitCameraPosX; 2 | cameraCenterY = InitCameraPosY; 3 | 4 | scaleMulitply = 0.9; 5 | 6 | mouseXPrevious = undefined; 7 | mouseYPrevious = undefined; 8 | 9 | camera_set_view_pos(view_camera[0], cameraCenterX - camera_get_view_width(view_camera[0]) / 2, cameraCenterY - camera_get_view_height(view_camera[0]) / 2); 10 | 11 | canControlDelayTime = 2; 12 | 13 | findingPlayer = true; 14 | findingPlayerCurveX = 0; 15 | findingPlayerStartX = cameraCenterX; 16 | findingPlayerStartY = cameraCenterY; 17 | 18 | mouseCameraMoveLock = false; 19 | 20 | MyCameraLinear = function(curveX, a, b) { 21 | var curve = animcurve_get(animcurve_cameraLinear); 22 | var curveY = animcurve_channel_evaluate(curve.channels[0], curveX); 23 | return a + (b - a) * curveY; 24 | } 25 | 26 | windowWidth = 1280; 27 | windowHeight = 720; 28 | 29 | -------------------------------------------------------------------------------- /objects/obj_camera/Step_0.gml: -------------------------------------------------------------------------------- 1 | if(canControlDelayTime > 0) { 2 | canControlDelayTime--; 3 | exit; 4 | } 5 | 6 | var cameraW = camera_get_view_width(view_camera[0]); 7 | var cameraH = camera_get_view_height(view_camera[0]); 8 | if(IsMouseOnGUI == false) { 9 | if(mouse_wheel_up()) { 10 | camera_set_view_size(view_camera[0], cameraW * scaleMulitply, cameraH * scaleMulitply); 11 | } else if(mouse_wheel_down()) { 12 | camera_set_view_size(view_camera[0], cameraW / scaleMulitply, cameraH / scaleMulitply); 13 | } 14 | } 15 | 16 | cameraW = camera_get_view_width(view_camera[0]); 17 | cameraH = camera_get_view_height(view_camera[0]); 18 | 19 | mouseXPrevious ??= mouse_x; 20 | mouseYPrevious ??= mouse_y; 21 | 22 | if(MouseMidHold() || 23 | (MouseLeftHold() 24 | && gSandboxMode == ESandboxMode.Normal 25 | && !InstanceExists(gSandboxSceneElementsDragging) 26 | && IsMouseOnGUI == false 27 | && mouseCameraMoveLock == false) 28 | ) { 29 | cameraCenterX -= mouse_x - mouseXPrevious; 30 | cameraCenterY -= mouse_y - mouseYPrevious; 31 | 32 | findingPlayer = false; 33 | } 34 | 35 | camera_set_view_pos(view_camera[0], cameraCenterX - cameraW / 2, cameraCenterY - cameraH / 2); 36 | 37 | mouseXPrevious = mouse_x; 38 | mouseYPrevious = mouse_y; 39 | 40 | /* 41 | if(keyboard_check_pressed(vk_space) && mouseCameraMoveLock == false && InstanceExists(obj_client)) { 42 | if(obj_client.MyCanUseSleeperId(mySleeperId)) { 43 | findingPlayer = true; 44 | findingPlayerCurveX = 0; 45 | findingPlayerStartX = cameraCenterX; 46 | findingPlayerStartY = cameraCenterY; 47 | } 48 | } 49 | 50 | if(findingPlayer && InstanceExists(obj_client)) { 51 | if(obj_client.MyCanUseSleeperId(mySleeperId)) { 52 | findingPlayerCurveX += 0.01; 53 | cameraCenterX = MyCameraLinear(findingPlayerCurveX, findingPlayerStartX, obj_client.sleepers[mySleeperId].x); 54 | cameraCenterY = MyCameraLinear(findingPlayerCurveX, findingPlayerStartY, obj_client.sleepers[mySleeperId].y - 44); 55 | } 56 | } 57 | 58 | */ 59 | 60 | if(__MouseOnGUIBackswing > 0) { 61 | __MouseOnGUIBackswing--; 62 | } 63 | if(gMouseOnGUI) { 64 | gMouseOnGUI = false; 65 | 66 | __MouseOnGUIBackswing = 1; 67 | } -------------------------------------------------------------------------------- /objects/obj_camera/Step_1.gml: -------------------------------------------------------------------------------- 1 | GUI_SetCursorDefault(); 2 | 3 | var w = window_get_width(); 4 | var h = window_get_height(); 5 | 6 | 7 | if((w != windowWidth || h != windowHeight) && surface_exists(application_surface) && (w != 0 && h != 0)) { 8 | DebugMes(["WindowResize", w, h]); 9 | 10 | surface_resize(application_surface, w, h); 11 | 12 | camera_set_view_size(view_camera[0], w * CameraScale(), h * CameraScale()); 13 | 14 | windowWidth = w; 15 | windowHeight = h; 16 | } 17 | 18 | 19 | InstancesOptimize(); 20 | -------------------------------------------------------------------------------- /objects/obj_camera/obj_camera.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_camera", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 27 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":1,"eventType":3,"collisionObjectId":null,}, 28 | ], 29 | "properties": [], 30 | "overriddenProperties": [], 31 | "parent": { 32 | "name": "Objects", 33 | "path": "folders/Objects.yy", 34 | }, 35 | } -------------------------------------------------------------------------------- /objects/obj_dragcheck/Create_0.gml: -------------------------------------------------------------------------------- 1 | gSandboxSceneElementsDragging = noone; 2 | insMouseOn = noone; 3 | 4 | -------------------------------------------------------------------------------- /objects/obj_dragcheck/Draw_64.gml: -------------------------------------------------------------------------------- 1 | // SaveDrawSettings(); 2 | 3 | if(insMouseOn != noone && insMouseOn != undefined && InstanceExists(insMouseOn)) { 4 | draw_set_color(GUIDefaultColor); 5 | draw_set_alpha(GUIDefaultAlpha); 6 | SCENE_DrawRectangleOnGui(insMouseOn.bbox_left, insMouseOn.bbox_top, insMouseOn.bbox_right, insMouseOn.bbox_bottom, true); 7 | } 8 | 9 | // LoadDrawSettings(); -------------------------------------------------------------------------------- /objects/obj_dragcheck/Step_0.gml: -------------------------------------------------------------------------------- 1 | if( 2 | IsMouseOnGUI == false 3 | && !InstanceExists(gSandboxSceneElementsDragging) 4 | && gSandboxGuiElementsDragObjIsOnRightClick == false 5 | && gSandboxMode == ESandboxMode.Normal 6 | ) { 7 | var checkSceneElementObj = noone; 8 | switch(gSandboxSceneElementsLayer) { 9 | case ESandboxSceneElementsLayers.sleepers: 10 | checkSceneElementObj = obj_SceneElementSleeper; 11 | break; 12 | case ESandboxSceneElementsLayers.backgrounds: 13 | checkSceneElementObj = obj_SceneElementBackground; 14 | break; 15 | case ESandboxSceneElementsLayers.decorates: 16 | checkSceneElementObj = obj_SceneElementDecorate; 17 | break; 18 | case ESandboxSceneElementsLayers.beds: 19 | checkSceneElementObj = obj_SceneElementBed; 20 | break; 21 | } 22 | 23 | if(checkSceneElementObj != noone) { 24 | var collisionList = ds_list_create(); 25 | 26 | collision_point_list(mouse_x, mouse_y, checkSceneElementObj, true, false, collisionList, false); 27 | 28 | insMouseOn = collisionList[| ds_list_size(collisionList) - 1]; 29 | if(MouseLeftPressed()) { 30 | gSandboxSceneElementsDragging = insMouseOn; 31 | } 32 | 33 | ds_list_destroy(collisionList); 34 | } 35 | } -------------------------------------------------------------------------------- /objects/obj_dragcheck/obj_dragcheck.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_DragCheck", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 27 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,}, 28 | ], 29 | "properties": [], 30 | "overriddenProperties": [], 31 | "parent": { 32 | "name": "Objects", 33 | "path": "folders/Objects.yy", 34 | }, 35 | } -------------------------------------------------------------------------------- /objects/obj_guielement_button/Create_0.gml: -------------------------------------------------------------------------------- 1 | labelText = ""; 2 | 3 | MyPressedFunction = function() {}; 4 | MyPressedFunctionArgs = undefined; 5 | 6 | width = undefined; 7 | height = undefined; 8 | 9 | // 是否是一次性按钮,如果是的话,那么会在鼠标左键单击后(不管有没有点到按钮)都会删除实例 10 | Disposable = false; 11 | 12 | color = GUIDefaultColor; 13 | 14 | 15 | mouseOnMe = false; 16 | 17 | -------------------------------------------------------------------------------- /objects/obj_guielement_button/Draw_64.gml: -------------------------------------------------------------------------------- 1 | GUI_DrawLabel_ext( 2 | labelText, x, y 3 | , (width == undefined) ? undefined : width / 2 4 | , (height == undefined) ? undefined : height / 2 5 | , mouseOnMe 6 | , color 7 | ); 8 | 9 | -------------------------------------------------------------------------------- /objects/obj_guielement_button/Step_0.gml: -------------------------------------------------------------------------------- 1 | var labelTextWHalf = GUI_GetStringWidthHalf(labelText); 2 | var labelTextHHalf = GUI_GetStringHeightHalf(labelText); 3 | 4 | mouseOnMe = (width == undefined) 5 | ? GUI_MouseGuiOnMe(x - labelTextWHalf, y - labelTextHHalf, x + labelTextWHalf, y + labelTextHHalf) 6 | : GUI_MouseGuiOnMe(x - width / 2, y - height / 2, x + width / 2, y + height / 2) 7 | 8 | 9 | if(mouseOnMe == true){ 10 | GUI_SetCursorHandpoint(); 11 | 12 | gMouseOnGUI = true; 13 | 14 | if(MouseLeftPressed()) { 15 | MyPressedFunction(MyPressedFunctionArgs); 16 | } 17 | } 18 | 19 | if(Disposable && (MouseLeftPressed() || MouseRightPressed())) { 20 | instance_destroy(id); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /objects/obj_guielement_button/obj_guielement_button.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_GuiElement_Button", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,}, 27 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 28 | ], 29 | "properties": [], 30 | "overriddenProperties": [], 31 | "parent": { 32 | "name": "GuiElements", 33 | "path": "folders/Objects/GuiElements.yy", 34 | }, 35 | } -------------------------------------------------------------------------------- /objects/obj_guielement_dragobj/Create_0.gml: -------------------------------------------------------------------------------- 1 | myFilename = ""; 2 | 3 | materialMasterArr = undefined; 4 | materialId = -1; 5 | 6 | width = 256; 7 | height = 256; 8 | 9 | mouseOnMe = false; 10 | 11 | isDragging = false; 12 | mySceneElementIns = noone; // 拖拽出来的物体 13 | 14 | myDeleteButtonIns = noone; // 我的删除按钮 15 | 16 | masterPage = noone; 17 | 18 | mySandboxSceneElementsLayer = ESandboxSceneElementsLayers.nothing; 19 | 20 | MyDelete = function() { 21 | if(masterPage != noone && InstanceExists(masterPage)) { 22 | 23 | var _tempStruct = undefined; 24 | switch(mySandboxSceneElementsLayer) { 25 | case ESandboxSceneElementsLayers.sleepers: 26 | _tempStruct = gSleepersStruct; 27 | 28 | instance_activate_object(obj_SceneElementSleeper); 29 | break; 30 | case ESandboxSceneElementsLayers.backgrounds: 31 | _tempStruct = gBackgroundsStruct; 32 | 33 | instance_activate_object(obj_SceneElementBackground); 34 | break; 35 | case ESandboxSceneElementsLayers.decorates: 36 | _tempStruct = gDecoratesStruct; 37 | 38 | instance_activate_object(obj_SceneElementDecorate); 39 | break; 40 | case ESandboxSceneElementsLayers.beds: 41 | _tempStruct = gBedsStruct; 42 | 43 | instance_activate_object(obj_SceneElementBed); 44 | break; 45 | } 46 | if(_tempStruct == undefined) { 47 | return; 48 | } 49 | 50 | 51 | var myIOnStruct = -1; 52 | var myIOnStructLen = array_length(_tempStruct.materials); 53 | for(var i = 0; i < myIOnStructLen; i++) { 54 | if(_tempStruct.materials[i].filename == myFilename) { 55 | myIOnStruct = i; 56 | } 57 | } 58 | 59 | var myIOnMasterPage = -1; 60 | var myIOnMasterPageLen = masterPage.vecChildElements.size(); 61 | for(var i = 0; i < myIOnMasterPageLen; i++) { 62 | if(masterPage.vecChildElements.Container[i] == id) { 63 | myIOnMasterPage = i; 64 | break; 65 | } 66 | } 67 | 68 | if(myIOnMasterPage != -1) { 69 | GuiElement_PageClearIns(masterPage, myIOnMasterPage, 0); 70 | 71 | switch(mySandboxSceneElementsLayer) { 72 | case ESandboxSceneElementsLayers.sleepers: 73 | SceneElement_ClearSleeperIns(myIOnMasterPage - 1, 1); 74 | break; 75 | case ESandboxSceneElementsLayers.backgrounds: 76 | SceneElement_ClearBackgroundIns(myIOnMasterPage - 1, 1); 77 | break; 78 | case ESandboxSceneElementsLayers.decorates: 79 | SceneElement_ClearDecorateIns(myIOnMasterPage - 1, 1); 80 | break; 81 | case ESandboxSceneElementsLayers.beds: 82 | SceneElement_ClearBedIns(myIOnMasterPage - 1, 1); 83 | break; 84 | } 85 | 86 | GuiElement_PageAlign(masterPage); 87 | 88 | var _jsonTemp = ""; 89 | 90 | if(myIOnStruct != -1) { 91 | switch(mySandboxSceneElementsLayer) { 92 | case ESandboxSceneElementsLayers.sleepers: 93 | array_delete(gSleepersStruct.materials, myIOnStruct, 1); 94 | array_delete(gSleepersSpritesStruct.sprites, myIOnStruct, 1); 95 | _jsonTemp = json_stringify(gSleepersStruct); 96 | 97 | FileWrite(WORKFILEPATH + FILEJSON_sleepers, _jsonTemp); 98 | 99 | FileRemove(WORKFILEPATH + FILEPATH_sleepers + myFilename); 100 | break; 101 | case ESandboxSceneElementsLayers.backgrounds: 102 | array_delete(gBackgroundsStruct.materials, myIOnStruct, 1); 103 | array_delete(gBackgroundsSpritesStruct.sprites, myIOnStruct, 1); 104 | _jsonTemp = json_stringify(gBackgroundsStruct); 105 | 106 | FileWrite(WORKFILEPATH + FILEJSON_backgrounds, _jsonTemp); 107 | 108 | FileRemove(WORKFILEPATH + FILEPATH_backgrounds + myFilename); 109 | break; 110 | case ESandboxSceneElementsLayers.decorates: 111 | array_delete(gDecoratesStruct.materials, myIOnStruct, 1); 112 | array_delete(gDecoratesSpritesStruct.sprites, myIOnStruct, 1); 113 | _jsonTemp = json_stringify(gDecoratesStruct); 114 | 115 | FileWrite(WORKFILEPATH + FILEJSON_decorates, _jsonTemp); 116 | 117 | FileRemove(WORKFILEPATH + FILEPATH_decorates + myFilename); 118 | break; 119 | case ESandboxSceneElementsLayers.beds: 120 | array_delete(gBedsStruct.materials, myIOnStruct, 1); 121 | array_delete(gBedsSpritesStruct.sprites, myIOnStruct, 1); 122 | _jsonTemp = json_stringify(gBedsStruct); 123 | 124 | FileWrite(WORKFILEPATH + FILEJSON_beds, _jsonTemp); 125 | 126 | FileRemove(WORKFILEPATH + FILEPATH_beds + myFilename); 127 | break; 128 | } 129 | 130 | //_jsonTemp = json_stringify(gSceneStruct); 131 | //FileWrite(WORKFILEPATH + FILEJSON_scene, _jsonTemp); 132 | 133 | SaveCloudPack(); 134 | } 135 | } 136 | 137 | // 修改其它 DragObj 的 materialId 138 | if(myIOnMasterPage != -1) { 139 | if(materialId == gSceneStruct.defaultBackground) { 140 | gSceneStruct.defaultBackground = -1; 141 | } 142 | for(var i = myIOnMasterPage; i < myIOnMasterPageLen - 1; i++) { 143 | if(mySandboxSceneElementsLayer == ESandboxSceneElementsLayers.backgrounds) 144 | if(gSceneStruct.defaultBackground != -1 && gSceneStruct.defaultBackground == masterPage.vecChildElements.Container[i].materialId) { 145 | gSceneStruct.defaultBackground--; 146 | } 147 | masterPage.vecChildElements.Container[i].materialId--; 148 | } 149 | } 150 | 151 | if(mySandboxSceneElementsLayer == ESandboxSceneElementsLayers.beds) { 152 | array_delete(gArrDragObjBedsCount, materialId, 1); 153 | } 154 | 155 | instance_destroy(id); 156 | } 157 | } 158 | 159 | -------------------------------------------------------------------------------- /objects/obj_guielement_dragobj/Draw_0.gml: -------------------------------------------------------------------------------- 1 | // 不在房间中绘制自己,所以开个空 Draw Event -------------------------------------------------------------------------------- /objects/obj_guielement_dragobj/Draw_64.gml: -------------------------------------------------------------------------------- 1 | // SaveDrawSettings(); 2 | 3 | draw_set_alpha(1.0); 4 | draw_set_color(c_white); 5 | GUI_DrawSprite_ext(sprite_index, image_index, x, y, image_xscale, image_yscale, image_angle, image_blend, image_alpha); 6 | 7 | if(mySandboxSceneElementsLayer == ESandboxSceneElementsLayers.beds) { 8 | var _dragObjBedsCountGetRes = string(DragObjBedsCountGet(materialId)); 9 | 10 | draw_set_alpha(0.5); 11 | draw_set_color(c_black); 12 | GUI_DrawRectangle(x - width / 2, y - height / 2, x - width / 2 + string_width(_dragObjBedsCountGetRes), y - height / 2 + string_height(_dragObjBedsCountGetRes), false); 13 | 14 | draw_set_color(c_white); 15 | GUI_DrawText( 16 | x - width / 2, y - height / 2 17 | , _dragObjBedsCountGetRes 18 | , false 19 | ); 20 | } 21 | 22 | if(mouseOnMe) { 23 | draw_set_alpha(GUIHighLightAlpha); 24 | GUI_DrawRectangle(x - width / 2, y - height / 2, x + width / 2, y + height / 2); 25 | 26 | GUI_DrawLabel(myFilename, 27 | GetPositionXOnGUI(mouse_x) + string_width(myFilename) / 2 + 12, 28 | GetPositionYOnGUI(mouse_y) + string_height(myFilename) / 2 + 12, 29 | false); 30 | 31 | // "删除"按钮 32 | if(MouseRightPressed() && !InstanceExists(gSandboxSceneElementsDragging)) { 33 | gSandboxGuiElementsDragObjIsOnRightClick = true; 34 | 35 | 36 | var buttonsOffsetX = GetPositionXOnGUI(mouse_x) + 12; 37 | var buttonsOffsetY = GetPositionYOnGUI(mouse_y) + 12; 38 | 39 | switch(mySandboxSceneElementsLayer) { 40 | case ESandboxSceneElementsLayers.sleepers: 41 | materialMasterArr = gSleepersStruct.materials; 42 | break; 43 | case ESandboxSceneElementsLayers.backgrounds: 44 | materialMasterArr = gBackgroundsStruct.materials; 45 | break; 46 | case ESandboxSceneElementsLayers.decorates: 47 | materialMasterArr = gDecoratesStruct.materials; 48 | break; 49 | case ESandboxSceneElementsLayers.beds: 50 | materialMasterArr = gBedsStruct.materials; 51 | break; 52 | } 53 | var newbtYAdd = 32; 54 | var newbtStr = ""; 55 | var newins = noone; 56 | switch(mySandboxSceneElementsLayer) { 57 | case ESandboxSceneElementsLayers.sleepers: 58 | case ESandboxSceneElementsLayers.decorates: 59 | case ESandboxSceneElementsLayers.beds: 60 | 61 | newbtStr = "更改物体中心点"; 62 | newins = GuiElement_CreateButton(buttonsOffsetX + string_width(newbtStr) / 2, buttonsOffsetY + string_height(newbtStr) / 2, newbtStr, function() { GuiElement_CreateOffsetSetter(materialMasterArr, materialId, sprite_index); gSandboxGuiElementsDragObjIsOnRightClick = false; }, true); 63 | newins.depth = depth - 1; 64 | 65 | buttonsOffsetY += newbtYAdd; 66 | 67 | } 68 | switch(mySandboxSceneElementsLayer) { 69 | case ESandboxSceneElementsLayers.decorates: 70 | case ESandboxSceneElementsLayers.beds: 71 | newbtStr = "更改物体碰撞体积"; 72 | newins = GuiElement_CreateButton(buttonsOffsetX + string_width(newbtStr) / 2, buttonsOffsetY + string_height(newbtStr) / 2, newbtStr, function() { GuiElement_CreateHitboxSetter(materialMasterArr, materialId, sprite_index); gSandboxGuiElementsDragObjIsOnRightClick = false; }, true); 73 | newins.depth = depth - 1; 74 | 75 | buttonsOffsetY += newbtYAdd; 76 | 77 | break; 78 | } 79 | 80 | switch(mySandboxSceneElementsLayer) { 81 | case ESandboxSceneElementsLayers.sleepers: 82 | newbtStr = "编辑睡客表情包"; 83 | newins = GuiElement_CreateButton(buttonsOffsetX + string_width(newbtStr) / 2, buttonsOffsetY + string_height(newbtStr) / 2, newbtStr, function() { GuiElement_CreateSleeperEmoteSetter(/*materialMasterArr, */materialId, sprite_index); gSandboxGuiElementsDragObjIsOnRightClick = false; }, true); 84 | newins.depth = depth - 1; 85 | 86 | buttonsOffsetY += newbtYAdd; 87 | 88 | break; 89 | 90 | case ESandboxSceneElementsLayers.backgrounds: 91 | newbtStr = "设为默认背景图"; 92 | newins = GuiElement_CreateButton(buttonsOffsetX + string_width(newbtStr) / 2, buttonsOffsetY + string_height(newbtStr) / 2, newbtStr, function() { SetSceneDefaultBackground(materialId); gSandboxGuiElementsDragObjIsOnRightClick = false; }, true); 93 | newins.depth = depth - 1; 94 | 95 | buttonsOffsetY += newbtYAdd; 96 | 97 | break; 98 | 99 | case ESandboxSceneElementsLayers.beds: 100 | newbtStr = "编辑睡客互动"; 101 | newins = GuiElement_CreateButton(buttonsOffsetX + string_width(newbtStr) / 2, buttonsOffsetY + string_height(newbtStr) / 2, newbtStr, function() { GuiElement_CreateBedSleepSetter(/*materialMasterArr, */materialId, sprite_index); gSandboxGuiElementsDragObjIsOnRightClick = false; }, true); 102 | newins.depth = depth - 1; 103 | 104 | buttonsOffsetY += newbtYAdd; 105 | 106 | break; 107 | } 108 | 109 | var _btDeleteStr = "删除 " + myFilename; 110 | myDeleteButtonIns = GuiElement_CreateButton(buttonsOffsetX + string_width(_btDeleteStr) / 2, buttonsOffsetY + string_height(_btDeleteStr) / 2, _btDeleteStr, function() { MyDelete(); gSandboxGuiElementsDragObjIsOnRightClick = false; }, true, GUIDangerousColor); 111 | myDeleteButtonIns.depth = depth - 1; 112 | } 113 | } 114 | 115 | if(myDeleteButtonIns != noone) { 116 | if(InstanceExists(myDeleteButtonIns) == false) { 117 | myDeleteButtonIns = noone; 118 | gSandboxGuiElementsDragObjIsOnRightClick = false; 119 | } 120 | } 121 | 122 | // LoadDrawSettings(); 123 | 124 | -------------------------------------------------------------------------------- /objects/obj_guielement_dragobj/Step_0.gml: -------------------------------------------------------------------------------- 1 | if(GUI_MouseGuiOnMe(x - width / 2, y - height / 2, x + width / 2, y + height / 2)) { 2 | mouseOnMe = true; 3 | gMouseOnGUI = true; 4 | } else { 5 | mouseOnMe = false; 6 | } 7 | 8 | if(MouseLeftPressed() && mouseOnMe && !InstanceExists(gSandboxSceneElementsDragging) && gSandboxGuiElementsDragObjIsOnRightClick == false) { 9 | switch(gSandboxMode) { 10 | case ESandboxMode.Normal: 11 | isDragging = true; 12 | 13 | switch(mySandboxSceneElementsLayer) { 14 | case ESandboxSceneElementsLayers.sleepers: 15 | mySceneElementIns = SceneElement_CreateSleeper(materialId, , , , sprite_index); 16 | break; 17 | case ESandboxSceneElementsLayers.backgrounds: 18 | mySceneElementIns = SceneElement_CreateBackground(materialId, , , , sprite_index); 19 | break; 20 | case ESandboxSceneElementsLayers.decorates: 21 | mySceneElementIns = SceneElement_CreateDecorate(materialId, , , , sprite_index); 22 | break; 23 | case ESandboxSceneElementsLayers.beds: 24 | mySceneElementIns = SceneElement_CreateBed(materialId, , , , sprite_index); 25 | break; 26 | } 27 | 28 | gSandboxSceneElementsDragging = mySceneElementIns; 29 | 30 | break; 31 | case ESandboxMode.Pencil: 32 | gSandboxPencilMaterialId = materialId; 33 | gSandboxPencilSceneElementsLayer = mySandboxSceneElementsLayer; 34 | break; 35 | } 36 | } 37 | 38 | if(gSandboxSceneElementsDragging != noone && isDragging) { 39 | if(MouseLeftHold()) { 40 | 41 | } else { 42 | isDragging = false; 43 | gSandboxSceneElementsDragging = noone; 44 | } 45 | } 46 | 47 | // DebugMes([gSandboxSceneElementsLayer, gSandboxSceneElementsDragging, InstanceExists(gSandboxSceneElementsDragging), gSandboxGuiElementsDragObjIsOnRightClick]); -------------------------------------------------------------------------------- /objects/obj_guielement_dragobj/obj_guielement_dragobj.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_GuiElement_DragObj", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":8,"collisionObjectId":null,}, 27 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 28 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 29 | ], 30 | "properties": [], 31 | "overriddenProperties": [], 32 | "parent": { 33 | "name": "GuiElements", 34 | "path": "folders/Objects/GuiElements.yy", 35 | }, 36 | } -------------------------------------------------------------------------------- /objects/obj_guielement_hitboxsetter/Alarm_0.gml: -------------------------------------------------------------------------------- 1 | if(materialId >= 0 && materialId < array_length(materialMasterArr)) { 2 | if(array_length(materialMasterArr[materialId].hitbox) >= 4) { 3 | myhitLeft = round(materialMasterArr[materialId].hitbox[0]); 4 | myhitTop = round(materialMasterArr[materialId].hitbox[1]); 5 | myhitRight = round(materialMasterArr[materialId].hitbox[2]); 6 | myhitBottom = round(materialMasterArr[materialId].hitbox[3]); 7 | } else { 8 | MyAutoSet(); 9 | } 10 | } 11 | 12 | if(sprite != undefined && sprite_exists(sprite)) { 13 | var _scalesTemp; 14 | if(sprite_get_width(sprite) > sprite_get_height(sprite)) { 15 | _scalesTemp = SetSizeLockAspect_Width_Generic(myImageMinimumWidthHeight, sprite_get_width(sprite)); 16 | } else { 17 | _scalesTemp = SetSizeLockAspect_Height_Generic(myImageMinimumWidthHeight, sprite_get_height(sprite)); 18 | } 19 | 20 | xscale = _scalesTemp[0]; 21 | yscale = _scalesTemp[1]; 22 | 23 | spriteLeft = (left + right) / 2 - xscale * sprite_get_width(sprite) / 2; 24 | spriteTop = (top + bottom) / 2 - yscale * sprite_get_height(sprite) / 2; 25 | spriteRight = (left + right) / 2 + xscale * sprite_get_width(sprite) / 2; 26 | spriteBottom = (top + bottom) / 2 + yscale * sprite_get_height(sprite) / 2; 27 | } 28 | 29 | MySynchHitboxTextbox(); 30 | 31 | 32 | inited = true; 33 | 34 | -------------------------------------------------------------------------------- /objects/obj_guielement_hitboxsetter/CleanUp_0.gml: -------------------------------------------------------------------------------- 1 | for(var i = 0; i < vecMyGuiElements.size(); i++) { 2 | if(InstanceExists(vecMyGuiElements.Container[i])) { 3 | instance_destroy(vecMyGuiElements.Container[i]); 4 | } 5 | } 6 | 7 | delete vecMyGuiElements; 8 | 9 | -------------------------------------------------------------------------------- /objects/obj_guielement_hitboxsetter/Create_0.gml: -------------------------------------------------------------------------------- 1 | materialMasterArr = []; 2 | materialId = -1; 3 | 4 | sprite = undefined; 5 | 6 | xscale = 0; 7 | yscale = 0; 8 | 9 | // 我的当前正在设定中的碰撞箱 10 | myhitLeft = 0; 11 | myhitTop = 0; 12 | myhitRight = 0; 13 | myhitBottom = 0; 14 | 15 | 16 | width = undefined; 17 | 18 | mouseOnMe = false; 19 | 20 | 21 | myImageMinimumWidthHeight = 512; 22 | bottomEdgeHeight = 88; 23 | 24 | left = 480; 25 | top = 64; 26 | right = left + myImageMinimumWidthHeight; 27 | bottom = top + myImageMinimumWidthHeight; 28 | 29 | spriteLeft = left; 30 | spriteTop = top; 31 | spriteRight = right; 32 | spriteBottom = bottom; 33 | 34 | // 可拖动的角标的大小(的一半) 35 | draggerRadius = 8; 36 | 37 | // 0 左上,1 右上,2 左下,3 右下,-1 无 38 | draggerIdMouseOn = -1; 39 | 40 | mouseIsDragging = false; 41 | 42 | 43 | MyAutoSet = function() { 44 | var bboxmodeWas = sprite_get_bbox_mode(sprite); 45 | sprite_set_bbox_mode(sprite, bboxmode_automatic); 46 | 47 | myhitLeft = sprite_get_bbox_left(sprite); 48 | myhitTop = sprite_get_bbox_top(sprite); 49 | myhitRight = sprite_get_bbox_right(sprite); 50 | myhitBottom = sprite_get_bbox_bottom(sprite); 51 | 52 | sprite_set_bbox_mode(sprite, bboxmodeWas); 53 | } 54 | MySave = function() { 55 | if(materialId >= 0 && materialId < array_length(materialMasterArr)) { 56 | materialMasterArr[materialId].hitbox[0] = myhitLeft; 57 | materialMasterArr[materialId].hitbox[1] = myhitTop; 58 | materialMasterArr[materialId].hitbox[2] = myhitRight; 59 | materialMasterArr[materialId].hitbox[3] = myhitBottom; 60 | } 61 | } 62 | 63 | 64 | vecMyGuiElements = new vector(); 65 | 66 | var _strTemp = ""; 67 | 68 | _strTemp = "自动设定"; 69 | vecMyGuiElements.push_back(GuiElement_CreateButton(left + 32 + string_width(_strTemp) / 2, bottom + bottomEdgeHeight / 2, _strTemp, function() { MyAutoSet(); MySynchHitboxTextbox(); })); 70 | 71 | 72 | // hitLeft/Top/Right/Bottom 文本框 73 | var _hitboxTextboxWidth = string_width("000000"); 74 | var _hitboxTextboxHeight = string_height("0"); 75 | 76 | // hitLeft 77 | vecMyGuiElements.push_back(textbox_create(left + 128, bottom + bottomEdgeHeight / 2 - _hitboxTextboxHeight / 2, _hitboxTextboxWidth, _hitboxTextboxHeight, string(myhitLeft), "left", 24, fontRegular, function() {})); 78 | textbox_set_font(vecMyGuiElements.back(), fontRegular, c_white, _hitboxTextboxHeight, 0); 79 | hitLeftTextboxIns = vecMyGuiElements.back(); 80 | 81 | // hitTop 82 | vecMyGuiElements.push_back(textbox_create(left + 128 + _hitboxTextboxWidth + 16, bottom + 8, _hitboxTextboxWidth, _hitboxTextboxHeight, string(myhitTop), "top", 24, fontRegular, function() {})); 83 | textbox_set_font(vecMyGuiElements.back(), fontRegular, c_white, _hitboxTextboxHeight, 0); 84 | hitTopTextboxIns = vecMyGuiElements.back(); 85 | 86 | // hitRight 87 | vecMyGuiElements.push_back(textbox_create(left + 128 + (_hitboxTextboxWidth + 16) * 2, bottom + bottomEdgeHeight / 2 - _hitboxTextboxHeight / 2, _hitboxTextboxWidth, _hitboxTextboxHeight, string(myhitRight), "right", 24, fontRegular, function() {})); 88 | textbox_set_font(vecMyGuiElements.back(), fontRegular, c_white, _hitboxTextboxHeight, 0); 89 | hitRightTextboxIns = vecMyGuiElements.back(); 90 | 91 | // hitBottom 92 | vecMyGuiElements.push_back(textbox_create(left + 128 + _hitboxTextboxWidth + 16, bottom + 8 + 16 + _hitboxTextboxHeight, _hitboxTextboxWidth, _hitboxTextboxHeight, string(myhitBottom), "bottom", 24, fontRegular, function() {})); 93 | textbox_set_font(vecMyGuiElements.back(), fontRegular, c_white, _hitboxTextboxHeight, 0); 94 | hitBottomTextboxIns = vecMyGuiElements.back(); 95 | 96 | 97 | _strTemp = "保存"; 98 | vecMyGuiElements.push_back(GuiElement_CreateButton(right - 32 - string_width(_strTemp) / 2, bottom + bottomEdgeHeight / 2, _strTemp, function() { MySave(); })); 99 | 100 | for(var i = 0; i < vecMyGuiElements.size(); i++) { 101 | if(InstanceExists(vecMyGuiElements.Container[i])) { 102 | vecMyGuiElements.Container[i].depth = depth - 1; 103 | } 104 | } 105 | 106 | 107 | MySynchHitboxTextbox = function() { 108 | if(InstanceExists(hitLeftTextboxIns)) { 109 | hitLeftTextboxIns.curt.tx = (string(myhitLeft)); 110 | } 111 | if(InstanceExists(hitTopTextboxIns)) { 112 | hitTopTextboxIns.curt.tx = (string(myhitTop)); 113 | } 114 | if(InstanceExists(hitRightTextboxIns)) { 115 | hitRightTextboxIns.curt.tx = (string(myhitRight)); 116 | } 117 | if(InstanceExists(hitBottomTextboxIns)) { 118 | hitBottomTextboxIns.curt.tx = (string(myhitBottom)); 119 | } 120 | } 121 | 122 | 123 | 124 | inited = false; 125 | alarm_set(0, 1); 126 | -------------------------------------------------------------------------------- /objects/obj_guielement_hitboxsetter/Draw_64.gml: -------------------------------------------------------------------------------- 1 | draw_set_color(GUIDefaultColor); 2 | draw_set_alpha(GUIDefaultAlpha); 3 | 4 | GUI_DrawRectangle(left, top, right, bottom, false); 5 | 6 | draw_set_alpha(1.0); 7 | GUI_DrawRectangle(left, bottom, right, bottom + bottomEdgeHeight, false); 8 | 9 | if(sprite != undefined && sprite_exists(sprite)) { 10 | GUI_DrawSprite_ext(sprite, 0, (left + right) / 2, (top + bottom) / 2, xscale, yscale, 0, c_white, 1); 11 | 12 | 13 | var leftPixel = spriteLeft + myhitLeft * xscale; 14 | var topPixel = spriteTop + myhitTop * yscale; 15 | var rightPixel = spriteLeft + myhitRight * xscale; 16 | var bottomPixel = spriteTop + myhitBottom * yscale; 17 | 18 | draw_set_color(c_black); 19 | draw_set_alpha(0.4); 20 | 21 | GUI_DrawRectangle(leftPixel, topPixel, rightPixel, bottomPixel); 22 | 23 | draw_set_alpha(GUIDefaultAlpha); 24 | 25 | GUI_DrawRectangle_Radius(leftPixel, topPixel, draggerRadius, false); 26 | GUI_DrawRectangle_Radius(rightPixel, topPixel, draggerRadius, false); 27 | GUI_DrawRectangle_Radius(leftPixel, bottomPixel, draggerRadius, false); 28 | GUI_DrawRectangle_Radius(rightPixel, bottomPixel, draggerRadius, false); 29 | 30 | draw_set_color(c_white); 31 | draw_set_alpha(GUIHighLightAlpha); 32 | if(draggerIdMouseOn != -1) { 33 | var _x = 0; 34 | var _y = 0; 35 | if(draggerIdMouseOn == 0) { _x = leftPixel; _y = topPixel; } 36 | if(draggerIdMouseOn == 1) { _x = rightPixel; _y = topPixel; } 37 | if(draggerIdMouseOn == 2) { _x = leftPixel; _y = bottomPixel; } 38 | if(draggerIdMouseOn == 3) { _x = rightPixel; _y = bottomPixel; } 39 | GUI_DrawRectangle_Radius(_x, _y, draggerRadius, false); 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /objects/obj_guielement_hitboxsetter/Step_0.gml: -------------------------------------------------------------------------------- 1 | if(GUI_MouseGuiOnMe(left, top, right, bottom + bottomEdgeHeight)) { 2 | mouseOnMe = true; 3 | gMouseOnGUI = true; 4 | } else if(draggerIdMouseOn = -1) { 5 | mouseOnMe = false; 6 | 7 | if(MouseLeftPressed() || MouseRightPressed()) { 8 | instance_destroy(id); 9 | } 10 | } 11 | 12 | 13 | var leftPixel = spriteLeft + myhitLeft * xscale; 14 | var topPixel = spriteTop + myhitTop * yscale; 15 | var rightPixel = spriteLeft + myhitRight * xscale; 16 | var bottomPixel = spriteTop + myhitBottom * yscale; 17 | 18 | if(/*GUI_MouseGuiOnMe(spriteLeft, spriteTop, spriteRight, spriteBottom) && */mouseIsDragging == false) { 19 | if(GUI_MouseGuiOnMe_Radius(leftPixel, topPixel, draggerRadius)) { 20 | draggerIdMouseOn = 0; 21 | } else 22 | if(GUI_MouseGuiOnMe_Radius(rightPixel, topPixel, draggerRadius)) { 23 | draggerIdMouseOn = 1; 24 | } else 25 | if(GUI_MouseGuiOnMe_Radius(leftPixel, bottomPixel, draggerRadius)) { 26 | draggerIdMouseOn = 2; 27 | } else 28 | if(GUI_MouseGuiOnMe_Radius(rightPixel, bottomPixel, draggerRadius)) { 29 | draggerIdMouseOn = 3; 30 | } else { 31 | draggerIdMouseOn = -1; 32 | } 33 | } 34 | 35 | 36 | if(inited 37 | && InstanceExists(hitLeftTextboxIns) 38 | && InstanceExists(hitTopTextboxIns) 39 | && InstanceExists(hitRightTextboxIns) 40 | && InstanceExists(hitBottomTextboxIns) 41 | ) { 42 | var myhitLeftStr = string_digits(textbox_return(hitLeftTextboxIns)); 43 | var myhitTopStr = string_digits(textbox_return(hitTopTextboxIns)); 44 | var myhitRightStr = string_digits(textbox_return(hitRightTextboxIns)); 45 | var myhitBottomStr = string_digits(textbox_return(hitBottomTextboxIns)); 46 | 47 | myhitLeft = (string_length(myhitLeftStr) > 0) ? real(myhitLeftStr) : 0; 48 | myhitTop = (string_length(myhitTopStr) > 0) ? real(myhitTopStr) : 0; 49 | myhitRight = (string_length(myhitRightStr) > 0) ? real(myhitRightStr) : 0; 50 | myhitBottom = (string_length(myhitBottomStr) > 0) ? real(myhitBottomStr) : 0; 51 | 52 | // if(GUI_MouseGuiOnMe(spriteLeft, spriteTop, spriteRight, spriteBottom)) { 53 | if(1) { 54 | if(draggerIdMouseOn != -1) { 55 | gMouseOnGUI = true; 56 | if(MouseLeftHold()) { 57 | mouseIsDragging = true; 58 | 59 | gMouseOnGUI = true; 60 | 61 | var mx = round((GetPositionXOnGUI(mouse_x) - spriteLeft) / xscale); 62 | var my = round((GetPositionYOnGUI(mouse_y) - spriteTop) / yscale); 63 | 64 | switch(draggerIdMouseOn) { 65 | case 0: 66 | myhitLeft = round(mx); 67 | myhitTop = round(my); 68 | 69 | myhitLeft = clamp(myhitLeft, 0, myhitRight); 70 | myhitTop = clamp(myhitTop, 0, myhitBottom); 71 | 72 | break; 73 | case 1: 74 | myhitRight = round(mx); 75 | myhitTop = round(my); 76 | 77 | myhitRight = clamp(myhitRight, myhitLeft, sprite_get_width(sprite) - 1); 78 | myhitTop = clamp(myhitTop, 0, myhitBottom); 79 | 80 | break; 81 | case 2: 82 | myhitLeft = round(mx); 83 | myhitBottom = round(my); 84 | 85 | myhitLeft = clamp(myhitLeft, 0, myhitRight); 86 | myhitBottom = clamp(myhitBottom, myhitTop, sprite_get_height(sprite) - 1); 87 | 88 | break; 89 | case 3: 90 | myhitRight = round(mx); 91 | myhitBottom = round(my); 92 | 93 | myhitRight = clamp(myhitRight, myhitLeft, sprite_get_width(sprite) - 1); 94 | myhitBottom = clamp(myhitBottom, myhitTop, sprite_get_height(sprite) - 1); 95 | 96 | break; 97 | } 98 | } else { 99 | mouseIsDragging = false; 100 | } 101 | } 102 | } 103 | 104 | if((hitLeftTextboxIns.curt.fo || hitTopTextboxIns.curt.fo || hitRightTextboxIns.curt.fo || hitBottomTextboxIns.curt.fo) == false) { 105 | MySynchHitboxTextbox(); 106 | } 107 | } 108 | 109 | -------------------------------------------------------------------------------- /objects/obj_guielement_hitboxsetter/obj_guielement_hitboxsetter.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_GuiElement_HitboxSetter", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 27 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,}, 28 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":12,"collisionObjectId":null,}, 29 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":2,"collisionObjectId":null,}, 30 | ], 31 | "properties": [], 32 | "overriddenProperties": [], 33 | "parent": { 34 | "name": "GuiElements", 35 | "path": "folders/Objects/GuiElements.yy", 36 | }, 37 | } -------------------------------------------------------------------------------- /objects/obj_guielement_offsetsetter/Alarm_0.gml: -------------------------------------------------------------------------------- 1 | if(materialId >= 0 && materialId < array_length(materialMasterArr)) { 2 | if(array_length(materialMasterArr[materialId].offset) >= 2) { 3 | myoffx = round(materialMasterArr[materialId].offset[0]); 4 | myoffy = round(materialMasterArr[materialId].offset[1]); 5 | } else { 6 | MyAutoSet(); 7 | } 8 | } 9 | 10 | if(sprite != undefined && sprite_exists(sprite)) { 11 | var _scalesTemp; 12 | if(sprite_get_width(sprite) > sprite_get_height(sprite)) { 13 | _scalesTemp = SetSizeLockAspect_Width_Generic(myImageMinimumWidthHeight, sprite_get_width(sprite)); 14 | } else { 15 | _scalesTemp = SetSizeLockAspect_Height_Generic(myImageMinimumWidthHeight, sprite_get_height(sprite)); 16 | } 17 | 18 | xscale = _scalesTemp[0]; 19 | yscale = _scalesTemp[1]; 20 | 21 | spriteLeft = (left + right) / 2 - xscale * sprite_get_width(sprite) / 2; 22 | spriteTop = (top + bottom) / 2 - yscale * sprite_get_height(sprite) / 2; 23 | spriteRight = (left + right) / 2 + xscale * sprite_get_width(sprite) / 2; 24 | spriteBottom = (top + bottom) / 2 + yscale * sprite_get_height(sprite) / 2; 25 | } 26 | 27 | MySynchXYTextbox(); 28 | 29 | 30 | inited = true; 31 | 32 | -------------------------------------------------------------------------------- /objects/obj_guielement_offsetsetter/CleanUp_0.gml: -------------------------------------------------------------------------------- 1 | for(var i = 0; i < vecMyGuiElements.size(); i++) { 2 | if(InstanceExists(vecMyGuiElements.Container[i])) { 3 | instance_destroy(vecMyGuiElements.Container[i]); 4 | } 5 | } 6 | 7 | delete vecMyGuiElements; 8 | 9 | -------------------------------------------------------------------------------- /objects/obj_guielement_offsetsetter/Create_0.gml: -------------------------------------------------------------------------------- 1 | materialMasterArr = []; 2 | materialId = -1; 3 | 4 | sprite = undefined; 5 | 6 | xscale = 0; 7 | yscale = 0; 8 | 9 | // 我的当前正在设定中的中心点 10 | myoffx = 0; 11 | myoffy = 0; 12 | 13 | 14 | width = undefined; 15 | 16 | mouseOnMe = false; 17 | 18 | 19 | myImageMinimumWidthHeight = 512; 20 | bottomEdgeHeight = 36; 21 | 22 | left = 480; 23 | top = 64; 24 | right = left + myImageMinimumWidthHeight; 25 | bottom = top + myImageMinimumWidthHeight; 26 | 27 | spriteLeft = left; 28 | spriteTop = top; 29 | spriteRight = right; 30 | spriteBottom = bottom; 31 | 32 | 33 | MyAutoSet = function() { 34 | myoffx = round(sprite_get_width(sprite) / 2); 35 | myoffy = round(sprite_get_height(sprite) / 2); 36 | } 37 | MySave = function() { 38 | if(materialId >= 0 && materialId < array_length(materialMasterArr)) { 39 | materialMasterArr[materialId].offset[0] = myoffx; 40 | materialMasterArr[materialId].offset[1] = myoffy; 41 | } 42 | } 43 | 44 | 45 | vecMyGuiElements = new vector(); 46 | 47 | var _strTemp = ""; 48 | 49 | _strTemp = "自动设定"; 50 | vecMyGuiElements.push_back(GuiElement_CreateButton(left + 32 + string_width(_strTemp) / 2, bottom + bottomEdgeHeight / 2, _strTemp, function() { MyAutoSet(); MySynchXYTextbox(); })); 51 | 52 | // x和y文本框 53 | var _xyTextboxWidth = string_width("000000"); 54 | var _xyTextboxHeight = string_height("0"); 55 | 56 | vecMyGuiElements.push_back(textbox_create(left + 128, bottom + 4, _xyTextboxWidth, _xyTextboxHeight, string(myoffx), "x", 24, fontRegular, function() {})); 57 | textbox_set_font(vecMyGuiElements.back(), fontRegular, c_white, _xyTextboxHeight, 0); 58 | xTextboxIns = vecMyGuiElements.back(); 59 | 60 | vecMyGuiElements.push_back(textbox_create(left + 128 + _xyTextboxWidth + 16, bottom + 4, _xyTextboxWidth, _xyTextboxHeight, string(myoffy), "y", 24, fontRegular, function() {})); 61 | textbox_set_font(vecMyGuiElements.back(), fontRegular, c_white, _xyTextboxHeight, 0); 62 | yTextboxIns = vecMyGuiElements.back(); 63 | 64 | 65 | _strTemp = "保存"; 66 | vecMyGuiElements.push_back(GuiElement_CreateButton(right - 32 - string_width(_strTemp) / 2, bottom + bottomEdgeHeight / 2, _strTemp, function() { MySave(); })); 67 | 68 | for(var i = 0; i < vecMyGuiElements.size(); i++) { 69 | if(InstanceExists(vecMyGuiElements.Container[i])) { 70 | vecMyGuiElements.Container[i].depth = depth - 1; 71 | } 72 | } 73 | 74 | 75 | MySynchXYTextbox = function() { 76 | if(InstanceExists(xTextboxIns)) { 77 | xTextboxIns.curt.tx = (string(myoffx)); 78 | } 79 | if(InstanceExists(yTextboxIns)) { 80 | yTextboxIns.curt.tx = (string(myoffy)); 81 | } 82 | } 83 | 84 | 85 | 86 | inited = false; 87 | alarm_set(0, 1); 88 | -------------------------------------------------------------------------------- /objects/obj_guielement_offsetsetter/Draw_64.gml: -------------------------------------------------------------------------------- 1 | draw_set_color(GUIDefaultColor); 2 | draw_set_alpha(GUIDefaultAlpha); 3 | 4 | GUI_DrawRectangle(left, top, right, bottom, false); 5 | 6 | draw_set_alpha(1.0); 7 | GUI_DrawRectangle(left, bottom, right, bottom + bottomEdgeHeight, false); 8 | 9 | if(sprite != undefined && sprite_exists(sprite)) { 10 | GUI_DrawSprite_ext(sprite, 0, (left + right) / 2, (top + bottom) / 2, xscale, yscale, 0, c_white, 1); 11 | 12 | var pointMidX = spriteLeft + myoffx * xscale; 13 | var pointMidY = spriteTop + myoffy * yscale; 14 | var pointMidSize = 2; 15 | var pointLineLen = 18; 16 | draw_set_color(c_white); 17 | draw_set_alpha(0.7); 18 | GUI_DrawRectangle(pointMidX - pointLineLen, pointMidY - pointMidSize, pointMidX - pointMidSize, pointMidY + pointMidSize, false); 19 | GUI_DrawRectangle(pointMidX + pointLineLen, pointMidY - pointMidSize, pointMidX + pointMidSize, pointMidY + pointMidSize, false); 20 | 21 | draw_set_color(c_black); 22 | GUI_DrawRectangle(pointMidX - pointLineLen, pointMidY - pointMidSize, pointMidX - pointMidSize, pointMidY + pointMidSize, true); 23 | GUI_DrawRectangle(pointMidX + pointLineLen, pointMidY - pointMidSize, pointMidX + pointMidSize, pointMidY + pointMidSize, true); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /objects/obj_guielement_offsetsetter/Step_0.gml: -------------------------------------------------------------------------------- 1 | if(GUI_MouseGuiOnMe(left, top, right, bottom + bottomEdgeHeight)) { 2 | mouseOnMe = true; 3 | gMouseOnGUI = true; 4 | } else { 5 | mouseOnMe = false; 6 | 7 | if(MouseLeftPressed() || MouseRightPressed()) { 8 | instance_destroy(id); 9 | } 10 | } 11 | 12 | if(inited 13 | && InstanceExists(xTextboxIns) 14 | && InstanceExists(yTextboxIns) 15 | ) { 16 | var myoffxStr = string_digits(textbox_return(xTextboxIns)); 17 | var myoffyStr = string_digits(textbox_return(yTextboxIns)); 18 | 19 | myoffx = (string_length(myoffxStr) > 0) ? real(myoffxStr) : 0; 20 | myoffy = (string_length(myoffyStr) > 0) ? real(myoffyStr) : 0; 21 | 22 | if(GUI_MouseGuiOnMe(spriteLeft, spriteTop, spriteRight, spriteBottom)) { 23 | if(MouseLeftHold()) { 24 | myoffx = round((GetPositionXOnGUI(mouse_x) - spriteLeft) / xscale); 25 | myoffy = round((GetPositionYOnGUI(mouse_y) - spriteTop) / yscale); 26 | } 27 | } 28 | 29 | if((xTextboxIns.curt.fo || yTextboxIns.curt.fo) == false) { 30 | MySynchXYTextbox(); 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /objects/obj_guielement_offsetsetter/obj_guielement_offsetsetter.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_GuiElement_OffsetSetter", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 27 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,}, 28 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":12,"collisionObjectId":null,}, 29 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":2,"collisionObjectId":null,}, 30 | ], 31 | "properties": [], 32 | "overriddenProperties": [], 33 | "parent": { 34 | "name": "GuiElements", 35 | "path": "folders/Objects/GuiElements.yy", 36 | }, 37 | } -------------------------------------------------------------------------------- /objects/obj_guielement_page/CleanUp_0.gml: -------------------------------------------------------------------------------- 1 | delete vecChildElements; 2 | delete vecChildElementsInitY; 3 | delete vecChildElementsHeight; -------------------------------------------------------------------------------- /objects/obj_guielement_page/Create_0.gml: -------------------------------------------------------------------------------- 1 | vecChildElements = new vector(); 2 | vecChildElementsInitY = new vector(); 3 | vecChildElementsHeight = new vector(); 4 | 5 | childElementsBottom = 0; 6 | 7 | labelText = ""; 8 | labelAlpha = 1.0; 9 | 10 | width = 256; 11 | height = 0; // height 的真正初始化需要在 GuiElement_CreatePage() 找到 12 | 13 | visible = false; 14 | working = false; 15 | 16 | MyStartWork = function() { 17 | if(working == false) { 18 | working = true; 19 | 20 | DebugMes(labelText + " Page On"); 21 | 22 | for(var i = 0; i < vecChildElements.size(); i++) { 23 | instance_activate_object(vecChildElements.Container[i]); 24 | } 25 | } 26 | } 27 | 28 | MyStopWork = function() { 29 | if(working == true) { 30 | working = false; 31 | 32 | DebugMes(labelText + " Page Off"); 33 | 34 | for(var i = 0; i < vecChildElements.size(); i++) { 35 | instance_deactivate_object(vecChildElements.Container[i]); 36 | } 37 | } 38 | } 39 | 40 | scrollYSpeed = 50; 41 | 42 | scrollYPrev = 0; 43 | scrollY = 0; 44 | MyScrollElements = function(_yAdd) { 45 | for(var i = 0; i < vecChildElements.size(); i++) { 46 | if(InstanceExists(vecChildElements.Container[i]) == false) { 47 | continue; 48 | } 49 | switch(vecChildElements.Container[i].object_index) { 50 | case textbox: 51 | textbox_set_position(vecChildElements.Container[i], 0, _yAdd, true); 52 | break; 53 | default: 54 | vecChildElements.Container[i].y += _yAdd; 55 | } 56 | } 57 | } 58 | 59 | scrollBarWidthMax = 16; 60 | scrollBarWidthMin = 8; 61 | scrollBarWidth = scrollBarWidthMin; 62 | scrollBarIsDragging = false; 63 | scrollBarDraggingOffY = 0; 64 | -------------------------------------------------------------------------------- /objects/obj_guielement_page/Draw_64.gml: -------------------------------------------------------------------------------- 1 | // SaveDrawSettings(); 2 | 3 | draw_set_color(GUIDefaultColor); 4 | draw_set_alpha(GUIDefaultAlpha); 5 | GUI_DrawRectangle(x, y, x + width, y + height); 6 | 7 | if(scrollY < 0) { 8 | labelAlpha = lerp(labelAlpha, 0, 0.1); 9 | } else { 10 | labelAlpha = lerp(labelAlpha, 1, 0.1); 11 | } 12 | 13 | 14 | var _scrollBarX = x + width + 1; 15 | var _scrollBarRight = _scrollBarX + scrollBarWidth; 16 | var _scrollBarY = y + -scrollY / childElementsBottom * height; 17 | var _scrollBarBottom = y + (-scrollY + height) / childElementsBottom * height; 18 | 19 | var _scrollBarBgY = y; 20 | var _scrollBarBgBottom = y + height; 21 | 22 | var _scrollBarHighlight = false; 23 | 24 | if(GUI_MouseGuiOnMe(_scrollBarX, _scrollBarBgY, _scrollBarX + scrollBarWidthMax, _scrollBarBgBottom)) { 25 | gMouseOnGUI = true; 26 | 27 | scrollBarWidth = lerp(scrollBarWidth, scrollBarWidthMax, 0.2); 28 | 29 | var _mouseYGui = GetPositionYOnGUI(mouse_y); 30 | if(_mouseYGui > _scrollBarY && _mouseYGui < _scrollBarBottom) { 31 | _scrollBarHighlight = true; 32 | 33 | if(scrollBarIsDragging == false) 34 | GUI_SetCursorHandpoint(); 35 | } 36 | 37 | if(MouseLeftPressed()) { 38 | scrollBarIsDragging = true; 39 | 40 | if(_mouseYGui > _scrollBarY && _mouseYGui < _scrollBarBottom) { 41 | scrollBarDraggingOffY = _mouseYGui - _scrollBarY; 42 | } else { 43 | scrollBarDraggingOffY = (_scrollBarBottom - _scrollBarY) / 2; 44 | } 45 | } 46 | } else { 47 | scrollBarWidth = lerp(scrollBarWidth, scrollBarWidthMin, 0.2); 48 | } 49 | 50 | if(scrollBarIsDragging) { 51 | gMouseOnGUI = true; 52 | _scrollBarHighlight = true; 53 | 54 | if(MouseLeftHold() == false) { 55 | scrollBarIsDragging = false; 56 | } else { 57 | scrollY = ((GetPositionYOnGUI(mouse_y) - y - scrollBarDraggingOffY) / height * childElementsBottom); 58 | 59 | if(scrollY + height > childElementsBottom) scrollY = childElementsBottom - height; 60 | if(scrollY < 0) scrollY = 0; 61 | 62 | scrollY = -scrollY; 63 | } 64 | } 65 | 66 | _scrollBarRight = _scrollBarX + scrollBarWidth; 67 | 68 | draw_set_color(GUIDefaultColor); 69 | draw_set_alpha(1.0); 70 | GUI_DrawRectangle(_scrollBarX, _scrollBarBgY, _scrollBarRight, _scrollBarBgBottom, false); 71 | 72 | draw_set_color(c_white); 73 | draw_set_alpha(GUIDefaultAlpha); 74 | GUI_DrawRectangle(_scrollBarX, _scrollBarY, _scrollBarRight, _scrollBarBottom, false); 75 | if(_scrollBarHighlight) { 76 | draw_set_alpha(GUIHighLightAlpha); 77 | GUI_DrawRectangle(_scrollBarX, _scrollBarY, _scrollBarRight, _scrollBarBottom, false); 78 | } 79 | 80 | draw_set_color(c_white); 81 | draw_set_alpha(1.0); 82 | 83 | 84 | // LoadDrawSettings(); 85 | 86 | -------------------------------------------------------------------------------- /objects/obj_guielement_page/Draw_75.gml: -------------------------------------------------------------------------------- 1 | // SaveDrawSettings(); 2 | 3 | draw_set_color(GUIDefaultColor); 4 | draw_set_alpha(labelAlpha); 5 | GUI_DrawRectangle(x, y, x + width, y + 32); 6 | 7 | draw_set_color(c_white); 8 | GUI_DrawText(x + width / 2, y + string_height(labelText) / 2, labelText, true); 9 | 10 | // LoadDrawSettings(); 11 | -------------------------------------------------------------------------------- /objects/obj_guielement_page/Step_0.gml: -------------------------------------------------------------------------------- 1 | if(working == false) { 2 | visible = false; 3 | } else { 4 | visible = true; 5 | 6 | if(GUI_MouseGuiOnMe(x, y, x + width + scrollBarWidthMax, y + height) && scrollBarIsDragging == false) { 7 | gMouseOnGUI = true; 8 | /* 9 | if(mouse_wheel_up()) { 10 | if(scrollY > 0) { 11 | MyScrollElements(scrollYSpeed); 12 | scrollY -= scrollYSpeed; 13 | } 14 | } else if(mouse_wheel_down()) { 15 | if(InstanceExists(vecChildElements.back())) 16 | if(0 + scrollYSpeed * 2 < vecChildElements.back().bbox_top) { 17 | MyScrollElements(-scrollYSpeed); 18 | scrollY += scrollYSpeed; 19 | } 20 | }*/ 21 | 22 | scrollY = ScrollYCalculate(scrollY, scrollYSpeed, 0, height, childElementsBottom); 23 | } 24 | 25 | if(scrollY != scrollYPrev) { 26 | MyScrollElements(scrollY - scrollYPrev); 27 | scrollYPrev = scrollY; 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /objects/obj_guielement_page/obj_guielement_page.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_GuiElement_Page", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 27 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":12,"collisionObjectId":null,}, 28 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,}, 29 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":75,"eventType":8,"collisionObjectId":null,}, 30 | ], 31 | "properties": [], 32 | "overriddenProperties": [], 33 | "parent": { 34 | "name": "GuiElements", 35 | "path": "folders/Objects/GuiElements.yy", 36 | }, 37 | } -------------------------------------------------------------------------------- /objects/obj_mainmenu/Create_0.gml: -------------------------------------------------------------------------------- 1 | DebugMes("working_directory = " + string(working_directory)); 2 | DebugMes("program_directory = " + string(program_directory)); 3 | DebugMes("temp_directory = " + string(temp_directory)); 4 | 5 | GuiElement_CreateButton_ext(128, 128, "新建场景包", 256, 64, , function() { 6 | DebugMes("Create New ScenePackage"); 7 | 8 | PackName = get_string("给新场景包取个名字吧~", ""); 9 | if(PackName != "") { 10 | WORKFILEPATH = WORKFILEPATH_default; 11 | 12 | var _newpackfilename = WORKFILEPATH; 13 | 14 | _newpackfilename += PackName + PackFileExtension; 15 | var fwriteRes = FileWrite(_newpackfilename, ""); 16 | 17 | DebugMes("FileWrite: " + string(fwriteRes)); 18 | 19 | DebugMes("_newpackfilename: " + _newpackfilename); 20 | 21 | if(fwriteRes == 0) { 22 | RemakeCloudPackGuid(false); 23 | room_goto(rm_Sandbox); 24 | } else { 25 | show_message("新建文件失败!" + string(fwriteRes)); 26 | } 27 | } 28 | }); 29 | 30 | GuiElement_CreateButton_ext(128, 228, "打开场景包", 256, 64, , function() { 31 | var filename = get_open_filename_ext("云睡觉场景包(*"+ PackFileExtension +")|*" + PackFileExtension, "", ".\\packages\\", "打开场景包"); 32 | if(filename != "") { 33 | PackName = GetNameFromFileName(filename, false); 34 | WORKFILEPATH = filename_dir(filename) + "\\"; 35 | 36 | DebugMes("Open ScenePackage : " + filename + " | PackName : " + PackName); 37 | 38 | LoadCloudPack(); 39 | 40 | room_goto(rm_Sandbox); 41 | } else { 42 | DebugMes("Open ScenePackage, but empty"); 43 | } 44 | }); 45 | 46 | GuiElement_CreateButton_ext(128, 328, "退出", 256, 64, , function() { 47 | DebugMes("Exit"); 48 | game_end(); 49 | }); 50 | 51 | -------------------------------------------------------------------------------- /objects/obj_mainmenu/Step_1.gml: -------------------------------------------------------------------------------- 1 | GUI_SetCursorDefault(); 2 | 3 | -------------------------------------------------------------------------------- /objects/obj_mainmenu/obj_mainmenu.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_mainMenu", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":1,"eventType":3,"collisionObjectId":null,}, 27 | ], 28 | "properties": [], 29 | "overriddenProperties": [], 30 | "parent": { 31 | "name": "MainMenu", 32 | "path": "folders/Objects/MainMenu.yy", 33 | }, 34 | } -------------------------------------------------------------------------------- /objects/obj_sandboxbuttons/Create_0.gml: -------------------------------------------------------------------------------- 1 | { // 切换网格 按钮 2 | var _labelGridAlignment = "切换网格"; 3 | _labelGridAlignmentWidth = string_width(_labelGridAlignment); 4 | var _labelGridAlignmentHeight = string_height(_labelGridAlignment); 5 | buttonGridAlignmentIns = GuiElement_CreateButton( 6 | GuiWidth() - _labelGridAlignmentWidth / 2, 7 | _labelGridAlignmentHeight / 2, 8 | _labelGridAlignment, 9 | function() { 10 | gSceneElementsGridAlignmentEnable = !gSceneElementsGridAlignmentEnable; 11 | } 12 | ); 13 | } 14 | { // 显示碰撞 按钮 15 | var _labelGridShowHitbox = "显示碰撞"; 16 | _labelGridShowHitboxWidth = string_width(_labelGridShowHitbox); 17 | var _labelGridShowHitboxHeight = string_height(_labelGridShowHitbox); 18 | buttonGridShowHitboxIns = GuiElement_CreateButton( 19 | GuiWidth() - _labelGridShowHitboxWidth / 2, 20 | _labelGridShowHitboxHeight / 2, 21 | _labelGridShowHitbox, 22 | function() { 23 | gGridShowHitBoxEnable = !gGridShowHitBoxEnable; 24 | } 25 | ); 26 | } 27 | { // SandboxMode 按钮 28 | var _labelSandboxMode = "普通模式"; 29 | _labelSandboxModeWidth = string_width(_labelSandboxMode); 30 | var _labelGridShowHitboxHeight = string_height(_labelSandboxMode); 31 | buttonSandboxModeIns = GuiElement_CreateButton_ext( 32 | GuiWidth() - _labelSandboxModeWidth / 2, 33 | _labelGridShowHitboxHeight / 2, 34 | _labelSandboxMode, , , , 35 | function(args) { 36 | switch(gSandboxMode) { 37 | case ESandboxMode.Normal: 38 | gSandboxMode = ESandboxMode.Pencil; 39 | args[0].labelText = "铅笔模式"; 40 | break; 41 | case ESandboxMode.Pencil: 42 | gSandboxMode = ESandboxMode.Eraser; 43 | args[0].labelText = "橡皮模式"; 44 | break; 45 | case ESandboxMode.Eraser: 46 | gSandboxMode = ESandboxMode.Normal; 47 | args[0].labelText = "普通模式"; 48 | break; 49 | } 50 | } 51 | ); 52 | buttonSandboxModeIns.MyPressedFunctionArgs = [buttonSandboxModeIns]; 53 | } 54 | 55 | { 56 | _slidingRodOutFocusLayerAlphaWidth = 228; 57 | slidingRodOutFocusLayerAlphaIns = GuiElement_CreateSlidingRod( 58 | GuiWidth() - _slidingRodOutFocusLayerAlphaWidth 59 | , 32 60 | , "焦点外图层透明度" 61 | , _slidingRodOutFocusLayerAlphaWidth 62 | , make_wheat_ptr(EWheatPtrType.Global, 0, "gOutFocusLayerAlpha") 63 | , 0, 1 64 | , function(n) { n *= 10; return round(n) / 10; } 65 | ); 66 | } 67 | { 68 | _slidingRodGridAlphaWidth = 228; 69 | slidingRodGridAlphaIns = GuiElement_CreateSlidingRod( 70 | GuiWidth() - _slidingRodGridAlphaWidth 71 | , 32 72 | , "网格线透明度" 73 | , _slidingRodGridAlphaWidth 74 | , make_wheat_ptr(EWheatPtrType.Global, 0, "gGridAlpha") 75 | , 0, 1 76 | , function(n) { n *= 100; return round(n) / 100; } 77 | ); 78 | } 79 | 80 | MySynchMyGuiElementsPosition = function() { 81 | static _SynchSlidingRodXScreenLeftFunc = function(_insTemp, _xToLeftMultiply = 1, _xToLeftMultiplyMax = 1) { 82 | if(InstanceExists(_insTemp)) { 83 | var _xTemp = _insTemp.x; 84 | var _yTemp = _insTemp.y; 85 | var _wTemp = _insTemp.width + 1; 86 | var _hTemp = _insTemp.height; 87 | if(gMouseDraggingSlidingRodIns == _insTemp || GUI_MouseGuiOnMe(0 - 48, _yTemp, _xTemp + _wTemp + 48 + _wTemp * (_xToLeftMultiplyMax - _xToLeftMultiply), _yTemp + _hTemp) && GetPositionXOnGUI(mouse_x) > -48) { 88 | _xTemp = lerp(_xTemp, 0 + _wTemp * (_xToLeftMultiply - 1), 0.2); 89 | } else { 90 | _xTemp = lerp(_xTemp, 0 + 32 - _wTemp * (_xToLeftMultiplyMax - _xToLeftMultiply + 1), 0.2); 91 | } 92 | _insTemp.x = _xTemp; 93 | } 94 | } 95 | static _SynchSlidingRodXScreenRightFunc = function(_insTemp, _xToRightMultiply = 1, _xToRightMultiplyMax = 1) { 96 | if(InstanceExists(_insTemp)) { 97 | var _guiW = GuiWidth(); 98 | 99 | var _xTemp = _insTemp.x; 100 | var _yTemp = _insTemp.y; 101 | var _wTemp = _insTemp.width + 1; 102 | var _hTemp = _insTemp.height; 103 | if(gMouseDraggingSlidingRodIns == _insTemp || GUI_MouseGuiOnMe(_xTemp - 48 - _wTemp * (_xToRightMultiplyMax - _xToRightMultiply), _yTemp, _guiW + 48, _yTemp + _hTemp) && GetPositionXOnGUI(mouse_x) < _guiW + 48) { 104 | _xTemp = lerp(_xTemp, _guiW - _wTemp * _xToRightMultiply, 0.2); 105 | } else { 106 | _xTemp = lerp(_xTemp, _guiW - 32 + _wTemp * (_xToRightMultiplyMax - _xToRightMultiply), 0.2); 107 | } 108 | _insTemp.x = _xTemp; 109 | } 110 | } 111 | 112 | _SynchSlidingRodXScreenRightFunc(slidingRodOutFocusLayerAlphaIns, 1, 2); 113 | _SynchSlidingRodXScreenRightFunc(slidingRodGridAlphaIns, 2, 2); 114 | } 115 | MySynchMyGuiElementsPosition(); 116 | 117 | -------------------------------------------------------------------------------- /objects/obj_sandboxbuttons/Draw_64.gml: -------------------------------------------------------------------------------- 1 | var _guih = GuiHeight(); 2 | var _strTemp = ""; 3 | switch(gSandboxMode) { 4 | case ESandboxMode.Normal: 5 | _strTemp = "鼠标左键 拖动场景元素或移动视角,鼠标中键 移动视角"; 6 | break; 7 | case ESandboxMode.Pencil: 8 | _strTemp = "鼠标左键 绘制,鼠标中键 移动视角,鼠标右键 擦除(仅擦除与当前笔刷相同的场景元素)"; 9 | break; 10 | case ESandboxMode.Eraser: 11 | _strTemp = "鼠标左键 擦除(擦除当前选中图层中的场景元素)"; 12 | break; 13 | } 14 | 15 | var _xTemp = 400; 16 | var _scale = 0.8; 17 | 18 | draw_set_color(c_black); 19 | draw_set_alpha(GUIDefaultAlpha); 20 | GUI_DrawRectangle(_xTemp, _guih - 28 * _scale, _xTemp + string_width(_strTemp) * _scale, _guih, false); 21 | 22 | draw_set_color(c_white); 23 | draw_set_alpha(0.7); 24 | GUI_DrawTextTransformed(_xTemp, _guih - 28 * _scale, _strTemp, _scale, _scale, 0, false); 25 | 26 | draw_set_alpha(1.0); -------------------------------------------------------------------------------- /objects/obj_sandboxbuttons/Draw_73.gml: -------------------------------------------------------------------------------- 1 | SandboxPencilWork(); 2 | SandboxEraserWork(); -------------------------------------------------------------------------------- /objects/obj_sandboxbuttons/Step_0.gml: -------------------------------------------------------------------------------- 1 | if(InstanceExists(buttonGridAlignmentIns)) 2 | buttonGridAlignmentIns.x = GuiWidth() - buttonGridAlignmentIns.width / 2; 3 | if(InstanceExists(buttonGridShowHitboxIns)) 4 | buttonGridShowHitboxIns.x = buttonGridAlignmentIns.x - buttonGridAlignmentIns.width / 2 5 | - buttonGridShowHitboxIns.width / 2 - 8; 6 | if(InstanceExists(buttonSandboxModeIns)) 7 | buttonSandboxModeIns.x = buttonGridShowHitboxIns.x - buttonGridShowHitboxIns.width / 2 8 | - buttonSandboxModeIns.width / 2 - 8; 9 | 10 | MySynchMyGuiElementsPosition(); 11 | -------------------------------------------------------------------------------- /objects/obj_sandboxbuttons/obj_sandboxbuttons.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_sandboxButtons", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 27 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":73,"eventType":8,"collisionObjectId":null,}, 28 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,}, 29 | ], 30 | "properties": [], 31 | "overriddenProperties": [], 32 | "parent": { 33 | "name": "Sandbox", 34 | "path": "folders/Objects/Sandbox.yy", 35 | }, 36 | } -------------------------------------------------------------------------------- /objects/obj_sandboxgrid/Create_0.gml: -------------------------------------------------------------------------------- 1 | // 网格的格子数量 2 | // 实际大小(单位:像素) = ((right - left) * cellSize) * ((bottom - top) * cellSize) 3 | /*left = gSceneStruct.left; 4 | top = gSceneStruct.top; 5 | right = gSceneStruct.right; 6 | bottom = gSceneStruct.bottom;*/ 7 | 8 | // lineWidth = 2; 9 | lineWidth = 1; 10 | 11 | cellSize = SCENE_CellSize; 12 | 13 | // 可拖动的角标的大小(的一半) 14 | draggerRadius = 12; 15 | 16 | // 0 左上,1 右上,2 左下,3 右下,-1 无 17 | draggerIdMouseOn = -1; 18 | 19 | mouseIsDragging = false; 20 | 21 | 22 | gridSurf = -1; 23 | gridSurfWidth = 2048; 24 | gridSurfHeight = 2048; 25 | 26 | MyCheckAndCreateGridSurf = function() { 27 | if(gridSurf == -1 || surface_exists(gridSurf) == false) { 28 | MyRemakeGridSurf(); 29 | } 30 | } 31 | 32 | MyRemakeGridSurf = function() { 33 | var _w = gridSurfWidth + lineWidth + 1, _h = gridSurfHeight + lineWidth + 1; 34 | if(gridSurf != -1 && surface_exists(gridSurf)) { 35 | surface_free(gridSurf); 36 | } 37 | gridSurf = surface_create(_w, _h); 38 | 39 | surface_set_target(gridSurf); 40 | 41 | draw_set_color(c_black); 42 | draw_set_alpha(1.0); 43 | 44 | // 画横线 45 | for(var iy = 0; iy <= _h / cellSize; iy++) { 46 | draw_line_width(0, iy * cellSize, _w - 2, iy * cellSize, lineWidth); 47 | } 48 | // 画竖线 49 | for(var ix = 0; ix <= _w / cellSize; ix++) { 50 | draw_line_width(ix * cellSize, 0, ix * cellSize, _h - 2, lineWidth); 51 | } 52 | 53 | draw_set_color(c_white); 54 | draw_set_alpha(1.0); 55 | 56 | surface_reset_target(); 57 | } 58 | 59 | cameraXPrev = CameraX(); 60 | cameraYPrev = CameraY(); 61 | 62 | mpGridHitboxDraw = -1; 63 | 64 | 65 | gridHitboxSurf = -1; 66 | gridHitboxSurfWidth = 1; 67 | gridHitboxSurfHeight = 1; 68 | 69 | MyCheckAndCreateGridHitboxSurf = function() { 70 | if(gridHitboxSurf == -1 || surface_exists(gridHitboxSurf) == false) { 71 | MyRemakeGridHitboxSurf(); 72 | } 73 | } 74 | 75 | MyRemakeGridHitboxSurf = function() { 76 | gridHitboxSurfWidth = GuiWidth(); 77 | gridHitboxSurfHeight = GuiHeight(); 78 | 79 | var _w = gridHitboxSurfWidth, _h = gridHitboxSurfHeight; 80 | if(gridHitboxSurf != -1 && surface_exists(gridHitboxSurf)) { 81 | surface_free(gridHitboxSurf); 82 | } 83 | gridHitboxSurf = surface_create(_w, _h); 84 | 85 | surface_set_target(gridHitboxSurf); 86 | 87 | DebugMes([surface_get_width(gridHitboxSurf), surface_get_height(gridHitboxSurf)]); 88 | 89 | draw_set_alpha(1.0); 90 | 91 | var _xoff = GetPositionXOnGUI(gSceneStruct.left * cellSize); 92 | var _yoff = GetPositionYOnGUI(gSceneStruct.top * cellSize); 93 | 94 | var _drawScale = 1 / CameraScale(); 95 | 96 | var _surflTemp = 0; 97 | var _surftTemp = 0; 98 | var _surfrTemp = _surflTemp + CameraWidth(); 99 | var _surfbTemp = _surftTemp + CameraHeight(); 100 | 101 | var _colPrev = undefined; 102 | 103 | for(var iy = gSceneStruct.top; iy < gSceneStruct.bottom; iy++) { 104 | var _ttemp = _yoff + (iy - gSceneStruct.top) * cellSize * _drawScale; 105 | var _btemp = _yoff + ((iy - gSceneStruct.top + 1) * cellSize - 1) * _drawScale; 106 | 107 | if(_ttemp > _surfbTemp || _btemp < _surftTemp) { 108 | continue; 109 | } 110 | 111 | for(var ix = gSceneStruct.left; ix < gSceneStruct.right; ix++) { 112 | var _ltemp = _xoff + (ix - gSceneStruct.left) * cellSize * _drawScale; 113 | var _rtemp = _xoff + ((ix - gSceneStruct.left + 1) * cellSize - 1) * _drawScale; 114 | 115 | if(_ltemp > _surfrTemp || _rtemp < _surflTemp) { 116 | continue; 117 | } 118 | 119 | var _colNext = (mp_grid_get_cell(mpGridHitboxDraw, (ix - gSceneStruct.left), (iy - gSceneStruct.top)) == 0) 120 | ? c_lime 121 | : c_red; 122 | 123 | if(_colNext != _colPrev) { 124 | draw_set_color(_colNext); 125 | _colPrev = _colNext; 126 | } 127 | draw_rectangle(_ltemp, _ttemp, _rtemp, _btemp, false); 128 | } 129 | } 130 | 131 | draw_set_color(c_white); 132 | 133 | surface_reset_target(); 134 | } 135 | 136 | -------------------------------------------------------------------------------- /objects/obj_sandboxgrid/Draw_0.gml: -------------------------------------------------------------------------------- 1 | // SaveDrawSettings(); 2 | /* 3 | draw_set_color(c_black); 4 | 5 | if(gSceneElementsGridAlignmentEnable == false) 6 | draw_set_alpha(0.05); 7 | else 8 | draw_set_alpha(0.2); 9 | 10 | var leftPixel = gSceneStruct.left * cellSize; 11 | var rightPixel = gSceneStruct.right * cellSize; 12 | var topPixel = gSceneStruct.top * cellSize; 13 | var bottomPixel = gSceneStruct.bottom * cellSize; 14 | 15 | // 画横线 16 | for(var iy = gSceneStruct.top; iy <= gSceneStruct.bottom; iy++) { 17 | draw_line_width(leftPixel, iy * cellSize, rightPixel, iy * cellSize, lineWidth); 18 | } 19 | // 画竖线 20 | for(var ix = gSceneStruct.left; ix <= gSceneStruct.right; ix++) { 21 | draw_line_width(ix * cellSize, topPixel, ix * cellSize, bottomPixel, lineWidth); 22 | } 23 | */ 24 | // LoadDrawSettings(); 25 | 26 | if(gGridShowHitBoxEnable) { 27 | if(mpGridHitboxDraw == -1) { 28 | //mpGridHitboxDraw = mp_grid_create( 29 | // floor(CameraX() / cellSize) * cellSize 30 | // , floor(CameraY() / cellSize) * cellSize 31 | // , CameraWidth() / cellSize + 2 32 | // , CameraHeight() / cellSize + 2 33 | // , cellSize, cellSize 34 | //); 35 | mpGridHitboxDraw = mp_grid_create( 36 | gSceneStruct.left * cellSize 37 | , gSceneStruct.top * cellSize 38 | , gSceneStruct.right - gSceneStruct.left 39 | , gSceneStruct.bottom - gSceneStruct.top 40 | , cellSize, cellSize 41 | ); 42 | 43 | with(obj_SceneElementDecorate) { 44 | try { 45 | mp_grid_add_rectangle(other.mpGridHitboxDraw 46 | , basex - offsetx + gDecoratesStruct.materials[materialId].hitbox[0] 47 | , basey - offsety + gDecoratesStruct.materials[materialId].hitbox[1] 48 | , basex - offsetx + gDecoratesStruct.materials[materialId].hitbox[2] 49 | , basey - offsety + gDecoratesStruct.materials[materialId].hitbox[3] 50 | ); 51 | } catch(error) { 52 | 53 | } 54 | } 55 | with(obj_SceneElementBed) { 56 | try { 57 | mp_grid_add_rectangle(other.mpGridHitboxDraw 58 | , basex - offsetx + gBedsStruct.materials[materialId].hitbox[0] 59 | , basey - offsety + gBedsStruct.materials[materialId].hitbox[1] 60 | , basex - offsetx + gBedsStruct.materials[materialId].hitbox[2] 61 | , basey - offsety + gBedsStruct.materials[materialId].hitbox[3] 62 | ); 63 | } catch(error) { 64 | 65 | } 66 | } 67 | 68 | surface_free(gridHitboxSurf); // 主动清除 surface,以此来让后续的 MyCheckAndCreateGridHitboxSurf() 能够执行 69 | } 70 | } else { 71 | if(mpGridHitboxDraw != -1) { 72 | mp_grid_destroy(mpGridHitboxDraw); 73 | mpGridHitboxDraw = -1; 74 | } 75 | } 76 | 77 | MyCheckAndCreateGridSurf(); 78 | if(surface_exists(gridSurf)) { 79 | var _camlTemp = CameraX(); 80 | var _camtTemp = CameraY(); 81 | var _camrTemp = _camlTemp + CameraWidth(); 82 | var _cambTemp = _camtTemp + CameraHeight(); 83 | 84 | for(var iy = gSceneStruct.top; iy < gSceneStruct.bottom; iy += gridSurfHeight / cellSize) { 85 | var _hAddTemp = 0; 86 | 87 | // 是否为纵向上最后一个 88 | if(iy + gridSurfHeight / cellSize > gSceneStruct.bottom) { 89 | _hAddTemp = lineWidth / 2 + 1; 90 | } 91 | 92 | var _yTemp = iy * cellSize; 93 | var _hTemp = (gSceneStruct.bottom - iy) * cellSize + _hAddTemp; 94 | 95 | if(_yTemp > _cambTemp || _yTemp + _hTemp < _camtTemp) { 96 | continue; 97 | } 98 | 99 | for(var ix = gSceneStruct.left; ix < gSceneStruct.right; ix += gridSurfWidth / cellSize) { 100 | var _wAddTemp = 0; 101 | 102 | // 是否为横向上最后一个 103 | if(ix + gridSurfWidth / cellSize > gSceneStruct.right) { 104 | _wAddTemp = lineWidth / 2 + 1; 105 | } 106 | 107 | var _xTemp = ix * cellSize; 108 | var _wTemp = (gSceneStruct.right - ix) * cellSize + _wAddTemp; 109 | 110 | if(_xTemp > _camrTemp || _xTemp + _wTemp< _camlTemp) { 111 | continue; 112 | } 113 | 114 | if(gSceneElementsGridAlignmentEnable) { 115 | // draw_text_color(ix * cellSize, iy * cellSize, string([ix, iy]), c_black, c_black, c_black, c_black, 0.2); 116 | draw_surface_part_ext(gridSurf 117 | , 0, 0, _wTemp, _hTemp 118 | , _xTemp, _yTemp 119 | , 1, 1, c_white 120 | , gGridAlpha); 121 | } 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /objects/obj_sandboxgrid/Draw_64.gml: -------------------------------------------------------------------------------- 1 | if(gSceneElementsGridAlignmentEnable == false) { 2 | exit; 3 | } 4 | 5 | // SaveDrawSettings(); 6 | 7 | var leftPixel = gSceneStruct.left * cellSize; 8 | var rightPixel = gSceneStruct.right * cellSize; 9 | var topPixel = gSceneStruct.top * cellSize; 10 | var bottomPixel = gSceneStruct.bottom * cellSize; 11 | 12 | draw_set_color(c_black); 13 | draw_set_alpha(GUIDefaultAlpha); 14 | 15 | SCENE_DrawRectangleOnGui_Radius(leftPixel, topPixel, draggerRadius, false); 16 | SCENE_DrawRectangleOnGui_Radius(rightPixel, topPixel, draggerRadius, false); 17 | SCENE_DrawRectangleOnGui_Radius(leftPixel, bottomPixel, draggerRadius, false); 18 | SCENE_DrawRectangleOnGui_Radius(rightPixel, bottomPixel, draggerRadius, false); 19 | 20 | draw_set_color(c_white); 21 | draw_set_alpha(GUIHighLightAlpha); 22 | if(draggerIdMouseOn != -1) { 23 | var _x = 0; 24 | var _y = 0; 25 | if(draggerIdMouseOn == 0) { _x = leftPixel; _y = topPixel; } 26 | if(draggerIdMouseOn == 1) { _x = rightPixel; _y = topPixel; } 27 | if(draggerIdMouseOn == 2) { _x = leftPixel; _y = bottomPixel; } 28 | if(draggerIdMouseOn == 3) { _x = rightPixel; _y = bottomPixel; } 29 | SCENE_DrawRectangleOnGui_Radius(_x, _y, draggerRadius, false); 30 | } 31 | 32 | // LoadDrawSettings(); 33 | 34 | -------------------------------------------------------------------------------- /objects/obj_sandboxgrid/Draw_74.gml: -------------------------------------------------------------------------------- 1 | var _x = CameraX(); 2 | var _y = CameraY(); 3 | 4 | if(gGridShowHitBoxEnable) { 5 | if(_x != cameraXPrev || _y != cameraYPrev) { 6 | gGridShowHitBoxEnable = false; 7 | exit; 8 | } 9 | 10 | var _scale = 1; // / CameraScale(); 11 | MyCheckAndCreateGridHitboxSurf(); 12 | if(surface_exists(gridHitboxSurf)) { 13 | draw_surface_ext( 14 | gridHitboxSurf 15 | , 0 16 | , 0 17 | , _scale, _scale 18 | , 0, c_white, 0.2 19 | ); 20 | } 21 | 22 | // DebugMes([_x, _y]); 23 | } 24 | 25 | cameraXPrev = _x; 26 | cameraYPrev = _y; 27 | -------------------------------------------------------------------------------- /objects/obj_sandboxgrid/Step_0.gml: -------------------------------------------------------------------------------- 1 | var leftPixel = gSceneStruct.left * cellSize; 2 | var rightPixel = gSceneStruct.right * cellSize; 3 | var topPixel = gSceneStruct.top * cellSize; 4 | var bottomPixel = gSceneStruct.bottom * cellSize; 5 | 6 | if(IsMouseOnGUI == false && mouseIsDragging == false && InstanceExists(gSandboxSceneElementsDragging) == false) { 7 | if(SCENE_MouseOnMe_Radius(leftPixel, topPixel, draggerRadius * CameraScale())) { 8 | draggerIdMouseOn = 0; 9 | gMouseOnGUI = true; 10 | } else 11 | if(SCENE_MouseOnMe_Radius(rightPixel, topPixel, draggerRadius * CameraScale())) { 12 | draggerIdMouseOn = 1; 13 | gMouseOnGUI = true; 14 | } else 15 | if(SCENE_MouseOnMe_Radius(leftPixel, bottomPixel, draggerRadius * CameraScale())) { 16 | draggerIdMouseOn = 2; 17 | gMouseOnGUI = true; 18 | } else 19 | if(SCENE_MouseOnMe_Radius(rightPixel, bottomPixel, draggerRadius * CameraScale())) { 20 | draggerIdMouseOn = 3; 21 | gMouseOnGUI = true; 22 | } else { 23 | draggerIdMouseOn = -1; 24 | } 25 | } 26 | 27 | if(draggerIdMouseOn != -1) { 28 | if(MouseLeftHold()) { 29 | mouseIsDragging = true; 30 | 31 | gMouseOnGUI = true; 32 | 33 | var mx = GetPositionXGridStandardization(mouse_x, cellSize); 34 | var my = GetPositionYGridStandardization(mouse_y, cellSize); 35 | 36 | switch(draggerIdMouseOn) { 37 | case 0: 38 | gSceneStruct.left = floor(mx / cellSize); 39 | gSceneStruct.top = floor(my / cellSize); 40 | 41 | gSceneStruct.left = clamp(gSceneStruct.left, -infinity, gSceneStruct.right - SCENE_MinimumSize); 42 | gSceneStruct.top = clamp(gSceneStruct.top, -infinity, gSceneStruct.bottom - SCENE_MinimumSize); 43 | 44 | break; 45 | case 1: 46 | gSceneStruct.right = floor(mx / cellSize); 47 | gSceneStruct.top = floor(my / cellSize); 48 | 49 | gSceneStruct.right = clamp(gSceneStruct.right, gSceneStruct.left + SCENE_MinimumSize, infinity); 50 | gSceneStruct.top = clamp(gSceneStruct.top, -infinity, gSceneStruct.bottom - SCENE_MinimumSize); 51 | 52 | break; 53 | case 2: 54 | gSceneStruct.left = floor(mx / cellSize); 55 | gSceneStruct.bottom = floor(my / cellSize); 56 | 57 | gSceneStruct.left = clamp(gSceneStruct.left, -infinity, gSceneStruct.right - SCENE_MinimumSize); 58 | gSceneStruct.bottom = clamp(gSceneStruct.bottom, gSceneStruct.top + SCENE_MinimumSize, infinity); 59 | 60 | break; 61 | case 3: 62 | gSceneStruct.right = floor(mx / cellSize); 63 | gSceneStruct.bottom = floor(my / cellSize); 64 | 65 | gSceneStruct.right = clamp(gSceneStruct.right, gSceneStruct.left + SCENE_MinimumSize, infinity); 66 | gSceneStruct.bottom = clamp(gSceneStruct.bottom, gSceneStruct.top + SCENE_MinimumSize, infinity); 67 | 68 | break; 69 | } 70 | } else { 71 | mouseIsDragging = false; 72 | } 73 | } 74 | 75 | -------------------------------------------------------------------------------- /objects/obj_sandboxgrid/obj_sandboxgrid.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_sandboxGrid", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":8,"collisionObjectId":null,}, 27 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 28 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,}, 29 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":74,"eventType":8,"collisionObjectId":null,}, 30 | ], 31 | "properties": [ 32 | {"resourceType":"GMObjectProperty","resourceVersion":"1.0","name":"variable_name","varType":0,"value":"0","rangeEnabled":false,"rangeMin":0.0,"rangeMax":10.0,"listItems":[],"multiselect":false,"filters":[],}, 33 | ], 34 | "overriddenProperties": [], 35 | "parent": { 36 | "name": "Sandbox", 37 | "path": "folders/Objects/Sandbox.yy", 38 | }, 39 | } -------------------------------------------------------------------------------- /objects/obj_sandboxinitsceneelements/Create_0.gml: -------------------------------------------------------------------------------- 1 | var MyChildFunc_CreateSceneElements = function(_gSpriteStruct, _gSceneStructArr, _func_SceneElement_Create) { 2 | var _sceneStructLen = array_length(_gSceneStructArr); 3 | for(var i = 0; i < _sceneStructLen; i++) { 4 | if(CheckStructCanBeUse(_gSceneStructArr[i])) { 5 | if(_gSceneStructArr[i].materialId >= 0 && _gSceneStructArr[i].materialId < array_length(_gSpriteStruct.sprites)) { 6 | var _newIns = _func_SceneElement_Create(_gSceneStructArr[i].materialId, false, _gSceneStructArr[i].xPos, _gSceneStructArr[i].yPos); 7 | _newIns.inited = true; 8 | _newIns.mygSceneStructI = i; 9 | } 10 | } 11 | } 12 | } 13 | 14 | MyChildFunc_CreateSceneElements(gSleepersSpritesStruct, gSceneStruct.sleepers, SceneElement_CreateSleeper); 15 | MyChildFunc_CreateSceneElements(gBackgroundsSpritesStruct, gSceneStruct.backgrounds, SceneElement_CreateBackground); 16 | MyChildFunc_CreateSceneElements(gDecoratesSpritesStruct, gSceneStruct.decorates, SceneElement_CreateDecorate); 17 | MyChildFunc_CreateSceneElements(gBedsSpritesStruct, gSceneStruct.beds, SceneElement_CreateBed); 18 | 19 | -------------------------------------------------------------------------------- /objects/obj_sandboxinitsceneelements/obj_sandboxinitsceneelements.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_sandboxInitSceneElements", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 26 | ], 27 | "properties": [], 28 | "overriddenProperties": [], 29 | "parent": { 30 | "name": "Sandbox", 31 | "path": "folders/Objects/Sandbox.yy", 32 | }, 33 | } -------------------------------------------------------------------------------- /objects/obj_sandboxsceneelementsdeletearea/Create_0.gml: -------------------------------------------------------------------------------- 1 | width = 160; 2 | height = 96; 3 | 4 | myLeft = GuiWidth() - width; 5 | myTop = GuiHeight() - height; 6 | myRight = GuiWidth(); 7 | myBottom = GuiHeight(); 8 | 9 | sceneElementOnMe = false; 10 | -------------------------------------------------------------------------------- /objects/obj_sandboxsceneelementsdeletearea/Draw_64.gml: -------------------------------------------------------------------------------- 1 | // SaveDrawSettings(); 2 | 3 | if(InstanceExists(gSandboxSceneElementsDragging)) { 4 | myLeft = GuiWidth() - width; 5 | myTop = GuiHeight() - height; 6 | myRight = GuiWidth(); 7 | myBottom = GuiHeight(); 8 | 9 | GUI_DrawLabel_ext("拖住场景中的元素\n到此处以删除", myLeft + width / 2, myTop + height / 2, width / 2, height / 2, 10 | sceneElementOnMe, GUIDangerousColor); 11 | } 12 | 13 | sceneElementOnMe = false; 14 | 15 | // LoadDrawSettings(); 16 | -------------------------------------------------------------------------------- /objects/obj_sandboxsceneelementsdeletearea/obj_sandboxsceneelementsdeletearea.yy: -------------------------------------------------------------------------------- 1 | { 2 | "spriteId": null, 3 | "solid": false, 4 | "visible": true, 5 | "managed": true, 6 | "spriteMaskId": null, 7 | "persistent": false, 8 | "parentObjectId": null, 9 | "physicsObject": false, 10 | "physicsSensor": false, 11 | "physicsShape": 1, 12 | "physicsGroup": 1, 13 | "physicsDensity": 0.5, 14 | "physicsRestitution": 0.1, 15 | "physicsLinearDamping": 0.1, 16 | "physicsAngularDamping": 0.1, 17 | "physicsFriction": 0.2, 18 | "physicsStartAwake": true, 19 | "physicsKinematic": false, 20 | "physicsShapePoints": [], 21 | "eventList": [ 22 | {"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 23 | {"isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 24 | ], 25 | "properties": [], 26 | "overriddenProperties": [], 27 | "parent": { 28 | "name": "Sandbox", 29 | "path": "folders/Objects/Sandbox.yy", 30 | }, 31 | "resourceVersion": "1.0", 32 | "name": "obj_sandboxSceneElementsDeleteArea", 33 | "tags": [], 34 | "resourceType": "GMObject", 35 | } -------------------------------------------------------------------------------- /objects/obj_sandboxsceneelementspages/Alarm_0.gml: -------------------------------------------------------------------------------- 1 | MyInitPageAll(); 2 | GuiElement_PageStopWorkAll(pages); 3 | 4 | -------------------------------------------------------------------------------- /objects/obj_sandboxsceneelementspages/CleanUp_0.gml: -------------------------------------------------------------------------------- 1 | delete buttons; 2 | delete pages; -------------------------------------------------------------------------------- /objects/obj_sandboxsceneelementspages/Draw_64.gml: -------------------------------------------------------------------------------- 1 | // SaveDrawSettings(); 2 | 3 | draw_set_color(GUIDefaultColor); 4 | draw_set_alpha(0.4); 5 | GUI_DrawRectangle(x, y - btHeight / 2 - 16, x + myWidth, y + myHeight); 6 | 7 | if(GUI_MouseGuiOnMe(x, y - btHeight / 2 - 16, x + myWidth, y + myHeight)) { 8 | gMouseOnGUI = true; 9 | } 10 | 11 | // LoadDrawSettings(); 12 | 13 | -------------------------------------------------------------------------------- /objects/obj_sandboxsceneelementspages/Step_0.gml: -------------------------------------------------------------------------------- 1 | if(sandboxSceneElementsLayerNeedRecheck) { 2 | sandboxSceneElementsLayerNeedRecheck = false; 3 | 4 | gSandboxSceneElementsLayer = ESandboxSceneElementsLayers.nothing; 5 | for(var i = 0; i < pages.size(); i++) { 6 | if(pages.Container[i].working) { 7 | switch(i) { 8 | case 0: 9 | gSandboxSceneElementsLayer = ESandboxSceneElementsLayers.sleepers; 10 | break; 11 | case 1: 12 | gSandboxSceneElementsLayer = ESandboxSceneElementsLayers.backgrounds; 13 | break; 14 | case 2: 15 | gSandboxSceneElementsLayer = ESandboxSceneElementsLayers.decorates; 16 | break; 17 | case 3: 18 | gSandboxSceneElementsLayer = ESandboxSceneElementsLayers.beds; 19 | break; 20 | } 21 | } 22 | } 23 | } 24 | // DebugMes(gSandboxSceneElementsLayer); 25 | 26 | myHeight = GuiHeight() - y; 27 | buttons.back().y = GuiHeight() - 16; 28 | for(var i = 0; i < pages.size(); i++) { 29 | pages.Container[i].height = GuiHeight(); 30 | } 31 | 32 | -------------------------------------------------------------------------------- /objects/obj_sandboxsceneelementspages/obj_sandboxsceneelementspages.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_sandboxSceneElementsPages", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":12,"collisionObjectId":null,}, 27 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,}, 28 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":2,"collisionObjectId":null,}, 29 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 30 | ], 31 | "properties": [], 32 | "overriddenProperties": [], 33 | "parent": { 34 | "name": "Sandbox", 35 | "path": "folders/Objects/Sandbox.yy", 36 | }, 37 | } -------------------------------------------------------------------------------- /objects/obj_sceneelement/Alarm_0.gml: -------------------------------------------------------------------------------- 1 | visible = true; 2 | 3 | if(sprite_exists(sprite_index)) { 4 | offsetx = sprite_get_xoffset(sprite_index); 5 | offsety = sprite_get_yoffset(sprite_index); 6 | x = basex + sprite_get_width(sprite_index) / 2 - offsetx; 7 | y = basey + sprite_get_height(sprite_index) / 2 - offsety; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /objects/obj_sceneelement/Create_0.gml: -------------------------------------------------------------------------------- 1 | isDragging = false; 2 | 3 | dragOffx = 0; 4 | dragOffy = 0; 5 | 6 | materialId = -1; 7 | 8 | mygSceneStructI = -1; 9 | 10 | inited = false; 11 | 12 | 13 | basex = x; 14 | basey = y; 15 | 16 | offsetx = 0; 17 | offsety = 0; 18 | 19 | 20 | visible = false; 21 | alarm_set(0, 1); 22 | 23 | 24 | myColorRedFrames = 0; 25 | MySetColorRed = function() { 26 | myColorRedFrames = 1; 27 | image_blend = GUIDangerousColor; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /objects/obj_sceneelement/Draw_0.gml: -------------------------------------------------------------------------------- 1 | draw_sprite_ext(sprite_index, image_index, x, y, image_xscale, image_yscale, image_angle, image_blend, image_alpha); 2 | 3 | -------------------------------------------------------------------------------- /objects/obj_sceneelement/Step_0.gml: -------------------------------------------------------------------------------- 1 | if(myColorRedFrames <= 0) { 2 | image_blend = c_white; 3 | } else { 4 | myColorRedFrames--; 5 | } 6 | 7 | if(gSandboxSceneElementsDragging == id && isDragging == false) { 8 | isDragging = true; 9 | 10 | dragOffx = mouse_x - basex; 11 | dragOffy = mouse_y - basey; 12 | } 13 | 14 | if(isDragging) { 15 | gSandboxSceneElementsDragging = id; 16 | 17 | // x = mouse_x - dragOffx; 18 | // y = mouse_y - dragOffy; 19 | basex = mouse_x - dragOffx; 20 | basey = mouse_y - dragOffy; 21 | 22 | if(gSceneElementsGridAlignmentEnable) { 23 | basex = GetPositionXGridStandardization(basex); 24 | basey = GetPositionYGridStandardization(basey); 25 | } 26 | 27 | if(MouseLeftHold() == false) { 28 | gSandboxSceneElementsDragging = noone; 29 | isDragging = false; 30 | } 31 | 32 | if(InstanceExists(obj_sandboxSceneElementsDeleteArea)) { 33 | var toDelL = obj_sandboxSceneElementsDeleteArea.myLeft; 34 | var toDelT = obj_sandboxSceneElementsDeleteArea.myTop; 35 | var toDelR = obj_sandboxSceneElementsDeleteArea.myRight; 36 | var toDelB = obj_sandboxSceneElementsDeleteArea.myBottom; 37 | if(GUI_MouseGuiOnMe(toDelL, toDelT, toDelR, toDelB)) { 38 | // image_blend = GUIDangerousColor; 39 | MySetColorRed(); 40 | obj_sandboxSceneElementsDeleteArea.sceneElementOnMe = true; 41 | 42 | if(isDragging == false) { 43 | instance_destroy(id); 44 | } 45 | } 46 | } 47 | } 48 | 49 | // 先运算上一帧得到的 offsetx 50 | x = basex + sprite_get_width(sprite_index) / 2 - offsetx; 51 | y = basey + sprite_get_height(sprite_index) / 2 - offsety; 52 | 53 | if(sprite_exists(sprite_index)) { 54 | offsetx = sprite_get_xoffset(sprite_index); 55 | offsety = sprite_get_yoffset(sprite_index); 56 | } 57 | 58 | /* 59 | if(sprite_exists(sprite_index) && isDragging == false && !InstanceExists(gSandboxSceneElementsDragging)) { 60 | var offx = sprite_get_xoffset(sprite_index); 61 | var offy = sprite_get_yoffset(sprite_index); 62 | 63 | var _width = sprite_get_width(sprite_index); 64 | var _height = sprite_get_height(sprite_index); 65 | 66 | var toL = x - offx; 67 | var toR = x + _width - offx; 68 | var toT = y - offy; 69 | var toB = y + _height - offy; 70 | if(SCENE_MouseOnMe(toL, toT, toR, toB)) { 71 | if(MouseLeftPressed()) { 72 | gSandboxSceneElementsDragging = id; 73 | } 74 | } 75 | } 76 | */ 77 | -------------------------------------------------------------------------------- /objects/obj_sceneelement/obj_sceneelement.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_SceneElement", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": null, 12 | "physicsObject": false, 13 | "physicsSensor": false, 14 | "physicsShape": 1, 15 | "physicsGroup": 1, 16 | "physicsDensity": 0.5, 17 | "physicsRestitution": 0.1, 18 | "physicsLinearDamping": 0.1, 19 | "physicsAngularDamping": 0.1, 20 | "physicsFriction": 0.2, 21 | "physicsStartAwake": true, 22 | "physicsKinematic": false, 23 | "physicsShapePoints": [], 24 | "eventList": [ 25 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, 26 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 27 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":8,"collisionObjectId":null,}, 28 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":2,"collisionObjectId":null,}, 29 | ], 30 | "properties": [], 31 | "overriddenProperties": [], 32 | "parent": { 33 | "name": "SceneElements", 34 | "path": "folders/Objects/SceneElements.yy", 35 | }, 36 | } -------------------------------------------------------------------------------- /objects/obj_sceneelementbackground/Destroy_0.gml: -------------------------------------------------------------------------------- 1 | /*if(mygSceneStructI != -1) { 2 | delete gSceneStruct.backgrounds[mygSceneStructI]; 3 | array_delete(gSceneStruct.backgrounds, mygSceneStructI, 1); 4 | }*/ 5 | 6 | -------------------------------------------------------------------------------- /objects/obj_sceneelementbackground/Step_0.gml: -------------------------------------------------------------------------------- 1 | event_inherited(); 2 | 3 | switch(gSandboxSceneElementsLayer) { 4 | case ESandboxSceneElementsLayers.nothing: 5 | case ESandboxSceneElementsLayers.backgrounds: 6 | image_alpha = 1.0; 7 | break; 8 | default: 9 | image_alpha = gOutFocusLayerAlpha; 10 | } 11 | 12 | if(inited == false) { 13 | inited = true; 14 | /* 15 | array_push(gSceneStruct.backgrounds, new SSceneElement(materialId, x, y)); 16 | mygSceneStructI = array_length(gSceneStruct.backgrounds) - 1; 17 | */ 18 | } 19 | /* 20 | if(mygSceneStructI >= 0 && mygSceneStructI < array_length(gSceneStruct.backgrounds)) { 21 | gSceneStruct.backgrounds[mygSceneStructI].xPos = x; 22 | gSceneStruct.backgrounds[mygSceneStructI].yPos = y; 23 | }*/ 24 | -------------------------------------------------------------------------------- /objects/obj_sceneelementbackground/obj_sceneelementbackground.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_SceneElementBackground", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": { 12 | "name": "obj_SceneElement", 13 | "path": "objects/obj_SceneElement/obj_SceneElement.yy", 14 | }, 15 | "physicsObject": false, 16 | "physicsSensor": false, 17 | "physicsShape": 1, 18 | "physicsGroup": 1, 19 | "physicsDensity": 0.5, 20 | "physicsRestitution": 0.1, 21 | "physicsLinearDamping": 0.1, 22 | "physicsAngularDamping": 0.1, 23 | "physicsFriction": 0.2, 24 | "physicsStartAwake": true, 25 | "physicsKinematic": false, 26 | "physicsShapePoints": [], 27 | "eventList": [ 28 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 29 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":1,"collisionObjectId":null,}, 30 | ], 31 | "properties": [], 32 | "overriddenProperties": [], 33 | "parent": { 34 | "name": "SceneElements", 35 | "path": "folders/Objects/SceneElements.yy", 36 | }, 37 | } -------------------------------------------------------------------------------- /objects/obj_sceneelementbed/Alarm_0.gml: -------------------------------------------------------------------------------- 1 | event_inherited(); 2 | 3 | DragObjBedsCountAdd(materialId); 4 | -------------------------------------------------------------------------------- /objects/obj_sceneelementbed/Destroy_0.gml: -------------------------------------------------------------------------------- 1 | DragObjBedsCountSubtract(materialId); 2 | -------------------------------------------------------------------------------- /objects/obj_sceneelementbed/Step_0.gml: -------------------------------------------------------------------------------- 1 | event_inherited(); 2 | 3 | SynchDepth(basey); 4 | 5 | switch(gSandboxSceneElementsLayer) { 6 | case ESandboxSceneElementsLayers.nothing: 7 | case ESandboxSceneElementsLayers.beds: 8 | image_alpha = 1.0; 9 | break; 10 | default: 11 | image_alpha = gOutFocusLayerAlpha; 12 | } 13 | 14 | if(inited == false) { 15 | inited = true; 16 | } 17 | 18 | if(array_length(gBedsStruct.materials) > materialId) 19 | if(array_length(gBedsStruct.materials[materialId].offset) >= 2) { 20 | offsetx = gBedsStruct.materials[materialId].offset[0]; 21 | offsety = gBedsStruct.materials[materialId].offset[1]; 22 | } 23 | -------------------------------------------------------------------------------- /objects/obj_sceneelementbed/obj_sceneelementbed.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_SceneElementBed", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": { 12 | "name": "obj_SceneElement", 13 | "path": "objects/obj_SceneElement/obj_SceneElement.yy", 14 | }, 15 | "physicsObject": false, 16 | "physicsSensor": false, 17 | "physicsShape": 1, 18 | "physicsGroup": 1, 19 | "physicsDensity": 0.5, 20 | "physicsRestitution": 0.1, 21 | "physicsLinearDamping": 0.1, 22 | "physicsAngularDamping": 0.1, 23 | "physicsFriction": 0.2, 24 | "physicsStartAwake": true, 25 | "physicsKinematic": false, 26 | "physicsShapePoints": [], 27 | "eventList": [ 28 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 29 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":2,"collisionObjectId":null,}, 30 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":1,"collisionObjectId":null,}, 31 | ], 32 | "properties": [], 33 | "overriddenProperties": [], 34 | "parent": { 35 | "name": "SceneElements", 36 | "path": "folders/Objects/SceneElements.yy", 37 | }, 38 | } -------------------------------------------------------------------------------- /objects/obj_sceneelementdecorate/Step_0.gml: -------------------------------------------------------------------------------- 1 | event_inherited(); 2 | 3 | SynchDepth(basey); 4 | 5 | switch(gSandboxSceneElementsLayer) { 6 | case ESandboxSceneElementsLayers.nothing: 7 | case ESandboxSceneElementsLayers.decorates: 8 | image_alpha = 1.0; 9 | break; 10 | default: 11 | image_alpha = gOutFocusLayerAlpha; 12 | } 13 | 14 | if(inited == false) { 15 | inited = true; 16 | } 17 | 18 | if(array_length(gDecoratesStruct.materials) > materialId) 19 | if(array_length(gDecoratesStruct.materials[materialId].offset) >= 2) { 20 | offsetx = gDecoratesStruct.materials[materialId].offset[0]; 21 | offsety = gDecoratesStruct.materials[materialId].offset[1]; 22 | } 23 | -------------------------------------------------------------------------------- /objects/obj_sceneelementdecorate/obj_sceneelementdecorate.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMObject", 3 | "resourceVersion": "1.0", 4 | "name": "obj_SceneElementDecorate", 5 | "spriteId": null, 6 | "solid": false, 7 | "visible": true, 8 | "managed": true, 9 | "spriteMaskId": null, 10 | "persistent": false, 11 | "parentObjectId": { 12 | "name": "obj_SceneElement", 13 | "path": "objects/obj_SceneElement/obj_SceneElement.yy", 14 | }, 15 | "physicsObject": false, 16 | "physicsSensor": false, 17 | "physicsShape": 1, 18 | "physicsGroup": 1, 19 | "physicsDensity": 0.5, 20 | "physicsRestitution": 0.1, 21 | "physicsLinearDamping": 0.1, 22 | "physicsAngularDamping": 0.1, 23 | "physicsFriction": 0.2, 24 | "physicsStartAwake": true, 25 | "physicsKinematic": false, 26 | "physicsShapePoints": [], 27 | "eventList": [ 28 | {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, 29 | ], 30 | "properties": [], 31 | "overriddenProperties": [], 32 | "parent": { 33 | "name": "SceneElements", 34 | "path": "folders/Objects/SceneElements.yy", 35 | }, 36 | } -------------------------------------------------------------------------------- /objects/textbox/CleanUp_0.gml: -------------------------------------------------------------------------------- 1 | surface_free(draw.su); 2 | window_set_cursor(cr_default); -------------------------------------------------------------------------------- /objects/textbox/Create_0.gml: -------------------------------------------------------------------------------- 1 | global.clipboard = ""; 2 | 3 | draw = { 4 | su : noone, // surface 5 | re : false, // refresh surface 6 | dc : 30, // display cursor 7 | ft : noone, // font 8 | co : c_black, // font color 9 | sx : 32, // x start 10 | sy : 32, // y start 11 | dw : 160, // draw width 12 | dh : 38, // draw height 13 | ox : 0, // x offset 14 | ry : 0, // y resive 15 | lh : 22 // line height 16 | } 17 | 18 | curt = { 19 | fo : false, // focus 20 | vi : false, // view 21 | tx : "", // text 22 | ph : "", // placeholder 23 | cu : 0, // cursor 24 | se : -1, // select 25 | ml : 80, // max length 26 | hr : [], // historic records 27 | rl : 64, // records upper limit 28 | cr : -1, // records cursor 29 | br : 0 30 | } 31 | 32 | keys = { 33 | ho : vk_home, // home 34 | ed : vk_end, // end 35 | bs : vk_backspace, // backspace 36 | de : vk_delete, // delete 37 | ct : vk_control, // control 38 | na : ord("A"), // A 39 | nx : ord("X"), // X 40 | nc : ord("C"), // C 41 | nv : ord("V"), // V 42 | nz : ord("Z"), // Z 43 | ny : ord("Y"), // Y 44 | le : vk_left, // left 45 | ri : vk_right, // right 46 | ml : mb_left, // mouse left 47 | en : vk_enter, // enter 48 | sh : vk_shift, // shift 49 | es : vk_escape // escape 50 | } 51 | 52 | keyboard_string = ""; -------------------------------------------------------------------------------- /objects/textbox/Draw_64.gml: -------------------------------------------------------------------------------- 1 | 2 | var su = draw.su, 3 | sx = draw.sx, 4 | sy = draw.sy, 5 | dw = draw.dw, 6 | dh = draw.dh; 7 | 8 | if (!surface_exists(su)) { 9 | su = surface_create(dw + 1, dh + 1); 10 | draw.su = su; 11 | draw.re = true; 12 | } 13 | 14 | draw_set_color(draw.co); 15 | draw_set_alpha(1.0); 16 | draw_rectangle(sx - 1, sy - 1, sx + dw + 1, sy + dh + 1, true); 17 | 18 | if (draw.re) { 19 | 20 | var co = draw.co, 21 | ox = draw.ox, 22 | lh = draw.lh, 23 | tx = curt.tx, 24 | cu = curt.cu, 25 | se = curt.se, 26 | dy = (dh - lh) / 2; 27 | 28 | surface_set_target(su); 29 | draw_clear_alpha(co, 0); 30 | 31 | draw_set_font(draw.ft); 32 | draw_set_color(co); 33 | draw_set_valign(fa_top); 34 | draw_set_halign(fa_left); 35 | 36 | #region draw selected 37 | 38 | if (se > -1) { 39 | var d0 = string_width(string_copy(tx, 1, se)) - ox, 40 | d1 = string_width(string_copy(tx, 1, cu)) - ox; 41 | draw_set_alpha(0.6); 42 | draw_rectangle(d0, dy, d1, dy + lh, false); 43 | draw_set_alpha(1); 44 | } 45 | 46 | #endregion 47 | 48 | #region draw text 49 | 50 | if (tx == "") { 51 | draw_set_alpha(0.6); 52 | draw_text(-ox, dy + draw.ry, curt.ph); 53 | draw_set_alpha(1); 54 | } else { 55 | draw_text(-ox, dy + draw.ry, tx); 56 | } 57 | 58 | #endregion 59 | 60 | #region draw cursor 61 | 62 | if (curt.fo && draw.dc > 0) { 63 | var dx = string_width(string_copy(tx, 1, cu)) - ox; 64 | draw_rectangle(dx, dy, dx, dy + lh, false); 65 | } 66 | 67 | #endregion 68 | 69 | surface_reset_target(); 70 | draw.re = false; 71 | 72 | } 73 | 74 | draw_surface(su, sx, sy); -------------------------------------------------------------------------------- /objects/textbox/Step_0.gml: -------------------------------------------------------------------------------- 1 | // var mx = mouse_x, 2 | // my = mouse_y, 3 | var mx = GetPositionXOnGUI(mouse_x), 4 | my = GetPositionYOnGUI(mouse_y), 5 | sx = draw.sx, 6 | sy = draw.sy, 7 | vi = point_in_rectangle(mx, my, sx, sy, sx + draw.dw, sy + draw.dh); 8 | 9 | if (vi != curt.vi) { 10 | window_set_cursor(vi ? cr_beam : cr_default); 11 | curt.vi = vi; 12 | } 13 | 14 | var dc = draw.dc - 1; 15 | if (dc < -30) { 16 | dc = 30; 17 | draw.re = true; 18 | } else if (dc == 0) { 19 | draw.re = true; 20 | } 21 | 22 | draw.dc = dc; 23 | 24 | #region update cursor (with mouse) 25 | 26 | if (mouse_check_button_pressed(keys.ml)) { 27 | curt.fo = vi; 28 | curt.se = -1; 29 | draw.dc = vi ? 30 : 0; 30 | draw.re = true; 31 | if (!vi) return; 32 | keyboard_string = ""; 33 | textbox_check_minput(keyboard_check(keys.sh)); 34 | curt.br = 5; 35 | } 36 | 37 | #endregion 38 | 39 | #region update y-offset (with mouse) 40 | 41 | if (vi) { 42 | 43 | var mc = mouse_wheel_up() - mouse_wheel_down(); 44 | if (mc != 0) { 45 | var ox = draw.ox - draw.lh * mc, 46 | mw = string_width(curt.tx) - draw.dw; 47 | if (mw < 0) ox = 0; 48 | else ox = clamp(ox, 0, mw); 49 | draw.ox = ox; 50 | draw.re = true; 51 | return; 52 | } 53 | 54 | } 55 | 56 | #endregion 57 | 58 | if (!curt.fo) return; 59 | 60 | #region get string 61 | 62 | var ks = keyboard_string; 63 | if (ks != "") { 64 | textbox_insert_string(ks); 65 | keyboard_string = ""; 66 | return; 67 | } 68 | 69 | #endregion 70 | 71 | #region update mouse selector 72 | 73 | if (mouse_check_button(keys.ml)) { 74 | curt.br --; 75 | if (curt.br < 0) { 76 | textbox_check_minput(true); 77 | curt.br = 3; 78 | } 79 | return; 80 | } 81 | 82 | #endregion 83 | 84 | #region execute 85 | 86 | if (keyboard_check_pressed(keys.es) || keyboard_check_pressed(keys.en)) { 87 | curt.fn(curt.tx); 88 | return; 89 | } 90 | 91 | #endregion 92 | 93 | #region update cursor 94 | 95 | var hc = keyboard_check_pressed(keys.ri) - keyboard_check_pressed(keys.le); 96 | if (hc != 0) { 97 | curt.br = 40; 98 | textbox_update_cursor(hc, keyboard_check(keys.sh)); 99 | } 100 | 101 | var ph = keyboard_check(keys.ri) - keyboard_check(keys.le); 102 | if (ph != 0) { 103 | curt.br --; 104 | if (curt.br < 0) { 105 | textbox_update_cursor(ph, keyboard_check(keys.sh)); 106 | curt.br = 3; 107 | } 108 | return; 109 | } 110 | 111 | #endregion 112 | 113 | #region delete string 114 | 115 | var de = keyboard_check_pressed(keys.de); 116 | if (keyboard_check_pressed(keys.bs) || de) { 117 | curt.br = 40; 118 | textbox_delete_string(de); 119 | } 120 | 121 | var pe = keyboard_check(keys.de); 122 | if (keyboard_check(keys.bs) || pe) { 123 | curt.br --; 124 | if (curt.br < 0) { 125 | textbox_delete_string(pe); 126 | curt.br = 3; 127 | } 128 | return; 129 | } 130 | 131 | #endregion 132 | 133 | #region edit string 134 | 135 | if (keyboard_check(keys.ct)) { 136 | 137 | // Select all string. 138 | if (keyboard_check_pressed(keys.na)) { 139 | var le = string_length(curt.tx); 140 | if (le < 1) return; 141 | curt.cu = le; 142 | curt.se = 0; 143 | textbox_refresh_surface(); 144 | return; 145 | } 146 | 147 | // Copy string. 148 | if (keyboard_check_pressed(keys.nc)) { 149 | textbox_copy_string(); 150 | return; 151 | } 152 | 153 | // Cut string. 154 | if (keyboard_check_pressed(keys.nx)) { 155 | textbox_copy_string(); 156 | textbox_delete_string(false); 157 | return; 158 | } 159 | 160 | // Paste string. 161 | if (keyboard_check_pressed(keys.nv)) { 162 | var cl = clipboard_has_text() ? clipboard_get_text() : global.clipboard; 163 | if (cl != "") textbox_insert_string(cl); 164 | return; 165 | } 166 | 167 | // Undo. 168 | if (keyboard_check_pressed(keys.nz)) { 169 | textbox_records_set(-1); 170 | return; 171 | } 172 | 173 | // Redo. 174 | if (keyboard_check_pressed(keys.ny)) { 175 | textbox_records_set(1); 176 | return; 177 | } 178 | 179 | } 180 | 181 | #endregion 182 | 183 | #region others 184 | 185 | // Go to the beginning. 186 | if (keyboard_check_pressed(keys.ho)) { 187 | var cu = curt.cu; 188 | if (cu == 0) return; 189 | curt.se = keyboard_check(keys.sh) ? cu : -1; 190 | curt.cu = 0; 191 | textbox_refresh_surface(); 192 | return; 193 | } 194 | 195 | // Go to the end. 196 | if (keyboard_check_pressed(keys.ed)) { 197 | var le = string_length(curt.tx); 198 | if (le < 1) return; 199 | curt.se = keyboard_check(keys.sh) ? curt.cu : -1; 200 | curt.cu = le; 201 | textbox_refresh_surface(); 202 | return; 203 | } 204 | 205 | #endregion -------------------------------------------------------------------------------- /objects/textbox/textbox.yy: -------------------------------------------------------------------------------- 1 | { 2 | "spriteId": null, 3 | "solid": false, 4 | "visible": true, 5 | "managed": true, 6 | "spriteMaskId": null, 7 | "persistent": false, 8 | "parentObjectId": null, 9 | "physicsObject": false, 10 | "physicsSensor": false, 11 | "physicsShape": 1, 12 | "physicsGroup": 0, 13 | "physicsDensity": 0.5, 14 | "physicsRestitution": 0.1, 15 | "physicsLinearDamping": 0.1, 16 | "physicsAngularDamping": 0.1, 17 | "physicsFriction": 0.2, 18 | "physicsStartAwake": true, 19 | "physicsKinematic": false, 20 | "physicsShapePoints": [], 21 | "eventList": [ 22 | {"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 23 | {"isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 24 | {"isDnD":false,"eventNum":64,"eventType":8,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 25 | {"isDnD":false,"eventNum":0,"eventType":12,"collisionObjectId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, 26 | ], 27 | "properties": [], 28 | "overriddenProperties": [], 29 | "parent": { 30 | "name": "Textbox - Single line", 31 | "path": "folders/Textbox - Single line.yy", 32 | }, 33 | "resourceVersion": "1.0", 34 | "name": "textbox", 35 | "tags": [], 36 | "resourceType": "GMObject", 37 | } -------------------------------------------------------------------------------- /options/linux/options_linux.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_linux_display_name": "Created with GameMaker", 3 | "option_linux_version": "1.0.0.0", 4 | "option_linux_maintainer_email": "", 5 | "option_linux_homepage": "http://www.yoyogames.com", 6 | "option_linux_short_desc": "", 7 | "option_linux_long_desc": "", 8 | "option_linux_splash_screen": "${base_options_dir}/linux/splash/splash.png", 9 | "option_linux_display_splash": false, 10 | "option_linux_icon": "${base_options_dir}/linux/icons/64.png", 11 | "option_linux_start_fullscreen": false, 12 | "option_linux_allow_fullscreen": false, 13 | "option_linux_interpolate_pixels": true, 14 | "option_linux_display_cursor": true, 15 | "option_linux_sync": false, 16 | "option_linux_resize_window": false, 17 | "option_linux_scale": 0, 18 | "option_linux_texture_page": "2048x2048", 19 | "option_linux_enable_steam": false, 20 | "option_linux_disable_sandbox": false, 21 | "resourceVersion": "1.0", 22 | "name": "Linux", 23 | "tags": [], 24 | "resourceType": "GMLinuxOptions", 25 | } -------------------------------------------------------------------------------- /options/mac/options_mac.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_mac_display_name": "Created with GameMaker", 3 | "option_mac_app_id": "com.company.game", 4 | "option_mac_version": "1.0.0.0", 5 | "option_mac_output_dir": "~/gamemakerstudio2", 6 | "option_mac_team_id": "", 7 | "option_mac_signing_identity": "Developer ID Application:", 8 | "option_mac_copyright": "", 9 | "option_mac_splash_png": "${base_options_dir}/mac/splash/splash.png", 10 | "option_mac_icon_png": "${base_options_dir}/mac/icons/1024.png", 11 | "option_mac_installer_background_png": "${base_options_dir}/mac/splash/installer_background.png", 12 | "option_mac_menu_dock": false, 13 | "option_mac_display_cursor": true, 14 | "option_mac_start_fullscreen": false, 15 | "option_mac_allow_fullscreen": false, 16 | "option_mac_interpolate_pixels": true, 17 | "option_mac_vsync": false, 18 | "option_mac_resize_window": false, 19 | "option_mac_enable_retina": false, 20 | "option_mac_scale": 0, 21 | "option_mac_texture_page": "2048x2048", 22 | "option_mac_build_app_store": false, 23 | "option_mac_allow_incoming_network": false, 24 | "option_mac_allow_outgoing_network": false, 25 | "option_mac_app_category": "Games", 26 | "option_mac_enable_steam": false, 27 | "option_mac_disable_sandbox": false, 28 | "option_mac_x86_64": true, 29 | "option_mac_arm64": true, 30 | "option_mac_apple_sign_in": false, 31 | "resourceVersion": "1.0", 32 | "name": "macOS", 33 | "tags": [], 34 | "resourceType": "GMMacOptions", 35 | } -------------------------------------------------------------------------------- /options/main/options_main.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_gameguid": "0d6ff39d-6542-491d-92f5-2549c0836f05", 3 | "option_gameid": "0", 4 | "option_game_speed": 60, 5 | "option_mips_for_3d_textures": false, 6 | "option_draw_colour": 4294967295, 7 | "option_window_colour": 255, 8 | "option_steam_app_id": "0", 9 | "option_sci_usesci": true, 10 | "option_author": "", 11 | "option_collision_compatibility": false, 12 | "option_copy_on_write_enabled": false, 13 | "option_spine_licence": false, 14 | "option_template_image": "${base_options_dir}/main/template_image.png", 15 | "option_template_icon": "${base_options_dir}/main/template_icon.png", 16 | "option_template_description": null, 17 | "resourceVersion": "1.4", 18 | "name": "Main", 19 | "tags": [], 20 | "resourceType": "GMMainOptions", 21 | } -------------------------------------------------------------------------------- /options/operagx/options_operagx.yy: -------------------------------------------------------------------------------- 1 | { 2 | "option_operagx_version": "1.0.0.0", 3 | "option_operagx_next_version": "1.0.0.0", 4 | "option_operagx_game_name": "${project_name}", 5 | "option_operagx_interpolate_pixels": true, 6 | "option_operagx_scale": 0, 7 | "option_operagx_texture_page": "2048x2048", 8 | "option_operagx_display_cursor": true, 9 | "option_operagx_guid": "", 10 | "option_operagx_team_name": "", 11 | "option_operagx_team_id": "", 12 | "option_operagx_editUrl": "", 13 | "option_operagx_internalShareUrl": "", 14 | "option_operagx_publicShareUrl": "", 15 | "resourceVersion": "1.0", 16 | "name": "operagx", 17 | "tags": [], 18 | "resourceType": "GMOperaGXOptions", 19 | } -------------------------------------------------------------------------------- /options/windows/icons/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WheatBox/CloudSleepEngine/0dfcf4d73a33ee487a2448a93b7b324a94b6545a/options/windows/icons/icon.ico -------------------------------------------------------------------------------- /options/windows/options_windows.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMWindowsOptions", 3 | "resourceVersion": "1.1", 4 | "name": "Windows", 5 | "option_windows_display_name": "CloudSleepEngine", 6 | "option_windows_executable_name": "${project_name}.exe", 7 | "option_windows_version": "1.0.0.0", 8 | "option_windows_company_info": "YoYo Games Ltd", 9 | "option_windows_product_info": "Created with GameMaker", 10 | "option_windows_copyright_info": "", 11 | "option_windows_description_info": "Cloud Sleep Engine", 12 | "option_windows_display_cursor": true, 13 | "option_windows_icon": "icons/icon.ico", 14 | "option_windows_save_location": 0, 15 | "option_windows_splash_screen": "${base_options_dir}/windows/splash/splash.png", 16 | "option_windows_use_splash": false, 17 | "option_windows_start_fullscreen": false, 18 | "option_windows_allow_fullscreen_switching": false, 19 | "option_windows_interpolate_pixels": true, 20 | "option_windows_vsync": false, 21 | "option_windows_resize_window": true, 22 | "option_windows_borderless": false, 23 | "option_windows_scale": 0, 24 | "option_windows_copy_exe_to_dest": false, 25 | "option_windows_sleep_margin": 1, 26 | "option_windows_texture_page": "2048x2048", 27 | "option_windows_installer_finished": "${base_options_dir}/windows/installer/finished.bmp", 28 | "option_windows_installer_header": "${base_options_dir}/windows/installer/header.bmp", 29 | "option_windows_license": "${base_options_dir}/windows/installer/license.txt", 30 | "option_windows_nsis_file": "${base_options_dir}/windows/installer/nsis_script.nsi", 31 | "option_windows_enable_steam": false, 32 | "option_windows_disable_sandbox": true, 33 | "option_windows_steam_use_alternative_launcher": false, 34 | } -------------------------------------------------------------------------------- /rooms/rm_mainmenu/rm_mainmenu.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnd": false, 3 | "volume": 1.0, 4 | "parentRoom": null, 5 | "views": [ 6 | {"inherit":false,"visible":true,"xview":0,"yview":0,"wview":1280,"hview":720,"xport":0,"yport":0,"wport":1280,"hport":720,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 7 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 8 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 9 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 10 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 11 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 12 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 13 | {"inherit":false,"visible":false,"xview":0,"yview":0,"wview":1366,"hview":768,"xport":0,"yport":0,"wport":1366,"hport":768,"hborder":32,"vborder":32,"hspeed":-1,"vspeed":-1,"objectId":null,}, 14 | ], 15 | "layers": [ 16 | {"instances":[ 17 | {"properties":[],"isDnd":false,"objectId":{"name":"obj_mainMenu","path":"objects/obj_mainMenu/obj_mainMenu.yy",},"inheritCode":false,"hasCreationCode":false,"colour":4294967295,"rotation":0.0,"scaleX":1.0,"scaleY":1.0,"imageIndex":0,"imageSpeed":1.0,"inheritedItemId":null,"frozen":false,"ignore":false,"inheritItemSettings":false,"x":0.0,"y":32.0,"resourceVersion":"1.0","name":"inst_1F62D907","tags":[],"resourceType":"GMRInstance",}, 18 | ],"visible":true,"depth":0,"userdefinedDepth":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"gridX":32,"gridY":32,"layers":[],"hierarchyFrozen":false,"effectEnabled":true,"effectType":null,"properties":[],"resourceVersion":"1.0","name":"Instances","tags":[],"resourceType":"GMRInstanceLayer",}, 19 | {"spriteId":null,"colour":4278190080,"x":0,"y":0,"htiled":false,"vtiled":false,"hspeed":0.0,"vspeed":0.0,"stretch":false,"animationFPS":15.0,"animationSpeedType":0,"userdefinedAnimFPS":false,"visible":true,"depth":100,"userdefinedDepth":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"gridX":32,"gridY":32,"layers":[],"hierarchyFrozen":false,"effectEnabled":true,"effectType":null,"properties":[],"resourceVersion":"1.0","name":"Background","tags":[],"resourceType":"GMRBackgroundLayer",}, 20 | ], 21 | "inheritLayers": false, 22 | "creationCodeFile": "", 23 | "inheritCode": false, 24 | "instanceCreationOrder": [ 25 | {"name":"inst_1F62D907","path":"rooms/rm_MainMenu/rm_MainMenu.yy",}, 26 | ], 27 | "inheritCreationOrder": false, 28 | "sequenceId": null, 29 | "roomSettings": { 30 | "inheritRoomSettings": false, 31 | "Width": 1280, 32 | "Height": 720, 33 | "persistent": false, 34 | }, 35 | "viewSettings": { 36 | "inheritViewSettings": false, 37 | "enableViews": true, 38 | "clearViewBackground": true, 39 | "clearDisplayBuffer": true, 40 | }, 41 | "physicsSettings": { 42 | "inheritPhysicsSettings": false, 43 | "PhysicsWorld": false, 44 | "PhysicsWorldGravityX": 0.0, 45 | "PhysicsWorldGravityY": 10.0, 46 | "PhysicsWorldPixToMetres": 0.1, 47 | }, 48 | "parent": { 49 | "name": "Rooms", 50 | "path": "folders/Rooms.yy", 51 | }, 52 | "resourceVersion": "1.0", 53 | "name": "rm_MainMenu", 54 | "tags": [], 55 | "resourceType": "GMRoom", 56 | } -------------------------------------------------------------------------------- /scripts/GetNthPower2Tier_/GetNthPower2Tier_.gml: -------------------------------------------------------------------------------- 1 | function GetNthPower2Tier(n) { 2 | if(n <= 0) return 0; 3 | if(n <= 2) return 2; 4 | if(n <= 4) return 4; 5 | if(n <= 8) return 8; 6 | if(n <= 16) return 16; 7 | if(n <= 32) return 32; 8 | if(n <= 64) return 64; 9 | if(n <= 128) return 128; 10 | if(n <= 256) return 256; 11 | if(n <= 512) return 512; 12 | if(n <= 1024) return 1024; 13 | if(n <= 2048) return 2048; 14 | if(n <= 4096) return 4096; 15 | if(n <= 8192) return 8192; 16 | if(n <= 16384) return 16384; 17 | if(n <= 32768) return 32768; 18 | if(n <= 65536) return 65536; 19 | if(n <= 131072) return 131072; 20 | if(n <= 262144) return 262144; 21 | if(n <= 524288) return 524288; 22 | if(n <= 1048576) return 1048576; 23 | if(n <= 2097152) return 2097152; 24 | if(n <= 4194304) return 4194304; 25 | if(n <= 8388608) return 8388608; 26 | if(n <= 16777216) return 16777216; 27 | if(n <= 33554432) return 33554432; 28 | if(n <= 67108864) return 67108864; 29 | if(n <= 134217728) return 134217728; 30 | if(n <= 268435456) return 268435456; 31 | if(n <= 536870912) return 536870912; 32 | if(n <= 1073741824) return 1073741824; 33 | if(n <= 2147483648) return 2147483648; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /scripts/GetNthPower2Tier_/GetNthPower2Tier_.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMScript", 3 | "resourceVersion": "1.0", 4 | "name": "GetNthPower2Tier_", 5 | "isDnD": false, 6 | "isCompatibility": false, 7 | "parent": { 8 | "name": "Scripts", 9 | "path": "folders/Scripts.yy", 10 | }, 11 | } -------------------------------------------------------------------------------- /scripts/HEX_DEC/HEX_DEC.gml: -------------------------------------------------------------------------------- 1 | /// @desc 十六进制 转换 十进制 2 | /// @param {string} str 输入一个 16进制 字符串 3 | /// @returns {real} 返回一个 10进制 数字 4 | function HEXtoDEC(str) { 5 | var temp = ""; 6 | var j = 0; 7 | var res = 0; 8 | 9 | for(var i = string_length(str); i > 0; i--) { 10 | var t = string_char_at(str, i); 11 | var m = 0; 12 | switch(t) { 13 | case "0": 14 | case "1": 15 | case "2": 16 | case "3": 17 | case "4": 18 | case "5": 19 | case "6": 20 | case "7": 21 | case "8": 22 | case "9": 23 | m = real(t); 24 | break; 25 | case "A": 26 | m = 10; 27 | break; 28 | case "B": 29 | m = 11; 30 | break; 31 | case "C": 32 | m = 12; 33 | break; 34 | case "D": 35 | m = 13; 36 | break; 37 | case "E": 38 | m = 14; 39 | break; 40 | case "F": 41 | m = 15; 42 | break; 43 | } 44 | res += m * power(16, j); 45 | j++; 46 | } 47 | 48 | return res; 49 | } 50 | 51 | /// @desc 十进制 转换 十六进制 52 | /// @param {real} num 输入一个 10进制 数字 53 | /// @returns {string} 返回一个 16进制 字符串 54 | function DECtoHEX(num) { 55 | if(num < 0) { 56 | return "ERROR!"; 57 | } 58 | 59 | if(num == 0) { 60 | return "0"; 61 | } 62 | 63 | var n = num, m; // n 表示 商,m 表示 余数 64 | var res = ""; 65 | 66 | while(n != 0) { 67 | m = n % 16; 68 | n = floor(n / 16); 69 | 70 | if(m < 10) { 71 | res += string(m); 72 | } else { 73 | switch(m) { 74 | case 10: 75 | res += "A"; 76 | break; 77 | case 11: 78 | res += "B"; 79 | break; 80 | case 12: 81 | res += "C"; 82 | break; 83 | case 13: 84 | res += "D"; 85 | break; 86 | case 14: 87 | res += "E"; 88 | break; 89 | case 15: 90 | res += "F"; 91 | break; 92 | } 93 | } 94 | } 95 | 96 | var resFinal = ""; 97 | for(var i = string_length(res); i > 0; i--) { 98 | resFinal += string_char_at(res, i); 99 | } 100 | 101 | return resFinal; 102 | } 103 | 104 | // show_message(DECtoHEX(114514)); 105 | 106 | // show_message(HEXtoDEC("1BF52")); 107 | 108 | -------------------------------------------------------------------------------- /scripts/HEX_DEC/HEX_DEC.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMScript", 3 | "resourceVersion": "1.0", 4 | "name": "HEX_DEC", 5 | "isDnD": false, 6 | "isCompatibility": false, 7 | "parent": { 8 | "name": "Scripts", 9 | "path": "folders/Scripts.yy", 10 | }, 11 | } -------------------------------------------------------------------------------- /scripts/__init/__init.gml: -------------------------------------------------------------------------------- 1 | // show_debug_overlay(1); 2 | 3 | randomize(); 4 | 5 | #macro DragObjBboxMode bboxmode_automatic 6 | 7 | globalvar InitCameraPosX, InitCameraPosY; 8 | InitCameraPosX = 640; 9 | InitCameraPosY = 360; 10 | 11 | enum ESandboxSceneElementsLayers { 12 | nothing, 13 | sleepers, 14 | backgrounds, 15 | decorates, 16 | beds 17 | }; 18 | 19 | globalvar gSandboxSceneElementsLayer, gSandboxSceneElementsDragging; 20 | gSandboxSceneElementsLayer = ESandboxSceneElementsLayers.nothing; 21 | gSandboxSceneElementsDragging = noone; 22 | 23 | // GUI中的 obj_GuiElment_DragObj 或 obj_GuiElement_BedSleepSetter 中的 BedSleepStruct 是否有被右键选中 24 | globalvar gSandboxGuiElementsDragObjIsOnRightClick; 25 | gSandboxGuiElementsDragObjIsOnRightClick = false; 26 | 27 | -------------------------------------------------------------------------------- /scripts/__init/__init.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMScript", 3 | "resourceVersion": "1.0", 4 | "name": "__init", 5 | "isDnD": false, 6 | "isCompatibility": false, 7 | "parent": { 8 | "name": "Scripts", 9 | "path": "folders/Scripts.yy", 10 | }, 11 | } -------------------------------------------------------------------------------- /scripts/camera/camera.gml: -------------------------------------------------------------------------------- 1 | function CameraX() { 2 | return camera_get_view_x(view_camera[0]); 3 | } 4 | 5 | function CameraY() { 6 | return camera_get_view_y(view_camera[0]); 7 | } 8 | 9 | function CameraWidth() { 10 | return camera_get_view_width(view_camera[0]); 11 | } 12 | 13 | function CameraHeight() { 14 | return camera_get_view_height(view_camera[0]); 15 | } 16 | 17 | function CameraScale(useWidth_0_OrHeight_1_ = 0, useDefaultGuiSize = false) { 18 | if(useWidth_0_OrHeight_1_) { 19 | if(useDefaultGuiSize) { 20 | return CameraHeight() / 720; 21 | } else { 22 | return CameraHeight() / GuiHeight(); 23 | } 24 | } 25 | if(useDefaultGuiSize) { 26 | return CameraWidth() / 1280; 27 | } else { 28 | return CameraWidth() / GuiWidth(); 29 | } 30 | } 31 | 32 | function CameraLock() { 33 | if(InstanceExists(obj_camera)) { 34 | obj_camera.mouseCameraMoveLock = true; 35 | } 36 | } 37 | 38 | function CameraUnlock() { 39 | if(InstanceExists(obj_camera)) { 40 | obj_camera.mouseCameraMoveLock = false; 41 | } 42 | } 43 | 44 | function GuiWidth() { 45 | return display_get_gui_width(); 46 | } 47 | 48 | function GuiHeight() { 49 | return display_get_gui_height(); 50 | } 51 | 52 | -------------------------------------------------------------------------------- /scripts/camera/camera.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMScript", 3 | "resourceVersion": "1.0", 4 | "name": "Camera", 5 | "isDnD": false, 6 | "isCompatibility": false, 7 | "parent": { 8 | "name": "Scripts", 9 | "path": "folders/Scripts.yy", 10 | }, 11 | } -------------------------------------------------------------------------------- /scripts/file_dll/file_dll.gml: -------------------------------------------------------------------------------- 1 | #macro NULL 0 2 | 3 | /* StringConverter.dll */ 4 | // https://github.com/JoyLeeSoft/StringConverter 5 | // g++ --share .\StringConverter.cpp -o .\StringConverter.dll -std=c++20 -static -DUNICODE 6 | 7 | // utf8 *StringConverter_MultiByteToUTF8(const multibyte *str) 8 | function StringConverter_MultiByteToUTF8(str) { 9 | static dllid = external_define("dll\\StringConverter.dll", "StringConverter_MultiByteToUTF8", dll_cdecl, ty_string, 1, ty_string); 10 | return external_call(dllid, str); 11 | } 12 | 13 | // multibyte *StringConverter_UTF8ToMultiByte(const utf8 *str) 14 | function StringConverter_UTF8ToMultiByte(str) { 15 | static dllid = external_define("dll\\StringConverter.dll", "StringConverter_UTF8ToMultiByte", dll_cdecl, ty_string, 1, ty_string); 16 | return external_call(dllid, str); 17 | } 18 | 19 | 20 | 21 | /* file_dll.dll */ 22 | 23 | /// @desc 获取文件大小,成功返回正数,失败返回-1 24 | function FileGetSize(file_name) { 25 | static dllid = external_define("dll\\file_dll.dll", "get_file_size", dll_cdecl, ty_real, 1, ty_string); 26 | file_name = StringConverter_UTF8ToMultiByte(file_name); 27 | return external_call(dllid, file_name); 28 | } 29 | 30 | /// @desc 读取文件,传入文件名,返回指向文件内容的指针,失败返回NULL,文件最大10M(内置10MB buffer) 31 | function FileRead(file_name) { 32 | static dllid = external_define("dll\\file_dll.dll", "read_file", dll_cdecl, ty_string, 1, ty_string); 33 | file_name = StringConverter_UTF8ToMultiByte(file_name); 34 | return external_call(dllid, file_name); 35 | } 36 | 37 | /// @desc 写文件,传入文件名和文件内容,成功返回0,失败返回其他 38 | function FileWrite(file_name, file_content) { 39 | static dllid = external_define("dll\\file_dll.dll", "write_file", dll_cdecl, ty_real, 2, ty_string, ty_string); 40 | file_name = StringConverter_UTF8ToMultiByte(file_name); 41 | return external_call(dllid, file_name, file_content); 42 | } 43 | 44 | /// @desc 拷贝文件,传入源文件名和目标文件名,成功返回0,失败返回其他 45 | function FileCopy(src_file_name, dst_file_name) { 46 | static dllid = external_define("dll\\file_dll.dll", "copy_file", dll_cdecl, ty_real, 2, ty_string, ty_string); 47 | src_file_name = StringConverter_UTF8ToMultiByte(src_file_name); 48 | dst_file_name = StringConverter_UTF8ToMultiByte(dst_file_name); 49 | return external_call(dllid, src_file_name, dst_file_name); 50 | } 51 | 52 | /// @desc 移动文件,传入源文件名和目标文件名,成功返回0,失败返回其他 53 | function FileMove(src_file_name, dst_file_name) { 54 | static dllid = external_define("dll\\file_dll.dll", "move_file", dll_cdecl, ty_real, 2, ty_string, ty_string); 55 | src_file_name = StringConverter_UTF8ToMultiByte(src_file_name); 56 | dst_file_name = StringConverter_UTF8ToMultiByte(dst_file_name); 57 | return external_call(dllid, src_file_name, dst_file_name); 58 | } 59 | 60 | /// @desc 删除文件,传入文件名,成功返回0,失败返回其他 61 | function FileRemove(file_name) { 62 | static dllid = external_define("dll\\file_dll.dll", "remove_file", dll_cdecl, ty_real, 1, ty_string); 63 | file_name = StringConverter_UTF8ToMultiByte(file_name); 64 | return external_call(dllid, file_name); 65 | } 66 | 67 | 68 | 69 | /* systemCmd.dll */ 70 | 71 | /// @desc system(""); 72 | function systemCmd(str) { 73 | static dllid = external_define("dll\\systemCmd.dll", "systemCmd", dll_cdecl, ty_real, 1, ty_string); 74 | str = StringConverter_UTF8ToMultiByte(str); 75 | return external_call(dllid, str); 76 | } 77 | -------------------------------------------------------------------------------- /scripts/file_dll/file_dll.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMScript", 3 | "resourceVersion": "1.0", 4 | "name": "file_dll", 5 | "isDnD": false, 6 | "isCompatibility": false, 7 | "parent": { 8 | "name": "Scripts", 9 | "path": "folders/Scripts.yy", 10 | }, 11 | } -------------------------------------------------------------------------------- /scripts/files/files.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMScript", 3 | "resourceVersion": "1.0", 4 | "name": "Files", 5 | "isDnD": false, 6 | "isCompatibility": false, 7 | "parent": { 8 | "name": "Scripts", 9 | "path": "folders/Scripts.yy", 10 | }, 11 | } -------------------------------------------------------------------------------- /scripts/font/font.gml: -------------------------------------------------------------------------------- 1 | globalvar fontRegular; 2 | fontRegular = font_add("fonts/SourceHanSansSC-Medium.otf", 14, false, false, 0, 65536); 3 | 4 | draw_set_font(fontRegular); 5 | 6 | -------------------------------------------------------------------------------- /scripts/font/font.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "Scripts", 6 | "path": "folders/Scripts.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "Font", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /scripts/getpositionongui/getpositionongui.gml: -------------------------------------------------------------------------------- 1 | /// @desc 获取某一坐标x投影到GUI上的位置 2 | /// @param {real} _x x 3 | /// @param {real} _cameraIndex 默认为0 4 | /// @returns {real} 投影后的 x坐标 5 | function GetPositionXOnGUI(_x, _cameraIndex = 0) { 6 | return (_x - camera_get_view_x(view_camera[_cameraIndex])) * (display_get_gui_width() / camera_get_view_width(view_camera[_cameraIndex])); 7 | } 8 | 9 | /// @desc 获取某一坐标y投影到GUI上的位置 10 | /// @param {real} _y y 11 | /// @param {real} _cameraIndex 默认为0 12 | /// @returns {real} 投影后的 y坐标 13 | function GetPositionYOnGUI(_y, _cameraIndex = 0) { 14 | return (_y - camera_get_view_y(view_camera[_cameraIndex])) * (display_get_gui_height() / camera_get_view_height(view_camera[_cameraIndex])); 15 | } 16 | -------------------------------------------------------------------------------- /scripts/getpositionongui/getpositionongui.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMScript", 3 | "resourceVersion": "1.0", 4 | "name": "GetPositionOnGUI", 5 | "isDnD": false, 6 | "isCompatibility": false, 7 | "parent": { 8 | "name": "Scripts", 9 | "path": "folders/Scripts.yy", 10 | }, 11 | } -------------------------------------------------------------------------------- /scripts/gui/gui.gml: -------------------------------------------------------------------------------- 1 | #macro GUIDepth -10000 2 | #macro GUIPageDepth -9900 3 | #macro GUIDragObjDepth -10100 4 | #macro GUIMessageDepth -10200 5 | 6 | #macro GUIDefaultColor #000037 7 | #macro GUIDangerousColor c_red 8 | #macro GUIWarningColor c_yellow 9 | 10 | #macro GUIDefaultAlpha 0.6 11 | #macro GUIHighLightAlpha 0.3 12 | 13 | globalvar gMouseOnGUI, gMouseDraggingSlidingRodIns; 14 | gMouseOnGUI = false; 15 | gMouseDraggingSlidingRodIns = noone; 16 | 17 | // 关于该变量的相关设置在 obj_camera 里 18 | globalvar __MouseOnGUIBackswing; 19 | __MouseOnGUIBackswing = 0; 20 | 21 | #macro IsMouseOnGUI (__MouseOnGUIBackswing > 0) 22 | 23 | globalvar __halignTemp, __valignTemp, __colTemp, __alphaTemp; 24 | __halignTemp = fa_left; 25 | __valignTemp = fa_top; 26 | __colTemp = c_white; 27 | __alphaTemp = 1.0; 28 | 29 | function SaveDrawSettings() { 30 | __halignTemp = draw_get_halign(); 31 | __valignTemp = draw_get_valign(); 32 | __colTemp = draw_get_color(); 33 | __alphaTemp = draw_get_alpha(); 34 | } 35 | 36 | function LoadDrawSettings() { 37 | draw_set_halign(__halignTemp); 38 | draw_set_valign(__valignTemp); 39 | draw_set_color(__colTemp); 40 | draw_set_alpha(__alphaTemp); 41 | } 42 | 43 | 44 | function GUI_GetStringWidth(text) { 45 | return string_width(text); 46 | } 47 | 48 | function GUI_GetStringHeight(text) { 49 | return string_height(text); 50 | } 51 | 52 | function GUI_GetStringWidthHalf(text) { 53 | return string_width(text) / 2; 54 | } 55 | 56 | function GUI_GetStringHeightHalf(text) { 57 | return string_height(text) / 2; 58 | } 59 | 60 | function GUI_MouseGuiOnMe(left, top, right, bottom) { 61 | var mx = GetPositionXOnGUI(mouse_x); 62 | var my = GetPositionYOnGUI(mouse_y); 63 | var x1 = left; 64 | var y1 = top; 65 | var x2 = right; 66 | var y2 = bottom; 67 | if(point_in_rectangle(mx, my, x1, y1, x2, y2)) { 68 | return true; 69 | } 70 | return false; 71 | } 72 | 73 | function GUI_MouseGuiOnMe_Radius(_x, _y, _radius) { 74 | var mx = GetPositionXOnGUI(mouse_x); 75 | var my = GetPositionYOnGUI(mouse_y); 76 | var x1 = _x - _radius; 77 | var y1 = _y - _radius; 78 | var x2 = _x + _radius; 79 | var y2 = _y + _radius; 80 | if(point_in_rectangle(mx, my, x1, y1, x2, y2)) { 81 | return true; 82 | } 83 | return false; 84 | } 85 | 86 | function GUI_DrawText(_xGui, _yGui, str, onCenter = false) { 87 | if(onCenter) { 88 | var ha = draw_get_halign(); 89 | var va = draw_get_valign(); 90 | 91 | draw_set_halign(fa_center); 92 | draw_set_valign(fa_middle); 93 | draw_text(_xGui, _yGui, str); 94 | 95 | draw_set_halign(ha); 96 | draw_set_valign(va); 97 | } else { 98 | draw_text(_xGui, _yGui, str); 99 | } 100 | } 101 | 102 | function GUI_DrawTextTransformed(_xGui, _yGui, str, xscale, yscale, angle, onCenter = false) { 103 | if(onCenter) { 104 | var ha = draw_get_halign(); 105 | var va = draw_get_valign(); 106 | 107 | draw_set_halign(fa_center); 108 | draw_set_valign(fa_middle); 109 | draw_text_transformed(_xGui, _yGui, str, xscale, yscale, angle); 110 | 111 | draw_set_halign(ha); 112 | draw_set_valign(va); 113 | } else { 114 | draw_text_transformed(_xGui, _yGui, str, xscale, yscale, angle); 115 | } 116 | } 117 | 118 | function GUI_DrawRectangle(left, top, right, bottom, outline = false) { 119 | draw_rectangle( 120 | /*GetPositionXOnGUI(left), 121 | GetPositionYOnGUI(top), 122 | GetPositionXOnGUI(right), 123 | GetPositionYOnGUI(bottom),*/ 124 | left, top, right, bottom, 125 | outline 126 | ); 127 | } 128 | 129 | function GUI_DrawRectangle_Radius(_x, _y, _radius, outline = false) { 130 | draw_rectangle( 131 | _x - _radius, _y - _radius, _x + _radius, _y + _radius, 132 | outline 133 | ); 134 | } 135 | 136 | function GUI_DrawLabel(text, _xGui, _yGui, highLight = false) { 137 | GUI_DrawLabel_ext(text, _xGui, _yGui, , , highLight); 138 | } 139 | 140 | function GUI_DrawLabel_ext(text, _xGui, _yGui, _widthHalf = undefined, _heightHalf = undefined, highLight = false, _color = GUIDefaultColor, _alpha = GUIDefaultAlpha) { 141 | var _x = _xGui; 142 | var _y = _yGui; 143 | 144 | var halignTemp = draw_get_halign(); 145 | var valignTemp = draw_get_valign(); 146 | var colTemp = draw_get_color(); 147 | var alphaTemp = draw_get_alpha(); 148 | 149 | 150 | draw_set_halign(fa_center); 151 | draw_set_valign(fa_middle); 152 | draw_set_color(_color); 153 | draw_set_alpha(_alpha); 154 | 155 | var strWHalf = ((_widthHalf == undefined) ? GUI_GetStringWidthHalf(text) : _widthHalf); 156 | var strHHalf = ((_widthHalf == undefined) ? GUI_GetStringHeightHalf(text) : _heightHalf); 157 | GUI_DrawRectangle(_x - strWHalf, _y - strHHalf, _x + strWHalf, _y + strHHalf, false); 158 | 159 | draw_set_color(c_white); 160 | draw_set_alpha(1.0); 161 | 162 | GUI_DrawText(_x, _y, text); 163 | 164 | if(highLight) { 165 | draw_set_alpha(GUIHighLightAlpha); 166 | GUI_DrawRectangle(_x - strWHalf, _y - strHHalf, _x + strWHalf, _y + strHHalf, false); 167 | } 168 | 169 | 170 | draw_set_halign(halignTemp); 171 | draw_set_valign(valignTemp); 172 | draw_set_color(colTemp); 173 | draw_set_alpha(alphaTemp); 174 | } 175 | 176 | function GUI_DrawSprite(spr, subimg, _xGui, _yGui) { 177 | draw_sprite(spr, subimg, _xGui, _yGui); 178 | } 179 | 180 | function GUI_DrawSprite_ext(spr, subimg, _xGui, _yGui, xscale, yscale, rot, col, alpha) { 181 | draw_sprite_ext(spr, subimg, _xGui, _yGui, xscale, yscale, rot, col, alpha); 182 | } 183 | 184 | function GUI_DrawSurface(surf, _xGui, _yGui) { 185 | draw_surface(surf, _xGui, _yGui); 186 | } 187 | 188 | 189 | globalvar __CursorTEMP; 190 | __CursorTEMP = cr_default; 191 | function GUI_SetCursorHandpoint() { 192 | if(window_get_cursor() != cr_handpoint) { 193 | window_set_cursor(cr_handpoint); 194 | } 195 | __CursorTEMP = cr_handpoint; 196 | } 197 | function GUI_SetCursorDefault() { 198 | var curCursor = window_get_cursor(); 199 | if( 200 | curCursor == cr_handpoint 201 | ) { 202 | // 等到下一帧看看 GUI_SetCursorHandpoint(); 会不会被再次触发(也就是鼠标依然在按钮上) 203 | // 如果再次触发,那么忽略,进行下一次检查的准备(__CursorTEMP = cr_default) 204 | if(__CursorTEMP == cr_default) { 205 | window_set_cursor(__CursorTEMP); 206 | } else { 207 | __CursorTEMP = cr_default; 208 | } 209 | } 210 | } 211 | -------------------------------------------------------------------------------- /scripts/gui/gui.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMScript", 3 | "resourceVersion": "1.0", 4 | "name": "GUI", 5 | "isDnD": false, 6 | "isCompatibility": false, 7 | "parent": { 8 | "name": "Scripts", 9 | "path": "folders/Scripts.yy", 10 | }, 11 | } -------------------------------------------------------------------------------- /scripts/guielementpage/guielementpage.gml: -------------------------------------------------------------------------------- 1 | function GuiElement_PageAddElement_Multi(pageIns, arrElementIns, arrElementHeight = undefined) { 2 | var len = array_length(arrElementIns); 3 | for(var i = 0; i < len; i++) { 4 | if(arrElementHeight == undefined) { 5 | GuiElement_PageAddElement(pageIns, arrElementIns[i], undefined); 6 | } else { 7 | GuiElement_PageAddElement(pageIns, arrElementIns[i], arrElementHeight[i]); 8 | } 9 | } 10 | } 11 | 12 | /// 注意!!!elementIns.y 在此处变为增量y,如果想要紧挨着最后一个元素添加,请直接设0!!! 13 | function GuiElement_PageAddElement(pageIns, elementIns, elementHeight = undefined) { 14 | with(pageIns) { 15 | var ins = elementIns; 16 | if(InstanceExists(ins)) { 17 | 18 | vecChildElementsInitY.push_back(ins.y); 19 | 20 | // 我不知道发什么了什么,反正调试后发现刚好多了这个值,所以在结尾ins.y减去它就好了 21 | // 怎么运行起来的,我不知道 22 | var insYTemp = ins.y; 23 | 24 | ins.x += x; 25 | ins.y += y + 32; 26 | 27 | vecChildElements.push_back(ins); 28 | 29 | if(elementHeight == undefined) { 30 | if(ins[$ "height"] != undefined) { 31 | // DebugMes(object_get_name(elementIns.object_index) + "-" + string(elementIns) + " 's auto got \"height\" = " + string(ins.height)); 32 | vecChildElementsHeight.push_back(ins.height); 33 | } else { 34 | // DebugMes(object_get_name(elementIns.object_index) + "-" + string(elementIns) + " 's \"height\" undefined"); 35 | vecChildElementsHeight.push_back(ins.sprite_height * ins.image_yscale); 36 | } 37 | } else { 38 | vecChildElementsHeight.push_back(elementHeight); 39 | } 40 | 41 | for(var i = 0; i < vecChildElementsHeight.size(); i++) { 42 | ins.y += vecChildElementsHeight.Container[i]; 43 | ins.y += vecChildElementsInitY.Container[i]; 44 | ins.y += 1; 45 | // DebugMes(string(ins.y) + " " + string(vecChildElementsHeight.Container[i]) + " " + string(vecChildElementsInitY.Container[i])); 46 | } 47 | 48 | ins.y -= vecChildElementsHeight.back() / 2; 49 | 50 | ins.y -= insYTemp; 51 | 52 | childElementsBottom = ins.y + vecChildElementsHeight.back() - scrollY; 53 | 54 | instance_deactivate_object(ins); 55 | } 56 | } 57 | } 58 | 59 | 60 | function GuiElement_PageGetIsWorking(ins) { 61 | if(InstanceExists(ins)) { 62 | return ins.working; 63 | } 64 | return false; 65 | } 66 | 67 | function GuiElement_PageStartWork(ins) { 68 | if(InstanceExists(ins)) { 69 | ins.MyStartWork(); 70 | } 71 | } 72 | 73 | function GuiElement_PageStopWork(ins) { 74 | if(InstanceExists(ins)) { 75 | ins.MyStopWork(); 76 | } 77 | } 78 | 79 | function GuiElement_PageStartWorkAll(_vector) { 80 | for(var i = 0; i < _vector.size(); i++) { 81 | GuiElement_PageStartWork(_vector.Container[i]); 82 | } 83 | } 84 | 85 | function GuiElement_PageStopWorkAll(_vector) { 86 | for(var i = 0; i < _vector.size(); i++) { 87 | GuiElement_PageStopWork(_vector.Container[i]); 88 | } 89 | } 90 | 91 | /// @desc 92 | /// 将 endI 设为 0,为仅仅只删除 beginI 对应的 ins(默认), 93 | /// 将 endI 设为 -1,删除直至结尾 94 | function GuiElement_PageClearIns(_pageIns, beginI, endI = 0) { 95 | if(endI == -1) { 96 | endI = _pageIns.vecChildElements.size() - beginI; 97 | } else if(endI == 0) { 98 | endI = beginI; 99 | } 100 | 101 | if(beginI > endI) { 102 | return; 103 | } 104 | 105 | for(var i = beginI; i <= endI; i++) { 106 | if(InstanceExists(_pageIns.vecChildElements.Container[i])) { 107 | //if(i != 0) { 108 | // _pageIns.childElementsBottom -= _pageIns.vecChildElementsInitY.Container[i]; 109 | // _pageIns.childElementsBottom -= _pageIns.vecChildElementsHeight.Container[i]; 110 | //} 111 | instance_destroy(_pageIns.vecChildElements.Container[i]); 112 | } 113 | } 114 | 115 | array_delete(_pageIns.vecChildElements.Container, beginI, endI - beginI + 1); 116 | array_delete(_pageIns.vecChildElementsInitY.Container, beginI, endI - beginI + 1); 117 | array_delete(_pageIns.vecChildElementsHeight.Container, beginI, endI - beginI + 1); 118 | 119 | 120 | // 整理目前已放置的 SceneElements 121 | // SceneElement_BackgroundsAlignAfterDelete(beginI, endI - beginI + 1); 122 | } 123 | 124 | /// @desc 对齐 Page 里的各个 Element 125 | function GuiElement_PageAlign(_pageIns) { 126 | if(!InstanceExists(_pageIns)) { 127 | return; 128 | } 129 | 130 | var _len = _pageIns.vecChildElements.size(); 131 | var ins = noone; 132 | for(var i = 0; i < _len; i++) { 133 | ins = _pageIns.vecChildElements.Container[i]; 134 | ins.y = _pageIns.y + 32 + _pageIns.scrollY; 135 | 136 | for(var j = 0; j <= i; j++) { 137 | ins.y += _pageIns.vecChildElementsHeight.Container[j]; 138 | ins.y += _pageIns.vecChildElementsInitY.Container[j]; 139 | ins.y += 1; 140 | } 141 | 142 | ins.y -= _pageIns.vecChildElementsHeight.Container[i] / 2; 143 | } 144 | 145 | if(InstanceExists(ins)) { 146 | _pageIns.childElementsBottom = ins.y + _pageIns.vecChildElementsHeight.back() - _pageIns.scrollY; 147 | } 148 | } 149 | 150 | -------------------------------------------------------------------------------- /scripts/guielementpage/guielementpage.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMScript", 3 | "resourceVersion": "1.0", 4 | "name": "GuiElementPage", 5 | "isDnD": false, 6 | "isCompatibility": false, 7 | "parent": { 8 | "name": "Scripts", 9 | "path": "folders/Scripts.yy", 10 | }, 11 | } -------------------------------------------------------------------------------- /scripts/guielements/guielements.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMScript", 3 | "resourceVersion": "1.0", 4 | "name": "GuiElements", 5 | "isDnD": false, 6 | "isCompatibility": false, 7 | "parent": { 8 | "name": "Scripts", 9 | "path": "folders/Scripts.yy", 10 | }, 11 | } -------------------------------------------------------------------------------- /scripts/mouse/mouse.gml: -------------------------------------------------------------------------------- 1 | function MouseLeftPressed() { 2 | return mouse_check_button_pressed(mb_left); 3 | } 4 | 5 | function MouseRightPressed() { 6 | return mouse_check_button_pressed(mb_right); 7 | } 8 | 9 | 10 | function MouseLeftHold() { 11 | return mouse_check_button(mb_left); 12 | } 13 | 14 | function MouseMidHold() { 15 | return mouse_check_button(mb_middle); 16 | } 17 | 18 | function MouseRightHold() { 19 | return mouse_check_button(mb_right); 20 | } 21 | 22 | 23 | function MouseLeftReleased() { 24 | return mouse_check_button_released(mb_left); 25 | } 26 | 27 | function MouseRightReleased() { 28 | return mouse_check_button_released(mb_right); 29 | } 30 | 31 | -------------------------------------------------------------------------------- /scripts/mouse/mouse.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "Scripts", 6 | "path": "folders/Scripts.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "Mouse", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /scripts/others/others.gml: -------------------------------------------------------------------------------- 1 | /// @desc DebugMes 2 | /// @arg {Any} arg 3 | function DebugMes(arg, inScript = false) { 4 | str = string(arg); 5 | if(inScript) { 6 | show_debug_message(str); 7 | } else { 8 | show_debug_message(object_get_name(object_index) + "-" + string(id) + ": " + str); 9 | } 10 | } 11 | 12 | function CheckStructCanBeUse(_structVal) { 13 | if(is_struct(_structVal) == true 14 | && _structVal != NULL 15 | && _structVal != "null" 16 | && _structVal != pointer_null 17 | && _structVal != undefined 18 | ) { 19 | return true; 20 | } else { 21 | return false; 22 | } 23 | } 24 | 25 | function InstanceExists(ins) { 26 | if(ins == undefined || ins == noone) { 27 | return false; 28 | } 29 | return instance_exists(ins); 30 | } 31 | 32 | 33 | // 虽然这两个函数的运算其实完全一样,但是还是稍微像这样区分着规范一下比较好 34 | function GetPositionXGridStandardization(_x, gridCellSize = SCENE_CellSize) { 35 | return floor((_x + gridCellSize / 2) / gridCellSize) * gridCellSize; 36 | } 37 | function GetPositionYGridStandardization(_y, gridCellSize = SCENE_CellSize) { 38 | return GetPositionXGridStandardization(_y, gridCellSize); 39 | } 40 | 41 | 42 | function ArrayReverse(arr) { 43 | var len = array_length(arr); 44 | for(var i = 0; i < len / 2; i++) { 45 | var t = arr[i]; 46 | arr[i] = arr[len - i - 1]; 47 | arr[len - i - 1] = t; 48 | } 49 | } 50 | 51 | 52 | /// @desc 同步 depth 53 | function SynchDepth(_y = y) { 54 | depth = - GetPositionYOnGUI(_y) + SceneDepthDynamicAdd; 55 | } 56 | 57 | 58 | /// @desc 生成GUID 59 | /// @arg {bool} withBrace 是否带有首尾的大括号,默认 true 60 | function GuidGenerate(withBrace = true) { 61 | var S4 = function() { 62 | var str = DECtoHEX((1 + irandom_range(0, 999999) / 1000000) * 0x10000 | 0); 63 | return string_copy(str, 1 + 1, string_length(str) - 1); 64 | } 65 | 66 | var res = S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4(); 67 | 68 | if(withBrace) { 69 | return "{" + res + "}"; 70 | } 71 | 72 | return res; 73 | } 74 | 75 | 76 | 77 | /// @desc 计算 scrollY 78 | function ScrollYCalculate(scrollY, scrollYSpeed, _guiTop, _guiBottom, _pageHeight) { 79 | var top = _guiTop; 80 | var bottom = _guiBottom; 81 | 82 | scrollY = -scrollY; 83 | 84 | if(mouse_wheel_up()) { 85 | scrollY -= scrollYSpeed; 86 | if(top + scrollY < 0) { 87 | scrollY -= top + scrollY; 88 | } 89 | } else if(mouse_wheel_down()) { 90 | if(_pageHeight >= bottom) { 91 | scrollY += scrollYSpeed; 92 | if(bottom + scrollY > _pageHeight) { 93 | scrollY -= bottom + scrollY - _pageHeight; 94 | } 95 | } 96 | } 97 | 98 | scrollY = -scrollY; 99 | 100 | return scrollY; 101 | } 102 | 103 | globalvar gArrDragObjBedsCount; 104 | gArrDragObjBedsCount = []; 105 | // gArrDragObjBedsCount[materialId]:该床在场景中的数量 106 | 107 | function DragObjBedsCountAdd(_materialId) { 108 | if(_materialId < 0) { 109 | return; 110 | } 111 | if(array_length(gArrDragObjBedsCount) <= _materialId) { 112 | gArrDragObjBedsCount[_materialId] = 0; 113 | } 114 | gArrDragObjBedsCount[_materialId]++; 115 | } 116 | 117 | function DragObjBedsCountSubtract(_materialId) { 118 | if(_materialId < 0) { 119 | return; 120 | } 121 | if(array_length(gArrDragObjBedsCount) <= _materialId) { 122 | return; 123 | // gArrDragObjBedsCount[_materialId] = 0; 124 | } 125 | gArrDragObjBedsCount[_materialId]--; 126 | } 127 | 128 | function DragObjBedsCountGet(_materialId) { 129 | if(_materialId < 0) { 130 | return 0; 131 | } 132 | if(array_length(gArrDragObjBedsCount) <= _materialId) { 133 | return 0; 134 | } 135 | return gArrDragObjBedsCount[_materialId]; 136 | } 137 | 138 | globalvar __InstancesOptimizeFreezing; 139 | __InstancesOptimizeFreezing = 5; 140 | 141 | /// @desc 将该函数放在 obj_camera 中 142 | function InstancesOptimize() { 143 | static _arrObjTemp = [ 144 | obj_SceneElementSleeper, 145 | obj_SceneElementBackground, 146 | obj_SceneElementDecorate, 147 | obj_SceneElementBed, 148 | ]; 149 | static _arrObjTempLen = array_length(_arrObjTemp); 150 | 151 | if(__InstancesOptimizeFreezing > 0) { 152 | __InstancesOptimizeFreezing--; 153 | return; 154 | } 155 | 156 | var _temp = 0;// 64; 157 | 158 | var _camleft = CameraX() - _temp; 159 | var _camtop = CameraY() - _temp; 160 | var _camright = _camleft + CameraWidth() + _temp; 161 | var _cambottom = _camtop + CameraHeight() + _temp; 162 | 163 | for(var i = 0; i < _arrObjTempLen; i++) { 164 | instance_activate_object(_arrObjTemp[i]); 165 | 166 | with(_arrObjTemp[i]) { 167 | if(rectangle_in_rectangle( 168 | _camleft, _camtop, _camright, _cambottom, 169 | bbox_left, bbox_top, bbox_right, bbox_bottom 170 | ) == false) { 171 | instance_deactivate_object(id); 172 | } 173 | } 174 | } 175 | } 176 | 177 | function SceneElementsActivate() { 178 | static _arrObjTemp = [ 179 | obj_SceneElementSleeper, 180 | obj_SceneElementBackground, 181 | obj_SceneElementDecorate, 182 | obj_SceneElementBed, 183 | ]; 184 | static _arrObjTempLen = array_length(_arrObjTemp); 185 | for(var i = 0; i < _arrObjTempLen; i++) { 186 | instance_activate_object(_arrObjTemp[i]); 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /scripts/others/others.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMScript", 3 | "resourceVersion": "1.0", 4 | "name": "Others", 5 | "isDnD": false, 6 | "isCompatibility": false, 7 | "parent": { 8 | "name": "Scripts", 9 | "path": "folders/Scripts.yy", 10 | }, 11 | } -------------------------------------------------------------------------------- /scripts/scene/scene.gml: -------------------------------------------------------------------------------- 1 | #macro SCENE_CellSize 32 2 | #macro SCENE_MinimumSize 10 3 | 4 | function SCENE_MouseOnMe(left, top, right, bottom) { 5 | var mx = mouse_x; 6 | var my = mouse_y; 7 | var x1 = left; 8 | var y1 = top; 9 | var x2 = right; 10 | var y2 = bottom; 11 | if(point_in_rectangle(mx, my, x1, y1, x2, y2)) { 12 | return true; 13 | } 14 | return false; 15 | } 16 | 17 | function SCENE_MouseOnMe_Radius(_x, _y, _radius) { 18 | var mx = mouse_x; 19 | var my = mouse_y; 20 | if(point_in_rectangle(mx, my, _x - _radius, _y - _radius, _x + _radius, _y + _radius)) { 21 | return true; 22 | } 23 | return false; 24 | } 25 | 26 | function SCENE_DrawRectangleOnGui(left, top, right, bottom, outline = false) { 27 | draw_rectangle( 28 | GetPositionXOnGUI(left), 29 | GetPositionYOnGUI(top), 30 | GetPositionXOnGUI(right), 31 | GetPositionYOnGUI(bottom), 32 | outline 33 | ); 34 | } 35 | 36 | function SCENE_DrawRectangleOnGui_Radius(_x, _y, _radius, outline = false) { 37 | draw_rectangle( 38 | GetPositionXOnGUI(_x) - _radius, 39 | GetPositionYOnGUI(_y) - _radius, 40 | GetPositionXOnGUI(_x) + _radius, 41 | GetPositionYOnGUI(_y) + _radius, 42 | outline 43 | ); 44 | } 45 | 46 | -------------------------------------------------------------------------------- /scripts/scene/scene.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "Scripts", 6 | "path": "folders/Scripts.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "SCENE", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /scripts/sceneelements/sceneelements.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMScript", 3 | "resourceVersion": "1.0", 4 | "name": "SceneElements", 5 | "isDnD": false, 6 | "isCompatibility": false, 7 | "parent": { 8 | "name": "Scripts", 9 | "path": "folders/Scripts.yy", 10 | }, 11 | } -------------------------------------------------------------------------------- /scripts/setsize_/setsize_.gml: -------------------------------------------------------------------------------- 1 | /// @desc 设置物体的大小 2 | /// @param {real} destWidth 宽 3 | /// @param {real} destHeight 高 4 | /// @param {id} destID 物体id,默认为当前物体的id,也可设为其它物体的id 5 | function SetSize(destWidth, destHeight, destID = id) { 6 | with(destID) { 7 | image_xscale = destWidth / sprite_get_width(sprite_index); 8 | image_yscale = destHeight / sprite_get_height(sprite_index); 9 | } 10 | } 11 | 12 | /// @desc 设置物体的大小,但是锁定宽高比 13 | /// @param {real} destWidth 宽 14 | /// @param {id} destID 物体id,默认为当前物体的id,也可设为其它物体的id 15 | function SetSizeLockAspect_Width(destWidth, destID = id) { 16 | with(destID) { 17 | image_xscale = destWidth / sprite_get_width(sprite_index); 18 | image_yscale = image_xscale; 19 | } 20 | } 21 | 22 | /// @desc 设置物体的大小,但是锁定宽高比 23 | /// @param {real} destHeight 高 24 | /// @param {id} destID 物体id,默认为当前物体的id,也可设为其它物体的id 25 | function SetSizeLockAspect_Height(destHeight, destID = id) { 26 | with(destID) { 27 | image_yscale = destHeight / sprite_get_height(sprite_index); 28 | image_xscale = image_yscale; 29 | } 30 | } 31 | 32 | 33 | /// @desc 设置物体的大小,通用版本,返回一个二维数组,[0] = xscale, [1] = yscale 34 | /// @param {real} destWidth 宽 35 | /// @param {real} destHeight 高 36 | /// @param {real} srcWidth sprite_get_width() 37 | /// @param {real} srcHeight sprite_get_height() 38 | function SetSize_Generic(destWidth, destHeight, srcWidth, srcHeight) { 39 | var res = [1, 1]; 40 | res[0] = destWidth / srcWidth; 41 | res[1] = destHeight / srcHeight; 42 | return res; 43 | } 44 | 45 | /// @desc 设置物体的大小,但是锁定宽高比,通用版本,返回一个二维数组,[0] = xscale, [1] = yscale 46 | /// @param {real} destWidth 宽 47 | /// @param {real} srcWidth sprite_get_width() 48 | function SetSizeLockAspect_Width_Generic(destWidth, srcWidth) { 49 | var res = [1, 1]; 50 | res[0] = destWidth / srcWidth; 51 | res[1] = res[0]; 52 | return res; 53 | } 54 | 55 | /// @desc 设置物体的大小,但是锁定宽高比,通用版本,返回一个二维数组,[0] = xscale, [1] = yscale 56 | /// @param {real} destHeight 高 57 | /// @param {real} srcHeight sprite_get_height() 58 | function SetSizeLockAspect_Height_Generic(destHeight, srcHeight) { 59 | var res = [1, 1]; 60 | res[1] = destHeight / srcHeight; 61 | res[0] = res[1]; 62 | return res; 63 | } 64 | 65 | -------------------------------------------------------------------------------- /scripts/setsize_/setsize_.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "Scripts", 6 | "path": "folders/Scripts.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "SetSize_", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /scripts/stlvector/stlvector.gml: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------*/ 2 | /* 构造函数 */ 3 | // 4 | // A = new vector(); 5 | // 声明一个名为A的空vector,无初始值 6 | // A = new vector(5); 7 | // 声明一个名为A的vector,内含5个元素为0的初始值 8 | // A = new vector(4, 7); 9 | // 声明一个名为A的vector,内含4个元素为7的初始值 10 | /*----------------------------------------------------*/ 11 | /* 成员变量 */ 12 | // 13 | // Container = []; 14 | // 该数组为该数据结构的核心 15 | // 你可以直接通过 A.Container[i] 来进行调用 16 | /*----------------------------------------------------*/ 17 | /* 基本信息 */ 18 | // 19 | // size(); 判断大小 20 | // empty(); 判断容器是否为空(true),不为空(false) 21 | // begin_(); 返回头指针,指向第一个元素,但因为GML没有指针,故返回下标 22 | // 因为begin是GML保留关键字,故使用begin_代替 23 | // end_(); 返回尾指针,指向最后一个元素,但因为GML没有指针,故返回下标 24 | // 因为end是GML保留关键字,故使用end_代替 25 | /*----------------------------------------------------*/ 26 | /* 访问元素 */ 27 | // 28 | // front(); 返回首元素的引用,若为空则返回undefined 29 | // back(); 返回尾元素的引用,若为空则返回undefined 30 | // at(_pos); 返回pos位置元素的引用,若为空则返回undefined 31 | /*----------------------------------------------------*/ 32 | /* 写入元素 */ 33 | // 34 | // push_back(_val); 从容器末尾写入元素 35 | // insert(_index, _n_or_val, _val = undefined); 插入元素 36 | /* C++中有两种写法: 37 | a.insert(it, val) 或 a.insert(it, n, val) */ 38 | /*----------------------------------------------------*/ 39 | /* 删除元素 */ 40 | // 41 | // pop_back(); 从容器末尾删除元素 42 | // erase(_first, _last = _first + 1); 删除 [_first,_last) 的元素 43 | // _first 和 _last 直接写下标即可 44 | // clear(); 清空容器 45 | /*----------------------------------------------------*/ 46 | /* 其它函数 */ 47 | // 48 | // resize(_size); 改变当前使用数据的大小,如果它比当前使用的大,填充默认值 49 | // swap(_vector); 互换两个vector里的数据 50 | /*----------------------------------------------------*/ 51 | 52 | function vector(_inilen = 0, _ininum = 0) constructor { 53 | Container = []; 54 | for(var i = 0; i < _inilen; i++) { 55 | Container[i] = _ininum; 56 | } 57 | 58 | /// @desc 判断大小 59 | static size = function() { 60 | return array_length(Container); 61 | } 62 | 63 | /// @desc 判断容器是否为空(true),不为空(false) 64 | static empty = function() { 65 | return size() > 0 ? false : true; 66 | } 67 | 68 | /// @desc 返回头指针,指向第一个元素,但因为GML没有指针,故返回下标 69 | static begin_ = function() { 70 | // 因为begin是GML保留关键字,故使用begin_代替 71 | return 0; // 额……,对,没错……,返回下标0…… 72 | } 73 | 74 | /// @desc 返回尾指针,指向最后一个元素,但因为GML没有指针,故返回下标 75 | static end_ = function() { 76 | // 因为end是GML保留关键字,故使用end_代替 77 | return size() - 1; 78 | } 79 | 80 | 81 | /// @desc 返回首元素的引用,若为空则返回undefined 82 | static front = function() { 83 | return empty() == false ? Container[0] : undefined; 84 | } 85 | 86 | /// @desc 返回尾元素的引用,若为空则返回undefined 87 | static back = function() { 88 | return empty() == false ? Container[end_()] : undefined; 89 | } 90 | 91 | /// @desc 返回pos位置元素的引用,若为空则返回undefined 92 | static at = function(_pos) { 93 | return _pos <= end_() ? Container[_pos] : undefined; 94 | } 95 | 96 | 97 | /// @desc 从容器末尾写入元素 98 | static push_back = function(_val) { 99 | array_push(Container, _val); 100 | } 101 | 102 | /// @desc 插入元素 103 | static insert = function(_index, _n_or_val, _val = undefined) { 104 | /* C++中有两种写法: 105 | a.insert(it, val) 或 a.insert(it, n, val)*/ 106 | if(_val != undefined) { 107 | repeat(_n_or_val) { 108 | array_insert(Container, _index, _val); 109 | } 110 | } else { 111 | array_insert(Container, _index, _n_or_val); 112 | } 113 | } 114 | 115 | 116 | /// @desc 从容器末尾删除元素 117 | static pop_back = function() { 118 | array_pop(Container); 119 | } 120 | 121 | /// @desc 删除 [_first,_last) 的元素 122 | static erase = function(_first, _last = _first + 1) { 123 | // _first 和 _last 直接写下标即可 124 | array_delete(Container, _first, _last - _first); 125 | } 126 | 127 | /// @desc 清空容器 128 | static clear = function() { 129 | repeat(size()) { 130 | pop_back(); 131 | } 132 | } 133 | 134 | 135 | /// @desc 改变当前使用数据的大小,如果它比当前使用的大,填充默认值 136 | static resize = function(_size) { 137 | if(size() > _size) { 138 | erase(_size, size()); 139 | } else if(size() < _size) { 140 | for(var i = size(); i < _size; i++) { 141 | Container[i] = 0; 142 | } 143 | } 144 | } 145 | 146 | /// @desc 互换两个vector里的数据 147 | static swap = function(_vector) { 148 | // var _vecsize = _vector.size(); 149 | var _vecCon = _vector.Container; 150 | _vector.Container = Container; 151 | Container = _vecCon; 152 | } 153 | } 154 | 155 | -------------------------------------------------------------------------------- /scripts/stlvector/stlvector.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "Scripts", 6 | "path": "folders/Scripts.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "STLvector", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /scripts/textbox_fns/textbox_fns.yy: -------------------------------------------------------------------------------- 1 | { 2 | "isDnD": false, 3 | "isCompatibility": false, 4 | "parent": { 5 | "name": "Textbox - Single line", 6 | "path": "folders/Textbox - Single line.yy", 7 | }, 8 | "resourceVersion": "1.0", 9 | "name": "textbox_fns", 10 | "tags": [], 11 | "resourceType": "GMScript", 12 | } -------------------------------------------------------------------------------- /scripts/wheat_ptr_/wheat_ptr_.gml: -------------------------------------------------------------------------------- 1 | enum EWheatPtrType { 2 | Global = 0, 3 | Struct = 1, 4 | Ins = 2, 5 | } 6 | 7 | /// @desc 小麦指针,不是指针的指针,UwU 有小麦麦在这里帮你指着就不怕找不到了哦喵呜 8 | /// @arg {Real} _EWheatPtrType_Or_wheat_ptr 变量的类型,例如 EWheatPtrType.Global,也可以直接填写一个 wheat_ptr,若这么做,则会跳过后面两个参数 9 | /// @arg {Struct} _varMasterStructOrIns 如果变量类型为 EWheatPtrType.Struct或Ins,此处请填入目标结构体或实例,若为 Global 请跳过 10 | /// @arg {String} _variableName 变量名称(填入一个字符串) 11 | function wheat_ptr(_EWheatPtrType_Or_wheat_ptr = EWheatPtrType.Global, _varMasterStructOrIns = noone, _variableName = "") constructor { 12 | type = _EWheatPtrType_Or_wheat_ptr; 13 | varMaster = _varMasterStructOrIns; 14 | varName = _variableName; 15 | 16 | if(is_struct(_EWheatPtrType_Or_wheat_ptr)) { 17 | type = _EWheatPtrType_Or_wheat_ptr.type; 18 | varMaster = _EWheatPtrType_Or_wheat_ptr.varMaster; 19 | varName = _EWheatPtrType_Or_wheat_ptr.varName; 20 | } 21 | 22 | /// @desc 指向目标 23 | /// @arg {Enum} _EWheatPtrType_Or_wheat_ptr 变量的类型,例如 EWheatPtrType.Global,也可以直接填写一个 wheat_ptr,若这么做,则会跳过后面两个参数 24 | /// @arg {Struct} _varMasterStructOrIns 如果变量类型为 EWheatPtrType.Struct或Ins,此处请填入目标结构体或实例,若为 Global 请跳过 25 | /// @arg {String} _variableName 变量名称(填入一个字符串) 26 | static point = function(_EWheatPtrType_Or_wheat_ptr = EWheatPtrType.Global, _varMasterStructOrIns = noone, _variableName = "") { 27 | type = _EWheatPtrType_Or_wheat_ptr; 28 | varMaster = _varMasterStructOrIns; 29 | varName = _variableName; 30 | 31 | if(is_struct(_EWheatPtrType_Or_wheat_ptr)) { 32 | type = _EWheatPtrType_Or_wheat_ptr.type; 33 | varMaster = _EWheatPtrType_Or_wheat_ptr.varMaster; 34 | varName = _EWheatPtrType_Or_wheat_ptr.varName; 35 | } 36 | } 37 | 38 | /// @desc 获取值,若获取失败会返回 undefined 39 | static value = function() { 40 | switch(type) { 41 | case EWheatPtrType.Global: 42 | if(variable_global_exists(varName)) { 43 | return variable_global_get(varName); 44 | } 45 | break; 46 | 47 | case EWheatPtrType.Struct: 48 | if(is_struct(varMaster)) 49 | if(variable_struct_exists(varMaster, varName)) { 50 | return variable_struct_get(varMaster, varName); 51 | } 52 | break; 53 | 54 | case EWheatPtrType.Ins: 55 | if(instance_exists(varMaster)) 56 | if(variable_instance_exists(varMaster, varName)) { 57 | return variable_instance_get(varMaster, varName); 58 | } 59 | break; 60 | } 61 | 62 | return undefined; 63 | } 64 | 65 | /// @desc 设定值到指向的变量,成功返回 true,失败返回 false 66 | static set = function(val) { 67 | if(varName == "") { 68 | return false; 69 | } 70 | switch(type) { 71 | case EWheatPtrType.Global: 72 | variable_global_set(varName, val); 73 | return true; 74 | 75 | case EWheatPtrType.Struct: 76 | if(is_struct(varMaster)) { 77 | variable_struct_set(varMaster, varName, val); 78 | return true; 79 | } 80 | break; 81 | 82 | case EWheatPtrType.Ins: 83 | if(instance_exists(varMaster)) { 84 | variable_instance_set(varMaster, varName, val); 85 | return true; 86 | } 87 | break; 88 | } 89 | 90 | return false; 91 | } 92 | 93 | /// @desc 返回该 wheat_ptr 所指向的目标相关的数据,返回结果也是一个结构体,但是并非用 new 创建,所以不需要手动释放内存 94 | static get = function() { 95 | var _res = {}; 96 | 97 | _res.type = type; 98 | _res.varMaster = varMaster; 99 | _res.varName = varName; 100 | 101 | _res.point = point; 102 | _res.value = value; 103 | _res.set = set; 104 | _res.get = get; 105 | _res.swap = swap; 106 | 107 | return _res; 108 | } 109 | 110 | /// @desc 互换两个 wheat_ptr 所指向的目标(不会对被指向的变量的值产生影响),成功返回 true,失败返回 false 111 | static swap = function(_wheat_ptr) { 112 | if(is_struct(_wheat_ptr)) { 113 | var _temp = [ type, varMaster, varName ]; 114 | 115 | type = _wheat_ptr.type; 116 | varMaster = _wheat_ptr.varMaster; 117 | varName = _wheat_ptr.varName; 118 | 119 | _wheat_ptr.type = _temp[0]; 120 | _wheat_ptr.varMaster = _temp[1]; 121 | _wheat_ptr.varName = _temp[2]; 122 | 123 | return true; 124 | } 125 | 126 | return false; 127 | } 128 | } 129 | 130 | /// @desc 小麦指针,不是指针的指针,UwU 有小麦麦在这里帮你指着就不怕找不到了哦喵呜,使用该函数创建的 wheat_ptr 不需要手动 delete 来释放内存呢~ 131 | /// @arg {Real} _EWheatPtrType_Or_wheat_ptr 变量的类型,例如 EWheatPtrType.Global,也可以直接填写一个 wheat_ptr,若这么做,则会跳过后面两个参数 132 | /// @arg {Struct} _varMasterStructOrIns 如果变量类型为 EWheatPtrType.Struct或Ins,此处请填入目标结构体或实例,若为 Global 请跳过 133 | /// @arg {String} _variableName 变量名称(填入一个字符串) 134 | function make_wheat_ptr(_EWheatPtrType_Or_wheat_ptr = EWheatPtrType.Global, _varMasterStructOrIns = noone, _variableName = "") { 135 | var _temp = new wheat_ptr(_EWheatPtrType_Or_wheat_ptr, _varMasterStructOrIns, _variableName); 136 | var _res = _temp.get(); 137 | delete _temp; 138 | return _res; 139 | } 140 | -------------------------------------------------------------------------------- /scripts/wheat_ptr_/wheat_ptr_.yy: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "GMScript", 3 | "resourceVersion": "1.0", 4 | "name": "wheat_ptr_", 5 | "isDnD": false, 6 | "isCompatibility": false, 7 | "parent": { 8 | "name": "Scripts", 9 | "path": "folders/Scripts.yy", 10 | }, 11 | } --------------------------------------------------------------------------------