MonoObject* ScriptStringTableManager::internal_GetTable(UINT32 id) { HStringTable table = StringTableManager::instance().getTable(id); ScriptResourceBase* scriptStringTable = ScriptResourceManager::instance().getScriptResource(table, true); return scriptStringTable->getManagedInstance(); }
MonoObject* ScriptEditorApplication::internal_SaveScene(MonoString* path) { Path nativePath = MonoUtil::monoToString(path); HSceneObject sceneRoot = gSceneManager().getRootNode(); SPtr<ProjectResourceMeta> resMeta = gProjectLibrary().findResourceMeta(nativePath); HPrefab scene; if (resMeta != nullptr) { if (resMeta->getTypeID() != TID_Prefab) return nullptr; scene = static_resource_cast<Prefab>(gProjectLibrary().load(nativePath)); scene->update(sceneRoot); gProjectLibrary().saveEntry(scene); } else { scene = Prefab::create(sceneRoot); gProjectLibrary().createEntry(scene, nativePath); } ScriptResourceBase* scriptPrefab = ScriptResourceManager::instance().getScriptResource(scene, true); return scriptPrefab->getManagedInstance(); }
MonoObject* ScriptBuiltin::internal_GetDefaultFont() { HFont font = BuiltinResources::instance().getDefaultFont(); ScriptResourceBase* scriptFont = ScriptResourceManager::instance().getScriptResource(font, true); return scriptFont->getManagedInstance(); }
MonoObject* ScriptBuiltin::internal_GetMesh(BuiltinMesh meshType) { HMesh mesh = BuiltinResources::instance().getMesh(meshType); ScriptResourceBase* scriptMesh = ScriptResourceManager::instance().getScriptResource(mesh, true); return scriptMesh->getManagedInstance(); }
MonoObject* ScriptBuiltin::internal_GetBuiltinShader(BuiltinShader type) { HShader diffuseShader = BuiltinResources::instance().getBuiltinShader(type); ScriptResourceBase* scriptShader = ScriptResourceManager::instance().getScriptResource(diffuseShader, true); return scriptShader->getManagedInstance(); }
MonoObject* ScriptBuiltin::internal_GetWhiteTexture() { HSpriteTexture whiteTexture = BuiltinResources::instance().getWhiteSpriteTexture(); ScriptResourceBase* scriptSpriteTex = ScriptResourceManager::instance().getScriptResource(whiteTexture, true); return scriptSpriteTex->getManagedInstance(); }
void ScriptRenderTexture2D::internal_getDepthStencilSurface(ScriptRenderTexture2D* thisPtr, MonoObject** value) { SPtr<RenderTexture> tex = thisPtr->getRenderTexture(); HTexture depthTex = tex->getDepthStencilTexture(); ScriptResourceBase* scriptSurface = ScriptResourceManager::instance().getScriptResource(depthTex, true); *value = scriptSurface->getManagedInstance(); }
MonoObject* ScriptGUIResourceField::nativeToManagedResource(const HResource& instance) { if (instance == nullptr) return nullptr; else { ScriptResourceBase* scriptResource = ScriptResourceManager::instance().getScriptResource(instance, true); return scriptResource->getManagedInstance(); } }
ScriptGUIElementStateStyleStruct ScriptGUIElementStateStyle::toManaged(const GUIElementStyle::GUIElementStateStyle& state) { ScriptResourceBase* scriptTexture = nullptr; if (state.texture != nullptr) scriptTexture = ScriptResourceManager::instance().getScriptResource(state.texture, true); ScriptGUIElementStateStyleStruct output; output.texture = scriptTexture != nullptr ? scriptTexture->getManagedInstance() : nullptr; output.textColor = state.textColor; return output; }
__Blend2DInfoInterop ScriptBlend2DInfo::toInterop(const Blend2DInfo& value) { __Blend2DInfoInterop output; ScriptResourceBase* scripttopLeftClip; scripttopLeftClip = ScriptResourceManager::instance().getScriptResource(value.topLeftClip, true); MonoObject* tmptopLeftClip; if(scripttopLeftClip != nullptr) tmptopLeftClip = scripttopLeftClip->getManagedInstance(); else tmptopLeftClip = nullptr; output.topLeftClip = tmptopLeftClip; ScriptResourceBase* scripttopRightClip; scripttopRightClip = ScriptResourceManager::instance().getScriptResource(value.topRightClip, true); MonoObject* tmptopRightClip; if(scripttopRightClip != nullptr) tmptopRightClip = scripttopRightClip->getManagedInstance(); else tmptopRightClip = nullptr; output.topRightClip = tmptopRightClip; ScriptResourceBase* scriptbotLeftClip; scriptbotLeftClip = ScriptResourceManager::instance().getScriptResource(value.botLeftClip, true); MonoObject* tmpbotLeftClip; if(scriptbotLeftClip != nullptr) tmpbotLeftClip = scriptbotLeftClip->getManagedInstance(); else tmpbotLeftClip = nullptr; output.botLeftClip = tmpbotLeftClip; ScriptResourceBase* scriptbotRightClip; scriptbotRightClip = ScriptResourceManager::instance().getScriptResource(value.botRightClip, true); MonoObject* tmpbotRightClip; if(scriptbotRightClip != nullptr) tmpbotRightClip = scriptbotRightClip->getManagedInstance(); else tmpbotRightClip = nullptr; output.botRightClip = tmpbotRightClip; return output; }
void ScriptRenderTexture2D::internal_getColorSurfaces(ScriptRenderTexture2D* thisPtr, MonoArray** value) { SPtr<RenderTexture> tex = thisPtr->getRenderTexture(); UINT32 numColorSurfaces = BS_MAX_MULTIPLE_RENDER_TARGETS; ScriptArray outArray = ScriptArray::create<ScriptTexture>(numColorSurfaces); for (UINT32 i = 0; i < numColorSurfaces; i++) { HTexture colorTex = tex->getColorTexture(i); if (colorTex != nullptr) { ScriptResourceBase* scriptSurface = ScriptResourceManager::instance().getScriptResource(colorTex, true); outArray.set<MonoObject*>(i, scriptSurface->getManagedInstance()); } else outArray.set<MonoObject*>(i, nullptr); } *value = outArray.getInternal(); }
MonoArray* ScriptEditorUtility::internal_FindDependencies(MonoObject* resource, bool recursive) { ScriptResource* srcResource = ScriptResource::toNative(resource); if (srcResource == nullptr) { ScriptArray emptyArray = ScriptArray::create<ScriptResource>(0); return emptyArray.getInternal(); } HResource srcHandle = srcResource->getGenericHandle(); Vector<ResourceDependency> dependencies = Utility::findResourceDependencies(srcHandle, recursive); UINT32 numEntries = (UINT32)dependencies.size(); ScriptArray output = ScriptArray::create<ScriptResource>(numEntries); for (UINT32 i = 0; i < numEntries; i++) { ScriptResourceBase* dependency = ScriptResourceManager::instance().getScriptResource(dependencies[i].resource, true); output.set(i, dependency->getManagedInstance()); } return output.getInternal(); }