void ScriptGUIToggle::internal_createInstance(MonoObject* instance, MonoObject* content, MonoObject* monoToggleGroup, MonoString* style, MonoArray* guiOptions) { GUIOptions options; ScriptArray scriptArray(guiOptions); UINT32 arrayLen = scriptArray.size(); for (UINT32 i = 0; i < arrayLen; i++) options.addOption(scriptArray.get<GUIOption>(i)); ScriptGUIToggleGroup* scriptToggleGroup = nullptr; SPtr<GUIToggleGroup> toggleGroup; if (monoToggleGroup != nullptr) { scriptToggleGroup = ScriptGUIToggleGroup::toNative(monoToggleGroup); toggleGroup = scriptToggleGroup->getInternalValue(); } GUIContent nativeContent(ScriptGUIContent::getText(content), ScriptGUIContent::getImage(content), ScriptGUIContent::getTooltip(content)); GUIToggle* guiToggle = GUIToggle::create(nativeContent, toggleGroup, options, toString(MonoUtil::monoToWString(style))); guiToggle->onClick.connect(std::bind(&ScriptGUIToggle::onClick, instance)); guiToggle->onHover.connect(std::bind(&ScriptGUIToggle::onHover, instance)); guiToggle->onOut.connect(std::bind(&ScriptGUIToggle::onOut, instance)); guiToggle->onToggled.connect(std::bind(&ScriptGUIToggle::onToggled, instance, std::placeholders::_1)); guiToggle->onDoubleClick.connect(std::bind(&ScriptGUIToggle::onDoubleClick, instance)); new (bs_alloc<ScriptGUIToggle>()) ScriptGUIToggle(instance, guiToggle); }
void ScriptGUIResourceField::internal_createInstance(MonoObject* instance, MonoReflectionType* type, __GUIContentInterop* title, UINT32 titleWidth, MonoString* style, MonoArray* guiOptions, bool withTitle) { GUIOptions options; ScriptArray scriptArray(guiOptions); UINT32 arrayLen = scriptArray.size(); for (UINT32 i = 0; i < arrayLen; i++) options.addOption(scriptArray.get<GUIOption>(i)); String styleName = MonoUtil::monoToString(style); ::MonoClass* monoClass = MonoUtil::getClass(type); String typeNamespace; String typeName; MonoUtil::getClassName(monoClass, typeNamespace, typeName); GUIResourceField* guiResourceField = nullptr; if (withTitle) { GUIContent nativeContent = ScriptGUIContent::fromInterop(*title); guiResourceField = GUIResourceField::create(typeNamespace, typeName, nativeContent, titleWidth, options, styleName); } else { guiResourceField = GUIResourceField::create(typeNamespace, typeName, options, styleName); } auto nativeInstance = new (bs_alloc<ScriptGUIResourceField>()) ScriptGUIResourceField(instance, guiResourceField); guiResourceField->onValueChanged.connect(std::bind(&ScriptGUIResourceField::onChanged, nativeInstance, _1)); }
void ScriptGUIProgressBar::internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions) { GUIOptions options; ScriptArray scriptArray(guiOptions); UINT32 arrayLen = scriptArray.size(); for (UINT32 i = 0; i < arrayLen; i++) options.addOption(scriptArray.get<GUIOption>(i)); GUIProgressBar* progressBar = GUIProgressBar::create(options, MonoUtil::monoToString(style)); new (bs_alloc<ScriptGUIProgressBar>()) ScriptGUIProgressBar(instance, progressBar); }
void ScriptGUICanvas::internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions) { GUIOptions options; ScriptArray scriptArray(guiOptions); UINT32 arrayLen = scriptArray.size(); for (UINT32 i = 0; i < arrayLen; i++) options.addOption(scriptArray.get<GUIOption>(i)); GUICanvas* guiCanvas = GUICanvas::create(options, toString(MonoUtil::monoToWString(style))); new (bs_alloc<ScriptGUICanvas>()) ScriptGUICanvas(instance, guiCanvas); }
void ScriptGUILabel::internal_createInstance(MonoObject* instance, MonoObject* content, MonoString* style, MonoArray* guiOptions) { GUIOptions options; ScriptArray scriptArray(guiOptions); UINT32 arrayLen = scriptArray.size(); for (UINT32 i = 0; i < arrayLen; i++) options.addOption(scriptArray.get<GUIOption>(i)); GUIContent nativeContent(ScriptGUIContent::getText(content), ScriptGUIContent::getImage(content), ScriptGUIContent::getTooltip(content)); GUILabel* guiLabel = GUILabel::create(nativeContent, options, toString(MonoUtil::monoToWString(style))); new (bs_alloc<ScriptGUILabel>()) ScriptGUILabel(instance, guiLabel); }
void ScriptGUISceneTreeView::internal_createInstance(MonoObject* instance, MonoString* style, MonoArray* guiOptions) { GUIOptions options; ScriptArray scriptArray(guiOptions); UINT32 arrayLen = scriptArray.size(); for (UINT32 i = 0; i < arrayLen; i++) options.addOption(scriptArray.get<GUIOption>(i)); String styleName = toString(MonoUtil::monoToWString(style)); GUISceneTreeView* treeView = GUISceneTreeView::create(options); new (bs_alloc<ScriptGUISceneTreeView>()) ScriptGUISceneTreeView(instance, treeView); }
void ScriptGUITexture::internal_createInstance(MonoObject* instance, MonoObject* texture, GUIImageScaleMode scale, bool transparent, MonoString* style, MonoArray* guiOptions) { GUIOptions options; ScriptArray scriptArray(guiOptions); UINT32 arrayLen = scriptArray.size(); for (UINT32 i = 0; i < arrayLen; i++) options.addOption(scriptArray.get<GUIOption>(i)); HSpriteTexture nativeTexture; if(texture != nullptr) nativeTexture = ScriptSpriteTexture::toNative(texture)->getHandle(); GUITexture* guiTexture = GUITexture::create(nativeTexture, scale, transparent, options, toString(MonoUtil::monoToWString(style))); new (bs_alloc<ScriptGUITexture>()) ScriptGUITexture(instance, guiTexture); }