标签: loading

如何更快地加载/卸载图块块(C#)

好的,基本上在我的游戏中,世界是由图块组成的,图块被分成块(50x50 图块,图块为 16x16),因此整个世界不会加载到内存中。这些块被保存到文件中,并且仅加载需要的块(屏幕上的块和屏幕每一侧(顶部、左侧、底部、右侧)的 1 个块),其他块则被卸载等等。这一切都有效不过很好,当加载实际包含图块的块时,游戏逻辑会冻结相当多的时间(你知道加载文件吗?),基本上我的问题是如何使我当前的方法更快,所以几乎没有明显的滞后?

基本上每个块只包含一个 2D 字节数组,包含图块类型而不是实际的图块类,并且该字节数组保存到文件中以供稍后加载。我的块加载/保存功能:

保存:

    public void SaveChunk(int cx, int cy)
    {

        String chunkname = "";
        chunkname = WorldChunks[cx, cy].X + "_" + WorldChunks[cx, cy].Y;

        FileStream fileStream = File.Create(Main.ChunkPath + "\\Chunks\\" + chunkname + ".chnk");
        StreamWriter writer = new StreamWriter(fileStream);
        String json = JsonConvert.SerializeObject(WorldChunks[cx, cy].myTiles, Formatting.None);
        writer.Write(json);
        writer.Close();
    }
Run Code Online (Sandbox Code Playgroud)

加载中:

    public void LoadChunk(int xx, int yy)
    {

        string chunkname = xx + "_" + yy;
        if (File.Exists(Main.ChunkPath + "\\Chunks\\" + chunkname + ".chnk"))
        {
            //If the …
Run Code Online (Sandbox Code Playgroud)

c# performance tiles loading chunks

3
推荐指数
1
解决办法
5251
查看次数

为什么 ELF 程序头有两个 LOAD 条目,而程序布局三个部分

我编写了一个启用了 PIE/PIC 的“hello world”程序。我观察到程序头有 2 个 LOAD 条目:

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
... ...
  LOAD           0x000000 0x00000000 0x00000000 0x00870 0x00870 R E 0x1000
  LOAD           0x000eb0 0x00001eb0 0x00001eb0 0x0015c 0x00164 RW  0x1000
Run Code Online (Sandbox Code Playgroud)

所以在我的理解中,ELF 二进制文件将被加载到 2 个页面中。第 1 页包含从偏移量 0 到文件大小 0x870 的二进制文件,它是 Read & Execute。由于它们是 0x1000 对齐的,因此第二个条目将被加载到包含二进制文件的第二页中(从偏移量0xeb00xeb0+0x15c)。此页面具有读写权限。

当我“pmap”正在运行的进程(或 cat /proc/pid/maps)时,它显示正在运行的程序有 3 个页面:

b7554000      4K rw---   [ anon ]
b7555000   1700K r-x-- libc-2.19.so
b76fe000      4K ----- libc-2.19.so
b76ff000      8K r---- libc-2.19.so
b7701000 …
Run Code Online (Sandbox Code Playgroud)

linux loading elf loader

3
推荐指数
1
解决办法
1181
查看次数

带有加载指示符的UISearchController

我实现了UISearchController,我从js回调中获取数据但是当我在磁带中使用searchbar它需要一些时间来放置数据,所以我想知道如何实现加载indicator到表视图中的结果UISearchController

loading objective-c ios uisearchcontroller

3
推荐指数
1
解决办法
1974
查看次数

Magento 2 自定义模块(管理员)微调器永远不会消失

我想在我的 magento2 模块中显示记录列表。数据已成功加载,但加载进度条从未消失: 加载进度条永不消失

我的 ui_component 文件名为:paymentconfirmations_paymentconfirmation_listing.xml:

<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<argument name="data" xsi:type="array">
    <item name="js_config" xsi:type="array">
        <item name="provider" xsi:type="string">paymentconfirmations_paymentconfirmation_listing.paymentconfirmations_paymentconfirmation_listing_data_source</item>
        <item name="deps" xsi:type="string">paymentconfirmations_paymentconfirmation_listing.paymentconfirmations_paymentconfirmation_listing_data_source</item>
    </item>
    <item name="spinner" xsi:type="string">blog_post_columns</item>
</argument>
<dataSource name="paymentconfirmations_paymentconfirmation_listing_data_source">
    <argument name="dataProvider" xsi:type="configurableObject">
        <argument name="class" xsi:type="string">PaymentConfirmationDataProvider</argument>
        <argument name="name" xsi:type="string">paymentconfirmations_paymentconfirmation_listing_data_source</argument>
        <argument name="primaryFieldName" xsi:type="string">id</argument>
        <argument name="requestFieldName" xsi:type="string">id</argument>
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="update_url" xsi:type="url" path="mui/index/render"/>
            </item>
        </argument>
    </argument>
    <argument name="data" xsi:type="array">
        <item name="js_config" xsi:type="array">
            <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
        </item>
    </argument>
</dataSource>
<container name="listing_top">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="template" xsi:type="string">ui/grid/toolbar</item>
        </item> …
Run Code Online (Sandbox Code Playgroud)

module admin loading magento magento2

3
推荐指数
1
解决办法
3258
查看次数

发布后无法加载asp.net图像

发布应用程序后,我的图像将无法加载。当我调试时它们会加载。知道什么会导致这个问题吗?

<a class="navbar-brand" href="@Url.Action("SearchQuery", "Search")"><img id="logo" src="~/Images/Logo.png"/></a>
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net image loading

3
推荐指数
2
解决办法
6448
查看次数

如何在 React 中加载组件之前显示加载微调器

我的问题不像标题那么简单。我试图显示一个加载组件 1 秒,然后用实际数据替换该组件。

这是我的代码:

const TopNavigationAuth = () => (
<Container>
    <Menu.Item
        name="landing"
        content="Landing"
        as={Link}
        to={routes.LANDING}
    />
    <Menu.Item name="home" content="Home" as={Link} to={routes.HOME} />
    <Menu.Menu position="right">
        <Menu.Item
            name="account"
            content="Account"
            as={Link}
            to={routes.ACCOUNT}
        />
        <UserSection />
        <Menu.Item
            name="signout"
            content={
                <Button
                    content="Sign Out"
                    onClick={authFunctions.doSignOut}
                    primary
                />
            }
        />
    </Menu.Menu>
</Container>
);
Run Code Online (Sandbox Code Playgroud)

所以这里我有一个<UserSection />组件,它基本上只保存用户的图片和姓名(现在)。我想在 1 或 2 秒后加载该组件,但在那之前我想显示一个微调器。

我正在为我的应用程序使用语义 ui react,它们有一个方便的微调器,如下所示:

const LoaderExampleInlineCentered = () => <Loader active inline='centered' />
Run Code Online (Sandbox Code Playgroud)

我可以请一些指导吗?

loading spinner reactjs

3
推荐指数
1
解决办法
6252
查看次数

使用javascript加载多个图像

我正在努力创建一个脚本来为在 Canvas 上绘制的游戏加载多个图像。该窗口似乎在未完成所有图像的加载的情况下加载。我尝试了很多方法,但似乎没有一个有效。在实际加载图像之前调用 drawGameMenu() 函数,因此不会绘制图像。如果有人可以提供帮助,我将不胜感激。这是我的脚本,亲切的问候:

var imageNames = ["menuImage", "resetScoreButton", "instructionsButton", "playButton", "dialogPanel", "gamePlayImage", "exitButton", "timerPanel", "messengerPanel", "scoreBar", "yesButton", "noButton", "goButton"];
var imageFileNames = ["game_Menu", "reset_score_button", "instructions_button", "play_button", "dialog_panel", "game_play", "exit_button", "timer", "messenger_panel", "score_bar", "yes_button", "no_button", "go_button"];
var imageCollection = {};

window.addEventListener("load", function() {
    var u = imageNames.length - 1;
    for(i = 0; i <= u; i++) {
        var name = imageNames[i];
        imageCollection[name] = new Image();
        imageCollection[name].src = imageFileNames[i] + ".png";
        console.log(imageCollection[name]);
        imageCollection[name].addEventListener('load', function() {
            do {
                var x = …
Run Code Online (Sandbox Code Playgroud)

javascript image loading html5-canvas

3
推荐指数
2
解决办法
4913
查看次数

在 nextjs 13 上加载页面

您好,我正在尝试在网站需要时间加载时显示加载页面。因为它是一个相当大的网站,我认为加载屏幕会提供最好的用户体验,但是我似乎无法弄清楚如何让它在 nextjs 13 上工作。我创建了一个简单的功能组件,上面写着加载...并且有将其直接导入到我的layout.jsx文件夹中。

我正在使用应用程序目录方法,这是相当新的,我在 nextjs 也是新的,所以我有点迷失 ^^

我想我可能需要在某个时候设置状态,但我似乎无法弄清楚何时何地进行设置

任何建议都会很棒。

谢谢

import "./globals.css";
import React, { useState, useEffect } from "react";
import Loading from "../components/loading/loading";

const Layout = ({ children, dataLoaded }) => {
  const [loading, setLoading] = useState(true);

  useEffect(() => {
    if (dataLoaded) {
      setLoading(false);
    }
  }, [dataLoaded]);

  return (
    <body className="app {oswald.className}">
      {loading && <Loading />}
      {children}
    </body>
  );
};

export default Layout;

Run Code Online (Sandbox Code Playgroud)

。。。

尝试 1 -

按照下面的答案之一后,我的加载页面似乎根本没有显示。并且没有出现错误。

我的布局如下

布局.jsx

import "./globals.css";
import { Suspense } from "react"; …
Run Code Online (Sandbox Code Playgroud)

javascript state loading reactjs next.js

3
推荐指数
1
解决办法
3880
查看次数

android:等待连接时显示进度对话框

我正在尝试在启动新活动时添加进度对话框,该活动必须等待来自互联网的响应.目前屏幕在等待时变黑.有没有人知道它需要放在哪里工作?

这个进程对话:

ProgressDialog dialog = ProgressDialog.show(SearchActivity.this, "", "Loading. Please wait...", true);
dialog.dismiss();
Run Code Online (Sandbox Code Playgroud)

这是在overlayActivity扩展ItemizedOverlay:

@Override
protected boolean onTap(int index) {
    final OverlayItem item = (OverlayItem) items.get(index);
    final Context mContext = context;
    AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
    builder.setTitle(item.getTitle())
    .setCancelable(true)
    .setPositiveButton("View Details", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            Intent intent = new Intent(mContext, Profile.class);
            intent.putExtra("id", item.getSnippet());
            mContext.startActivity(intent);
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
    return true;
}
Run Code Online (Sandbox Code Playgroud)

这是个人资料活动:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.profile);
    Bundle extras = getIntent().getExtras(); …
Run Code Online (Sandbox Code Playgroud)

android loading http-post progressdialog

2
推荐指数
1
解决办法
1万
查看次数

Android弹出旋转装载机

我正在创建一个Android应用程序,用户在点击按钮时从在线服务器加载一些数据

我需要添加以下内容:当用户点击按钮时,弹出屏幕显示在当前屏幕的顶部并显示类似"加载""旋转加载器"或类似的任何想法?

android loading popup

2
推荐指数
1
解决办法
8186
查看次数