RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-180600

Artik Slayer's questions

Martin Hope
Artik Slayer
Asked: 2020-08-28 03:30:13 +0000 UTC

什么是测试用例和错误报告,它们之间有什么区别?

  • 0

据我了解test case(需要检查/执行什么 - 是我们的任务来确定和写下,还是他们写信给我们需要检查的内容?)由执行的操作(Action)-预期结果(预期结果)组成- 实际结果(测试结果)。


但是错误报告具有相同的成分,只是更广泛。

• 简短描述(问题的简短描述)。

• 严重性(对错误应用的影响程度分级)。

• 优先级(纠错队列)。

• 状态(显示错误在其生命周期中的状态)。

• 再现步骤(导致缺陷发生的路径的描述)。

• 实际结果(我们在完成所有回放步骤后得到的结果)。

• 预期结果(符合要求的结果)。

тестирование
  • 2 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-07-06 17:14:24 +0000 UTC

为什么 Unity 中的代码对对象有不同的作用?

  • 1

有 2 个在搅拌机中制作并导入 Unity 的对象。

独眼巨人之眼.blend

烧瓶混合:

问题是在使用了应该在手臂-身体区域创建一个项目的代码之后(我仍在研究这个),一个项目是在远离角色的地方创建的。

例:
好的。 在此处输入图像描述

不好。 在此处输入图像描述

代码:
PlayerInteraction:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerInteraction : MonoBehaviour
{

    public GameObject target = null;

    public KeyCode interactKey;

    public GameObject itemHolder;

    private void Update()
    {
        if (Input.GetKeyDown(interactKey))
        {
            if (target == null)
            {
                return;
            }

            FoodBox food = target.GetComponent<FoodBox>();
            if (food != null && itemHolder == null)
            {
                food.Interact(this);
            }

            TableBox table = target.GetComponent<TableBox>();
            if (table != null)
            {
                table.Interact(itemHolder, this);
            }

        }
    }

    public void SetItem(GameObject c)
    {
        if (c != null)
        {
            Debug.Log("Взяли предмет!");
            itemHolder = Instantiate(c, transform.position + new Vector3(0f, 2.15f, -0.65f), Quaternion.Euler(-90f, 0f, 180f), transform);
        }
        else
        {
            Destroy(itemHolder);
        }
    }

    private void OnTriggerEnter(Collider col)
    {
        if (target != col.gameObject && target != null)
        {
            return;
        }
        else {
            target = col.gameObject;
            Debug.Log("Мы дошли сюда до " + target.name);
        }

    }

    private void OnTriggerExit(Collider col)
    {
        if (col.gameObject == target)
        {
            target = null;
        }
    }
}

表框:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TableBox : MonoBehaviour
{

    public GameObject itemHolder;

    private void Start()
    {
        if (itemHolder != null)
        {
            itemHolder = Instantiate(itemHolder, transform.position + new Vector3(0f, 1.9f, 0f), Quaternion.Euler(-90f, 45f, 0f),transform);
            Debug.Log("Мы создались!!");
        }
    }

    public void Interact(GameObject i, PlayerInteraction player)
    {
        if ((i == null || itemHolder == null))
        {
            player.SetItem(this.itemHolder);
            Destroy(this.itemHolder);
            //Debug.Log(itemHolder);
            this.itemHolder = i;

            if (this.itemHolder != null)
            {
                this.itemHolder = Instantiate(this.itemHolder, transform.position + new Vector3(0f, 1.9f, 0f), Quaternion.Euler(-90f, 0f, -135f),transform);
                Debug.Log("Мы ингридиенты из ТейблБокса!");
            }
        }
        else
        {
            return;
        }
    }
}

食品盒:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FoodBox : MonoBehaviour
{

    public GameObject ingredient;
    private Animator anim;

    // Use this for initialization
    void Start()
    {
        anim = GetComponent<Animator>();
        anim.SetBool("openFoodBox",false);
    }
    public void Interact(PlayerInteraction player)
    {
        anim.SetBool("openFoodBox", true);

        if (anim.GetBool("openFoodBox")) {
            anim.Play("Opening");
            player.SetItem(ingredient);
            Debug.Log("Мы ингридиенты из ФудБокса!");
        }

        anim.SetBool("openFoodBox",false);
    }
}

还有一个假设是这是由于模型的初始位置。因为我有一些模型是垂直保存的,有些是水平放置的。

在此处输入图像描述

我还添加了一个预制检查器:

独眼巨人之眼:
在此处输入图像描述

烧瓶:
在此处输入图像描述

unity3d
  • 1 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-06-24 20:41:37 +0000 UTC

为什么在 Unity 中不尊重 Blender 中对象的比例?

  • 1

Blender 中有一个对象,当转移到 Unity 时,其中一个部分不匹配。

在搅拌机中: 在此处输入图像描述

在统一中: 在此处输入图像描述

搅拌机文件:tyts。

unity3d
  • 1 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-06-17 16:00:34 +0000 UTC

C:\Program Files\dotnet\dotnet.exe 在控制台中的输出是什么意思?

  • 1

切换到Visual Studio 2019。

在项目中,我开始注意到以下行:C:\Program Files\dotnet\dotnet.exe

  • 她是什么意思?
  • 她需要吗?
  • 它会干扰(至少在美学上对我来说)吗?
  • 有可能摆脱它吗?

在此处输入图像描述

c#
  • 1 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-02-10 23:39:28 +0000 UTC

为什么我的网格是平的并且位置变化?

  • 1

开始之前:(这是基础立方体)

在此处输入图像描述

开始后:(应该是一只眼睛(即一个球))

在此处输入图像描述

改造木桌:

在此处输入图像描述

编码:

成分资产:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(fileName = "New Ingredient", menuName = "Ingredient")]
public class IngredientAsset : ScriptableObject {

    public Mesh ingredientMesh;

}

成分:

using System.Collections.Generic;
using UnityEngine;

[System.Serializable]
public class Ingredient : MonoBehaviour {

    public IngredientAsset asset;
    


    public Ingredient (IngredientAsset a) {
        asset = a;
    }
    
    public bool HasIngrediend()
    {
        if (asset == null) {
            return false;
        } else {
            return true;
        }
    }

    public Mesh GetIngrediendMesh()
    {
        if (asset == null) {
            return null;
        }

        return asset.ingredientMesh;

    }


}

表框:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TableBox : MonoBehaviour {

    public MeshFilter overlay;

    public IngredientAsset ingredient;
    public EquipmentAsset equipment;
    
    private void Start()
    {
        if (ingredient!=null) {
            overlay.mesh = ingredient.ingredientMesh;
        } else if (equipment != null) {
            overlay.mesh = equipment.equipmentMesh;
        }
    }
    
    public void Interact(IngredientAsset c, EquipmentAsset t, PlayerInteraction player)
    {
        player.SetIngredient(ingredient);
        ingredient = c;
        player.SetEquipment(equipment);
        equipment = t;
        
        if (equipment != null)
            overlay.mesh = equipment.equipmentMesh;
        else if (ingredient != null)
            overlay.mesh = ingredient.ingredientMesh;
        else
            overlay.mesh = null;
    }
}

玩家互动:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerInteraction : MonoBehaviour {

    public GameObject target;
    
    public KeyCode interactKey;

    
    [SerializeField]
    private IngredientAsset ingredient;
    [SerializeField]
    private EquipmentAsset equipment;
    
    private void Update()
    {
        if (Input.GetKeyDown(interactKey))
        {
            if (target == null)
                return;
          
            TableBox table = target.GetComponent<TableBox>();
            if (table != null)
            {
                table.Interact(ingredient, equipment, this);
            }

        }
    }
    
    public void SetIngredient(IngredientAsset c)
    {
        ingredient = c;

    }

    
    public void SetEquipment(EquipmentAsset t)
    {
        equipment = t;

    }

    
    private void OnTriggerEnter(Collider col)
    {
        if (target != col.gameObject && target != null)
        {
            Deselect();
        }
        
        target = col.gameObject;
    
        }
    }
    
    private void OnTriggerExit(Collider col)
    {
        if (col.gameObject == target)
        {
            Deselect();
            target = null;
        }
    }
    
    void Deselect()
    {

    }
}

我的项目。

PS我的网格,与预制不同,是“裸露的”,如何将对象的其余组件从预制添加到网格中?(纹理、碰撞器等)

感谢您的关注!

unity3d
  • 1 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-02-09 00:30:24 +0000 UTC

如何将物品放在盒子上以及如何将其带回 3D 中的角色

  • 0

最初,我是通过创建和删除一个对象来完成的,但我遇到了一个公共领域的项目,它可以做我想做的事情,但是是 2D 的。项目。

一般来说,据我了解,这个想法是我们通过ScriptableObject通过图层更改桌子上的精灵 。在此处输入图像描述

在此处输入图像描述

ps什么是OverlaySprite,一个空对象?为什么它像一个预制件,但是灰色的,虽然它是活动的。

主要代码:

作物资产:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(fileName = "New Crop", menuName = "Crop")]
public class CropAsset : ScriptableObject
{
    public Sprite seedSprite;
    public Sprite deadSprite;
    public Sprite doneSprite;

    public bool seedIsOnGround = false;
}

庄稼:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[System.Serializable]
public class Crop
{
    public CropAsset asset;

    public CropState state;

    private float growthLevel;
    private float waterLevel;
    private bool isDead;

    public bool Grow(float amount)
    {
        if (GetWaterState() == WaterState.Watered)
        {
            growthLevel += amount / 20f;
        }

        if (growthLevel >= 1f)
        {
            state = CropState.Done;
            return true;
        }

        return false;
    }

    public WaterState Dry(float amount)
    {
        waterLevel -= amount / 8f;
        return GetWaterState();
    }

    public WaterState GetWaterState ()
    {
        if (waterLevel > 0f)
        {
            return WaterState.Watered;
        }
        else if (waterLevel > -1f)
        {
            return WaterState.Dry;
        }
        else
        {
            state = CropState.Dead;
            return WaterState.Dead;
        }
    }

    public void Water ()
    {
        waterLevel = 1f;
    }

    public Crop (CropAsset a) {
        asset = a;
        state = CropState.Seed;
        growthLevel = 0f;
        waterLevel = 1f;
        isDead = false;
    }

    public bool HasCrop()
    {
        if (asset == null)
            return false;
        else
            return true;
    }

    public Sprite GetCropSprite()
    {
        if (asset == null)
            return null;

        switch (state)
        {
            case CropState.Seed:
                return asset.seedSprite;
            case CropState.Planted:
                return asset.seedSprite;
            case CropState.Dead:
                return asset.deadSprite;
            case CropState.Done:
                return asset.doneSprite;
        }

        Debug.LogError("WHAT?!");
        return asset.seedSprite;
    }

    public bool IsOnGround()
    {
        if (state == CropState.Planted && asset.seedIsOnGround)
            return true;
        else
            return false;
    }

    public Sprite GetDoneSprite()
    {
        return asset.doneSprite;
    }

    public string GetName()
    {
        if (asset == null)
            return null;

        return asset.name;
    }
}

public enum CropState
{
    Seed,
    Planted,
    Dead,
    Done
}

public enum WaterState
{
    Watered,
    Dry,
    Dead
}

工具:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(fileName = "New Tool", menuName = "Tool")]
public class Tool : ScriptableObject
{
    public Sprite sprite;
    public ToolType toolType;
}

public enum ToolType
{
    Plow,
    Watercan
}

平铺:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TableTile : MonoBehaviour
{
    public SpriteRenderer overlay;

    public Crop crop;
    public Tool tool;

    private void Start()
    {
        if (crop.HasCrop())
            overlay.sprite = crop.GetCropSprite();
        else if (tool != null)
            overlay.sprite = tool.sprite;
    }

    public void Interact(Crop c, Tool t, PlayerInteraction player)
    {
        player.SetCrop(crop);
        crop = c;
        player.SetTool(tool);
        tool = t;

        if (tool != null)
            overlay.sprite = tool.sprite;
        else if (crop != null)
            overlay.sprite = crop.GetCropSprite();
        else
            overlay.sprite = null;
    }

}

我想做同样的事情,但对于 3D 对象。建议我将使用 Sprite 和 SpriteRenderer 的位置更改为 Mesh 和 MeshRenderer。

我的代码:

成分资产:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(fileName = "New Ingredient", menuName = "Ingredient")]
public class IngredientAsset : ScriptableObject {

    public Mesh ingredientMesh;

}

在此处输入图像描述

成分:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[System.Serializable]
public class Ingredient : MonoBehaviour {

    public IngredientAsset asset;

    public Ingredient (IngredientAsset a) {
        asset = a;
    }

    public bool HasIngrediend()
    {
        if (asset == null)
            return false;
        else
            return true;
    }

    public Mesh GetIngrediendObject()
    {
        if (asset == null)
            return null;

        return asset.ingredientMesh;

    }
}

设备资产:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(fileName = "New Equipment", menuName = "Equipment")]
public class EquipmentAsset : ScriptableObject {

    public Mesh equipmentMesh;

}

表框:

using System.Collections.Generic;
using UnityEngine;

public class TableBox : MonoBehaviour {

    public MeshRenderer overlay;

    public Ingredient ingredient;
    public EquipmentAsset equipment;

    private void Start()
    {
        if (ingredient.HasIngrediend())
            overlay.mesh = ingredient.GetIngrediendObject();
        else if (equipment != null)
            overlay.mesh = equipment.mesh;
    }

    public void Interact(Ingredient c, EquipmentAsset t, PlayerInteraction player)
    {
        player.SetIngredient(ingredient);
        ingredient = c;
        player.SetEquipment(equipment);
        equipment = t;

        if (equipment != null)
            overlay.sprite = equipment.mesh;
        else if (ingredient != null)
            overlay.mesh = ingredient.GetIngrediendObject();
        else
            overlay.mesh = null;
    }
}

Но начиная с момента создания моих ScriptableObjects типа mesh, в моей версии Crop ругается на overlay.mesh.

在此处输入图像描述

Сам стол:

在此处输入图像描述

Overlay: 在此处输入图像描述 Прошу помочь разобраться как преобразовать данную функцию к 3Д объектам. Правильно ли то что мне подсказали? Правильно ли так делать? Можно также но с префабами?

unity3d
  • 1 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-02-03 23:45:22 +0000 UTC

什么是“四元数旋转”?

  • 2

“四元数旋转”栏目负责什么?

在此处输入图像描述

单独更改值不会执行任何操作。

在此处输入图像描述

但是随着骨骼的一般变化/旋转 - 值也会发生变化。

在此处输入图像描述

blender
  • 1 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-01-30 17:40:28 +0000 UTC

为什么我在 UV 编辑中看不到对象?

  • 0

默认:

在此处输入图像描述

紫外线编辑:

在此处输入图像描述

文件:这里和这里。

blender
  • 1 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-01-29 06:23:35 +0000 UTC

为什么我的模型在绑定到骨骼结构后表现异常?

  • 0

我制作了一个骨架,将角色的所有部分组合在一起。然后他建立了联系。

在此处输入图像描述

然后他试图移动他的手,结果,那只手收紧了斗篷、帽子和眼睛的下半部分。

在此处输入图像描述

应该有这样的反应吗?如何避免:

文件: 这里。

blender
  • 1 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-01-28 18:24:22 +0000 UTC

从 Blender 导入模型后如何在 Unity 中更改材质/纹理颜色?

  • 0

我按照视频中的方式进行所有操作,并在10.22手动调整颜色。但由于某种原因,这个功能对我来说是不活跃的,就像所有其他人一样。

没有反应。 在此处输入图像描述

如何让它做出反应?

unity3d
  • 2 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-01-23 19:31:43 +0000 UTC

搅拌机错误 - 骨骼热量加权:无法找到一个或多个骨骼的解决方案

  • 0

我想为我的角色设置动画。

我制作了一个骨骼结构,就像这里一样。

搅拌机抛出错误。

在此处输入图像描述

在此处输入图像描述

(我认为错误与肩膀有关)。

怎么了,怎么解决?

анимация
  • 1 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-01-14 01:33:59 +0000 UTC

如何在游戏“煮过头”中进行控制?

  • 3

我想让玩家控制就像在“Overcooked”游戏中一样。

游戏预告片。

我目前的球员管理。

在此处输入图像描述

播放器控制器.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerControllerTransform : MonoBehaviour {

    private string moveInputAxis = "Vertical";
    private string turnInputAxis = "Horizontal";

    public float rotationRate = 360f;
    public float moveSpeed = 1;


    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () 
    {
        float moveAxis = Input.GetAxis (moveInputAxis);
        float turnAxis = Input.GetAxis (turnInputAxis);

        //Обновляет каждый кадр наше положение и поворот
        ApplyInput (moveAxis, turnAxis);
    }

    private void ApplyInput(float moveInput, float turnInput)
    {
        Move (moveInput);
        Turn(turnInput);
    }

    private void Move(float input)
    {
        transform.Translate (Vector3.forward*input*moveSpeed);//Можно добавить Time.DeltaTime
    }

    private void Turn(float input)
    {
        transform.Rotate (0,input * rotationRate * Time.deltaTime,0);
    }
}

问题是什么。游戏里我点了(WASD),鼻子转过去就走了。(据我了解)对我来说,此刻的操控更像是操控一辆汽车。AD负责转牌。W-前进,S-后退。

因此,我想让控件类似于游戏。

ps 更多游戏视频,更好地了解游戏控制。

感谢您的关注。

unity3d
  • 1 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-09-06 23:13:16 +0000 UTC

如何显示具有一个键和多个值的哈希表?

  • 0

在这个问题之后,另一个问题立即出现了。如果一个键在一个哈希表中有多个值,怎么能一次全部显示出来呢?

我的代码:

        Hashtable graph = new Hashtable();

        graph["my"] = new[] { "alice", "bob", "claire" };
        graph["bob"] = new[] { "anuj", "peggy" };
        graph["alice"] = new[] { "peggy" };

        foreach (var element in graph.Keys)
        {
            Console.WriteLine(element + " friends is " + graph[element]);
        }

在此处输入图像描述

c#
  • 1 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-08-30 01:13:32 +0000 UTC

如何为哈希表中的同一个键指定多个值?C#

  • 0

我正在阅读Aditya Bhargava的《Grokaem 算法》一书。

有这样的时刻。

在此处输入图像描述

在此处输入图像描述

试图:

在此处输入图像描述

问题:如何在哈希表中为C#中的同一个键指定多个值?以后用Hash Table来表示Graph是否可取?

c#
  • 1 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-05-18 00:06:15 +0000 UTC

LinkedList<T> 和 LinkedListNode<T> 有什么区别?

  • 1

阅读LinkedList ,然后LinkedListNode出现在代码中。这本书使用它,但没有解释它是什么。

LinkedList<int> numbers = new LinkedList<int>();

// Заполнение List<int> с помощью метода AddFirst
foreach (int number in new int[] {10, 8, 6, 4, 2})
{
    numbers.AddFirst(number);
}

// Итерация с использованием инструкции for
Console.WriteLine("Iterating using a for statement:");
for (LinkedListNode<int> node = numbers.First; node != null; node = node.Next)
{
    int number = node.Value;
    Console.WriteLine(number);
}

// Итерация с использованием инструкции foreach
Console.WriteLine("\nIterating using a foreach statement:");
foreach (int number in numbers)
{
    Console.WriteLine(number);
}
c#
  • 1 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-01-08 02:04:29 +0000 UTC

Convert.ToString()、ToString() 和 (String) 有什么区别?

  • 1

例如,有一个变量:

int temp = 5;

然后:

String a = Convert.ToString(temp);
String b = (temp).ToString();
String c = (String)temp;

这些表达有什么区别?

c#
  • 1 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-11-30 06:03:35 +0000 UTC

带有 GridView 的应用程序以黑屏响应

  • 0

我拆卸 GridView,我在 YouTube 上观看视频。比如这个家伙。

代码如下。

MainActivity.java

package com.example.android.theend;

import android.content.Context;
import android.content.res.Resources;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    GridView myGrid;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        myGrid = (GridView) findViewById(R.id.gridView);
        myGrid.setAdapter(new PokedexAdapter(this));
    }
}

class Pokemon{
    int imageId;
    String pokemonName;
    Pokemon(int imageId,String pokemonName){
        this.imageId=imageId;
        this.pokemonName=pokemonName;
    }
}

class PokedexAdapter extends BaseAdapter{

    private ArrayList<Pokemon> list;
    private Context context;

    PokedexAdapter(Context context){

        this.context=context;
        list = new ArrayList<Pokemon>();

        Resources res=context.getResources();
        String[] tempPokemonNames = res.getStringArray(R.array.pokemon_names);
        int[] pokemonImages = {
                R.drawable.one,R.drawable.two,R.drawable.three,
                R.drawable.four,R.drawable.five,R.drawable.six,
                R.drawable.seven,R.drawable.eight,R.drawable.nine
        };

        for(int i=0;i<9;i++){
            Pokemon tempPokemon = new Pokemon(pokemonImages[i],tempPokemonNames[i]);
            list.add(tempPokemon);
        }
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return list.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    class ViewHolder{
        ImageView myPokemon;
        ViewHolder(View v){
            myPokemon = (ImageView) v.findViewById(R.id.imageView);
        }
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {

        View row = view;
        ViewHolder holder = null;

        if(row==null){

            //first time
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            row = inflater.inflate(R.layout.single_item,viewGroup,false);
            holder=new ViewHolder(row);
            row.setTag(holder);

        }else{

            //recycling
            holder = (ViewHolder) row.getTag();
        }

        Pokemon temp=list.get(i);
        holder.myPokemon.setImageResource(temp.imageId);

        return row;
    }
}

Activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.android.theend.MainActivity">


    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="58dp"
        android:text="Информация" />

    <GridView
        android:id="@+id/gridView"
        android:layout_width="match_parent"
        android:layout_height="375dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:numColumns="auto_fit"
        android:horizontalSpacing="10dp"
        android:verticalSpacing="10dp"
        android:columnWidth="120dp"
        android:stretchMode="spacingWidthUniform"/>
</RelativeLayout>

Single_item.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:src="@drawable/one" />
</RelativeLayout>

字符串.xml

<resources>
    <string name="app_name">TheEnd</string>
    <string-array name="pokemon_names">
        <item>001. Бульбазавр</item>
        <item>002. Ивизавр</item>
        <item>003. Венузавр</item>
        <item>004. Чармандер</item>
        <item>005. Чармелеон</item>
        <item>006. Чаризард</item>
        <item>007. Сквиртл</item>
        <item>008. Вартортл</item>
        <item>009. Бластойз</item>
    </string-array>
</resources>

理论上,在这个阶段,应用程序应该显示一个 GridView,其中包含 9 个图像,没有任何交互。

但应用程序显示黑屏。我请求指导。指出我的任何愚蠢错误。很高兴有任何建议。

PS这里是图像格式以防万一。

在此处输入图像描述

android
  • 1 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-05-14 18:20:54 +0000 UTC

一段时间后如何将方块放回原处?

  • 2

我使用SetActive禁用了一个块。然后我使用ActiveSelf检查对象是否处于活动状态。但是根据我的想法,一段时间后块不会出现。

在此处输入图像描述

在此处输入图像描述

编码:

using UnityEngine;
using System.Collections;

public class IceBlockDestroy : MonoBehaviour {

    bool onBlock;
    Animator anim;
    public float waitAfterStepped;
    public float waitAfterDestroy;
    public IceBlockDestroy block;
    // Use this for initialization
    void Start () {

        block = gameObject.GetComponent<IceBlockDestroy>();
        anim = gameObject.GetComponent<Animator> ();

    }

    // Update is called once per frame
    void Update () {

        if(!block.gameObject.activeSelf){

            waitAfterDestroy-=Time.deltaTime;

            if(waitAfterDestroy < 0){

                block.gameObject.SetActive(true);
                anim.SetBool ("isStepped", false);

            }
        }
    }

    void OnCollisionStay2D(Collision2D other)
    {

        if (onBlock) {

            anim.SetBool ("isStepped", true);
            waitAfterStepped-=Time.deltaTime;

            if(waitAfterStepped < 0){

                block.gameObject.SetActive(false);

            }
        }
    }

    void OnTriggerEnter2D()
    {
        onBlock = true;

    }

    void OnTriggerExit2D(){

        onBlock = false;
    }
}

问题:如何归还区块?SetActive 和 ActiveSelf 在这里合适吗?

c#
  • 1 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-03-01 23:48:08 +0000 UTC

什么是参数的“别名”?

  • 4

阅读John Sharp - Microsoft Visual C#。详细指南 - 2017 年。

我用ref和out分析题目,有这么一条注释:

在此处输入图像描述

我第二次、第三次遇到笔名这个词。

实际上问题是:在这种情况下,什么是参数的别名或一般的别名。

c#
  • 2 个回答
  • 10 Views
Martin Hope
Artik Slayer
Asked: 2020-02-18 00:05:17 +0000 UTC

UWP - 设计器未显示。需要较新版本的 Windows

  • 0

上次我们了解到我需要下载 Visual Studio 2015 才能使用UWP。所以,在下载、安装并创建一个 UWP 项目后,我就退出了,真是一个不愉快的时刻。

在此处输入图像描述

由于我使用的是 Windows 8.1,并且没有上一个问题的教程中提到的“本地计算机”设备选择,因此我假设我需要下载 Windows 10 (?)的模拟器。

所以,我点击下载模拟器:

在此处输入图像描述

我选择这个:(如果我理解正确的话)

在此处输入图像描述

启动安装程序后,大约20-40%的负载出现错误:

在此处输入图像描述

谷歌搜索,我意识到我必须进入我的笔记本电脑 * (HP) * 的 BIOS 并点击那里的东西。

实际问题是什么:我是否试图通过未在构造函数中显示设备并阻止通过正确步骤进一步启动来解决此问题。怎么解决上个截图的问题(最好写出如何进入BIOS),有必要吗,Error需要我切换/启用什么,真的有必要吗?

提前致谢。

ps原则上,所有错误都很容易用谷歌搜索,但我对您的意见很感兴趣。

pss拆除操作系统并升级到 Windows 10 - 不建议。

更新:

在BIOS中启用Virtualization Technology后,安装模拟器时会弹出这样的错误。

在此处输入图像描述

使用这个名称 (HYPER-V) 没有安装任何东西。什么是 HYPER-V,它有什么用?

uwp
  • 1 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5